Monthly Archives: February 2006

The information contained in this article is deprecated. Please refer to the articles published in UTMAG, on the same subject, using the GdiPlusX classes, that are more suitable to applying effects to images for VFP developers:

Special effects on images with new GDIPlus-X classes - Part 1
Special effects on images with new GDIPlus-X classes - Part 2

 

This is the continuation of my previous post. to completely understand the contents of this one, i strongly recommend you to read first that article.

http://weblogs.foxite.com/vfpimaging/archive/2006/02/13/1139.aspx

The ImageAttributes class has many other methods, that can produce some really cool effects.… Continue reading

The information contained in this article is deprecated. Please refer to the articles published in UTMAG, on the same subject, using the GdiPlusX classes, that are more suitable to applying effects to images for VFP developers:

Special effects on images with new GDIPlus-X classes - Part 1
Special effects on images with new GDIPlus-X classes - Part 2

 

Sometimes we may need to make some adjustments in the colors of an image, like to make gamma adjustments, change saturation, contrast, brightness, hue, convert to grayscale, to increase or decrease a specific color, etc.

The most simple way to do… Continue reading

Execute the code below to change shear and scale of an image.

Special thanks to anatolyi mogylevets, from www.news2news.com
A great part of this code comes from him, once _GdiPlus.vcx is incomplete, what obliges us to call directly through API http://www.news2news.com/vfp/?example=479

 

To better understand how scale and shear work with GDI+, take a look at these links as well:
http://www.vbaccelerator.com/home/vb/code/vbmedia/using_gdi_plus/scale__rotate__skew_and_transform_images/article.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/gdiplus/gdiplusreference/classes/matrixclass/matrixmethods/shear.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/gdiplus/gdiplusreference/classes/matrixclass/matrixmethods/shear.asp

 

1000.107.1231.Noronha2 1000.107.1232.Sheared_NORONHA2
Original Image After applying the Scale and Shear effect

 

* Scale and Shear with GDI+
* --------------------------
* special thanks to anatolyi mogylevets, from
www.news2news.com
* a great part of this code comes from him,… Continue reading

The following piece of code loads an image and saves it on the same original folder in the formats supported by GDI+, using the _gdiPlus.vcx class, that you can find in the VFP9 FFC folder:

local lcSource, lcDestination
lcSource = getpict()
lcDestination = justpath(lcSource) + "\_" + juststem(lcSource)

local loImage as gpimage of home() + ffc/_gdiplus.vcx
loImage = newobject("gpimage", home() + "ffc/_gdiplus.vcx")
loImage.CreateFromFile(lcsource)
loImage.SaveToFile(lcDestination + ".jpg","image/jpeg")
loImage.SaveToFile(lcDestination + ".bmp","image/bmp")
loImage.SaveToFile(lcDestination + ".tif","image/tiff")
loImage.SaveToFile(lcDestination + ".gif","image/gif")
loImage.SaveToFile(lcDestination + ".png","image/png")

*!* jpegs allow to choose the quality of the image
loImage.SaveToFile(lcDestination + ".jpg","image/jpeg", "quality=70")

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… Continue reading
resize image with gdiplus
The function GetThumbnailImage can be used to get a resized image, but the result may come with less quality.
 
The sample below does the same thing, but creates an image with a better quality.
 
#define gdiplus_pixelformat_1bppindexed      0x00030101
#define gdiplus_pixelformat_4bppindexed      0x00030402
#define gdiplus_pixelformat_8bppindexed      0x00030803
#define gdiplus_pixelformat_16bppgrayscale   0x00101004
#define gdiplus_pixelformat_16bpprgb555      0x00021005
#define gdiplus_pixelformat_16bpprgb565      0x00021006
#define… Continue reading