Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
508cb61e
Commit
508cb61e
authored
May 16, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some problems where AColor was not used correctly; documentation of AColor.
parent
98bb8853
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
21 deletions
+29
-21
doc/type/color.txt
doc/type/color.txt
+15
-7
doc/type/font.txt
doc/type/font.txt
+1
-1
src/data/font.cpp
src/data/font.cpp
+2
-2
src/data/font.hpp
src/data/font.hpp
+2
-2
src/render/text/element.cpp
src/render/text/element.cpp
+9
-9
No files found.
doc/type/color.txt
View file @
508cb61e
...
...
@@ -2,20 +2,28 @@ Primitive type: color
--Syntax--
In files and scritps a color can be represented as
<pre>
rgb
(<i>red_component</i>, <i>green_component</i>, <i>blue_component</i>)</pre>
<pre>
<span class='hl-kw'>rgb</span>
(<i>red_component</i>, <i>green_component</i>, <i>blue_component</i>)</pre>
where red_component, green_component and blue_component are numbers between 0 and 255 (inclusive).
In some places MSE also supports colors with a transparency value, notated as
<pre><span class='hl-kw'>rgba</span>(<i>red_component</i>, <i>green_component</i>, <i>blue_component</i>, <i>alpha_component</i>)</pre>
An alpha value of @0@ indicates a transparent color, an alpha value of @255@ is completely opaque.
--Named colors--
MSE also supports named colors, for instance @"white"@ is the same as @rgb(255,255,255)@.
For a full list of supported colors, see [[http://www.wxwidgets.org/manuals/stable/wx_wxcolourdatabase.html|the wxWidgets documentation]].
In addition, the named color @"transparent"@ stands for the completely transparent color, @rgba(0,0,0,0)@.
In scripts named colors are represented as [[type:string]]s.
--Examples--
For example:
! Code Represents <<<
| @rgb(255,255,255)@ white <div style="border:1px solid black; background:white;width:30px;height:15px;"> </div>
| @rgb(0,0,0)@ black <div style="border:1px solid black; background:black;width:30px;height:15px;"> </div>
| @rgb(255,0,0)@ red <div style="border:1px solid black; background:red; width:30px;height:15px;"> </div>
| @rgb(0,255,0)@ green <div style="border:1px solid black; background:rgb(0,255,0);width:30px;height:15px;"> </div>
| @rgb(0,0,255)@ blue <div style="border:1px solid black; background:blue; width:30px;height:15px;"> </div>
! Code Represents <<<
| @rgb(255,255,255)@ white <div style="border:1px solid black; background:white;width:30px;height:15px;"> </div>
| @rgb(0,0,0)@ black <div style="border:1px solid black; background:black;width:30px;height:15px;"> </div>
| @rgb(255,0,0)@ red <div style="border:1px solid black; background:red; width:30px;height:15px;"> </div>
| @rgb(0,255,0)@ green <div style="border:1px solid black; background:rgb(0,255,0);width:30px;height:15px;"> </div>
| @rgb(0,0,255)@ blue <div style="border:1px solid black; background:blue; width:30px;height:15px;"> </div>
| @rgba(0,0,0,0)@ transparent <div style="border:1px solid black; width:30px;height:15px;text-align:center;">over</div>
| @rgba(255,0,0,128)@ transparent red <div style="border:1px solid black; background:rgb(255,128,128);color:rgb(128,0,0);width:30px;height:15px;text-align:center;">over</div>
| @rgba(0,0,255,192)@ transparent blue <div style="border:1px solid black; background:rgb(64,64,255);color:rgb(0,0,192);width:30px;height:15px;text-align:center;">over</div>
doc/type/font.txt
View file @
508cb61e
...
...
@@ -19,7 +19,7 @@ A reference to a normal [[type:font]] for drawing text.
| @shadow displacement x@ [[type:double]] @0@ Relative position of the shadow in pixels. A shadow is only drawn if the displacement is nonzero.
| @shadow displacement y@ [[type:double]] @0@ ^^^
| @shadow blur@ [[type:double]] @0@ How much should the shadow be blurred?
| @separator color@ [[type:color]] @rgb
(128,128
,128)@ Color for @"<sep-soft>"@ tags inserted by the [[fun:combined_editor]] function.
| @separator color@ [[type:color]] @rgb
a(0,0,0
,128)@ Color for @"<sep-soft>"@ tags inserted by the [[fun:combined_editor]] function.
--Example--
>font:
...
...
src/data/font.cpp
View file @
508cb61e
...
...
@@ -20,7 +20,7 @@ Font::Font()
,
color
(
AColor
(
0
,
0
,
0
))
,
shadow_displacement
(
0
,
0
)
,
shadow_blur
(
0
)
,
separator_color
(
128
,
128
,
128
)
,
separator_color
(
AColor
(
0
,
0
,
0
,
128
)
)
,
flags
(
FONT_NORMAL
)
{}
...
...
@@ -50,7 +50,7 @@ void Font::initDependencies(Context& ctx, const Dependency& dep) const {
shadow_color
.
initDependencies
(
ctx
,
dep
);
}
FontP
Font
::
make
(
int
add_flags
,
Color
*
other_color
,
double
*
other_size
)
const
{
FontP
Font
::
make
(
int
add_flags
,
A
Color
*
other_color
,
double
*
other_size
)
const
{
FontP
f
(
new
Font
(
*
this
));
f
->
flags
|=
add_flags
;
if
(
add_flags
&
FONT_CODE_STRING
)
{
...
...
src/data/font.hpp
View file @
508cb61e
...
...
@@ -45,7 +45,7 @@ class Font : public IntrusivePtrBase<Font> {
Scriptable
<
AColor
>
shadow_color
;
///< Color for shadow
RealSize
shadow_displacement
;
///< Position of the shadow
double
shadow_blur
;
///< Blur radius of the shadow
Color
separator_color
;
///< Color for <sep> text
AColor
separator_color
;
///< Color for <sep> text
int
flags
;
///< FontFlags for this font
Font
();
...
...
@@ -61,7 +61,7 @@ class Font : public IntrusivePtrBase<Font> {
}
/// Add style to a font, and optionally change the color and size
FontP
make
(
int
add_flags
,
Color
*
other_color
,
double
*
other_size
)
const
;
FontP
make
(
int
add_flags
,
A
Color
*
other_color
,
double
*
other_size
)
const
;
/// Convert this font to a wxFont
wxFont
toWxFont
(
double
scale
)
const
;
...
...
src/render/text/element.cpp
View file @
508cb61e
...
...
@@ -60,13 +60,13 @@ double TextElements::scaleStep() const {
}
// Colors for <atom-param> tags
Color
param_colors
[]
=
{
Color
(
0
,
170
,
0
)
,
Color
(
0
,
0
,
200
)
,
Color
(
200
,
0
,
100
)
,
Color
(
200
,
200
,
0
)
,
Color
(
0
,
170
,
170
)
,
Color
(
200
,
0
,
0
)
A
Color
param_colors
[]
=
{
A
Color
(
0
,
170
,
0
)
,
A
Color
(
0
,
0
,
200
)
,
A
Color
(
200
,
0
,
100
)
,
A
Color
(
200
,
200
,
0
)
,
A
Color
(
0
,
170
,
170
)
,
A
Color
(
200
,
0
,
0
)
};
const
size_t
param_colors_count
=
sizeof
(
param_colors
)
/
sizeof
(
param_colors
[
0
]);
...
...
@@ -77,7 +77,7 @@ struct TextElementsFromString {
int
soft
,
kwpph
,
param
,
line
,
soft_line
;
int
code
,
code_kw
,
code_string
,
param_ref
,
error
;
int
param_id
;
vector
<
Color
>
colors
;
vector
<
AColor
>
colors
;
vector
<
double
>
sizes
;
/// put angle brackets around the text?
bool
bracket
;
...
...
@@ -127,7 +127,7 @@ struct TextElementsFromString {
else
if
(
is_substr
(
text
,
tag_start
,
_
(
"<color"
)))
{
size_t
colon
=
text
.
find_first_of
(
_
(
">:"
),
tag_start
);
if
(
colon
<
pos
-
1
&&
text
.
GetChar
(
colon
)
==
_
(
':'
))
{
Color
c
=
parse_
color
(
text
.
substr
(
colon
+
1
,
pos
-
colon
-
2
));
AColor
c
=
parse_a
color
(
text
.
substr
(
colon
+
1
,
pos
-
colon
-
2
));
if
(
!
c
.
Ok
())
c
=
style
.
font
.
color
;
colors
.
push_back
(
c
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment