[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GNUstep cookbook: screen grab with X11. Misc.
From: |
Marko Riedel |
Subject: |
GNUstep cookbook: screen grab with X11. Misc. |
Date: |
Tue, 23 Sep 2003 18:03:03 +0200 |
Hi folks,
I have added support for TrueColor visuals to my screen grab
recipe. This is much faster because there are no calls to
XQueryColor. It's also quite simple; the URL is
http://www.gnustep.it/marko/index.html
Please let me know if there are any problems with the TGZ or ZIP
archives, or if there are any bugs that remain in the program.
I also have some comments.
1. I looked at the code in XGServer where improvements are
solicited. As far as I can see this code tries to guess the bitmap
structure of TrueColor pixels by trying different combinations,
sending them as a pixel value to the server, reading the component
values that the server returned and checking whether the guess was
correct. Shouldn't we be able to do without guessing? It seems to
me that we need only look at the fields "red_mask", "green_mask"
and "blue_mask" of the visual, the way I do in my recipe. That way
we could handle all pixel structures and not just the few that are
hardcoded into XGServer.
2. As the writers of XGServer well know, XQueryColor can be very
slow. In fact the current implementation is not usable at all on
PseudoColor displays. Maybe we should use a cache here, the way I
did in the recipe. Imagine your basic XEmacs window, say 400x400,
which is mostly grey, black and white, with a couple more greys
thrown in. This kind of pixmap would require maybe ten or fifteen
calls to XQueryColor if a cache were used, as opposed to 160000
calls with no cache, if I understand correctly.
3. Stefan Urbanek asked whether we could use the code from my recipe
in a color picker. I don't quite understand what he means. It is
certainly not difficult to grab the contents of the root window and
collect all the colors. BTW it seems that on displays other than
TrueColor displays GNUstep does not re-use colors that have already
been allocated, e.g. if "darkblue" has been allocated it will
allocate it again.
Best regards,
--
+------------------------------------------------------------+
| Marko Riedel, EDV Neue Arbeit gGmbH, mriedel@neuearbeit.de |
| http://www.geocities.com/markoriedelde/index.html |
+------------------------------------------------------------+