Skip to main content
Participant
November 18, 2020
Question

[SDK] AE - How to simply iterate over Pixel

  • November 18, 2020
  • 2 replies
  • 569 views

Hello everyone, 

 

iam trying to build an simple plugin. I was wondering how to simply iterate over the pixeldata with an for loop or something else ? 

Would be helpful if someone could help me 🙂 

 

 

This topic has been closed for replies.

2 replies

N00B_Author
Participant
November 18, 2020

But with

static PF_Err Render(
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
PF_LayerDef* in_layer = &params[0]->u.ld;
for(int pixel = 0; pixel <= 1000; pixel++) {
        PF_GET_PIXEL_DATA8 ( in_layer, in_layer->data + pixel, &in_buf );
        PF_GET_PIXEL_DATA8 ( output, output->data + pixel, &out_buf );
        //Simple Channel Swap
        out_buf->blue = in_buf->red;
        out_buf->green = in_buf->green;
        out_buf->red = in_buf->blue;
}
...
}

i get some buggy image.. what i am doing wrong here ? 

Community Expert
November 18, 2020

take a look at the "CCU" sample project. it does what look for.

N00B_Author
Participant
November 18, 2020

Found it finally: 

PF_GET_PIXEL_DATA8 ( in_layer, in_layer->data + pixel_idx, &in_buf );
Ref.: https://ae-plugin-sdk-guide.readthedocs.io/effect-basics/PF_EffectWorld.html#effect-basics-pf-effectworld-pf-pixelptr-accessor-macros