This wiki is out of date, use the continuation of this wiki instead

Grayscale

From FenixWiki

Jump to: navigation, search


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() •
Personal tools