Highlighted

SmartFX Expand Layer Bounds - Shifter Example Project

Contributor ,
Nov 21, 2020

Copy link to clipboard

Copied

Using SmartFX and expanding on the 'Shifter' Example project, how can I expand the bounds of my square layer here to show the shifted image on top in its entirely, rather than being restricted to the original square?  

Screenshot_118.png

I know it is something to do with the extra and/or PF_CheckoutResult but cannot pinpoint how by messing with the result_rects!

 

Thanks!

In my case, I expanded the result_rect, then unioned it with the output rects which also expanded them:

 

PF_Rect expandedRect = in_result.result_rect;

expandedRect.left -= stuffP->innerExpansion.left; // expand by subtracting on the left and top
expandedRect.top -= stuffP->innerExpansion.top;
expandedRect.right += stuffP->innerExpansion.right;
expandedRect.bottom += stuffP->innerExpansion.bottom;

UnionLRect(&expandedRect, &in_result.result_rect);
UnionLRect(&expandedRect, &in_result.max_result_rect);

 

UnionLRect(&in_result.result_rect, &extra->output->result_rect);

UnionLRect(&in_result.max_result_rect, &extra->output->max_result_rect);

 

I don't quite understand why your code gave a magic error though.

TOPICS
SDK

Views

81

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

SmartFX Expand Layer Bounds - Shifter Example Project

Contributor ,
Nov 21, 2020

Copy link to clipboard

Copied

Using SmartFX and expanding on the 'Shifter' Example project, how can I expand the bounds of my square layer here to show the shifted image on top in its entirely, rather than being restricted to the original square?  

Screenshot_118.png

I know it is something to do with the extra and/or PF_CheckoutResult but cannot pinpoint how by messing with the result_rects!

 

Thanks!

In my case, I expanded the result_rect, then unioned it with the output rects which also expanded them:

 

PF_Rect expandedRect = in_result.result_rect;

expandedRect.left -= stuffP->innerExpansion.left; // expand by subtracting on the left and top
expandedRect.top -= stuffP->innerExpansion.top;
expandedRect.right += stuffP->innerExpansion.right;
expandedRect.bottom += stuffP->innerExpansion.bottom;

UnionLRect(&expandedRect, &in_result.result_rect);
UnionLRect(&expandedRect, &in_result.max_result_rect);

 

UnionLRect(&in_result.result_rect, &extra->output->result_rect);

UnionLRect(&in_result.max_result_rect, &extra->output->max_result_rect);

 

I don't quite understand why your code gave a magic error though.

TOPICS
SDK

Views

82

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
Nov 21, 2020 0
Adobe Community Professional ,
Nov 22, 2020

Copy link to clipboard

Copied

Try applying Grow Bounds before you apply Shifter.

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
Reply
Loading...
Nov 22, 2020 0
Contributor ,
Nov 22, 2020

Copy link to clipboard

Copied

Rick, I don't believe there are any example projects or code for that! I'm asking how to do it via the SDK, not applying premade effects.

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
Reply
Loading...
Nov 22, 2020 0
Adobe Employee ,
Nov 25, 2020

Copy link to clipboard

Copied

If you want to go outside the bounds of the original layer to which the effect is applied, you'll need to resize the output buffer; see the (aptly-named) Resizer sample.

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
Reply
Loading...
Nov 25, 2020 0
Participant ,
Nov 25, 2020

Copy link to clipboard

Copied

To expand the buffer in smartFX, in pre render you need to expand the result_rect and max_result_rect and then set the flag 

extra->output->flags = PF_RenderOutputFlag_RETURNS_EXTRA_PIXELS;

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
Reply
Loading...
Nov 25, 2020 0
Contributor ,
Nov 28, 2020

Copy link to clipboard

Copied

@James Whiffin Which rects are we talking about, the extra or the input? I have tried on the extra and the input in various places in the PreRender(), but I get 'AEGP Magic Error'. Is this the right format? 

Screenshot_123.png

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
Reply
Loading...
Nov 28, 2020 0
Participant ,
Nov 28, 2020

Copy link to clipboard

Copied

In my case, I expanded the result_rect, then unioned it with the output rects which also expanded them:

 

PF_Rect expandedRect = in_result.result_rect;

expandedRect.left -= stuffP->innerExpansion.left; // expand by subtracting on the left and top
expandedRect.top -= stuffP->innerExpansion.top;
expandedRect.right += stuffP->innerExpansion.right;
expandedRect.bottom += stuffP->innerExpansion.bottom;

UnionLRect(&expandedRect, &in_result.result_rect);
UnionLRect(&expandedRect, &in_result.max_result_rect);

 

UnionLRect(&in_result.result_rect, &extra->output->result_rect);

UnionLRect(&in_result.max_result_rect, &extra->output->max_result_rect);

 

I don't quite understand why your code gave a magic error though.

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
Reply
Loading...
Nov 28, 2020 0