Does anybody know of a built-in method or have a way that I can flip an image in the way I want with scaling. Basically, I want to be able to scale an image with something like this:
The scale of 1 would mean the same dimensions as the OriginalPicture. The scale of 0 would mean no picture. And the scale of -1 would mean it flips it horiz or vert depending on whether it is scale x or y?
There’s nothing “built-in” but you can write your own extension to the picture class. I’ve done that so that I can resize a picture with a percent instead of the normal convoluted way (which includes the ability to crop, etc.).
For flipping, there are third party modules such as the ImagePlayEffects library (pure Xojo code, not a plugin).
[quote=73350:@Marc Zeedar]There’s nothing “built-in” but you can write your own extension to the picture class. I’ve done that so that I can resize a picture with a percent instead of the normal convoluted way (which includes the ability to crop, etc.).
For flipping, there are third party modules such as the ImagePlayEffects library (pure Xojo code, not a plugin).[/quote]
What function do you use to scale backwards. I want to use negative values for the scale to flip. For example the x scale of 1 is the original scale but -1 is flipped and -.5 is flipped and scale half the size horizontally.
Oops, should be “column for a horizontal - Y axis - flip”.
Another approach would be to use GetData to put the picture data into a MemoryBlock and move chunks of data around, calculating the offsets. A flip on the Y axis would be tedious this way, but flipping top-too-bottom should be fast.
[quote=73421:@Jeff Tullin]Pretty sure that the WINAPI call BitBlt under Windows allows you to specify negative parameters to achieve a one line flip/inversion
What platform are you targeting?[/quote]
Windows, Mac and Linux. Xojo only lets me use the width of 1 as a minimum.
I would look into context translations. On the Mac, CoreGraphics has translations that can scale and flip the context, I’m sure under Windows there are similar translations.
If you your time is worth $10 per hour, and you already spent 4 hours thinking about it, you could buy the MBS Picture plugin on its own at 39EUR
It has an invert and HMirror function , plus a lot of other goodies, and its cross platform.