Colormap segments whose size is not a power of two

Ed Falk falk at peregrine.eng.sun.com
Mon Aug 13 17:56:57 AEST 1990


In article <1990Aug13.011000.5497 at rice.edu> mlandau at diamond.bbn.com (Matthew Landau) writes:

>In any case, I seem to recall that someone a couple of months
>back posted an article on how to get the low-level colormap
>routines in SunView to allow colormap segments whose size is
>not a power of two.  Does anyone have a copy of that posting, 
>or details on how to do this?  Please reply be email, and I'll
>summarize if there are enough requests.

Normally, for reasons better left to historians, the pixwin package
assumes that colormaps are a power of two in length, and limits your write
masks accordingly.  To override this limitation, you add this line:

	pw->pw_clipdata->pwcd_flags |= PWCD_SET_CMAP_SIZE ;

After which, pixwins will let you set any write mask you want, whether or
not it makes sense.  To calculate the maximum reasonable write mask for
any arbitrary colormap length, do

	int i,maxmask ;

	i = len - 1 ;
	maxmask = 1 ;
	while( i ) {
	  i >>= 1 ;
	  maxmask <<= 1 ;
	}
	--maxmask ;

	-ed falk, sun microsystems -- sun!falk, falk at sun.com



More information about the Comp.sys.sun mailing list