Copy link to clipboard
Copied
Hi all;
Very new to the SDK but making great progress.
I see that using the following function, we can write pixels at a coordinate (as opposed to iterating through every pixel):
PF_Pixel *sampleIntegral32(PF_EffectWorld &def, int x, int y){
return (PF_Pixel*)((char*)def.data +
(y * def.rowbytes) +
(x * sizeof(PF_Pixel)));
}
And then we call it using:
PF_Pixel *myPixel = sampleIntegral32(*output,x,y);
myPixel->red = 255;
myPixel->green = 255;
myPixel->blue = 255;
myPixel->alpha = 255;
But how does one read a pixel at X,Y?
Thanks,
-Richard
The answer is already in the code
The myPixel pointer already contains all the pixel data you need (myPixel->red is the red channel, myPixel->green is the green channel, etc).
Here is an example to read the blue channel value, decrease it by 10, then write it back to the red channel (no boundary checks!)
myPixel->red = myPixel->blue - 10;
Be aware that the code above is only valid in 8bpc (values 0..255), you should also support 16bpc and 32bpc
Copy link to clipboard
Copied
The answer is already in the code
The myPixel pointer already contains all the pixel data you need (myPixel->red is the red channel, myPixel->green is the green channel, etc).
Here is an example to read the blue channel value, decrease it by 10, then write it back to the red channel (no boundary checks!)
myPixel->red = myPixel->blue - 10;
Be aware that the code above is only valid in 8bpc (values 0..255), you should also support 16bpc and 32bpc
Copy link to clipboard
Copied
Well don't I feel foolish.
Thank you for the explanation.