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

Blendop grayscale

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 12:13, 17 January 2008 (edit)
Sandman (Talk | contribs)
(New page: Category:functions Category:Blendops ==Definition== '''INT''' blendop_grayscale ( <'''INT''' blendopID> , <'''INT''' mode> ) Modify the blend table of the blend operation...)
← Previous diff
Current revision (13:57, 25 May 2008) (edit) (undo)
86.72.151.199 (Talk)
(Parameters)
 
(3 intermediate revisions not shown.)
Line 3: Line 3:
==Definition== ==Definition==
-'''INT''' blendop_grayscale ( <'''INT''' blendopID> , <'''INT''' mode> )+'''INT''' blendop_grayscale ( <'''INT''' blendTable> , <'''INT''' mode> )
-Modify the [[blend table]] of the [[blend operation]] by modifying the colours, so the compononts of one colour is the same (this makes them appear gray). This means that the [[graphic]] the blend operation is assigned to will appear gray.+Modify the [[blend table]] by modifying the colours, so the compononts of one colour is the same (this makes them appear gray). This means that the [[graphic]] the blend operation is assigned to will appear gray.
The source section of the [[blend table]] will be modified; this will clear the destination section of the blend table. The source section of the [[blend table]] will be modified; this will clear the destination section of the blend table.
Line 11: Line 11:
== Parameters == == Parameters ==
{| {|
-| '''INT''' blendopID || - The [[blendopID]] of the [[blendop]] to modify.+| '''INT''' blendTable || - The [[blend table]] to modify.
|- |-
-| '''FLOAT''' amount || - The mode to perform the grayscaling (see [[#Notes|notes]]).+| '''INT''' mode || - The mode to perform the grayscaling (see [[#Notes|notes]]).
|} |}
== Returns == == Returns ==
'''INT''' : [[true]] '''INT''' : [[true]]
 +
 +== Notes ==
 +* Method 1
 +<code>
 +component = 0.3*r+0.59*g+0.11*b
 +colour = rgb ( component , component , component )
 +</code>
 +
 +* Method 2
 +<code>
 +max = r > g ? r > b ? r : g : g > b ? g : b ;
 +min = r < g ? r < b ? r : g : g < b ? g : b ;
 +component = ( max + min ) / 2
 +colour = rgb ( component , component , component )
 +</code>
 +
 +* Method 3
 +<code>
 +max = r > g ? r > b ? r : g : g > b ? g : b ;
 +colour = rgb ( max , max , max )
 +</code>
{{Funcbox {{Funcbox
| category = Blendops | category = Blendops
}} }}

Current revision


Contents

[edit] Definition

INT blendop_grayscale ( <INT blendTable> , <INT mode> )

Modify the blend table by modifying the colours, so the compononts of one colour is the same (this makes them appear gray). This means that the graphic the blend operation is assigned to will appear gray.

The source section of the blend table will be modified; this will clear the destination section of the blend table.

[edit] Parameters

INT blendTable - The blend table to modify.
INT mode - The mode to perform the grayscaling (see notes).

[edit] Returns

INT : true

[edit] Notes

  • Method 1

component = 0.3*r+0.59*g+0.11*b colour = rgb ( component , component , component )

  • Method 2

max = r > g ? r > b ? r : g : g > b ? g : b ; min = r < g ? r < b ? r : g : g < b ? g : b ; component = ( max + min ) / 2 colour = rgb ( component , component , component )

  • Method 3

max = r > g ? r > b ? r : g : g > b ? g : b ; colour = rgb ( max , max , max )


Blendops Functions
Blendop_apply() • Blendop_assign() • Blendop_free() • Blendop_grayscale() • Blendop_identity() • Blendop_intensity() • Blendop_new() • Blendop_swap() • Blendop_tint() • Blendop_translucency() •
Personal tools