Skip to main content
Participating Frequently
January 20, 2012
Question

render pixel(s)

  • January 20, 2012
  • 1 reply
  • 1398 views

I currently don't see how i can achieve this. I have an array of pixel data, looking like this:

unsigned char pixels[width*height][3]; //1024*768

So to get data fom a pixel i do this:

pixels[0][0] = R;

pixels[0][1] = G;

pixels[0][2] = B;

Next thing i want to do is write all these pixels to my layer.What exactly do i have to do?

This topic has been closed for replies.

1 reply

asdf1Author
Participating Frequently
January 21, 2012

I guess i got a bit further. I'm using PF_ITERATE to iterate over all the pixels (not using the suite right now).

So PF_ITERATE calls my callback function for each pixel. My callback function looks like this right now:

static PF_Err 
ChangePixelColor (
          long refcon, 
          long x, long y, 
          PF_Pixel *in, PF_Pixel *out)
{
     register ShiftInfo     *si = (ShiftInfo *)refcon;
     PF_InData               *in_data = si->in_data;
     PF_Err                    err;

     // CHANGE COLOR TO RED?
     // JUST A TRYOUT, DOESN'T HELP :-(
     out->alpha = 255;
     out->red = 255;
     out->green = 0;
     out->blue = 0;

     err = PF_SUBPIXEL_SAMPLE(x, y, &si->samp_pb, out);

     return err;
}

Obviously, this isn't changing any pixels yet, because i'm not sure what to do next. This function gives me the current x and y location of the pixel and also the PF_Pixel *in data.

How can i change the color of the current pixel...?

EDIT

I think i found my problem. I wasn't casting the rgb values to an unsigned char. Its painting the pixels now.

Community Expert
January 21, 2012

glad to see you solved it man!

now you can get rid of.

err = PF_SUBPIXEL_SAMPLE(x, y, &si->samp_pb, out);

it fetches you the subpixel sample from the input world in the x/y coordinates you provide.

currently you're asking for what AE already gives you in *in.

so you're just slowing yourself down considerably, without any reason.

is you want a faster implementation, look at the CCU sample.

it shows how to access the output pixels directly without using the iteration suite.

if you combine the with iterate_generic() to iterate lines, you'll get much better speed than you would with the current iteration suite.

but no hurry. get your plug-in up and running first.

:-)