[vox-tech] xlib/gdk questions

Peter Jay Salzman vox-tech@lists.lugod.org
Mon, 3 Jun 2002 11:47:01 -0700


a few Xlib/Gdk questions...



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?



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?

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?



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?

pete

ps - of course, by "Window" i mean an Xlib "Window *window" in this email.