News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GDI+ scribble

Started by donkey, February 12, 2010, 09:09:51 AM

Previous topic - Next topic

donkey

I am testing the capabilities of GDI+ this week and wrote a small drawing program using it. The main thing to note with GDI+ is the separation of the vector drawing and image manipulation functions into 2 groups, Graphics and Image. This leads to a few inconsistencies with the way things were done in the GDI, mainly the complete lack of vector drawing functions for bitmaps, LineTo and Poly's are history except when dealing with Graphics objects as well as all of the familiar Pen and Brush functions. So, in order to have the best of both worlds you have write your own. For my test I adapted my bresenham line function so it works with GDI+ directly and incorporated it into a little test package called Scribble. It is named after a similar one for the GDI I saw on this board many years ago (I think Bcraven wrote it) but is now lost. To build this project you will have to locate GDIplus.DLL version 1.1 and Comctl32.dll version 6 and copy them into the project folder. The exe and source are included.

Scribble uses the GdipBitmapLockBits function to obtain a pointer to the bitmap data in a way similar to how GetObject works with the GDI. It then manipulates the memory directly either by setting a single pixel or drawing a line. There are many functions that I included that are not used in the demo but the code is there none the less.

Have fun

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

ecube

"This Application has failed to start because the application configuration is incorrect.Reinstalling the application may fix the problem".

donkey

Quote from: E^cube on February 12, 2010, 09:55:43 AM
"This Application has failed to start because the application configuration is incorrect.Reinstalling the application may fix the problem".

Mmmm, not sure what the problem could be. What OS are you running it on Win7 ?
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

ecube

XP Sp2, stock I believe. I tried copying the manifest into the same directory and it didn't help so idk either.

donkey

Quote from: E^cube on February 12, 2010, 10:01:59 AM
XP Sp2, stock I believe. I tried copying the manifest into the same directory and it didn't help so idk either.

The manifest is in the resource section of the executable. Have to try it on XP tomorrow, perhaps you don't have GDI+ 1.1 available, have you looked in the WinSxS folder to see if it was there ?
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

dedndave

same here, Edgar - xp pro sp2
i do have gdi+ 5.1.3097.0 and 5.1.3102.2180


dedndave

i noticed when i install newer versions of yahoo messenger, it runs vcredist_x86.exe
it's the first thing that it does, too

sinsi

Win7 x64 RC works well, no flickers or artifacts.
Light travels faster than sound, that's why some people seem bright until you hear them.

Bill Cravener

My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

donkey

Hi Dave and E^Cube,

GDI+ versioning is a bit weird, 5.1.3097.0 and 5.1.3102.2180 are both versions 1.0. GDI+ Version 1.1 has a DLL version 6.0 or greater. I mentioned this in the following thread:

http://www.masm32.com/board/index.php?topic=13348.0

I was going to include it with the app but its a little demo and a 2 MB DLL was a bit much to pack up with it so I put in a res based manifest and who ever has it has it...

This version will run with GDI+ version 1.0, though all of the effects and file ops that I included as extra functions have to be commented out:

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

As a side note, Yuri's idea about API versioning made making the application GDI+ 1.0 compatible very easy, it will be a really good addition to the header project and will be uploaded as part of the main project later today. When I changed the Windows version to NTDDI_WINXP from NTDDI_VISTA and set the FILTERAPI switch I got the following message:

QuoteGoLink.Exe Version 0.26.10 - Copyright Jeremy Gordon 2002/9 - JG@JGnet.co.uk

Error!
The following symbols were not defined in the object file or files:-
GdipInitializePalette_NotAvailable
GdipBitmapConvertFormat_NotAvailable
GdipBitmapApplyEffect_NotAvailable
Output file not made

Awesome addition that should make writing for different versions of Windows a much easier task. Yuri has earned a mention in the Windows.h file for that oneĀ  :bg

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Yuri

Quote from: donkey on February 12, 2010, 04:34:17 PM
Yuri has earned a mention in the Windows.h file for that one :bg

Thanks for the honour. :bg My role was very small, since both the idea and the work are actually yours. In the meanwhile I encountered the same issue, now it was my DLL which failed to get loaded under XP.

donkey

Hi Yuri,

Dependency Walker is a great utility to search for things like that, I use it a lot when I get mysterious failures like that.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

BlackVortex

I found a gdiplus.dll versioned 6.1.xxx and put it on my XP installation in the same folder, but still same error.

Works fine on win7x64 of course. I'm talking about the link in the first post.

How can I tell the windows loader to use that dll ? Do I have to register something, somehow ?