- This wiki is out of date, use the continuation of this wiki instead
Grayscale
From FenixWiki
(Difference between revisions)
| Revision as of 19:10, 14 April 2008 (edit) Sandman (Talk | contribs) (New page: Category:functions Category:graphical effects ==Definition== '''INT''' grayscale ( <'''INT''' fileID> , <'''INT''' graphID> , <'''BYTE''' method> ) This will convert the specifie...) ← Previous diff |
Current revision (19:12, 14 April 2008) (edit) (undo) Sandman (Talk | contribs) m |
||
| Line 83: | Line 83: | ||
| </pre> | </pre> | ||
| - | Note that <code>[[rgbscale]](0,map,1,1,1) = [[grayscale]](0,map,0)</code>. | + | Note that <code>[[rgbscale]](0,map,1,1,1) = [[grayscale]](0,map,0)</code> for a valid graphic (0,map). |
| {{Funcbox | {{Funcbox | ||
| | category=Graphical effects | | category=Graphical effects | ||
| }} | }} | ||
Current revision
Contents |
[edit] Definition
INT grayscale ( <INT fileID> , <INT graphID> , <BYTE method> )
This will convert the specified graphic by using the specified method; see notes for the details.
[edit] Parameters
| INT fileID | - The fileID of the file that holds the graphics. |
| INT graphID | - The graphID of the graphic to convert. |
| BYTE method | - The method used (see notes). |
[edit] Returns
INT
| -1 | - Invalid graphic. |
| 1 | - Success. |
[edit] Errors
| Unsupported color depth | - The graphic's color depth is not 16bit. |
[edit] Notes
The exact formula is:
c = 0.3 * oldpixel_r + 0.59 * oldpixel_g + 0.11 * oldpixel_b
Method 0:
for every pixel:
newpixel_rgb = (c,c,c)
Method 1:
for every pixel:
newpixel_rgb = (c,0,0)
Method 2:
for every pixel:
newpixel_rgb = (0,c,0)
Method 3:
for every pixel:
newpixel_rgb = (0,0,c)
Method 4:
for every pixel:
newpixel_rgb = (c,c,0)
Method 5:
for every pixel:
newpixel_rgb = (c,0,c)
Method 6:
for every pixel:
newpixel_rgb = (0,c,c)
Other methodnumbers:
for every pixel:
newpixel_rgb = oldpixel_rgb
Note that rgbscale(0,map,1,1,1) = grayscale(0,map,0) for a valid graphic (0,map).
| Graphical effects Functions | |
| • Blur() • Grayscale() • Rgbscale() • | |
