Advertisement

Offsetting an image, same source and destination

Started by August 18, 2018 12:01 PM
3 comments, last by JoeJ 6 years, 5 months ago

I was just writing an 'offset' function to offset an image by x, y, as found in photoshop or the gimp etc (where the source pixels wrap around when outside the image). In the case where the source and destination is the same image, I was wondering is there a cunning way to offset an image WITHOUT making a copy?

The issue is the feedback where a pixel needs to be set to the OLD value of a source pixel, when the source pixel has already been set to a NEW value.

https://www.geeksforgeeks.org/array-rotation/

Guess its fun to extend to 2D.

Advertisement

I was thinking along the lines of 3, but knew someone had to have come up with the ready debugged solution! :) 

Not very cache friendly but should avoid the need for a duplicate on large images.

1 hour ago, lawnjelly said:

Not very cache friendly

Yeah, but it would be useful for example on GPU when working in limited LDS memory. :)

This topic is closed to new replies.

Advertisement