1 #include <aros/oldprograms.h>
9 int MapImageV
= DefRes
*DefRepV
,
10 MapImageH
= DefRes
*DefRepH
; /* virtual screen size */
11 static int PixV
=DefRes
,
12 PixH
=DefRes
; /* true ilbm size in pixels */
13 short MapRepV
= DefRepV
,
15 static short BytesPerLine
;
16 static unsigned char *Raster
= null
;
18 static bool AxisFlipped
= DefXYFlip
;
20 * Update the MapImageH and MapImageV variables
24 MapImageV
= PixV
* MapRepV
;
25 MapImageH
= PixH
* MapRepH
;
29 MapImageV
= MapImageH
;
34 * free up any memory holding mapping image
38 if( Raster
) free(Raster
);
40 PixV
= 0xff; PixH
= 0xff;
45 * cause x and y axises to be reversed
47 void FlipImgPix( flip
)
55 * 4 bits per pixel means 2 pixels per byte
57 bool OpenImgPix(sizex
, sizey
, maxshade
)
63 OutErr("OpenImgPix: got max shade = 0\n");
67 BytesPerLine
= (sizex
+1)/2;
68 Raster
= (unsigned char *) malloc( BytesPerLine
* sizey
);
70 printf("OpenImgPix: not enough memory\n");
71 return(false); /* no memory err */
80 #define CalcByte(cbx,cby) (Raster + ( BytesPerLine * cby ) + (cbx >> 1))
83 void SetImgPix(x
, y
, val
)
84 int x
, y
; /* location */
90 if( x
> PixH
|| x
< 0 || y
> PixV
|| y
< 0 ) {
91 printf("SetImgPix(%d,%d,%d) out of range\n",x
,y
,val
);
96 shade
= ( (val
<< 4)-val
)/MaxShade
;
99 *bite
= (*bite
& 0xf) | ( shade
<<4 );
102 *bite
= (*bite
& 0xf0) | shade
;
114 temp
= x
; x
= y
; y
= temp
;
121 return( (short)(((x
^ y
)& 0x10) ? 0xff: 0));
123 bite
= CalcByte(x
,y
);
126 return((short)(*bite
& 0xf0));
129 return( (short)((*bite
& 0x0f) <<4));