#ifndef lint static char sccsid[] = "@(#)mem_colorm.c 9.2 88/01/19 SMI"; #endif /* * Copyright 1986 by Sun Microsystems, Inc. */ /* * Memory pixrect "colormap" routines. */ #include #ifdef REF #include #endif #include #include #include #include /*ARGSUSED*/ mem_putcolormap(pr, index, count, red, green, blue) struct pixrect *pr; int index, count; u_char red[], green[], blue[]; { struct mpr_data *md; if (pr && index == 0) { md = mpr_d(pr); if (!red[0] && (md->md_flags & MP_DISPLAY)) md->md_flags |= MP_REVERSEVIDEO; else md->md_flags &= ~MP_REVERSEVIDEO; } return (0); } mem_putattributes(pr, planes) struct pixrect *pr; int *planes; { if (pr != 0) { register struct mprp_data *mprp; mprp = (struct mprp_data *) pr->pr_data; if (mprp->mpr.md_flags & MP_PLANEMASK && planes != 0) mprp->planes = *planes; } return 0; } #ifndef KERNEL mem_getattributes(pr, planes) struct pixrect *pr; int *planes; { if (pr != 0 && planes != 0) { register struct mprp_data *mprp; mprp = (struct mprp_data *) pr->pr_data; if (mprp->mpr.md_flags & MP_PLANEMASK) *planes = mprp->planes; else *planes = ~0; } return 0; } static u_char cmap[] = {0, 255, 0}; mem_getcolormap(pr, index, count, red, green, blue) struct pixrect *pr; int index, count; u_char red[], green[], blue[]; { struct mpr_data *md; short i, k, offset; if (index > 1) index = 1; if (index+count > 2) count = 2 - index; if (pr) { md = mpr_d(pr); offset = 1; if (md->md_flags & MP_REVERSEVIDEO) offset = 0; for (i = 0; i < count; i++) { k = i+index+offset; red[i] = cmap[k]; green[i] = cmap[k]; blue[i] = cmap[k]; } } return (0); } #endif /* !KERNEL */