In the last weeks I've been doing some extensive tests and creating some examples using the new VFP-X GdiplusX library. These classes are terrific, completely insane. this library is already making my life with gdi+ a lot easier.
The more I use it, the more I like it. I'm really having fun.
As Craig Boyd said in one of his blog posts: "the GdiplusX library is a pure Visual FoxPro reproduction of the drawing related namespaces in .NET. We've coded well over 40,000 lines of vfp code and the library consists of 80+ classes now. at nearly 95% complete. It is safe to say that no other library on the planet gives visual foxpro developers the functionality and power that this one does when working with gdi+. " - That's totally true.
If you're planning to start a new project and will need to use GDI+, or are interested to help in the project, coding, testing making suggestions, I strongly recommend to enter the codeplex vfp-x page, select the "releases" tab, and download the most recent stable version available.
Start running the file demo.prg in the samples folder, and you'll have a good idea of the power of the class.
By the way, the VFP-X project now has a new logo too !
From now on, I'll use this space to show some examples using these classes. You may use the comments space of this blog to make this kind of requests.
Code samples
My first sample comes to attend Bernard Bout, to create an image to be used in his "blueglass" example. You can obtain more information at this link: http://weblogs.foxite.com/bernardbout/archive/2006/06/15/1838.aspx
Create a 2x2 pixel image, with a blue background and a magenta pixel at (0,0)
Here's the code:
** creates an image to be used in the "blueglass" example ** from Bernard Bout ** 2x2 pixel image, with blue background and a magenta pixel at (0,0) LOCAL lnRgbBackgClr, lnRgbPointClr DO LOCFILE("System.app") * define the colors to be used m.lnRgbPointClr = RGB(0,0,255) && blue m.lnRgbBackgClr = RGB(255,0,255) && magenta WITH _SCREEN.SYSTEM.Drawing LOCAL loBitmap AS xfcBitmap LOCAL loColor AS xfcColor LOCAL loGfx AS xfcGraphics * create a new 2x2 bitmap in the default pixelformat - 32bppargb m.loBitmap = .BITMAP.New(2,2) * create a graphics object to be able to use the clear function, * that will fill all the bitmap with the desired color. * for this case that is not fundamental, because the bitmap is * small, so we could calls "setpixel" 4 times to cover the bitmap. m.loGfx = .Graphics.FromImage(m.loBitmap) m.loGfx.CLEAR(.COLOR.fromrgb(m.lnRgbBackgClr)) * draw the pixel m.loBitmap.setpixel(0,0, .COLOR.fromrgb(m.lnRgbPointClr)) * save the image as png m.loBitmap.SAVE("c:\blueglass.png", .Imaging.ImageFormat.Png) ENDWITH
And here's the image created in a bigger size.
[: )
ReplyDeleteThanks Cesar. Will download the latest class and then blog about it...
Cool, I hope that it will help you.
Versión en Español de este artículo en / Spanish version at http://www.portalfox.com/article.php?sid=2237
ReplyDelete