Older Newer
Mon, 17 Nov 2008 03:51:15 . . . . adsl196-109-51-217-196.adsl196-10.iam.net.ma


Changes by last author:

Added:
= set_psetp_mode =

== Syntax ==

:void set_psetp_mode(n)

== Arguments ==

:n

::Set n to 1, if you want to be able to set alpha to 0 with psetp. Set n to 0 to restore default behavior again.

== Return ==

:Nothing

== Description ==

By default, you can't set the alpha channel to zero with psetp. This is an intended behavior, that allows to use psetp function in conjuction with RGB function without messing up alpha channel ( i.e psetp(x,y,RGB(r,g,b)) ). To cancel this behavior, just do the instruction set_psetp_mode(1).

== Example ==

<code>

%ffp

SupportedModes:RGBMode

//------- the default color is orange, but ---

//------- you can change it with sliders -----

ctl[0]:"R value",range=(0,255),val=255

ctl[1]:"G value",range=(0,255),val=128

ctl[2]:"B value",range=(0,255),val=0

ForEveryTile: {

int color;

if ( Z<4 ) { //check if alpha channel available

Info( "This plugin needs to be applied to a layer to achieve the effect" );

return true;

}

//------- the important line :

set_psetp_mode(1);

for(y=y_start;y<y_end;y++) {

for(x=x_start;x<x_end;x++) {

if( ((x%100)<50) ^ ((y%100)<50) ) {//chess board pattern

a=255;

} else {

a=0;

}

color=RGBA(ctl(0),ctl(1),ctl(2),a);

psetp(x,y,color);

}//end for x

}//end for y

return true;

}//end ForEveryTile

</code>

== Also see ==

:psetp, srcp, pgetp, RGB, RGBA

== Comments ==

:Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.