2006-02-07

ROTATE / FLIP IMAGES WITH VFP9 AND GDI+

Rotating and / or flipping images is a simple task for gdi+. to see the different results possible, change the constant value in the parameter "rotateflip" in the code below.


*-- rotatefliptype constants
#define rotatenoneflipnone 0
#define rotate90flipnone   1
#define rotate180flipnone  2
#define rotate270flipnone  3

#define rotatenoneflipx    4
#define rotate90flipx      5
#define rotate180flipx     6
#define rotate270flipx     7


local lcsource, lcdestination

lcsource = getpict("jpg;gif;bmp")


local loimage as gpimage of ffc/_gdiplus.vcx
loimage = newobject("gpimage",home()+"ffc/_gdiplus.vcx")
loimage.createfromfile(lcsource)

loimage.rotateflip(Rotate180FlipNone) && try changing using the constants above
loimage.savetofile("flipped.png","image/png")



run /n explorer.exe flipped.png



RotateNoneFlipNone 0  1000.107.1764.flipped0

Rotate90FlipNone   1  1000.107.1763.flipped1

Rotate180FlipNone  2  1000.107.1765.flipped2

Rotate270FlipNone  3  1000.107.1766.flipped3

RotateNoneFlipX    4  1000.107.1767.flipped4

Rotate90FlipX      5  1000.107.1768.flipped5

Rotate180FlipX     6  1000.107.1769.flipped6

Rotate270FlipX     7  1000.107.1770.flipped7



See also this blog post:

Use encoder parameters to save your images with gdi+



1 comment:

  1. Versión en Español de este artículo in / Spanish version at http://www.portalfox.com/article.php?sid=2181

    ReplyDelete