• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

SmartFX Expand Layer Bounds - Shifter Example Project

Contributor ,
Nov 21, 2020 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!

TOPICS
SDK

Views

601

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 3 Correct answers

Adobe Employee , Nov 25, 2020 Nov 25, 2020

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.

Votes

Translate

Translate
Engaged , Nov 25, 2020 Nov 25, 2020

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;

Votes

Translate

Translate
Engaged , Nov 28, 2020 Nov 28, 2020

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);

 

U

...

Votes

Translate

Translate
Community Expert ,
Nov 22, 2020 Nov 22, 2020

Copy link to clipboard

Copied

Try applying Grow Bounds before you apply Shifter.

Votes

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

Votes

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
Adobe Employee ,
Nov 25, 2020 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.

Votes

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
Engaged ,
Nov 25, 2020 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;

Votes

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
Contributor ,
Nov 28, 2020 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

Votes

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
Engaged ,
Nov 28, 2020 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.

Votes

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
Contributor ,
Nov 16, 2021 Nov 16, 2021

Copy link to clipboard

Copied

LATEST

Votes

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