Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site eneevax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!mcnc!philabs!cmcl2!seismo!umcp-cs!eneevax!phaedrus From: phaedrus@eneevax.UUCP (The Sophist) Newsgroups: net.graphics Subject: HELP!! SUN specific graphics question. Message-ID: <225@eneevax.UUCP> Date: Thu, 24-Jan-85 14:15:43 EST Article-I.D.: eneevax.225 Posted: Thu Jan 24 14:15:43 1985 Date-Received: Mon, 28-Jan-85 07:12:15 EST Distribution: net Organization: EE Dept, Maryversity of Uniland Lines: 49 Ok, here are the preliminaries: I am working on a Sun running Berkeley 4.2. I am working at the `pixrect' level. What I need to do is to define a colormap so that I can make the pixels be nine different and very distinct colors. The Sun manuals have no examples on how to set up the colormap and I don't have too much experience with graphics so, I am going no where trying to figure it out. Could someone please tell me how to set up a colormap at the pixrect level? If that isn't possible, could someone send me an example of a colormap that they have set up (liberally sprinkled with comments)? And if that isn't possible could someone explain to me how the following routine (which sets up a colormap) works? I don't quite understand what all the shifting and the oring does. int mak_col_map () { int index; unsigned char red[256], blue[256], green[256]; int r, b, g; for (b = 0; b < 4; b++) { for (g = 0; g < 8; g++) { for (r = 0; r < 8; r++) { index = (b << 6) | (g << 3) | (r); blue[index] = b * 84; red[index] = r * 36; green[index] = g * 36; } } } pr_putcolormap (col_mon, 0, 256, red, green, blue); } Thanks in advance. -- Pravin Kumar Don't bother me! I'm on an emergency third rail power trip. ARPA: phaedrus!eneevax@maryland UUCP: {seismo,allegra,brl-bmd}!umcp-cs!eneevax!phaedrus