בSaturday 13 May 2006 18:15, נכתב על ידי Andreas Berger:
> >>>Seems to me the mask is not flipped?
> >>
> >>What mask?
> >
> >In order to know what part of the image to display and what part of the
> > image to hide (transparent effect), there are many ways to do it.. the
> > most common and easy way to do it, is by using mask.
> >
> >A mask is a monochmore copy of the image, where black is for the
> > transparent copy, and the white is for the part that you wish to display.
> >
> >Ido
>
> Since I am migrating from Delphi, I don't really know how to use the
> mask - nor where it is. Is there a discription somewhere where I can
> read up on how to use the bitmap mask?

OK, here is an old code of mine that I made 4-5 years ago to do just that :

procedure TSprite.Show;
var R,R0:TRect;
begin
  if not fVisible then begin
     fVisible:=True;
     R0:=Rect(0,0,W,H); R:=Rect(X,Y,X+W,Y+H);
   Canvas           .CopyMode:=cmSrcCopy;
   BackBitMap.Canvas.CopyRect(R0,Canvas       ,R );
//     BitBlt(BackBitMap.Canvas.Handle,0,0,W,H,Canvas.Handle,X,Y,cmSrcCopy);

   Canvas           .CopyMode:=cmSrcAnd;
   Canvas           .CopyRect(R ,MaskBitMap.Canvas,R0);
//     BitBlt(Canvas.Handle,X,Y,W,H,MaskBitMap.Canvas.Handle,0,0,cmSrcAnd);

   Canvas           .CopyMode:=cmSrcPaint;
   Canvas           .CopyRect(R ,BitMap.Canvas,R0);
   Canvas           .CopyMode:=cmSrcCopy;
//     BitBlt(Canvas.Handle,X,Y,W,H,BitMap.Canvas.Handle,0,0,cmSrcPaint);
     end;
end;

The "//" lines are for Windows API based functions... please do not use 
specific WinAPI, to make your code easier to port for other systems and 
OS's...

I hope that helps 

Ido
-- 
Wile E. Coyote... Super genius

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to