Added 'recolor_image' function

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1473 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-08-03 18:19:05 +00:00
parent ca0e762b64
commit e01b24aa63
13 changed files with 185 additions and 29 deletions
+2 -1
View File
@@ -83,7 +83,8 @@ These functions are built into the program, other [[type:function]]s can be defi
| [[fun:set_alpha]] Change the transparency of an image.
| [[fun:set_combine]] Change how the image should be combined with the background.
| [[fun:saturate]] Saturate/desaturate an image.
| [[fun:invert]] Invert the colors of an image.
| [[fun:invert_image]] Invert the colors of an image.
| [[fun:recolor_image]] Change the colors of an image to match the font color.
| [[fun:enlarge]] Enlarge an image by putting a border around it.
| [[fun:crop]] Crop an image, giving only a small subset of it.
| [[fun:flip_horizontal]] Flip an image horizontally.
-14
View File
@@ -1,14 +0,0 @@
Function: invert
--Usage--
> invert(input: image)
Invert the colors in an image.
--Parameters--
! Parameter Type Description
| @input@ [[type:image]] Image to invert.
--Examples--
> invert("image_logo.png") == [[Image]]
>>> invert(<img src="image_logo.png" alt='"image_logo.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />) == <img src="image_logo_invert.png" alt='"image_logo_invert.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />
+14
View File
@@ -0,0 +1,14 @@
Function: invert_image
--Usage--
> invert_image(input: image)
Invert the colors in an image.
--Parameters--
! Parameter Type Description
| @input@ [[type:image]] Image to invert.
--Examples--
> invert_image("image_logo.png") == [[Image]]
>>> invert_image(<img src="image_logo.png" alt='"image_logo.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />) == <img src="image_logo_invert.png" alt='"image_logo_invert.png"' style="border:1px solid black;vertical-align:middle;margin:1px;" />
+26
View File
@@ -0,0 +1,26 @@
Function: recolor_image
--Usage--
> recolor_image(input: image, color: color)
Re-color an image:
* Red is replaced by the color
* Green is replaced by black or white, of the same lightness as the color.
So if the color is light, green will be replaced by white.
* Blue is replaced by black or white, of the opposite lightness.
* White stays white, black stays black
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.
--Examples--
> 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(<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;" />