Subject Re: Support for Mask
From helmut <>
Date Sat, 14 Oct 2006 07:03:32 +0800
Newsgroups graphics32.general

set the bitmap drawmode to dmblend then use  the alpha channel.
ie. snippets from my app.
// image to be drawn
zbrush := tbitmap32.create;
  zbrush.SetSize(200, 200);
  zbrush.DrawMode := dmblend;
  zbrush.MasterAlpha := 255;

// mask for image
  zbrushmask := tbitmap32.create;
  zbrushmask.SetSize(200, 200);
  zbrushmask.DrawMode := dmblend;
  zbrushmask.MasterAlpha := 255;

// draw a shape on the  mask.
// in this case a circle
Ellipse(zbrushmask, Rect(50,50,150,150), false, true, clwhite32, clwhite32);
// blur for soft edge
FastBlur(zbrushmask, 4,2);
// copy the mask bitmap to brush alpha channel
intensitytoalpha(zbrush, zbrushmask);

thats it when zbrush is drawn to a image32.bitmap  any zero values in
the alpha are transparent with gray values ramping up to 255 becoming fully
opaque. The overall transparency can also be controlled with masteralpha.
The ellipse and fastblur routines are on the newsgroup somewhere..let me
know if you cant find them and i'll post
them to you.

hope thats reasonably clear.

"Andy" <> wrote in message
> Is it possible to create a Mask on an image and if yes, are there any
> examples on how to do this?
> Thanks in advance.
> Andy