[comp.windows.x] draw color image

sarima@tdatirv.UUCP (Stanley Friesen) (02/05/91)

In article <1991Feb2.000128.5464@efi.com> chiu@efi.com (Chan Chiu) writes:
>   The trick here is that I cannot find any routine to modifies pixmap
>   data.

I am not sure what you mean her.  A pixmap is an X drawable, which means
that *all* of the standard Xlib drawing routines work on a pixmap just
like they do on a window.  [I.e. a pixmap is essentially an undisplayable
window (I would almost say an output-only window)]
-- 
---------------
uunet!tdatirv!sarima				(Stanley Friesen)

dsr@mir.mitre.org (Douglas S. Rand) (02/05/91)

In article <1991Feb2.000128.5464@efi.com>, chiu@efi.com (Chan Chiu) writes:
> I am programming to display color image in X window (256 colors).
> 
> It looks like XDrawPointer doesn't support color (It doesn't have a parameter
> to input color value).
> 

Wrong.  The GC in XDrawPoint or XDrawPoints allows you to specify the foreground
color.  However this is an inefficient way to deal with images.

> I am aware of only two ways : (Correct me if I'm wrong)
> 
> 1, I use pixmap. Then I use XCopyArea. 
>    The trick here is that I cannot find any routine to modifies pixmap
>    data.

You can use pixmaps to buffer the image.  All the XDraw** routines take a 
drawable which is defined as either a window or a pixmap.  So...

> 2, I use XImage. Then XPutImage to window.
> 
Use XPutImage to put the image to a pixmap and make that pixmap the 
background pixmap of your display window.  Works great.  

> Any pointers ?
> 
> /Chan

O'Reilly books vI and vII have it all.  There are doubtlessly other
places as well.

-- 
Douglas S. Rand 
Internet:   <dsrand@mitre.org>
Snail:	    MITRE, Burlington Road, Bedford, MA 
Disclaimer: MITRE might agree with me - then again...
Amateur Radio: KC1KJ

stuart.rose@canrem.uucp (stuart rose) (02/07/91)

In article <126#tdatirv.UUCP>
sarima@tdatirv.UUCP (Stanley Friesen) writes:

SF>I am not sure what you mean her.  A pixmap is an X drawable, which means
SF>that *all* of the standard Xlib drawing routines work on a pixmap just
SF>like they do on a window.  [I.e. a pixmap is essentially an undisplayable
SF>window (I would almost say an output-only window)]

Be aware that pixmaps use server (memory) resources. This fact is
very important when using you IBM-PC as an X server. Though
efficient from a programmer's standpoint, pixmaps should only be
used sparingly. XImages recopied to the window make more sense
(resource-wise).


Take Care,                            | stuart.rose@canrem.uucp
Stuart                                | Mississauga, Ontario, Canada.
---
 ~ DeLuxe}ac #2428 ~ Stacatto signals of constant information - P.Simon
--
Canada Remote Systems.  Toronto, Ontario
NorthAmeriNet Host

mouse@lightning.mcrcim.mcgill.EDU (02/08/91)

>> I am not sure what you mean her.  A pixmap is an X drawable, which
>> means that *all* of the standard Xlib drawing routines work on a
>> pixmap just like they do on a window.  [I.e. a pixmap is essentially
>> an undisplayable window (I would almost say an output-only window)]

> Be aware that pixmaps use server (memory) resources.  This fact is
> very important when using you IBM-PC as an X server.
(If, not when, at least in my case :-)
> Though efficient from a programmer's standpoint, pixmaps should only
> be used sparingly.  XImages recopied to the window make more sense
> (resource-wise).

*May* make more sense, depending on the resource mix available.
Sometimes network bandwidth is more precious than server memory.

However, for many applications it's pretty much an academic question,
because there is no way to draw into an XImage, so the only alternative
is to use a Pixmap.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu