need to rotate a pixmap with smooth filtering

BlitzMax Forums/BlitzMax Programming/need to rotate a pixmap with smooth filtering

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The next thing to do with this would be to turn the loops inside out, ie the X and Y counters should be set outside the loop and with an X_Add and Y_Add increment, which steps through the source pixmap in non-rotated space, and then the X_U,X_V and Y_U,Y_V gets translated to loop counters in the For-Next loops.

At the moment you're looking at a non-rotated viewport into a rotating world, whereas what you probably want is a rotated viewport into a non-rotated world. .. then you can set the rotation angle and have it draw all of the pixels from the source pixmap, and only those pixels, at the rotated angle like Max2D does. I think that should be simple enough.

Then all that's left to add is filtering. I guess you can't really draw the rotated image to some buffer in a big size and then scale it down as it would be more efficient to somehow filter it on the fly.

I guess it totally depends what kind of filtering you want - what algorithm. Different levels of antialiasing, ie 2x2, 4x4, 8x8 etc? You'd have to probably accumulate the values for all the pixels in the square and divide by total number of pixels (use a Shift!), and then plot that pixel? That would at least be antialiased, but I'm not sure how it'd look when zoomed up big .... not quite the same as bi/trilinear filtering/interpolation. I suppose you could interpolate from the color of one pixel to the next based on what decimal portion of the source pixel you are at.