bradr@quorum.com (Brad Rubenstein) (03/05/91)
I have a color raster bitmap that I want to "image" onto
a canvas. I can't get it to work.
Each "pixel" of the bitmap is an 8 bit colormap entry, and
I have in hand the RGB color associated with each of the 256
pixel values.
I wrote a simple test program that attempts to image a four
color bitmap onto the canvas, and it doesn't work.
Am I missing something?
Brad
------------ cut here ------------
%!PS
%
% This example is supposed to be read into pageview, and put a
% 256x256 bit color image in the upper lefthand corner of the page.
%
% colormap: red, green, blue, white (eventually will have 256 colors)
/red <ff0000ff> def
/green <00ff00ff> def
/blue <0000ffff> def
%
% Fix this to actually find the pseudo visual
%
/pseudo framebuffer /VisualList get 0 get def
%
% create and stuff colormap
%
/cmap pseudo createcolormap def
/csegs cmap 4 0 createcolorsegment def
(NeWS/debug.ps) LoadFile
cmap /Entries get {
/e exch def
/slot e /Slot get def
e slot
red slot get green slot get blue slot get
RGBcolor putcolor
(entry: %\n) [ e ] dbgprintf
} forall
% install colormap on current canvas
currentcanvas /Colormap cmap put
cmap /Installed true put
% The image proc below creates a <width x height> pixel image
% with different colored patches (each patch has the given patchwidth
% and patchheight). For example:
%
% 00001111
% 00001111
% 00001111
% 22223333
% 22223333
% 22223333
/width 256 def
/height 256 def
/num_patch_across 2 def
/num_patch_down 2 def
/row_data width string def
/row 0 def
/patchwidth width num_patch_across idiv def
/patchheight height num_patch_down idiv def
width height 8 matrix currentmatrix {
/offset row patchheight idiv num_patch_across mul def
/row row 1 add def
0 1 width 1 sub {
row_data exch dup patchwidth idiv offset add put
} for
row_data
} image
--
Brad Rubenstein -- Quorum Software Systems, Inc. -- bradr@quorum.com