Important alert: (current site time 7/16/2013 2:31:15 AM EDT)
 

winzip icon

LaVolpe 32bpp DIB Suite [16Feb09]

Email
Submitted on: 2/19/2009 8:29:58 PM
By: LaVolpe 
Level: Advanced
User Rating: By 69 Users
Compatibility: VB 6.0
Views: 51502
author picture
(About the author)
 
     Updatd to fix 2 logic errors. Enclosed is a suite of classes that allow you to work strictly with 32bpp DIBs, including recognizing transparency/alpha channels in gifs, icons, pngs, tga & bitmaps. There are a bunch of "nice to have" routines and maybe an eye-opener or two for some of you. The classes are heavily commented. 18Feb08. Added text support & tiling. 9Mar08: Added TGA read/write, save as JPG, added Paul Caton's revised CDECL thunks for safer zlib usage, updated sample form. Review Change History in the RTF file for important notes & overview of class functions/properties. Most recent changes: Manually parsing grayscale PNGs can fail to correctly parse transparency, and the icon parser could fail to recognize some transparency in the icon mask.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 72 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
12/26/2006 10:23:03 AMmichael doering

Hi,
another very very cool app from you.
(If this comment was disrespectful, please report it.)

 
12/26/2006 10:31:54 AMLaVolpe

The PNG class, w/o GDI+, is kinda slow in IDE, but flies when compiled. When GDI+ is used; no noticable difference.
(If this comment was disrespectful, please report it.)

 
12/26/2006 10:34:39 AMLaVolpe

Oops. In iparseCreateShapedRegion, near top of routine, replace
If hasAlpha = True to
If hasAlpha = False Then
Will update when I get the chance.
(If this comment was disrespectful, please report it.)

 
12/26/2006 1:58:53 PMLight Templer

