Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GDI - Change colordepth for BMP file
Message
From
21/10/2005 15:39:08
 
 
To
21/10/2005 14:44:32
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01061230
Message ID:
01061261
Views:
11
Johann

I'm more used to working with GPIMAGE to deal with GDI+ instead of _gdiplus.vcx, but both classes work the same way, you have just to apply this principles.

I'm just not very sure about the syntaxes...

Hope this helps !

Regards

Cesar
#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	GDIPLUS_PIXELFORMAT_16bppARGB1555   	0x00061007
#define	GDIPLUS_PIXELFORMAT_24bppRGB        	0x00021808
#define	GDIPLUS_PIXELFORMAT_32bppRGB        	0x00022009
#define	GDIPLUS_PIXELFORMAT_32bppARGB       	0x0026200A
#define	GDIPLUS_PIXELFORMAT_32bppPARGB      	0x000E200B
#define	GDIPLUS_PIXELFORMAT_48bppRGB        	0x0010300C
#define	GDIPLUS_PIXELFORMAT_64bppPARGB      	0x001C400E


lcSource = "c:\copy\test.bmp"
lcDestination = "C:\copy\test.bmp"

LOCAL loImage AS GpImage of ffc/_gdiplus.vcx
loImage = NEWOBJECT("GpImage", "ffc/_gdiplus.vcx")
loImage.CreateFromFile(lcSource)

LOCAL loBitmap AS GpBitmap of ffc/_gdiplus.vcx
loBitmap = NEWOBJECT("GpBitmap", "ffc/_gdiplus.vcx")
LOCAL loGraphics as GpGraphics of ffc/_gdiplus.vcx
loGraphics = NEWOBJECT('GpGraphics','ffc/_gdiplus.vcx')

*** Now we create a new image with 
*** Create Method - Creates a bitmap object. 
*** Syntax: ? THIS.Create(tnWidth, tnHeight[, tnPixelFormat])
***
***tnPixelFormat, optional, one of GDIPLUS_PIXELFORMAT_* constants, 
***      defaults to GDIPLUS_PIXELFORMAT_32bppARGB.

loBitmap.Create(324,198,GDIPLUS_PIXELFORMAT_16bppARGB1555) && The size you specified
*** The other constants are in the beginning of this code

loGraphics.CreateFromImage(loBitmap)
loGraphics.DrawImageScaled(loImage, 0, 0, 324, 198)
loBitmap.SaveToFile(tcDestination, "image/bmp")
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform