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.
* Init GdiPlusX
DO System.app
LOCAL lnEnumRotateFlip
WITH _SCREEN.SYSTEM.Drawing
loBmp = .Bitmap.FromFile(GETPICT())
lnEnumRotateFlip = .RotateFlipType.Rotate90FlipNone && change this value with the presented below
loBmp.rotateflip(lnEnumTotateFlip)
* to save the image as png
loBmp.Save("c:\RotateFlip.png", .imaging.imageformat.png)
ENDWITH
RUN /N EXPLORER.EXE RotateFlip.png
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
ReplyDeleteHi 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
Hi Cesar.
ReplyDeleteThen, 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 !
Hi Cesar. Grettings from the hot Asunción of Paraguay. Thanks for your excelent work.
ReplyDeleteI 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
lnEnumRotateFlip = .RotateFlipType.Rotate90FlipNone
ReplyDeleteisnt 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
Versión en Español de este artículo en / Spanish version at http://www.portalfox.com/article.php?sid=2454
ReplyDeleteHi Cesar.
ReplyDeleteCan we use system.app to rotate images by any desired angle ? Thank you very much
Hi Warren,
Sure you can ! Please refer to the samples provided with GdiPlusX, there are a couple showing you how to do this :-D