Skip navigation
Or_Yair
Currently Being Moderated

Resize Question

Aug 11, 2012 7:50 AM

Hello,
lets say that i want to make an effect thats all it does is to change the buffer size,
so in the FRAME_SETUP i set the new height and width,
then, in the RENDER i have a problem because the input (params[0]->u.ld.data) is not the same size as the output (output->data)
so i can't copy the pixels from one to another...
what is the right way to deal with this?

 

(i know the PF_COPY can manage this problem, but i want to know to do it myself)

 

tnx :-)

 
Replies
  • Currently Being Moderated
    Aug 13, 2012 3:38 PM   in reply to Or_Yair

    you're asking something very general.

    if it's just a matter of copying the input buffer into the center of the enlarged output buffer, then PF_COPY takes two rectangles with which you can resolve this issue easily.

    there are a few other transformation functions that can handle the translation of images between buffers of different sizes. (transform_world() for instance)

     

    if by "do it myself" you mean to ask how to access the image buffers directly in RAM, the take a look in the CCU sample project.

    the drawing of the green circle is done directly into each pixel's location in memory.

    this way you can copy data between buffers of different sizes. (or do any other thing, now that you can access random pixels in any buffer)

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 11:25 AM   in reply to Or_Yair

    actually, that's pretty much it.

    it's now up to you to optimize the process.

    a couple of examples:

     

    a blur effect is calculated over the expanded buffer,

    so you copy the small input to the large output, and blur the output buffer.

     

    a warp effect would iterate over the large output, calculate it's origin pixel, and copy it from the small input.

     

    if you want to color correct the image while expanding the buffer because... i don't know... you have fat pixels, the you can either copy the small input into a small intermediate, process the intermediate and then copy to the large output.

    or, you can work directly on the small input (you can do that technically, just test your plug-in thoroughly), and copy the result to the output.

     

    only you know what you want to do,

    so figure out the route with the least redundant operations.

    fun fun fun!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points