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
ed92518f
Commit
ed92518f
authored
Aug 03, 2010
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recolor_image function can now be used with custom colors
parent
f065a3ad
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
63 additions
and
6 deletions
+63
-6
doc/function/flip_horizontal.txt
doc/function/flip_horizontal.txt
+2
-0
doc/function/flip_vertical.txt
doc/function/flip_vertical.txt
+2
-0
doc/function/invert_image.txt
doc/function/invert_image.txt
+2
-0
doc/function/recolor_image.txt
doc/function/recolor_image.txt
+18
-3
doc/function/rotate.txt
doc/function/rotate.txt
+3
-1
doc/function/saturate.txt
doc/function/saturate.txt
+2
-0
doc/function/symbol1_recolor_custom.png
doc/function/symbol1_recolor_custom.png
+0
-0
src/gfx/generated_image.cpp
src/gfx/generated_image.cpp
+14
-0
src/gfx/generated_image.hpp
src/gfx/generated_image.hpp
+11
-0
src/script/functions/image.cpp
src/script/functions/image.cpp
+9
-2
No files found.
doc/function/flip_horizontal.txt
View file @
ed92518f
Function: flip_horizontal
DOC_MSE_VERSION: since 0.3.9
--Usage--
> flip_horizontal(input: image)
...
...
doc/function/flip_vertical.txt
View file @
ed92518f
Function: flip_vertical
DOC_MSE_VERSION: since 0.3.9
--Usage--
> flip_vertical(input: image)
...
...
doc/function/invert_image.txt
View file @
ed92518f
Function: invert_image
DOC_MSE_VERSION: since 0.3.9
--Usage--
> invert_image(input: image)
...
...
doc/function/recolor_image.txt
View file @
ed92518f
Function: recolor_image
DOC_MSE_VERSION: since 0.3.9
--Usage--
> recolor_image(input: image, color: color)
> recolor_image(input: image, red: color, green: color, blue: color, white: color)
Re-color an image:
* Red is replaced by the color
...
...
@@ -13,14 +16,26 @@ Re-color an image:
This function is mostly intended to make symbols in a symbol font wich can match the text color.
--Parameters--
! Parameter Type Description
| @input@ [[type:image]] Image to recolor.
| @color@ [[type:color]] Color by which to replace red.
Or
! Parameter Type Description
| @input@ [[type:image]] Image to recolor.
| @red@ [[type:color]] Color by which to replace red.
| @green@ [[type:color]] Color by which to replace green.
| @blue@ [[type:color]] Color by which to replace blue.
| @white@ [[type:color]] Color by which to replace white.
--Examples--
> recolor_image("symbol1.png", color: rgb(180,0,0))
==
[[Image]]
> recolor_image("symbol1.png", color: rgb(180,0,0))
==
[[Image]]
>>> recolor_image(<img src="symbol1.png" alt='"symbol1.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />, color: rgb(180,0,0)) == <img src="symbol1_red.png" alt='"symbol1_red.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />
> recolor_image("symbol1.png", color: rgb(100,255,0))
==
[[Image]]
> recolor_image("symbol1.png", color: rgb(100,255,0))
==
[[Image]]
>>> recolor_image(<img src="symbol1.png" alt='"symbol1.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />, color: rgb(100,255,0)) == <img src="symbol1_green.png" alt='"symbol1_green.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />
Custom choices for green, blue and white are also possible:
>>> recolor_image(<img src="symbol1.png" alt='"symbol1.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />, red:rgb(0,170,0), green:rgb(200,0,255), blue:rgb(128,0,0), white:rgb(220,255,0))
>>> == <img src="symbol1_recolor_custom.png" alt='"symbol1_recolor_custom.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />
doc/function/rotate.txt
View file @
ed92518f
Function: flip_vertical
Function: rotate
DOC_MSE_VERSION: since 0.3.9
--Usage--
> rotate(input: image, angle: some_number)
...
...
doc/function/saturate.txt
View file @
ed92518f
Function: saturate
DOC_MSE_VERSION: since 0.3.9
--Usage--
> saturate(input: image, amount: saturation amount)
...
...
doc/function/symbol1_recolor_custom.png
0 → 100644
View file @
ed92518f
2.48 KB
src/gfx/generated_image.cpp
View file @
ed92518f
...
...
@@ -221,6 +221,20 @@ bool RecolorImage::operator == (const GeneratedImage& that) const {
&&
color
==
that2
->
color
;
}
Image
RecolorImage2
::
generate
(
const
Options
&
opt
)
const
{
Image
img
=
image
->
generate
(
opt
);
recolor
(
img
,
red
,
green
,
blue
,
white
);
return
img
;
}
bool
RecolorImage2
::
operator
==
(
const
GeneratedImage
&
that
)
const
{
const
RecolorImage2
*
that2
=
dynamic_cast
<
const
RecolorImage2
*>
(
&
that
);
return
that2
&&
*
image
==
*
that2
->
image
&&
red
==
that2
->
red
&&
green
==
that2
->
green
&&
blue
==
that2
->
blue
&&
white
==
that2
->
white
;
}
// ----------------------------------------------------------------------------- : FlipImage
Image
FlipImageHorizontal
::
generate
(
const
Options
&
opt
)
const
{
...
...
src/gfx/generated_image.hpp
View file @
ed92518f
...
...
@@ -227,6 +227,17 @@ class RecolorImage : public SimpleFilterImage {
private:
Color
color
;
};
/// Recolor an image, with custom colors
class
RecolorImage2
:
public
SimpleFilterImage
{
public:
inline
RecolorImage2
(
const
GeneratedImageP
&
image
,
Color
red
,
Color
green
,
Color
blue
,
Color
white
)
:
SimpleFilterImage
(
image
),
red
(
red
),
green
(
green
),
blue
(
blue
),
white
(
white
)
{}
virtual
Image
generate
(
const
Options
&
opt
)
const
;
virtual
bool
operator
==
(
const
GeneratedImage
&
that
)
const
;
private:
Color
red
,
green
,
blue
,
white
;
};
// ----------------------------------------------------------------------------- : FlipImage
...
...
src/script/functions/image.cpp
View file @
ed92518f
...
...
@@ -93,8 +93,15 @@ SCRIPT_FUNCTION(invert_image) {
SCRIPT_FUNCTION
(
recolor_image
)
{
SCRIPT_PARAM_C
(
GeneratedImageP
,
input
);
SCRIPT_PARAM
(
Color
,
color
);
return
intrusive
(
new
RecolorImage
(
input
,
color
));
SCRIPT_OPTIONAL_PARAM
(
Color
,
red
)
{
SCRIPT_PARAM
(
Color
,
green
);
SCRIPT_PARAM
(
Color
,
blue
);
SCRIPT_PARAM_DEFAULT
(
Color
,
white
,
*
wxWHITE
);
return
intrusive
(
new
RecolorImage2
(
input
,
red
,
green
,
blue
,
white
));
}
else
{
SCRIPT_PARAM
(
Color
,
color
);
return
intrusive
(
new
RecolorImage
(
input
,
color
));
}
}
SCRIPT_FUNCTION
(
enlarge
)
{
...
...
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