Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

VFP IMAGING



Rotate and Flip images with GdiPlusX

Some people have been asking about Rotating / Flipping images with GdiPlusX.
Here's some adapted code from a previous post that used _GdiPlus.vcx, but this time using GdiPlusX:
 
Rotating and / or flipping images is a very simple task for Gdi+. To see the different results possible, change the constant value in the variable lnEnumRotateFlip in the code below.
 
IMPORTANT
Requires VFP9 and GdiPlusX to run. 
Please make sure that you have the latest version!
http://www.codeplex.com/VFPX/Wiki/View.aspx?title=GDIPlusX&referringTitle=Home

 

* Init GdiPlusX
DO LOCFILE("System.App")

LOCAL loBMP as xfcBitmap
LOCAL lnEnumRotateFlip

WITH _SCREEN.System.Drawing

   loBMP = .Bitmap.FromFile(GETPICT())
   lnEnumRotateFlip = .RotateFlipType.Rotate90FlipNone  && Try Changing this value for the presented below
   loBmp.
RotateFlip(lnEnumRotateFlip)

   * To Save the Image as PNG
   loBMP.Save("C:\RotateFlip.png", .Imaging.ImageFormat.Png)

ENDWITH
RUN /N explorer.EXE RotateFlip.png

 

 
RotateNoneFlipNone 0 

Rotate90FlipNone   1 

Rotate180FlipNone  2 

Rotate270FlipNone  3 

RotateNoneFlipX    4 

Rotate90FlipX      5 

Rotate180FlipX     6 

Rotate270FlipX     7 

Published Monday, June 18, 2007 8:58 PM by cesarchalom
Filed Under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Ken Murphy said:

Very cool - but would you really want a LOCFILE() in this?  I would just pop an error message and return .f. it it couldn't find System.VCX

Hi Ken,

Thanks for your comment.

We`re using LOCFILE() in almost every sample to ease the task for users to run the codes. We hope GdiPlusX will help beginners and experts.

Using LOCFILE() in the samples, users wont need to worry to SET PATH or to throw the samples in the "source" folder.

Of course, if the user will use those samples in a project, the GdiPlusX library will need to be added to the project, and LOCFILE() will be removed. Was I clear ?

Regards

Cesar

June 19, 2007 1:41 AM
 

Reymundo López said:

Hi Cesar.

Then, if I want to put GdiPlusX in a real project I need to put the library in my "Clases" directory and have a reference in the path's for GdiPlusX, really?.

Greath work Cesar.

PS: Sorry for the bad english

Hi, Just add the library to your project, and that's all. Don't forget to clear the "LOCFILE()" command in the initialization of GDI+. Once it's in the project, your EXE will find it automatically.

Good luck !

June 21, 2007 3:55 PM
 

Guillermo said:

Hi Cesar. Grettings from the hot Asunción of Paraguay. Thanks for your excelent work.
I just wanna to know how i can make a blur effects in a image with GDI+. I do this with a DLL (gdpicture), but it is not free, but it's possible. Please replay me. Thanks

Here you are !

Blur Images with GdiPlusX

http://weblogs.foxite.com/cesarchalom/archive/2007/06/22/4153.aspx

June 21, 2007 11:17 PM
 

Cesar Chalom said:

Este articulo fue traducido a espanol:

Rotar y voltear imágenes con GdiPlusX

June 27, 2007 7:20 PM
 

Thomas Baehr said:

lnEnumRotateFlip = .RotateFlipType.Rotate90FlipNone

isnt exactly nice esp. if you want to got a Button to Rotate 90° Right + Flip so here is how you do that:

lnFlip = MOD(thisform.RotateRight + thisform.RotateX*4 + thisform.RotateY*6,8)
oBMP.RotateFlip(lnFLip)
- this is if you ALWAYS use a original Image and NOT Rotate the oBMP twice++
- so if you do that without using a org. Clone  clicking "RotateRight" twice will actually get you 270° instead of 180°



there the Commands
CMD Rotate 90° Right -> Click() = thisform.RotateRight=MOD(thisform.RotateRight+1,4)
CMD Rotate 90° Left -> Click() = thisform.RotateRight=MOD(thisform.RotateRight-1,4)
CMD Flip Y -> Click()  = thisform.rotateY = MOD(thisform.RotateY + 1,2)
CMD Flip X -> Click()  = thisform.rotateX = MOD(thisform.RotateX + 1,2)

so it doesnt matter which CMD you click in which order it roates the right angle if
July 20, 2007 12:34 PM
 

Ana María Bisbé said:

Versión en Español de este artículo en / Spanish version at http://www.portalfox.com/article.php?sid=2454  
July 24, 2007 7:33 PM

What do you think?

(required) 
(optional)
(required) 

This Blog

Post Calendar

<June 2007>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

Syndication