GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
Go Back  Xtreme Visual Basic Talk > > > > GDI+ type library - plus wrapper classes


Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2003, 09:59 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip gdiplus4.zip (61.0 KB, 3330 views)

Last edited by OnErr0r; 10-22-2003 at 12:33 PM.
Reply With Quote
  #2  
Old 08-11-2003, 08:32 AM
ThinkerGDI+ type library - plus wrapper classes Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default

Very, very impressive work. I assume you used midl to compile. Did you
use any special command line options?
__________________
Posting Guidelines
Reply With Quote
  #3  
Old 08-11-2003, 10:15 AM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

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
Reply With Quote
  #4  
Old 08-19-2003, 09:13 AM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

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.
Attached Files
File Type: zip gdiplus5.zip (53.0 KB, 1690 views)
Reply With Quote
  #5  
Old 08-25-2003, 01:43 AM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

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.
Attached Files
File Type: zip gdiplus6.zip (55.9 KB, 1352 views)
Reply With Quote
  #6  
Old 10-22-2003, 12:19 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip gdiplus7.zip (56.0 KB, 2056 views)
Reply With Quote
  #7  
Old 01-25-2004, 11:03 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip gdiplus8.zip (57.0 KB, 2628 views)
Reply With Quote
  #8  
Old 01-26-2004, 08:09 AM
Mathimagics's Avatar
MathimagicsGDI+ type library - plus wrapper classes Mathimagics is offline
Algorithms 'R' Us

Forum Leader
* Guru *
 
Join Date: Jun 2002
Location: Canberra
Posts: 4,159
Default

I'm looking forward to trying this stuff, if and when I get the chance!
__________________
Cogito, ergo codo
Reply With Quote
  #9  
Old 02-01-2004, 02:32 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip gdipAniGif.zip (94.5 KB, 1299 views)
Reply With Quote
  #10  
Old 02-15-2004, 06:48 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Lightbulb 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.
Attached Files
File Type: zip offscr.zip (121.1 KB, 7774 views)
Reply With Quote
  #11  
Old 06-19-2004, 12:46 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

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.
Attached Files
File Type: zip gdipAniGif2.zip (100.1 KB, 1147 views)
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #12  
Old 10-04-2004, 10:17 AM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip multipage.zip (69.1 KB, 1489 views)
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #13  
Old 12-31-2004, 03:54 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip gdiplus_1_1_0.zip (90.8 KB, 1841 views)
__________________
Quis custodiet ipsos custodues.

Last edited by OnErr0r; 01-31-2005 at 08:38 PM. Reason: Added note to XP users
Reply With Quote
  #14  
Old 10-15-2005, 06:02 PM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default 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.
Attached Files
File Type: zip SaveAniGif.zip (73.1 KB, 942 views)
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #15  
Old 12-21-2005, 11:40 AM
OnErr0r's Avatar
OnErr0rGDI+ type library - plus wrapper classes OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default *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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a type library (tlb) for a VB Application finwis Database and Reporting 1 01-25-2003 10:58 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
 
GDI+ type library - plus wrapper classes
GDI+ type library - plus wrapper classes
 
-->