Older Newer
Mon, 30 Dec 2019 15:10:26 . . . . SyneRyder [Tweak formatting]


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.

== 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;

// Check if alpha channel available

if ( Z<4 ) {

Info("This plug-in 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++) {

// Chess board pattern

if( ((x%100)<50) ^ ((y%100)<50) ) {

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>

== See Also ==

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.