Changes

no edit summary
Line 1: Line 1: −
<html>
  −
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  −
<!-- misc-responsive -->
  −
<ins class="adsbygoogle"
  −
    style="display:block"
  −
    data-ad-client="ca-pub-8542359430745061"
  −
    data-ad-slot="5971110325"
  −
    data-ad-format="auto"
  −
    data-full-width-responsive="true"></ins>
  −
<script>
  −
(adsbygoogle = window.adsbygoogle || []).push({});
  −
</script>
  −
</html>
      +
'''Q:  How can my program tell whether it is running on a system with a color screen?'''
 +
 +
The PostScript graphics model allows you to do all your rendering in 24 bit color,  and have the WindowServer display it in the best way possible (dithering down to 2 bits,  if necessary).  If there are situations in which you need to use the "inquire and adapt" approach, the AppKit provides you with a method in the Application class called colorScreen that returns the most colorful screen available to your application.  By examining this data structure,  you can determine how deep your color screen is.  Below is a code fragment that does this:
 
<pre>
 
<pre>
Q:  How can my program tell whether it is running on a system with a color screen?
  −
  −
A:  The PostScript graphics model allows you to do all your rendering in 24 bit color,  and have the WindowServer display it in the best way possible (dithering down to 2 bits,  if necessary).  If there are situations in which you need to use the "inquire and adapt" approach, the AppKit provides you with a method in the Application class called colorScreen that returns the most colorful screen available to your application.  By examining this data structure,  you can determine how deep your color screen is.  Below is a code fragment that does this:
  −
   
#import <appkit/Application.h>
 
#import <appkit/Application.h>
 
#import <appkit/screens.h>
 
#import <appkit/screens.h>
Line 43: Line 29:  
}
 
}
 
}
 
}
 +
</pre>
    +
'''Q: How can I tell whether a View can display color or not?'''
   −
Q: How can I tell whether a View can display color or not?
+
The previous question does not answer which kinds of rendering commands you should be sending for a given View.  There are two headed systems,  and other circumstances where the window you are drawing in is not based on the value of colorScreen. The most common thing you want to do is different rendering based on whether this View can display color or not.  One way to do this is to use the shouldDrawColor method of View.  Do the following in your drawSelf:: method for the View:
 
+
<pre>
A: The previous question does not answer which kinds of rendering commands you should be sending for a given View.  There are two headed systems,  and other circumstances where the window you are drawing in is not based on the value of colorScreen. The most common thing you want to do is different rendering based on whether this View can display color or not.  One way to do this is to use the shouldDrawColor method of View.  Do the following in your drawSelf:: method for the View:
  −
 
   
- drawSelf:(NXRect *)rects :(int)count
 
- drawSelf:(NXRect *)rects :(int)count
 
{
 
{
Line 58: Line 44:  
    ...
 
    ...
 
}
 
}
 
+
</pre>
 
If you need to know  the actual depth of a given window,  use the  depthLimit method of Window. Here's some code for that:
 
If you need to know  the actual depth of a given window,  use the  depthLimit method of Window. Here's some code for that:
 
+
</pre>
 
NXWindowDepthLimit depth;
 
NXWindowDepthLimit depth;
 
if ((depth = [myWindow depthLimit]) == NX_DefaultDepth) {
 
if ((depth = [myWindow depthLimit]) == NX_DefaultDepth) {
 
depth = [Window defaultDepthLimit];
 
depth = [Window defaultDepthLimit];
 
}
 
}
 
+
</pre>
 
QA700
 
QA700
    
Valid for 2.0, 3.0
 
Valid for 2.0, 3.0
</pre>
+
 
    
[[Category:Computing]][[Category:NeXT]]
 
[[Category:Computing]][[Category:NeXT]]