 |

08-10-2003, 08:59 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
GDI+ type library - plus wrapper classes
This sample contains a complete Type Library containing all the declares you should need to use GDI+ in VB5 or 6. I did not add the IStream related functions, because I don't see the need. If I do in the future, or there are requests, I'll add them too.
Included are:
600 - Declares encompassing the entirety of GDI+
44 - Enums
36 - Structs/UDTS/Types
And, too many Constants to count
I parsed the GDIP headers to create this tlb, so I'm sure there will need to be changes made. Please post in the API forum with "GDI+" in your topic if you have questions/suggestions/comments.
My bitmap/graphics wrapper is a work in progress, I'll probably make updates periodically.
To use this tlb with my previous samples, you'll need to change GUID to CLSID. Due to the fact that stdole has a GUID type that is not consumable by VB, I changed to CLSID.
Last edited by OnErr0r : 10-22-2003 at 11:33 AM.
|

08-11-2003, 07:32 AM
|
|
Iron-Fisted Programmer
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
|
|
Very, very impressive work. I assume you used midl to compile. Did you
use any special command line options?
|

08-11-2003, 09:15 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
Thank You.
I usually use mktyplib for VB type libraries, but it didn't like the way some constants were combined. So yes, midl was used to compile the odl script to a tlb. Compiling consisted of a very basic: midl drive:\path\gdi+.odl
|

08-19-2003, 08:13 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
I added a couple more apis to the type library, CreateStreamOnHGlobal and GdipLoadImageFromStream. Those two allow for loading of any supported GDI+ image types from a custom resource file (created with the resource addin). Included find the updated tlb (overwrite your old one) and a project that loads a PNG with alpha directly from a resouce.
|

08-25-2003, 12:43 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
Here is a bit more to do with Streams. I've now added the IStream interface definition. And code to extract a stream from an encoded image. This could be useful for various applications, such as sending an encoded image via winsock, or generating images on the fly.
As before, overwrite your previous tlb with this one. And cBitmap/cGraphics classes supersede previous versions.
|

10-22-2003, 11:19 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
type library/class wrapper update
BugFix: PixelFormat8bppIndexed had the wrong value, thanks to Ark for pointing that out.
This shows how to resize an image using GDI+. Note: The image is saved to BMP format. You could easily save to some compressed format using other examples I've posted.
|

01-25-2004, 10:03 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
Multi-page TIFF Viewer
This example uses GDI+ to display all the pages in a multi-page TIFF file. Animated GIF could also be viewed with a change of one line in the provided code. I'll be doing an example of Ani GIF specifically soon.
|

01-26-2004, 07:09 AM
|
 |
Algorithms 'R' Us
Forum Leader * Guru *
|
|
Join Date: Jun 2002
Location: Canberra
|
|
I'm looking forward to trying this stuff, if and when I get the chance! 
__________________
Sept, 2006: 2 ^ 232,582,657 - 1 is prime!
At first, I was iridescent. Then, I became transparent. Finally, I was absent.
|

02-01-2004, 01:32 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
GDI+ Animated GIF Control
This example uses GDI+ to open an Animated GIF file and display it's frames in a custom control. Full source is included.
Note: The gdi+.tlb was updated to include ~250 new constants in the PropertyTags and PropertyTagTypes enums. The cBitmap.cls was also updated to deal with Multi-page TIFF and AniGif.
|

02-15-2004, 05:48 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
Memory Graphics
Being rather short-sighted in my first wrapper design, I put GDI+ initialization code in the cBitmap class. This has the unwanted effect of only allowing one bitmap per project (since gdip was shutdown in the terminate event). So I've moved init code to a class of it's own. And also generic error handling.
Another new class has also been added to handle GDI+ Fonts and Font Families. The class is necessary to wrap Font information and to call the DrawString method of cGraphics.
The included sample project demonstrates drawing on a memory graphics buffer before drawing to the screen. As with any back buffering, this prevents flicker.
|

06-19-2004, 11:46 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
This update to the Animated GIF control adds MouseIn and MouseOut events. The control is also updated to use my newest GDI+ wrapper and tlb. This version supports control arrays due to better GDI+ initialization/deinitialization.
__________________
Quis custodiet ipsos custodues.
|

10-04-2004, 09:17 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
Create Multipage TIFF
This example uses GDI+ to create multipage TIFF files. The sample code could easily be altered to save Animated GIF as well (I might add that in the future).
In doing a fair amount of debugging I noticed that I was enumerating the gdip encoders in the cBitmap class. That code has been moved to the cGDIP class, as it only needs to be done once. Associated functions were moved as well.
__________________
Quis custodiet ipsos custodues.
|

12-31-2004, 02:54 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
GDI+ 1.1 Effect Example
This example contains a new type library (tlb) with ~20 new functions included with gdiplus.dll version 6.x. If you have Office 03, Visio 03 or PowerPoint Viewer 03, then you should have version 6 installed already. You will need to move the dll to the app.path of this project, or \windows\system32 or equivalent.
The new tlb has a new GUID and version, so it will not interfere with any previous versions. It cannot be used with the 5.0 version of the dll, as various functions do not exist.
If you do not have any of those installed, you can get the free PowerPoint Viewer 03 here: http://office.microsoft.com/search/r...DC010505971033
Once installed, you will then find the gdiplus.dll 6.0.32.64 (or newer) installed at: c:\program files\microsoft office\powerpoint viewer. Copy the file and place as mentioned previously.
This example demonstrates briefly the usage of 11 subclasses of the effect class. They are:
Blur
Sharpen
Tint
BrightnessContrast
RedEyeCorrection
ColorMatrixEffect
ColorLUT
HueSaturationLightness
ColorBalance
Levels
ColorCurve
Since MS has not released the new dll version for redistribution, I would not suggest releasing any code using it. However, now is a good time to get familiar with the new functions. Enjoy!
P.S. If you are an XP user, place the gdiplus.dll in the app.path of the exe. Then create an empty file called: Exename.exe.local
That will allow XP Side-by-side component sharing to find the dll.
__________________
Quis custodiet ipsos custodues.
Last edited by OnErr0r : 01-31-2005 at 07:38 PM.
Reason: Added note to XP users
|

10-15-2005, 05:02 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
GDI+ 1.1 Save Animated GIF
GDI+ 1.1 has the ability to save any image it can open to an animated GIF. This example demonstrates saving the loop count, frame delays and other image information of various selected images to a single Animated GIF file.
Please read the information in the previous post in this thread about using this dll.
__________________
Quis custodiet ipsos custodues.
|

12-21-2005, 10:40 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
|
|
*News Bulletin*
Note: This information is for GDI+ 1.1 on WinXP only
I've found a simple way to use the gdiplus.dll (version 6) with WinXP in the VB IDE. As is the case for a compiled exe, the IDE also requires a local copy of the dll and a file for SxS to function properly. Follow these two easy steps:
1) Copy the gdiplus.dll to your VB directory.
2) Create an empty file named after the VB EXE. For instance: vb5.exe.local or vb6.exe.local
You will now be able to open a GDI+ 1.1 project in the IDE and debug it.
Enjoy!
__________________
Quis custodiet ipsos custodues.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
| |
|