/**** * * Copyright (c) 1988 by Sun Microsystems, Inc. * @(#)sh_CMAP.h 22.1 89/08/10 Copyright 1988 Sun Micro * * CMAP.H - CMAP object information * ****/ #ifndef _SH_CLASS_CMAP /* * Color map attributes */ typedef enum { CMAP_INPUT, /* type of input colors */ CMAP_OUTPUT, /* type of output colors */ CMAP_FUNC, /* color translation function */ CMAP_OFFSET, /* offset of colors */ CMAP_SIZE, /* size of color map */ CMAP_RASTER, /* parent raster of color map */ } CMAP_attr; #define CMAP_ATTRS ((int) CMAP_RASTER) /* * Write/Read_Cmap data formats */ #define CMAP_UNPACKED_RGB 0 #define CMAP_PACKED_RGB 1 typedef struct { Sgn16 index; /* starting cmap index */ Sgn16 count; /* number of cmap locations */ Sgn16 *red; /* list of RED values */ Sgn16 *green; /* list of GREEN values */ Sgn16 *blue; /* list of BLUE values */ } *CMAP_RGB_UNPACKED, CMAP_RGB_UNPACKED_DATA; typedef struct { Sgn16 index; /* starting cmap index */ Sgn16 count; /* number of cmap locations */ Unsgn32 *rgb; /* list of 0/B/G/R values */ }*CMAP_RGB_PACKED, CMAP_RGB_PACKED_DATA; /* * CMAP operators. * * CMAP Create_Cmap(i,s) create cmap * CMAP Temp_Cmap(i,s) create temporary cmap * CMAP Read_Cmap(cm, data, opt) read cmap data * CMAP Write_Cmap(cm, data, opt) write cmap data * Destroy_Cmap(cm) destroy cmap object * Get_Cmap(cm, attr) get cmap attribute * Set_Cmap(cm, attr, val) set cmap attribute * * Print_Cmap(cm) print cmap object info * Install_Cmap(cm) install color map * Remove_Cmap(cm) remove color map * Apply_Cmap(cm,col) apply device color function */ #define CMAP_OP_Destroy 0 #define CMAP_OP_Init 1 #define CMAP_OP_Get 2 #define CMAP_OP_Set 3 #define CMAP_OP_Print 4 #define CMAP_OP_Install 5 #define CMAP_OP_Remove 6 #define CMAP_OP_Read 7 #define CMAP_OP_Write 8 #define CMAP_OPERS 9 #define Create_Cmap sh_Create_Cmap #define Temp_Cmap sh_Temp_Cmap #define Destroy_Cmap(c) Destroy_Obj(c) #ifndef SH_MONITOR #define Set_Cmap(c,a,v) ((void) GetOper_Obj(c, CMAP_OP_Set)(c, a, v)) #else /* SH_MONITOR */ #define Set_Cmap(c,a,v) ((void) GetOper_Obj(c, CMAP_OP_Set)((CMAP)sh_Monitor_Set_Cmap(c), a, v)) #endif /* SH_MONITOR */ #define Read_Cmap(c,d,t) ((CMAP) GetOper_Obj(c, CMAP_OP_Read)(c, d, t)) #define Write_Cmap(c,d,t) ((CMAP) GetOper_Obj(c, CMAP_OP_Write)(c, d, t)) #define Print_Cmap(c) ((void) GetOper_Obj(c, CMAP_OP_Print)(c)) #define Install_Cmap(c) ((void) GetOper_Obj(c, CMAP_OP_Install)(c)) #define Remove_Cmap(c) ((void) GetOper_Obj(c, CMAP_OP_Remove)(c)) #define Apply_Cmap(cm,c) ((Unsgn32) (*(cm->cmap_apply_func))(cm, c)) extern CMAP sh_Create_Cmap(); extern CMAP sh_Temp_Cmap(); struct class_CMAP { #include "sh_CMAP.ah" }; /* * Get_Cmap(cmap, attr) * Fast way to access color map attributes. * This macro depends on the "attr" argument being a compile time constant. */ #ifndef SH_MONITOR #define Get_Cmap(c,a) CAT(a,get)((CMAP)(c)) #else /* SH_MONITOR */ #define Get_Cmap(c,a) CAT(a,get)((CMAP)sh_Monitor_Get_Cmap(c)) #endif /* SH_MONITOR */ #define CMAP_INPUTget(c) ((c)->CMAP_INPUT) #define CMAP_OUTPUTget(c) ((c)->CMAP_OUTPUT) #define CMAP_OFFSETget(c) ((c)->CMAP_OFFSET) #define CMAP_RASTERget(c) ((c)->CMAP_RASTER) #define CMAP_FUNCget(c) ((c)->CMAP_FUNC) #define CMAP_SIZEget(c) ((c)->CMAP_SIZE) #define cmap_dataget(c) ((c)->cmap_data) #define cmap_depthget(c) ((c)->cmap_depth) #define _SH_CLASS_CMAP #endif /* _SH_CLASS_CMAP */