Important alert: (current site time 7/16/2013 2:45:22 AM EDT)
 

winzip icon

Stretching alpha-bitmaps

Email
Submitted on: 5/8/2005 8:06:31 PM
By: Carles P.V. 
Level: Intermediate
User Rating: By 28 Users
Compatibility: VB 6.0
Views: 17508
 
     Some additions: AlphaBltStrecth and AlphaBlendStretch with and without interpolation (bilinear). Thanks to Ron van Tilburg for the fast 'integer maths' version of Peter Scale's 'Bilinear resizing' routine. And about this, a note: API AlphaBlend stretches using nearest-neighbour method (it only allows COLORONCOLOR for SetStretchBltMode function). This has a simple explanation: interpolation of alpha-bitmaps involves "pre-blending" (composition) alpha-pixels before rendering onto given DC. This complicates processing. This is supposed what GDI+ solves. Attached, there is a GDI+ test project for comparison purposes (compare flower contour-pixels of both tests; increase iterations for better appreciation and use AlphaBlendStretch function). __________________________________________________ Update #1. Some effects; packed in mDIB32Ext module: 'ConvertToGrey', 'BlendWithColor' and 'ChangeGlobalAlpha'. You can add your own ones. Remember pixel data is stored as ARGB (BGRA byte array).

 
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 53 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 Intermediate 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
5/9/2005 4:09:07 AMPhantom Man

Only One Thing To Say - Simply Brilliant. Thanks Carles.

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

 
5/9/2005 5:59:16 AMGDuncan

If it says Carles P.V. next to the submission dowload it, its gauranteed to be good stuff.

One thing you missed though Charles is the GdiplusShutdown call in your gdiplus app.
(If this comment was disrespectful, please report it.)

 
5/9/2005 7:50:48 AMTerriTop

Very Nice! This is a very solid submission and one worth the download! 5 Balls from me...Thanks for sharing...

TerriTop


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

 
5/9/2005 3:50:25 PMCarles P.V.

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

 
5/9/2005 5:47:42 PMjames kahl

Nice as always, 5 from me
(If this comment was disrespectful, please report it.)

 
5/9/2005 7:15:36 PMAvi

Brilliant as always, thanks for sharing 5G
(If this comment was disrespectful, please report it.)

 
5/10/2005 12:41:06 AMenmity

ok, looking at the screenshot, I knew it was you, Carles, always the exceptionally excellent style & quality:)
(If this comment was disrespectful, please report it.)

 
5/10/2005 9:55:07 AM

You 'R the best! 5 Globes from me... You are keeping us surprized with every new submission, nothing seems impossible for the best graphic GuRu's of PSCode.
You know what would be nice/great? To add something like Graying Picture (For Disabled Picture), Blend Picture (Seethru Like Draging an XP-icon on the Desktop) to the code. Keep up the good work!
(If this comment was disrespectful, please report it.)

 
5/11/2005 9:12:46 AMMatthew R. Usner

Phenomenal as always Carles.
(If this comment was disrespectful, please report it.)

 
5/12/2005 7:04:26 AM

Carles thank you for the updates and your quick responds. I hoped I could give you another Excellent rate! Keep up the good work.
(If this comment was disrespectful, please report it.)

 
5/12/2005 10:34:38 AMHeilan Percio Cardoso

Carles Strikes Again !
PS : Carles, all your dreams are alpha-blended with effects ? hehehehe
5 Globes.
(If this comment was disrespectful, please report it.)

 
5/15/2005 3:05:55 PMAris Buenaventura

great job! :)
(If this comment was disrespectful, please report it.)

 
5/16/2005 10:34:16 AMRichard Mewett

Fantastic rendering quality + highly readable project = 5*
(If this comment was disrespectful, please report it.)

 
5/25/2005 4:55:28 AM

Exceptional Work, 5 Globes From Me.
(If this comment was disrespectful, please report it.)

 
5/30/2005 7:09:16 AMRichard Mewett

Over 1000 hits and just 23 votes - crazy! The feedback ratio seems to get ever lower on PSC...
(If this comment was disrespectful, please report it.)

 
6/29/2005 1:22:13 PMneurokaotix

I can't seem to find a program that will export bitmaps that work with your code. What did you use?
(If this comment was disrespectful, please report it.)

 
7/1/2005 1:09:03 PMRiccardo Cohen

The app within the code itself!
(If this comment was disrespectful, please report it.)

 
7/7/2005 6:46:09 AM

I too have some problems creating bitmaps that will work with the code. The code wont accept bitmaps generated with MS Paint and Photoshop cant create or open the image that comes with the code. It seems that the image provided with the code is saved in 32bit color depth. Anyone knows how to generate such an image? Any help would be greatly appreciated.
(If this comment was disrespectful, please report it.)

 
12/27/2005 10:25:14 PMLaVolpe

Carles, mind if I play with this & possibly add it to the PNG project I'm trying to post next month? Keith
(If this comment was disrespectful, please report it.)

 
1/18/2006 9:50:31 AMLaVolpe

Carles, most excellent. After several tests, I find your routines flawless. I do have one suggestion to add global alphablending without changing the DIB alpha as done in your "effects" samples; done on the fly: 1) Allow global 0-255 passed as parameter ByVal aGlobal As Long. 2) To keep integer math, multiply the global by 100, 3) When assigning a1, make it a1=(aSBitsR(i)*aGlobal)\25500&
(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.