l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2002 Jun 03 13:25

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] xlib/gdk questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] xlib/gdk questions



On Mon, 3 Jun 2002, Peter Jay Salzman wrote:

> 1: colormaps
> ============
> when an xlib book talks about a colormap, is it talking about something
> which is global in scope?  something that's shared by all Windows?  is
> it determined by the graphics card?
>
> or something which exists for each Window on a display?

An application can use a global colormap (which limits its colors) or an
application can make its own global colormap.  In 8-bit mode, that means
whenever the app gains focus, all other windows are gonna look weird,
and when the app loses focus it'll look weird.

As I recall, if you don't specifically create a colormap, you end up using
the global one (or maybe you request for the global colormap).  Also,
colormap isn't necessary if you're using 16bit or above.  But it doesn't
hurt to set one up if you're not writing a code with too many colors.

As I recall.

> 2: visuals
> ==========
> same question for a visual.  a visual describes how pixel colors are
> interpreted -- whether we use a colormap (1, 8, 16 bpp) or a true RGB
> triplet (24, 32 bpp).   this makes it sound like there's one visual for
> each server, since depth information should be the same for all Windows.
> yet from reading, it sounds like each Window has a visual.  what's the
> deal?

Don't know.

> btw, what exactly is 32bpp?  how can any true-color color map have a
> depth that's not divisible by 3?  doesn't each color goes from 0 to FF?
> what are the extra bits used for?

32bpp = 8 bit red, 8 bit green, 8 bit blue, 8 bit alpha.  The alpha
channel can be used to blend things, to get translucency.  For example:

   bitmap one with alpha
   bitmap two with alpha
   bitmap three where you blit one and two together

so you can get translucent colors on bitmap three.  But I think the
final number of colors you can see is actually 24-bits (if you blend
[200,0,0] with [201,0,0], you don't end up with [200.5,0,0]).

> 3: Graphics Contexts and Color
> ==============================
> suppose i want to do some plotting in Xlib or Gdk.  suppose my plot has
> 1000 colors.   do i really have to:
>
>   1. allocate a color.  1000 times.
>   2. declare 1000 graphics contexts
>
> that seems more than painful; it's masochistic.   is this what someone
> needs to do to draw a picture that contains 1000 colors?

Don't know.

-Mark "sometimes-it's-okay-to-say-I-don't-know" Kim

--
Mark K. Kim
http://www.cbreak.org/
PGP key available upon request.

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.