<div>procedure AlphaBlendPanel(P: TCustomPanel;var Bmp: TBitmap;AColor:TColor;ABlend:integer;AddFrame:boolean);</div><div><br></div><div>var</div><div> b:TBitmap;</div><div><br></div><div><br></div><div>var</div><div> bf:TBlendFunction;</div>
<div> c:TCanvas;</div><div>begin</div><div><br></div><div>// AColor := clInfoBk;</div><div> fillchar(bf,sizeof(bf),0);</div><div> b := TBitmap.Create;</div><div> b.Height := p.Height;</div><div> b.Width := P.Width;</div>
<div> b.Canvas.Brush.Style := bsSolid;</div><div> b.Canvas.Brush.Color := AColor;</div><div> b.Canvas.FillRect(rect(0,0,b.Width,b.height));</div><div><br></div><div> bf.BlendOp := AC_SRC_OVER;</div><div> bf.SourceConstantAlpha := ABlend;</div>
<div><br></div><div> BMP.Height := p.Height;</div><div> BMP.Width := p.Width;</div><div> p.PaintTo(bmp.Canvas,0,0);</div><div><br></div><div> windows.AlphaBlend(bmp.Canvas.Handle,0,0,P.Width,P.Height,b.Canvas.Handle,0,0,P.Width,P.Height,bf);</div>
<div><br></div><div> if AddFrame then</div><div> begin</div><div><br></div><div> b.Canvas.Brush.Color := clNavy;</div><div> b.Canvas.FillRect(rect(0,0,b.Width,b.height));</div><div><br></div><div> bf.BlendOp := AC_SRC_OVER;</div>
<div> bf.SourceConstantAlpha := 150;</div><div><br></div><div> windows.AlphaBlend(bmp.Canvas.Handle,0,0,P.Width,4,b.Canvas.Handle,0,0,P.Width,4,bf);</div><div> windows.AlphaBlend(bmp.Canvas.Handle,0,p.height-4,P.Width,4,b.Canvas.Handle,0,p.height-4,P.Width,4,bf);</div>
<div> windows.AlphaBlend(bmp.Canvas.Handle,0,0,4,p.height,b.Canvas.Handle,0,0,3,p.height,bf);</div><div> windows.AlphaBlend(bmp.Canvas.Handle,p.width-4,0,4,p.height,b.Canvas.Handle,p.width-4,0,4,p.height,bf);</div><div>
<br></div><div> end;</div><div>{</div><div>// BMP.Canvas.CopyMode := cmSrcAnd;</div><div> BMP.Canvas.CopyMode := cmSrcInvert;</div><div> BMP.Canvas.CopyRect(r,b.Canvas,r);</div><div> BMP.Canvas.Brush.Color := clyellow;</div>
<div> Dec(r.Right);</div><div> Dec(r.Bottom);</div><div><br></div><div> BMP.Canvas.FrameRect(r);</div><div> Dec(r.Right);Dec(r.Bottom);Inc(r.Left);Inc(r.Top);</div><div> BMP.Canvas.FrameRect(r);</div><div> }</div><div>
b.free;</div><div><br></div><div>end;</div><div><br></div><br><div class="gmail_quote">On Fri, Mar 20, 2009 at 1:04 PM, Jeremy North <span dir="ltr"><<a href="mailto:jeremy.north@gmail.com">jeremy.north@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Delphi 2009 has support for alpha blending. Otherwise Graphics32 might<br>
be of some use.<br>
<br>
On Fri, Mar 20, 2009 at 10:15 AM, Jeremy Coulter <<a href="mailto:jscoulter@gmail.com">jscoulter@gmail.com</a>> wrote:<br>
> Hi guys.<br>
> I need to have an overlay that does an alphablend.<br>
> I thought that I might be able to do this with a panel but thats no go.<br>
> Anyone know of a way yo acheive this?<br>
><br>
><br>
> Jeremy<br>
><br>
> _______________________________________________<br>
> NZ Borland Developers Group - Delphi mailing list<br>
> Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
> Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
> Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject:<br>
> unsubscribe<br>
><br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br>
</blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>+64-21-671-821<br>