?
Solved

Alpha Blending

Posted on 2003-02-25
7
Medium Priority
?
498 Views
Last Modified: 2010-04-04
People Say The Alpha Blending Is Only Supported On 2K & XP Machines Only, I Know That Nothing Is Impossible.
So Being A Junior Programmer, I Can't Write A Function Which Would Give My Form An Alpha Blending Effect On 9X & Me Computers.
Could Any One Help Me In This One,Please.
0
Comment
Question by:Ahmad_R
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Accepted Solution

by:
Lummie earned 272 total points
ID: 8023885
It depends on what you want to Alphablend....

If it is 2 images then check this out
http://www.efg2.com/Lab/ImageProcessing/Tween.htm
or
http://delphi.icm.edu.pl/ftp/d30free/graph64.zip
There are various examples and libraries

Alternatively if its icons you want to put on a form, try using PNG and an Image component : http://pngdelphi.sourceforge.net/
This one works great but is a bit slow if you want to do things like large animations.

Hope this helps
0
 
LVL 1

Assisted Solution

by:Korsar_13
Korsar_13 earned 264 total points
ID: 8026638
For Delphi, check Graphics32:
http://www.g32.org/graphics32/

Some of Graphics32 features include:
Fast per-pixel access up to 100 times faster compared to standard TCanvas/TBitmap;
Bitmap alpha blending (including per-pixel alpha blending);
Pixel, line and polygon antialiasing (combined with alpha blending);
Locking the bitmap for safe multithreading;
Enhanced scaling of bitmaps;
Affine transformations of bitmaps: rotations, scaling, etc. with sub-pixel accuracy;
Arbitrary projective transformations of bitmaps;
Flicker-free image displaying components with optimized double buffering;
Multiple customizable easy-to-use overlay layers;
A property editor for RGB and alpha channel loading;
Design-time loading of image formats supported by standard TPicture;
0
 
LVL 34

Assisted Solution

by:Slick812
Slick812 earned 264 total points
ID: 8028777
hello Ahmad_R, ther are many components that will do this sort of thein, you can look at Torry's for some, but if you want to try the code, here is some that might do what you want



procedure TForm1.sbut_TestMergClick(Sender: TObject);
Type
  TpRGB = packed record
    b, g, r : Byte;
    end;
var
Bmp1RGB: ^TpRGB;
Bmp2RGB: ^TpRGB;
y, x, pic: Integer;
BlendFactor  : real;
FirstBmp, BlendBmp: TBitmap;
Amount,Amt: Real;
GboxDC: HDC;
begin
Amount := 0.50;
{Amount is the Blend ratio, se here to Half and half
from each image}
FirstBmp := TBitmap.Create;
BlendBmp := TBitmap.Create;
try
FirstBmp.LoadFromFile('C:\Stuff\First.bmp');
FirstBmp.PixelFormat  := pf24Bit;


BlendBmp.PixelFormat := pf24bit;
//BlendBmp.Canvas.Brush.Color := clRed;
BlendBmp.LoadFromFile('C:\Stuff\Blend.bmp');
BlendBmp.Width := FirstBmp.Width;
BlendBmp.Height := FirstBmp.Height;
{IMPORTANT BlendBmp and FirstBmp MUST have the same dimentions}

Amt := Amount;

BlendFactor := 1.0 - Amt;
  For y := 0 to FirstBmp.Height -1 do
    begin // y to height
    Bmp1RGB := FirstBmp.ScanLine[y];
    Bmp2RGB := BlendBmp.ScanLine[y];
    For x := 0 to FirstBmp.Width -1 do
      Begin
      Bmp2RGB.r := ROUND(BlendFactor * Bmp2RGB.r + Amt * Bmp1RGB.r);
      Bmp2RGB.g := ROUND(BlendFactor * Bmp2RGB.g  + Amt * Bmp1RGB.g);
      Bmp2RGB.b := ROUND(BlendFactor * Bmp2RGB.b  + Amt * Bmp1RGB.b);
      Inc(Bmp1RGB);
      Inc(Bmp2RGB);
      End;
    end; //y to height
Canvas.Draw(3,70, BlendBmp);
finally
FirstBmp.Free;
BlendBmp.Free;
end;
end;


- - - - - - - - - - - - - - - - - - - - - - -
scanline is useful, but not easy to learn
ask questions if you need more Info
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 34

Expert Comment

by:Slick812
ID: 8028789
should be


BlendBmp.LoadFromFile('C:\Stuff\Blend.bmp');
BlendBmp.PixelFormat := pf24bit;
0
 

Expert Comment

by:CleanupPing
ID: 9317063
Ahmad_R:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 10

Expert Comment

by:kacor
ID: 9969984
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       split points between Lummie, Korsar_13 and Slick812
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question