Article View: comp.windows.x
Article #2485024 bit TrueColor problem (a Stardent computer)
From: steritir
Date: Tue, 12 Jan 1993 17:31
Date: Tue, 12 Jan 1993 17:31
73 lines
2663 bytes
2663 bytes
I'm having trouble using x on a Stardent (24 bit color)
The code works fine on Dec's
It apparently has trouble creating proper visuals and colormaps
Here's the relevant code:
screen = XDefaultScreen (display);
parent = XRootWindow (display, screen);
depth = XDefaultDepth (display, screen);
planes = XDisplayPlanes (display, screen);
ncolors = XDisplayCells (display, screen);
default_visual = DefaultVisual ( display, screen );
switch ( default_visual->class ) {
case PseudoColor:
r = XMatchVisualInfo ( display, screen, depth, PseudoColor, &vis_info );
break;
case GrayScale:
printf ( "GrayScale \n" );
r = XMatchVisualInfo ( display, screen, depth, GrayScale, &vis_info );
break;
case DirectColor:
printf ( "DirectColor \n" );
r = XMatchVisualInfo ( display, screen, depth, DirectColor, &vis_info );
break;
case TrueColor:
/*
r = XMatchVisualInfo ( display, screen, depth, TrueColor, &vis_info );
*/
printf ( "TrueColor -> PseudoColor \n" );
r = XMatchVisualInfo ( display, screen, depth, PseudoColor, &vis_info );
break;
default:
printf ( " No visual found. \n");
}
if ( !r ) printf ( " Problem matching visual \n" );
cmap = XCreateColormap ( display, parent, vis_info.visual, AllocAll );
colors = (XColor *) malloc ( ncolors * sizeof (XColor) );
colors = (XColor *) malloc ( ncolors * sizeof (XColor) );
for (i=0;i<ncolors;i++) {
colors[i].pixel = i;
colors[i].red = colors[i].green = colors[i].blue = i*256;
colors[i].flags = DoRed | DoGreen | DoBlue;
}
XStoreColors ( display, cmap, colors, ncolors);
The default visual is TrueColor, it was suggested that i use Pseudo anyway
hence the commented out XMatchVisual ( TrueColor )
Matching with PseudoColor however does print the (appropriate) error message
"problem matching visual",
Both Pseudo and True result in
X Protocol error: BadValue, integer parameter out of range for operation
Major opcode of failed request: 78 (X_CreateColormap)
I'd appreciate any help!
Ron Steriti
UMass Lowell
steritir@woods.ulowell.edu
The code works fine on Dec
Technical Details
Message-ID:
<1993Jan12.123148.1@woods.ulowell.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ulowell!woods.ulowell.edu!steritirShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.x Path: arc1-ca.pugleaf.net!sparky!uunet!ulowell!woods.ulowell.edu!steritir From: steritir@woods.ulowell.edu Subject: 24 bit TrueColor problem (a Stardent computer) Message-ID: <1993Jan12.123148.1@woods.ulowell.edu> Lines: 73 Sender: usenet@ulowell.ulowell.edu (News manager - ulowell) Organization: University of Lowell Date: Tue, 12 Jan 1993 17:31:48 GMT