Author Topic: KOL-CE TPaintBox AlphaBlend  (Read 4746 times)


  • New Member
  • *
  • Posts: 14
KOL-CE TPaintBox AlphaBlend
« on: March 01, 2010, 12:10:20 am »
Hi to all.
First, let me say that I've tried all the tips that I've found on the net (so, I'm not a lazy guy).

I'm developing an App for PNA devices (480x272 pixel).
I'm using a PaintBox for background, and a couple more Paintboxes as buttons.
I'm copying the background image to the "button" Paintboxes, so that they do not distinguish from the background.
Now I want to add pictures to the "button" Paintboxes, so that they merge with current canvas content.
I'm not satisfied with transparency, and I can't get any kind of blending working.
I have found some AlphaBlending code for Delphi on the net, but I can't get it working.
Delphi code is expecting TBitmap as input and output, and I have pBitmap. I have no clue what is the difference, and how can I get it to the right form.
Here is the Delphi code (ripped from JanFX component, courtesy of JanSoft, freeware with source):
Code: [Select]
procedure Blend(src1, src2, dst: tbitmap; amount: extended);
var w,h,x,y:integer;
w:=src1.Width ;
dst.Width :=w;
dst.Height :=h;
src1.PixelFormat :=pf24bit;
dst.PixelFormat :=pf24bit;
for y:=0 to h-1 do begin
 ps1:=src1.ScanLine [y];
 ps2:=src2.ScanLine [y];
 pd:=dst.ScanLine [y];
 for x:=0 to w-1 do begin

I've also tried AlphaBlend function as described here:,5930.0.html
but all I can get is an application exception.

Anyone with any tip on how can I get this working?


TinyPortal © 2005-2018