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

Grayscale

From FenixWiki

(Difference between revisions)
Jump to: navigation, search

Sandman (Talk | contribs)
(New page: Category:functions Category:graphical effects ==Definition== '''INT''' grayscale ( <'''INT''' fileID> , <'''INT''' graphID> , <'''BYTE''' method> ) This will convert the specifie...)
Next diff →

Revision as of 19:10, 14 April 2008


Contents

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.

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).

Returns

INT

-1 - Invalid graphic.
1 - Success.

Errors

Unsupported color depth - The graphic's color depth is not 16bit.

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).


Graphical effects Functions
Blur() • Grayscale() • Rgbscale() •
Personal tools