Drawing on a new Effect World not working

Explorer ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Hi gang;

 

I would like to create a new effect world, draw to it, and then transform it with transform_world.

 

Something isn't working correctly so I will outline my process in case I should be approaching it differently. I have simplified this code for posting here so hopefully I didn't mistype anything but I think you'll get the idea of what I'm trying to do.

 

First, I create a small 10x10 effect world:

ERR(suites.WorldSuite1()->new_world(in_data->effect_ref,
							10L,
							10L,
							flags,
							&my_world));

 

Then I call my drawing function which scans through every pixel and simply outputs an alpha of 255 and a color blue (this is just for testing).

 

ERR(drawPixel32(px, py, 10, &my_world));

 

Here is my drawing function, *myPixel is the standard drawing function in the manual which I will also list below:

 

static PF_Err
drawPixel32(int x, int y, int size, PF_EffectWorld *output)
{
	PF_Err err = PF_Err_NONE;
	int u, v;

	for (u=0; u < size; u++)
	for (v=0; v < size; v++)
	{

	PF_Pixel *myPixel = sampleIntegral32(*output,x+u,y+v);
	myPixel->red = 0;
	myPixel->green = 0;
	myPixel->blue =	255;
	myPixel->alpha = 255;

	} // uv

	return err;
}

 

 

PF_Pixel *sampleIntegral32(PF_EffectWorld &def, int x, int y){
return (PF_Pixel*)((char*)def.data +
(y * def.rowbytes) +
(x * sizeof(PF_Pixel)));
}

 

 

 

 

And I follow this by displaying &my_world using transform_world. But it doesn't display any of my drawing function. I know this is not an issue with transform_world because if I fill &my_world with PF_FILL, it shows up. 

 

If I want to draw pixel by pixel to an effect world, what is wrong with my approach?

 

Thanks,

-Richard

TOPICS
SDK

Views

99

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 13, 2022 May 13, 2022
without diving into your code (which seems ok at a glance), have you tried drawing using drawPixel32 directly into the output? just trying some basic elimination here.

Likes

Translate

Translate
Adobe Community Professional ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

without diving into your code (which seems ok at a glance), have you tried drawing using drawPixel32 directly into the output?

just trying some basic elimination here.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

LATEST

Hi Sachar;

 


@shachar carmi wrote:

without diving into your code (which seems ok at a glance), have you tried drawing using drawPixel32 directly into the output?

just trying some basic elimination here.


 

Thank you, as always, for your helpful reply.

 

Your confirmation that I was indeed following the correct process prompted me to hunt through the rest of my code for logic mistakes and I found it. I also changed the output from &my_world to output as you suggested and indeed it was working correctly so that confirmed it.

 

Thank you again for your help.

 

Regards,

Rich

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines