Board index » delphi » Transparent bitmap - line around the non transparent part

Transparent bitmap - line around the non transparent part

Hi all,

I would like that someone helps me with find how to trace a line around the
non transparent part of a bitmap.

For example, if I display a bitmap representing a pencil, I would like to
trace a line of 3 just pixels around the pencil.  (Not a square around the
hole bitmap).

Many thanks in advance.

Jean-Pol Dupont
jpdup...@skynet.be

 

Re:Transparent bitmap - line around the non transparent part


On 1 Oct 96 18:42:19 GMT, "Jean-Pol Dupont" <jpdup...@skynet.be>
wrote:

Essaie de suivre des cours d'anglais ca te ferait pas de mal :)

En attendant, j'ai pos une question similaire (je pense), et j'ai eu
une rponse un peu plus claire que celle donne par l'autre lame de
Mark Pritchard. Fait une recherche sur SID, le titre de ma question
commence par PlEaSe hElP mE !!!!!!!!!!!!!. Fais attention il y en a
plusieurs. J'espre que cela t'avancera un peu.

N.B. n'essaie pas de rpondre l'adresse @mail qui se trouve c?t
de mes messages, je ne la checke qu'une fois tous les deux mois (dans
le meilleur des cas).

Mes meilleurs sentiments

SID

Re:Transparent bitmap - line around the non transparent part


The Pixels property may help you here - it provides the colour value for a
reference in the pixels grid.  You can read from and write to this
property, and draw the line yourself.

--
Mark Pritchard
-------------
http://www.ozemail.com.au/~pritchma

Jean-Pol Dupont <jpdup...@skynet.be> wrote in article
<01bbafb7$8401b140$472b4...@jpdupont.skynet.be>...

Quote
> I would like that someone helps me with find how to trace a line around
the
> non transparent part of a bitmap.

> For example, if I display a bitmap representing a pencil, I would like to
> trace a line of 3 just pixels around the pencil.  (Not a square around
the
> hole bitmap).

Re:Transparent bitmap - line around the non transparent part


Quote
"Jean-Pol Dupont" <jpdup...@skynet.be> wrote:
>I would like that someone helps me with find how to trace a line around the
>non transparent part of a bitmap.
>For example, if I display a bitmap representing a pencil, I would like to
>trace a line of 3 just pixels around the pencil.  (Not a square around the
>hole bitmap).
>Jean-Pol Dupont
>jpdup...@skynet.be

You can probably do this by 'jitter-ing' the bitmap a little.  Create
a monochrome mask of the bitmap (black for all transparent pixels,
white for non-transparent), then bitblt the mask into a temp mono
bitmap using the SRCPAINT raster opcode (to combine the source and
dest pixels with an OR operation).  Blit the mask into the destination
multiple times, each time at a slight offset from the original image
origin.  Blit the mask into the dest at dest origin (0,0), then one
pixel lower at (0,1), and one pixel higher at (0,-1), and one pixel to
the left (-1,0), and one pixel to the right (1,0).  This will 'fatten'
the silhouette of the image by 2 pixels in both the X and Y axis.
Paint the fattened mask to the final destination using a colored brush
(to give the outline color), then paint the real image to the final
destination with transparency.

-Danny
 dtho...@subliminal.com
-Danny Thorpe
 author of "Delphi Component Design" 1996 Addison Wesley
 ISBN 0-201-46136-6

Other Threads