Board index » delphi » How to draw filled transparent polygon

How to draw filled transparent polygon

How can I draw TRANSPARENT polygon on Bitmap.Canvas using
Bitmap.Canvas.Polygon( array_of_points );
I want polygon to be drawn with red line borders and filled with gray color,
but the image below should be visible through that gray surface.

Is that possible?

 

Re:How to draw filled transparent polygon


Hi Davor,

You will find a good example at http://www.geocities.com/den_alex . Check for
the Graphics32 components ( specially the Polygon_Ex  example).

Good luck!

Pierre

Davor Pleskina a crit:

Quote
> How can I draw TRANSPARENT polygon on Bitmap.Canvas using
> Bitmap.Canvas.Polygon( array_of_points );
> I want polygon to be drawn with red line borders and filled with gray color,
> but the image below should be visible through that gray surface.

> Is that possible?

Re:How to draw filled transparent polygon


"Davor Pleskina" <davor.plesk...@ri.tel.hr> schrieb im Newsbeitrag
news:3a3122d8$1_2@dnews...
Quote
> How can I draw TRANSPARENT polygon on Bitmap.Canvas using
> Bitmap.Canvas.Polygon( array_of_points );
> I want polygon to be drawn with red line borders and filled with
gray color,
> but the image below should be visible through that gray surface.

As Pierre told already, you can get it done with my library. It is not
Bitmap.Canvas however. But if you need to do it with Bitmap.Canvas,
you may alternatively create a copy of your bitmap, draw an opaque
polygon on one of the bitmaps, and finally blend two bitmaps together.

Re:How to draw filled transparent polygon


Quote
>You will find a good example at http://www.geocities.com/den_alex . Check
for
>the Graphics32 components ( specially the Polygon_Ex  example).

Actually, thanks, but you did not understand; when I would like to use any
special components, it would not be a problem! Unfortunately, this must be
done "manualy", which means on any normal Canvas, using any normal Windows
or Delphi functions.

Re:How to draw filled transparent polygon


Quote
"Alex Denissov" <deni...@uwindsor.ca> wrote in message

news:3a320a0f$1_2@dnews...

Quote
> "Davor Pleskina" <davor.plesk...@ri.tel.hr> schrieb im Newsbeitrag
> news:3a3122d8$1_2@dnews...
> > How can I draw TRANSPARENT polygon on Bitmap.Canvas using
> > Bitmap.Canvas.Polygon( array_of_points );
> > I want polygon to be drawn with red line borders and filled with
> gray color,
> > but the image below should be visible through that gray surface.

> As Pierre told already, you can get it done with my library. It is not
> Bitmap.Canvas however. But if you need to do it with Bitmap.Canvas,
> you may alternatively create a copy of your bitmap, draw an opaque
> polygon on one of the bitmaps, and finally blend two bitmaps together.

It would not help, please take a look at my answer to Pierre's post...

Re:How to draw filled transparent polygon


"Davor Pleskina" <davor.plesk...@ri.tel.hr> schrieb im Newsbeitrag
news:3a32399d_1@dnews...

Quote
> Actually, thanks, but you did not understand; when I would like to
use any
> special components, it would not be a problem! Unfortunately, this
must be
> done "manualy", which means on any normal Canvas, using any normal
Windows
> or Delphi functions.

Well, the solution I have posted in my previous message would work for
most canvases.

If you are ok with that fact your software will not work under Win95
and NT4, you can use AlphaBlt function from msimg32.dll, which will
blend image from one canvas to another with given transparency (I
don't remember already, but it might even work with device dependent
bitmaps directly).

But if you want better compatibility, you can always BitBlt everything
you need to DDB's and blend them together. As long as your canvas
normally supports BitBlt into device dependent bitmaps and back, I
don't see any problems.

Other Threads