Board index » delphi » Pattern brushes/pens that behave like hatch brushes/pens

Pattern brushes/pens that behave like hatch brushes/pens

I think the answer to the following question is no, but here goes anyway.

Is there an easier way to make a pattern brush behave like a hatch brush
without creating transparent bitmaps?

Say you are using a checker board pattern (monochrome) for a brush or pen,
black pixels (0) would take on the font color while white pixels (1) would
either be transparent.

At the moment I have to create temporary bitmaps and draw them transparently
(transparent := true, transparentcolor := clWhite).

When drawing unfilled shapes (using a Geometric pen) could probably draw the
thing twice and use appropriate SetROP2 calls to get the desired effect, but
SetROP2 does not work for filled shapes.

maybe just over looking something really simple.

thanks

change 'goaway' to 'smh1072' to reply via email

 

Re:Pattern brushes/pens that behave like hatch brushes/pens


you can assign a 8x8 bitmap to a brush..
Quote
Steve Hunt wrote:
> I think the answer to the following question is no, but here goes anyway.

> Is there an easier way to make a pattern brush behave like a hatch brush
> without creating transparent bitmaps?

> Say you are using a checker board pattern (monochrome) for a brush or pen,
> black pixels (0) would take on the font color while white pixels (1) would
> either be transparent.

> At the moment I have to create temporary bitmaps and draw them transparently
> (transparent := true, transparentcolor := clWhite).

> When drawing unfilled shapes (using a Geometric pen) could probably draw the
> thing twice and use appropriate SetROP2 calls to get the desired effect, but
> SetROP2 does not work for filled shapes.

> maybe just over looking something really simple.

> thanks

> change 'goaway' to 'smh1072' to reply via email

Re:Pattern brushes/pens that behave like hatch brushes/pens


I am using an 8x8 monochrome bitmap, but the black pixels take on the
current font color while the white pixels take on the background color.

Is there some way to make the white pixels transparent (like a hatch brush)
without first drawing on the canvas of a temporary bitmap, setting the
Transparent property, then drawing that bitmap back to the main canvas
(Delphi will then use MaskBlt (NT4) to blit the temporary bitmap)

SetROP2 does work with brushes, I must have been calling it before setting
the brush.

Quote
"Maynard Philbrook" <ja...@{*word*104}zone.net> wrote in message

news:3889444D.20B8D014@{*word*104}zone.net...
Quote
> you can assign a 8x8 bitmap to a brush..

> Steve Hunt wrote:

> > I think the answer to the following question is no, but here goes
anyway.

> > Is there an easier way to make a pattern brush behave like a hatch brush
> > without creating transparent bitmaps?

> > Say you are using a checker board pattern (monochrome) for a brush or
pen,
> > black pixels (0) would take on the font color while white pixels (1)
would
> > either be transparent.

> > At the moment I have to create temporary bitmaps and draw them
transparently
> > (transparent := true, transparentcolor := clWhite).

> > When drawing unfilled shapes (using a Geometric pen) could probably draw
the
> > thing twice and use appropriate SetROP2 calls to get the desired effect,
but
> > SetROP2 does not work for filled shapes.

Other Threads