From: beck@irzr17.inf.tu-dresden.de (Andre Beck)
Subject: Re: Pixmaps, Masks, & Icons - Clues?
Organization: Dept. of Computer Science, TU Dresden, Germany.
Lines: 40
Distribution: world
Reply-To: Andre_Beck@IRS.Inf.TU-Dresden.DE
NNTP-Posting-Host: irzr17.inf.tu-dresden.de


In article <44975@sophia.inria.fr>, lehors@koala.inria.fr (Arnaud Le_Hors) writes:
|> In article <BUZZ.93Mar31093626@lion.bear.com>, buzz@bear.com (Buzz Moschetti)
|> writes:
|> > This is a simple X graphics question:
|> > 
|> > Assume you have a valid Window w, an icon pixmap, and the background
|> > mask (also a pixmap) for that icon.  You wish to place the icon at (x,y)
|> > in w *without* the background.
|> > 
|> > Question: What combination of XCopyArea() and GC functions are necessary?
|> > I think the idea is to "merge only those pixels of pixmap into w as
|> > indicated by the corresponding mask pixel value."  Specifically, the
|> > problem involves a pixmap and mask generated by the XPM libs.
|> > 
|> > Any clues would be most appreciated.
|> 
|> 
|> Xpm provides you with symbolic color names which can be specified at load time.
|> So, for doing what you want I would suggest you to define a Background symbol
|> in your pixmap file which you'll set to whatever color is used by the widget or
|> the window on which you want to put your pixmap. 
|> This would surely be the simplest and fastest way to do what you want.  

No. As soon as you blit two of this icons once on top of the other with a
little dislocation, you see the rectangular blit crashes too much of the
icon first blitted, because it draws a full rectangle. The way to do it
is masking: Create a bitmap with all pixels to be merged are 1 and all
not to be merged are 0. Then, set the clip_mask of the gc to this
bitmap, set the clip_x_origin and clip_y_origin of the gc to the x/y
coordinates where you blit the icon to the destination drawable, use GXCopy,
and XCopyArea() the icon pixmap to the destination drawable using this gc.


--
+-o-+--------------------------------------------------------------+-o-+
| o |                \\\-  Brain Inside -///                       | o |
| o |                    ^^^^^^^^^^^^^^^                           | o |
| o | Andre' Beck (ABPSoft) mehl: Andre_Beck@IRS.Inf.TU-Dresden.de | o |
+-o-+--------------------------------------------------------------+-o-+
