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
m.lcSource = GETPICT("jpg;gif;bmp")

LOCAL loImage AS gpImage OF FFC / _GdiPlus.vcx
m.loImage = NEWOBJECT("gpimage",HOME() + "ffc/_gdiplus.vcx")
m.loImage.CreateFromFile(m.lcSource)

m.loImage.ROTATEFLIP(Rotate180FlipNone) && try changing using the constants above
m.loImage.SaveToFile("Flipped.png","image/png")

RUN /N Explorer.EXE Flipped.Png





RotateNoneFlipNone 0  

 

Rotate90FlipNone   1  

 

Rotate180FlipNone  2  

 

Rotate270FlipNone  3  



RotateNoneFlipX    4   



Rotate90FlipX      5  

 

Rotate180FlipX     6   



Rotate270FlipX     7   


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