From: jct@slpfs1.UUCP (Jeff Tolmie)
Newsgroups: comp.os.os2.programmer
Subject: Re: X/Motif to PM Questions
Keywords: xwindows motif pm
Date: 28 Aug 92 08:29:08 GMT
Organization: SEL - Research Center, Pforzheim, DE


In article <dic5340@hertz.njit.edu (David Charlap)> writes:-
>
>  In article <103@slpfs1.UUCP> jct@slpfs1.UUCP (Jeff Tolmie) writes:
>
>> Before anyone else says it, that should be ClientWndProc.
>
> The procedure could be anything.  It's just another function (declared
> with the EXPENTRY qualifier) and can have any name.  It is passed to
> the WinRegisterClass function when declaring the class to OS/2.
>
Yes, I know. I think I mentioned that actually. The point was what
is the default used. ie what IBM always calls it, what Charles Petzold
called it etc. Of course it's up to you. I try not to add complication
to a problem when I'm explaining it to a beginner. Personally, I like to
give it a meaningful name:- MainEventProc, AboutDlgEventProc.
It makes my life easier.

> You can use any RGB color fairly easilly - you request an RGB and it
> gives you a palette offset.  If you're on a 24-bit color device, you
> get the color.  Otherwise, PM gives you the nearest match based on the
> current palette.  Dithered colors (for fills) may be done with a
> different API call.

So. Can I allocate 200 colors with this method. EXACT RGB values that
I want placed into unused cells in the hardware colormap. The Toolkit
doco is VERY unclear on this. 

> If you need the exact colors, you're going to have to mess with the
> palette manager.  This is a pain under OS/2 and Windows.  I don't know
> why it has to be, though.  

OS/2 and Windows. Hmm... Where's your info come from Dave? I suspected
this "mess around with" all along, So If I could read the same books
as you about Color in Windows/OS2 I would be a lot happier.

> Doesn't X assume a 24-bit palette?  That
> makes things infinitely easier, since there are no palettes to muck
> with. 

No, X is much much much better with color. X has the concept of a "Visual"
which allows you to specify the properties of visualization for a particualar
X windows client. A standard X server for a Sun will have visuals for
Monochrome, 8bit Color Table (PsuedoColor), 24 color (TrueColor) and many
more. These are provided as a list to the X-client when it starts. So you,
the programmer, can decide what kind of visual you want. Usually you just take
the default visual, PsuedoColor on a 8bit display, for example. But you can
write a single program that will run on all display types. Also, I have
direct access to the hardware colormap. Normally this is bad programming
behaviour, but if I want to allocate the top 200 colors of the hardware
palette for Image display/processing, then this is the best way to do it.

OS/2 protects the hardware colormap to prevent "color flashing". In other
words, that moving from one window to the next causes some colors to be
displayed false in the non-active windows. So OS/2 takes the color request,
and looks at it's hardware colormap to decide if it has space. This decision
takes ALL windows into account. So it is very miserly with colors. I wan't
the right to say, "OK, normally yes, but for my Image Displayer I wan't
all 256 colors for myself."

I am working on this issue, but if you'd like to write a program fragment
of how you would read the 256 colors in a 800x600x256 .dll and display them
as boxes in a PM window, then I would be interested in comparing notes.


If anyone from the IBM OS/2 team is reading this, please let us know your
reasons, and if possible how to do this. There are whole branches of
computing that require High Resolution - High Color. I don't want to use
DOS. I don't want to use Windows. But I also don't want to use just
16 colors.


.........................................................................
                  Jeff Tolmie                       email: jct@rcp.sel.de  
  _____ ______    ALCATEL-SEL Research Center.      Ph   : +49 7231 71041 
    / __  /       P.O. Box 1760.                    Fax  : +49 7231 71045
   / /   /	  7530 Pforzheim. 	      
\_/./__./.........GERMANY................................................

Xref: sparky comp.os.os2.programmer:4462 comp.os.os2.apps:5560