Keith, what a wonderfull Christmas gift! Finest graphic stuff for all VB fans! OOOOO++ from me and regards - LiTe.
(One suggestion to presentation (demo): Maybe a checkerboard background and/or a second image to show what great magic is happening here ...
(If this comment was disrespectful, please report it.)

 
12/26/2006 10:15:10 PMLaVolpe

Modified to fix error noted above & to allow String resource IDs (didn't know until today that resource IDs can be strings -- learn something new every day).
(If this comment was disrespectful, please report it.)

 
12/27/2006 7:24:04 PMZhu JinYong

I got error when loading resource file.It's supposed to be: LoadResPicture((X + 100) & "Lavolpe", sResSection)
(If this comment was disrespectful, please report it.)

 
12/27/2006 7:25:06 PMZhu JinYong

I got an error when loading resource file.It's supposed to be: LoadResPicture((X + 100) & "Lavolpe", sResSection)
(If this comment was disrespectful, please report it.)

 
12/27/2006 10:10:00 PMLaVolpe

Thanx to one reader. Lack of parenthesis in a statement in the sample form could cause an error on some machines. Patched & re-uploaded.
(If this comment was disrespectful, please report it.)

 
12/28/2006 4:29:37 AMRobert Rayment

Keith: the correction by Zhu is necessary to match the resource identifiers.
(If this comment was disrespectful, please report it.)

 
12/28/2006 10:21:21 AMHerman CK

Keith: Excellent one, a worthy posting. Just a few points (i) I happen to know ICO and PNG quite a bit, hence can appreciate much of your hard work (both formats are tough enough, even only for load). (ii) Addng "LaVolpe" as suggested by an earlier reader is necessary, otherwise could have "326" runtime error.
(iii) If you are interested, I can give you another file format of 32-BPP to include. (iv) Question, - how to
obtain a DIB or a byte array without "premultiply" alpha (while using GDI+ to load VistaPNG.ico) (v) It appears to me
that some code lines loading ICO-PNG could/should be reduced. I could give you examples if you
are interested. (vi) VistaPNG.ico seems to have 3 PNGs inside (index 0, 4 and 8), it would be nice if user
can control which one to display. (vii) Code can display PNGs very well, though not quite still with 1-BPP ones

Herman


(If this comment was disrespectful, please report it.)

 
12/28/2006 2:42:00 PMLaVolpe

Duh! My bad, here I am looking at the wrong routine. Fixed & updated to properly handle cursors loaded from a resource file. Added color cursor as an example too. Fixed 1 or 2 other minor bugs.
(If this comment was disrespectful, please report it.)

 
12/28/2006 4:33:42 PMLaVolpe

Herman; replied off line
(If this comment was disrespectful, please report it.)

 
12/29/2006 9:17:19 AMPhantom Man

Pure Genius.

Happy New Year.

Kind Regards
Gary
(If this comment was disrespectful, please report it.)

 
12/31/2006 4:32:37 AMSooekd

Hi LaVolpe
How can load and save picture from buffer (don't save and load from file or RES) Please help me. Thanks
(If this comment was disrespectful, please report it.)

 
12/31/2006 10:15:21 AMLaVolpe

It is included in the main class: LoadPicture_Stream & SaveToStream
(If this comment was disrespectful, please report it.)

 
1/1/2007 10:53:53 AMRussell Sanders

Great work. Thanks for sharing. 5 from me.
(If this comment was disrespectful, please report it.)

 
1/2/2007 6:55:13 AMTerriTop

Keith, as always you stuff blows me away ;-) Thanks for sharing this gem!! TerriTop
(If this comment was disrespectful, please report it.)

 
1/4/2007 7:35:07 PMLaVolpe

Found a nasty bug that only appears when compiled. If you have downloaded prior to date of this comment, please download again. See Change History in c32bppDIB class.
(If this comment was disrespectful, please report it.)

 
1/5/2007 6:17:53 AMSooekd

Hi LaVolpe
How can use FYI: 32bpp DIB Suite capture screen and load picture use LoadPicture_Stream & SaveToStream
don't save to file? Please help me. Thanks
(If this comment was disrespectful, please report it.)

 
1/5/2007 9:25:31 AMLaVolpe

Sooekd, don't. This is overkill for simple screen captures and is designed for images needing AlphaBlend; screen captures don't. I would convert screen captures to JPG (CodeId=50351) and send that thru a stream. The size savings can be in megabytes.
(If this comment was disrespectful, please report it.)

 
1/6/2007 12:47:04 PMFlavio Gonzalez Vazquez

Wow! That is incredible. I see a lot of work in the file decoder classes! Thank you very much for your contributions!

Anyway, I compiled the sample project and it worked OK in WinXP, but shadows and alpha effects became black in Win98. Is not Win98 supported any longer?
(If this comment was disrespectful, please report it.)

 
1/6/2007 4:33:05 PMLaVolpe

Flavio, thanx for the bug report. Please replace both occurrences of m_os9x=3 with m_os9X=1. Will upload this change along with some enhancements this weekend.
(If this comment was disrespectful, please report it.)

 
1/7/2007 6:20:40 PMLaVolpe

Fixed. Made minor enhancements. BTW: failure to read O/S correctly was a simple math error on my part. Sorry. See Class History in c32bppDIB for enhancements.
(If this comment was disrespectful, please report it.)

 
1/8/2007 8:11:41 AMSteven Atkiss

WOW... Yeah I think thats a sufficient comment. I can't comment on the code because I don't understand it. Isn't this the sort of stuff Adobe write? Absolutely incredible.
(If this comment was disrespectful, please report it.)

 
1/9/2007 7:56:38 AMMr.Intermediate

are you human? coz ur a super genuis..
(If this comment was disrespectful, please report it.)

 
1/16/2007 5:36:37 AMIan Welch

Excellent. 5 globes.
Now I just want to add in mAlphaBlt from http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=64110&lngWId=1
to take care of older OS. I've tried but BMP and JPG (non alpha) do not render. Any ideas?
(If this comment was disrespectful, please report it.)

 
1/16/2007 10:07:04 PMLaVolpe

To all. Ian noticed something that isn't "wrong" but will be added/tweaked. The cBMPparser & cGIFparser do not modify the alpha bytes for non-transparent images. Therefore, when using AlphaBlend with AC_SRC_ALPHA flag, images will not paint correctly. Not an issue for the classes, but an issue if calling AlphaBlend yourself.
And to continue... I found 3 other minor bugs in other routines; will include those fixes with the update too.
(If this comment was disrespectful, please report it.)

 
1/17/2007 12:37:57 PMLaVolpe

^^ Updated as of this date/time. See Change history in c32bppDIB class.
(If this comment was disrespectful, please report it.)

 
1/19/2007 7:37:26 AMJoaquin Marcher

other LaVolpe exelent work!! =)
(If this comment was disrespectful, please report it.)

 
1/21/2007 1:09:19 PMLaVolpe

Small update forthcoming. Found an issue with NT4 where the manual decompression of PNGs can cause a GPF.
(If this comment was disrespectful, please report it.)

 
1/26/2007 12:15:19 PMLaVolpe

^^ If you haven't re-downloaded after the above date. Check the last line in the c32bppDIB class Initialize event. Remove m_os9x=1 if it is there -- was testing win95 capabilities & forgot to remove that. The most recent upload has it removed and also recgonizes DCs with AutoRedraw=False when rendering on Win9x systems.
(If this comment was disrespectful, please report it.)

 
1/26/2007 8:33:43 PMBrian Ail

*plays* Neat stuff! Let me read the code and learn!
(If this comment was disrespectful, please report it.)

 
1/27/2007 8:15:11 AMmarblemad

can you add a rotation parameter in a render function please !!!
(If this comment was disrespectful, please report it.)

 
1/28/2007 11:15:06 PMLaVolpe

marblemad, good idea -- looking into it. Playing w/algorithms to make non-GDI+ routines faster. But can use GDI+ to rotate if it is installed.
(If this comment was disrespectful, please report it.)

 
1/29/2007 6:25:22 AMmarblemad

I looking in some other vb sourcecode and I see the function :
Private Declare Function GdipRotateWorldTransform Lib "gdiplus.dll" (ByVal graphics As Long, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus.
if that can be useful for you !
Thanks a lot !!
(If this comment was disrespectful, please report it.)

 
1/29/2007 9:37:13 AMLaVolpe

marblemad, I'll use that for GDI+, but want to include manual rotation for systems that don't have GDI+ installed. I have non-GDI+ routines working using Nearest-Neighbor algorithm, but want to include a bicubic algorithm too.
(If this comment was disrespectful, please report it.)

 
1/31/2007 7:13:34 AMSooekd

Hi, LaVolpe
I hope you will support capture and restore screen use stream. I can imalloc at link http://www.vbaccelerator.com/codelib/imalloc/imalloc.htm. I very you development. Thanks
(If this comment was disrespectful, please report it.)

 
1/31/2007 8:46:21 AMLaVolpe

Sooekd as I mentioned earlier, you don't want to use these classes if you are capture screen and sending across network. Better to capture, make GIF/JPG, and send that. However, this can be easily used. Capture the screen (well documented on PSC), add it to a DIB class, and use the SaveToStream method to convert DIB to bytes. But that is a lot of overhead, vs creating your own 8-24bpp DIB, copying screen to it & simply passing its bytes. Many options exists, use whichever suits your needs.
(If this comment was disrespectful, please report it.)

 
1/31/2007 9:02:15 AMLaVolpe

To all, in cGDIPlus class, routine: RenderGDIplus, remove following line. I need to test that routine a little more on different O/S & believe the line is buggy for rotating negative degree angles. Will update after more testing:
If Angle < 0 Then Angle = Abs(Angle)
(If this comment was disrespectful, please report it.)

 
1/31/2007 12:15:08 PMLaVolpe

Need to give this a good once over again, found another line of test code left in. If your c32bppDIB.RotateAtTopLeft routine has the following line rem'd out. Un-rem it:
.rHost.Alpha = True
(If this comment was disrespectful, please report it.)

 
2/1/2007 4:54:48 AMmarblemad

Excelent job laVolpe, thanks a lot !!
Are you planned to add mirror function when you put negative width or/and height ?
(If this comment was disrespectful, please report it.)

 
2/1/2007 6:41:02 AMSooekd

Hi LaVolpe
You can demo small application. I try a appication but don't run. Thanks
(If this comment was disrespectful, please report it.)

 
2/1/2007 8:52:32 AMLaVolpe

marblemad, no mirror function. The AlphaBlend API does not support mirroring and neither will the classes. You will need to add your own.
(If this comment was disrespectful, please report it.)

 
2/1/2007 5:30:32 PMLaVolpe

Second thoughts... just cause AlhpaBlend can't do it doesn't mean we can't. Done. Feedback welcomed.
(If this comment was disrespectful, please report it.)

 
2/2/2007 3:50:03 AMSoorya

Hi Keith,
I think, your are the only coder who gets lot of votes in one day. Great !
btw, Pls. add TGA format and try to make
LaPictureBox control from this class, so that we can replace vb's picbox.
Thanks for the submission

soorya
(If this comment was disrespectful, please report it.)

 
2/2/2007 5:38:04 AMSooekd

Hi, LaVolpe
I have a question. You can help me use GDI Drawtext like API Drawtext with format
Private Function (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
I don't like drawtext by system. I wanna use Drawtext by GDI.
Thanks
(If this comment was disrespectful, please report it.)

 
2/4/2007 3:21:59 AMmarblemad

LaVolpe : you are my hero !! thanks a lot for this wonderfull code. The posibility to make fun games, cool apps, ... for me is infinite ! The speed of gdi+ is very impressive, The quality of code simplify coding in vb enormously. like one says in France : "chapeau bas, MONSIEUR !"
(If this comment was disrespectful, please report it.)

 
2/4/2007 12:07:23 PMShaun

I'm very impressed with this, especially your cPNGparser.cls
I've started to work my way through your other 61 submissions, with some excitement.
(If this comment was disrespectful, please report it.)

 
2/5/2007 8:00:28 AMmarblemad

HI LaVolpe : I want to merge 2 c32bppDIB object and save it to 1 png file with alpha channel. I'm view the SaveToFile function but I dont have any idea to merge 2 c32bppDIB objects. Can you help me, please. thanks
(If this comment was disrespectful, please report it.)

 
2/5/2007 10:58:04 AMmarblemad

me again :( !! i want to copy a c32bppDIB picture to an another c32bppDIB picture. I'm testing with CopyImageTo function but i have an error message, can you put a sample code about this please.
(If this comment was disrespectful, please report it.)

 
2/5/2007 1:26:18 PMLaVolpe

^^ Replied to MableMad offline. Basically to merge 2 or more images, render one DIB to another DIB. Get the target DIB's DC by calling LoadDIBinDC(True).
(If this comment was disrespectful, please report it.)

 
2/6/2007 2:35:33 AMApeiron

Just keeps getting better and better. I have a lot of ideas for these classes! Thanks for all your hard work in creating this and sharing it.
(If this comment was disrespectful, please report it.)

 
2/6/2007 5:21:34 PMRobert D Moore

Cool Program
Rookie question:
How do i change background pic to 1 of my own?
(If this comment was disrespectful, please report it.)

 
2/10/2007 4:52:15 AMmarblemad

Me Again !! Can you add a fonction to remove empty sides of images when you loading a png file with a little object in the center of picture and big transparency zone around.

This function should return position X, y, W, H of the resulting zone

Thanks
(If this comment was disrespectful, please report it.)

 
2/10/2007 5:22:15 PMLaVolpe

MarbleMad, good idea -- done. Options to trim image on any or all sides too. See TrimImage.
(If this comment was disrespectful, please report it.)

 
2/11/2007 6:21:32 AMLight Templer

SO COOL to see this project growing! For me its one of the most important additions to VB6. If you want to build state-of-the-art GUIs (Vista ...) you will need this. Many thanks!
(If this comment was disrespectful, please report it.)

 
2/12/2007 5:40:30 AMHardStream Software Development

Uhmz, where did the images and resource file go?? They're missing in your latest update :P
(If this comment was disrespectful, please report it.)

 
2/12/2007 9:01:35 AMLaVolpe

HardStream, thanx. Emailed zip to someone else w/o res file & forgot to add it back in before uploading. It's back now.
(If this comment was disrespectful, please report it.)

 
2/12/2007 4:21:52 PMHardStream Software Development

ok tnx :D
(If this comment was disrespectful, please report it.)

 
2/14/2007 5:40:31 PMbruno_RAM

very cool program!!!
very interesting

thanks!
(If this comment was disrespectful, please report it.)

 
2/20/2007 3:49:00 AMPaul Turcksin

An eye-opener or two? You must be joking! I can't close them anymore! @@@@@
(If this comment was disrespectful, please report it.)

 
2/21/2007 6:03:58 AMUpt3r_U

hi LaVolpe, do you have a delphi version of your button? i used to use your button when i program in vb, but now im using delphi 7 bcoz that is the language use here in my job... im a great fun of your button.
(If this comment was disrespectful, please report it.)

 
2/21/2007 9:55:06 AMLaVolpe

Barring any bugs, I believe this project is done. Now is the time to have fun with it and put it to real use.
(If this comment was disrespectful, please report it.)

 
2/28/2007 2:46:01 PMHerman CK

An excellent posting as commented earlier on; and pleased to read the updated version. On PNG, particularly impressive about the capability of calling zLIB1. A few imperfections, as a feedback: (1) (On non-XP only) for some 32-BPP PNGs the image shown might have taints, whether GDIplus is used or not. (2) (On both XP and non-XP) load a paletted PNG and save it, lots of color change on retrieval of the saved file. (3) File size of saved PNG is too big when GDIplus is not used, e.g. load the program-supplied Alpha-ARGB.bmp and save it to PNG, filtered or not filtered, the size of saved file is about the same as original bmp (80+ K), whereas the correct size using zLIB should be not more than 20K, filtered or not.
-- If wanted, samples, screenshots and/or details are avaiable.

(If this comment was disrespectful, please report it.)

 
2/28/2007 4:03:22 PMLaVolpe

Herman, regarding size differences, I will look into that. Now regarding paletted or any other image really. Remember we are using pre-multiplied RGB (pARGB) images. pARGB permanently destroys color information and reversal is close but not perfect. In order to create PNG from pARGB, the premultiplication must be removed.
As a side note. I can save any 32bpp as PNG without loss of color by not reversing pARGB but no other PNG reader will process it correctly because PNG is not required to check for pARGB formating; already tried. However, all said and done, the routines can check for original image bytes (if loaded with that option) and use those to create PNG vs pARGB. Will do that. Thanx
(If this comment was disrespectful, please report it.)

 
2/28/2007 4:49:30 PMLaVolpe

Herman, asking for clarification of your statement #3 about file sizes. For me, using default filters: 20.6k, Adaptive: 18.5k, no filters: 21.1k. Kinda curious now if something else is going on. Could you repeat the experiment? Thank you.
(If this comment was disrespectful, please report it.)

 
3/1/2007 12:58:46 AMHerman CK

Keith: Regarding color changes (point "2") I would not have brought it up if it is only of the nature of some color variations, it is of a nature that the colors of image changed dramatically to a degree beyond recognition and on a 8-BPP, changd to entirely black. Regarding big size (point "3") I tried not less than 6 times before posting the feedback and another 6 times after reading your response, on both my XP and ME, always 80+ K. (As a note, the size is always below 20+ K if saved with my own PNG program). It appears something worth looking into - why diff machines yielded such a huge diff results.

(If this comment was disrespectful, please report it.)

 
3/1/2007 2:02:46 AMRobert Rayment

Keith: Tried saving pngs using one of your supplied pngs from before ie Spider.png.

Spider.png 63.8KB
Saving:
GDI+ 69.9KB
zlib No filters 258KB.

WinXP Pro SP2 VB6 SP6

(If this comment was disrespectful, please report it.)

 
3/2/2007 10:28:24 AMLaVolpe

Herman, thank you for bearing with me. Palette and WinME tweaks will be applied and uploaded this weekend.
Robert, thank you too. With your help, identified why zLIB PNGs were larger (in some cases) than should be. That update will also be included in the update.
(If this comment was disrespectful, please report it.)

 
3/2/2007 11:49:26 AMApeiron

Wondering if you could point me in the right direction. I'm trying to render from one c32bpp to another then render that to a picture buffer, used manage own dc, used handle as dc, getdc on handle and even added another public property to return m_hdc, can't seem to get it to work.
(If this comment was disrespectful, please report it.)

 
3/2/2007 3:22:35 PMLaVolpe

Apeiron, answered offline. This question is in the FAQ rtf document. To load a DIB into a DC and return the DC handle, call dibDC=LoadDIBinDC(True) then LoadDIBinDC(False) to unselect the DIB from that DC & destroy the DC.
(If this comment was disrespectful, please report it.)

 
3/6/2007 8:14:21 AMYogi Yang

What you have done is really superb. But after playing with your code and looking inside it I think that for loading/saving of various files format images why not use ready made libraries like GraphicMagik thery are really fast and very very usable and of course OpenSource and free like Air.

Thanks

(If this comment was disrespectful, please report it.)

 
3/6/2007 8:16:14 AMYogi Yang

If it would have been possible I would have given you 1000 points!

keep it up!
(If this comment was disrespectful, please report it.)

 
3/6/2007 8:26:08 AMYogi Yang

I have one wish!

Can you implement support for layer in an Image. If this is possible it would be possible to load images which have layers embeded in them as well as add multiple images and merge them to get a colleged image.

In fact I personally feel that the true power of you hard work will become more apparent and other will appreciate your hard work even more.

Thanks

(If this comment was disrespectful, please report it.)

 
3/6/2007 8:56:38 AMLaVolpe

Yogi. 1) Re: external DLLs, no. I do not want the code to require dependencies. Except GDI+ or zLIB to create PNGs.
2) Merging images can be done simply by rendering one onto the other using more than one DIB as needed.
(If this comment was disrespectful, please report it.)

 
3/7/2007 3:47:33 AMYogi Yang

if you are using GDI+ which is a proprietory Graphics Lib then what is wrong in using other libraries?

I do not understand your second point.

(If this comment was disrespectful, please report it.)

 
3/7/2007 9:24:38 AMLaVolpe

Yogi, moved conversation offline
(If this comment was disrespectful, please report it.)

 
3/8/2007 3:52:37 AMYogi Yang

have you people seen this

http://www.xtremevbtalk.com/showthread.php?t=98285

Check it out. it is a store house on GDI+

(If this comment was disrespectful, please report it.)

 
3/24/2007 5:33:17 PMOption Explicit

Keith, just fyi, I gave this project a workout and it seems to run perfectly in Vista... I'll let you know if I run into any issues.
(If this comment was disrespectful, please report it.)

 
3/28/2007 8:19:38 PMLaVolpe

Uploaded with more enhancements. Adding this code to a complicated graphic-related project, I am finding a need for more nice-to-have functions.
(If this comment was disrespectful, please report it.)

 
3/28/2007 10:36:46 PMJohn

Excellent. As always, your work is top notch. 5 from me.
(If this comment was disrespectful, please report it.)

 
4/1/2007 7:03:26 AMdafhi

keep em coming
(If this comment was disrespectful, please report it.)

 
4/2/2007 10:02:10 AMHardStream Software Development

Very nice :D It would be nice to have an 'invert' property, which would invert the colors of each pixel. 5*
(If this comment was disrespectful, please report it.)

 
4/3/2007 10:55:20 AMHardStream Software Development

Thanks 4 adding the ability to invert the colors. Nice work :D
(If this comment was disrespectful, please report it.)

 
4/12/2007 11:23:21 AMHardStream Software Development

How about GetPixelColor and SetPixelColor functions?
(If this comment was disrespectful, please report it.)

 
4/12/2007 3:47:00 PMLaVolpe

It's there: GetPixel & SetPixel methods.
(If this comment was disrespectful, please report it.)

 
8/27/2007 6:26:35 PMRobert Kersey

out standing work, I wish I knew as much as you do. great update and all the other post you have posted over the years.
(If this comment was disrespectful, please report it.)

 
8/28/2007 1:00:07 AMenmity

excellent update!!!
(If this comment was disrespectful, please report it.)

 
8/28/2007 2:55:11 AMAvi

I wish I could vote twice...
Thanks man
(If this comment was disrespectful, please report it.)

 
8/28/2007 9:43:10 AMLaVolpe

There will be at least one more update soon. When attempting to render DIB class to DIB class passing the optional destHostDIB to Render, it fails 90% of the time. Bad logic on my part & easy fix. I am also going to merge the RotateAtCenterPoint & RotateAtTopLeft into the Render so one call will do it all. Requires only 2 more optional parameters and a jump to rotation routines as needed.
(If this comment was disrespectful, please report it.)

 
8/31/2007 12:53:27 PMLaVolpe

Ugh. Bad example in sample form's Unload event. Change to following. Will update next time around.

If m_GDItoken Then
cImage.gdiToken = 0&
If Not cShadow Is Nothing Then _
cShadow.gdiToken = 0&
cImage.DestroyGDIplusToken m_GDItoken
End If

(If this comment was disrespectful, please report it.)

 
8/31/2007 1:43:19 PMLaVolpe

Minor inconsistencies noted in the RTF file and will also be updated next time:
- ReleaseGDItoken is DestroyGDItoken within the class
- GetPastedFileNames says return array is zero-bound. It is one-bound.
- RTF files suggests using the GDItoken property produces slower overall performance. Faster overall performance is achieved.

(If this comment was disrespectful, please report it.)

 
10/25/2007 6:00:23 AMSpector

Outstanding work LaVolpe! This has to be one of the best DIB projects I have seen in VB. Detailed commenting makes the code a lot easier to follow. This is a great start for anyone who wants to start a image editing project. A lot of the base code in already there, so it makes it easy to expand on this project. Thanks for sharing!

* Suggestion *
You should add JPEG writing support using Ron van Tilburg's Integer Only JPEG Encoder Class.
(If this comment was disrespectful, please report it.)

 
11/16/2007 3:35:48 PMThraka

LaVolpe you are truly a treasure to the VB Classic community.
(If this comment was disrespectful, please report it.)

 
11/19/2007 2:13:35 PMLaVolpe

@Spector. Sorry for late response. GDI+ does JPG easily & without it Tilburg's code should work. However, JPG has nothing over PNG. JPG is color-lossless and PNG is not. I think having a slightly larger PNG is better than a color-changed JPG. Personal preferences.
(If this comment was disrespectful, please report it.)

 
11/20/2007 1:08:23 PMGiovanni Rojas Ortiz

in c32bppDib _ CreateCheckerBoard error in line
iparseOverlayHost_Byte dibBytes, VarPtr(tSA), 2, m_Height, m_Width * 4&, m_Pointer ' overlay DMA array

dont find rutine. excuse me english
(If this comment was disrespectful, please report it.)

 
11/20/2007 1:40:01 PMLaVolpe

@myself. ^^ Ugh, JPG produces color loss and/or color change. PNG does not.
(If this comment was disrespectful, please report it.)

 
11/21/2007 4:01:40 PMLaVolpe

@Giovanni. Thank you. The previous post had 3 old versions of classes. Really goofed on that one. The current post is correct.
(If this comment was disrespectful, please report it.)

 
11/22/2007 4:35:22 AMSpector

@LaVolpe: I understand that JPEG is a lossy format but it is also more widely used than PNG.
(If this comment was disrespectful, please report it.)

 
11/23/2007 12:25:08 AMRajeev

ClearAllProperties not defined
(If this comment was disrespectful, please report it.)

 
11/23/2007 1:03:47 PMLaVolpe

@Spector. The SaveToJPG routine already exists in cGDIplus, just make it public. Add Tilburg's class as desired.
@Rajeev. Sorry, my bad. Will fix & put back up. Just been a bad week for me :(
(If this comment was disrespectful, please report it.)

 
2/22/2008 9:36:32 AMFauzie

hmmm.... do you have any idea about TGA Images?
(If this comment was disrespectful, please report it.)

 
2/24/2008 9:38:49 AMAndRAY

I have. The answer for "tga" is "FreeImage"
(If this comment was disrespectful, please report it.)

 
2/24/2008 9:49:05 PMLaVolpe

@Fauzie. TGA (Targa). Googling seems to indicate GDI+ doesn't support it & if that's true, then would require a class to parse for reading/writing. The specifications for v1 & v2 are on the net but I have no desire at this time to research & create the code needed. Other libraries probably support it (i.e., FreeLib)
(If this comment was disrespectful, please report it.)

 
2/25/2008 11:09:53 PMLaVolpe

@Fauzie. Ummm. FreeImage not FreeLib (got API on the brain). Anyway, another coder has a class, here on PSC, to read/write TGA. You might want to experiment with it: txtCodeId=35713
(If this comment was disrespectful, please report it.)

 
2/26/2008 9:43:58 AMRuturaaj

This code is great and classes are certainly very nicely commented with some gr8 procedures that I didn't know how to do it. One thing I'm not able to achieve is: when I apply changes, visually the image changes, but Save does not save it with applied effects (for example light adjustment). I don't know how to get these effects in action. I checked your Demo project and found that it doesn't do it either. Am I missing something? I know it might be just a small thing here or there; but I'll be thankful to you if you share your opinion on this aspect of your classes. Thanks for sharing such a quality code. -- Ruturaaj.
(If this comment was disrespectful, please report it.)

 
2/26/2008 5:46:21 PMLaVolpe

@Ruturaaj. Answered off line. For everyone. The easy answer is to create 2nd DIB class, render 1st DIB to 2nd DIB passing 2nd DIB as the optional destHostDIB parameter; then save the 2nd DIB to file.
(If this comment was disrespectful, please report it.)

 
2/29/2008 10:14:38 AMRuturaaj

Thanks so much for your detailed reply! That helped me to understand the things a lot.
(If this comment was disrespectful, please report it.)

 
3/13/2008 8:09:45 PMSpector

Thanks a lot for the JPG and TGA updates! The addition of the updated thunks is also extremely helpful!
(If this comment was disrespectful, please report it.)

 
4/17/2008 3:25:23 AMlaviewpt

I just want to get non-premultiplied data from png files.so could you give me a hand?GetPixel in your project will give some wrong answers compared with what photoshop shows.
(If this comment was disrespectful, please report it.)

 
5/31/2008 9:40:53 PMTerrorlone

Hi,
I press the PrtSc key and paste the image to the demo program, but the result turn out to be something really bad. It seems quite like a bug to me. If I paste the screen image to some image process software first and then re-copy it and paste to the demo, then everything is fine.
(If this comment was disrespectful, please report it.)

 
6/13/2008 10:46:10 AMEvripidis

Very nice job!
(If this comment was disrespectful, please report it.)

 
11/12/2008 9:59:27 AMRandy Gomez

Just wanted my thanks for sharing this project - I just recently downloaded it to use on a project where I need to access 32-bit .png files - works like a charm!
(If this comment was disrespectful, please report it.)

 
2/3/2009 10:04:02 AMMarbleMad

HI LaVolpe, and thanks and congratulations for this marvelous code. I have a little problem to put a standard VB6 "picture" picture (Or image) into a c32bppDIB objet. It is possible to make that ?

Thanks again, MarbleMad (a big fan)
(If this comment was disrespectful, please report it.)

 
2/7/2009 9:45:06 AMMarbleMad

Hi LaVolpe. I myself responded to my question. The solution was to pass the image of the PictureBox VB : "myc32bppDIB.LoadPicture_ByHandle Picture1.Image"
(If this comment was disrespectful, please report it.)

 
2/7/2009 9:47:59 AMMarbleMad

something else. Is the GDI + lib used to edit color images: hue, saturation, brightness, contrast, saturation rgb? and if so, would it not possible to include these features in your already superb class?
(If this comment was disrespectful, please report it.)

 
12/22/2009 3:13:13 AMnour

Hello,
I don't understand how to change the coordinates of the shadow, could you explain please?
Many thanks
(If this comment was disrespectful, please report it.)

 
12/14/2010 3:24:15 PMUFO

OK !!!!!!!!!!!!!!!
Many thanks

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.