devin@pippin.Colorado.EDU (Yampalimardilor) (08/04/90)
I have a strange question - if anyone can help that would be nice. I have a Bitmap (single plane Pixmap) and an eight plane Pixmap. I want to stamp the Bitmap onto the Pixmap so that any off locations in the Bitmap don't change the Pixmap and any on locations in the Bitmap set that location in the Pixmap to a specific value (i.e. 254). Is there an easy X way to do this? Thanks. -Devin *********************************************************************** * Yampalimardilor * a.k.a Devin Hooker (RP90) DoD # 0034 * * Mage School, Glantri * University of Colorado-Boulder * * (Master of Movement) * (Undergrad Student) * ***********************************************************************
ekberg@ti-csl.csc.ti.COM (08/06/90)
An easy way to do this is to use the clip mask in the GC. Just specify your bitmap as the clip mask and perform the drawing operation you want. A 0 in the clip mask causes the corresponding pixel in the pixmap to not be modified. If you set the GC's foreground color to your specific value, and do the drawing operation for the object you want (rectangle, line, etc.) the 1 pixels in the clip mask will cause the corresponding pixels (if they are part of the object being drawn) in the pixmap to be set to the foreground pixel. -- tom (aisle C-4Q), ekberg@csc.ti.com
karlton@sgi.com (Phil Karlton) (08/07/90)
In article <24310@boulder.Colorado.EDU>, devin@pippin.Colorado.EDU (Yampalimardilor) writes: |> I have a Bitmap (single plane Pixmap) and an eight plane Pixmap. |> I want to stamp the Bitmap onto the Pixmap so that any off locations in |> the Bitmap don't change the Pixmap and any on locations in the Bitmap |> set that location in the Pixmap to a specific value (i.e. 254). Is there |> an easy X way to do this? Thanks. You can do CopyPlane twice changing the GC between the two calls. Assuming a depth 8 destination visual, the following should work. GC function foreground background And 254 255 Or 254 0 Other combinations of functions and background/foreground will also work. The efficiency of any of the choices will depend upon the particular server you are using. PK
mouse@LARRY.MCRCIM.MCGILL.EDU (08/10/90)
> I have a Bitmap (single plane Pixmap) and an eight plane Pixmap. I > want to stamp the Bitmap onto the Pixmap so that any off locations in > the Bitmap don't change the Pixmap and any on locations in the Bitmap > set that location in the Pixmap to a specific value (i.e. 254). Is > there an easy X way to do this? Create a GC appropriate to the 8-plane pixmap; set its components as follows: stipple = the bitmap fill-style = FillStippled foreground = 254 (or whatever the specific value is) Then use XFillRectangle to fill the whole pixmap with this GC. (I assume the origins are to be identified with one another; if this is not true you need to set the tile/stipple origin in the GC.) Alternatively, set clip-mask = the bitmap fill-style = FillSolid foreground = 254 Then use XFillRectangle just as before. Which is more efficient? I don't know; it depends on your server. The semantics are the same only under certain circumstances which I don't feel up to working out in all their gory detail. But if no part of the pixmap extends outside the bitmap, the semantics are identical, at least as far as I understand them. (One obvious semantic difference is that if the bitmap is smaller than the pixmap, the first method given replicates it; the second doesn't.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu