For Terrance

Dependencies:   mbed

Committer:
emh203
Date:
Wed Jun 13 15:10:06 2012 +0000
Revision:
0:085749c8446f

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:085749c8446f 1 #include "DataTypes.h"
emh203 0:085749c8446f 2 #include "GFX.h"
emh203 0:085749c8446f 3 #include "SmartSwitch.h"
emh203 0:085749c8446f 4 #include "FixedMath.h"
emh203 0:085749c8446f 5
emh203 0:085749c8446f 6 //Linking Functions to Physical Screen
emh203 0:085749c8446f 7 //***********************************************************************************
emh203 0:085749c8446f 8
emh203 0:085749c8446f 9 void GFX_InitPhysicalScreen()
emh203 0:085749c8446f 10 {
emh203 0:085749c8446f 11 InitSmartSwitch();
emh203 0:085749c8446f 12 }
emh203 0:085749c8446f 13
emh203 0:085749c8446f 14 void GFX_DumpRenderContextToPhysicalScreen(RenderContext *Image)
emh203 0:085749c8446f 15 {
emh203 0:085749c8446f 16 int x,y;
emh203 0:085749c8446f 17
emh203 0:085749c8446f 18 SmartSwitch_SS = 0;
emh203 0:085749c8446f 19 SmartSwitchWriteByte(SMART_SWITCH_CMD_DISPLAY_DATA);
emh203 0:085749c8446f 20
emh203 0:085749c8446f 21 for(y=0;y<PHYSICAL_DISPLAY_YRES;y++)
emh203 0:085749c8446f 22 {
emh203 0:085749c8446f 23 for(x=0;x<PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES;x++)
emh203 0:085749c8446f 24 {
emh203 0:085749c8446f 25 SmartSwitchWriteByte(Image->RenderPlane.BitPlaneSpace[(y*PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES) + (PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES - x - 1)]);
emh203 0:085749c8446f 26 }
emh203 0:085749c8446f 27 }
emh203 0:085749c8446f 28 SmartSwitch_SS = 1;
emh203 0:085749c8446f 29 }
emh203 0:085749c8446f 30
emh203 0:085749c8446f 31 void GFX_PowerUpScreen()
emh203 0:085749c8446f 32 {
emh203 0:085749c8446f 33 PowerUpSmartSwitch();
emh203 0:085749c8446f 34 }
emh203 0:085749c8446f 35
emh203 0:085749c8446f 36 void GFX_PowerDownScreen()
emh203 0:085749c8446f 37 {
emh203 0:085749c8446f 38 PowerDownSmartSwitch();
emh203 0:085749c8446f 39 }
emh203 0:085749c8446f 40
emh203 0:085749c8446f 41 //Device Independent Functions
emh203 0:085749c8446f 42 //***********************************************************************************
emh203 0:085749c8446f 43
emh203 0:085749c8446f 44 //Reserve Space for the backbuffer
emh203 0:085749c8446f 45
emh203 0:085749c8446f 46 RenderContext BackBuffer;
emh203 0:085749c8446f 47 BYTE BackBufferRenderPlaneSpace[PHYSICAL_DISPLAY_PLANE_BUFFER_SIZE];
emh203 0:085749c8446f 48
emh203 0:085749c8446f 49
emh203 0:085749c8446f 50 //FontData
emh203 0:085749c8446f 51
emh203 0:085749c8446f 52 #define FONT5x7_FONT_WIDTH 5
emh203 0:085749c8446f 53 #define FONT5x7_FONT_HEIGHT 8
emh203 0:085749c8446f 54 #define FONT5x7_FONT_ELEMENTS 128
emh203 0:085749c8446f 55 #define FONT5x7_FONT_COLUMN_SIZE_IN_BYTE 1
emh203 0:085749c8446f 56
emh203 0:085749c8446f 57 BYTE FontTable_Font5x7 [640] = {
emh203 0:085749c8446f 58 0x00 ,0x08 ,0x0C ,0xFA ,0x81 ,0xFA ,0x0C ,0x08 ,0x00 ,0x00 ,0x00 ,0x10 ,0x30 ,0x5F ,0x81 ,0x5F ,
emh203 0:085749c8446f 59 0x30 ,0x10 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 60 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 61 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 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x00 ,0x00 ,0x00 ,0x00 };
emh203 0:085749c8446f 98
emh203 0:085749c8446f 99 BYTE CharacterWidthTable_Font5x7 [128] = {
emh203 0:085749c8446f 100 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,
emh203 0:085749c8446f 101 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,
emh203 0:085749c8446f 102 0x05 ,0x01 ,0x03 ,0x05 ,0x05 ,0x05 ,0x05 ,0x01 ,0x02 ,0x02 ,0x05 ,0x05 ,0x02 ,0x05 ,0x01 ,0x04 ,
emh203 0:085749c8446f 103 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x01 ,0x01 ,0x04 ,0x04 ,0x04 ,0x05 ,
emh203 0:085749c8446f 104 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x04 ,0x05 ,0x05 ,0x05 ,
emh203 0:085749c8446f 105 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x03 ,0x04 ,0x05 ,0x03 ,0x05 ,
emh203 0:085749c8446f 106 0x02 ,0x05 ,0x04 ,0x04 ,0x05 ,0x04 ,0x04 ,0x04 ,0x04 ,0x01 ,0x04 ,0x04 ,0x01 ,0x05 ,0x04 ,0x05 ,
emh203 0:085749c8446f 107 0x05 ,0x05 ,0x04 ,0x04 ,0x03 ,0x04 ,0x05 ,0x05 ,0x05 ,0x05 ,0x03 ,0x03 ,0x01 ,0x05 ,0x05 ,0x05 };
emh203 0:085749c8446f 108
emh203 0:085749c8446f 109 #define FONT3x5_FONT_WIDTH 3
emh203 0:085749c8446f 110 #define FONT3x5_FONT_HEIGHT 5
emh203 0:085749c8446f 111 #define FONT3x5_ELEMENTS 128
emh203 0:085749c8446f 112 #define FONT3x5_FONT_COLUMN_SIZE_IN_BYTE 1
emh203 0:085749c8446f 113
emh203 0:085749c8446f 114
emh203 0:085749c8446f 115 BYTE FontTable_Font3x5 [384] = {
emh203 0:085749c8446f 116 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 117 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 118 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 119 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 120 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 121 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
emh203 0:085749c8446f 122 0x00 ,0x00 ,0x00 ,0x17 ,0x00 ,0x00 ,0x03 ,0x00 ,0x03 ,0x0E ,0x1F ,0x0E ,0x14 ,0x1F ,0x0A ,0x00 ,
emh203 0:085749c8446f 123 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x03 ,0x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0x04 ,0x1B ,0x01 ,0x1E ,0x01 ,0x19 ,0x15 ,
emh203 0:085749c8446f 133 0x13 ,0x1F ,0x11 ,0x00 ,0x03 ,0x0C ,0x10 ,0x11 ,0x1F ,0x00 ,0x02 ,0x01 ,0x02 ,0x10 ,0x10 ,0x10 ,
emh203 0:085749c8446f 134 0x01 ,0x02 ,0x00 ,0x08 ,0x14 ,0x1C ,0x1F ,0x14 ,0x08 ,0x0C ,0x12 ,0x12 ,0x08 ,0x14 ,0x1F ,0x0C ,
emh203 0:085749c8446f 135 0x16 ,0x16 ,0x14 ,0x0E ,0x05 ,0x06 ,0x15 ,0x0F ,0x1F ,0x04 ,0x18 ,0x1D ,0x00 ,0x00 ,0x10 ,0x0D ,
emh203 0:085749c8446f 136 0x00 ,0x1F ,0x0C ,0x12 ,0x1F ,0x00 ,0x00 ,0x1C ,0x08 ,0x1C ,0x1C ,0x02 ,0x1C ,0x0C ,0x12 ,0x0C ,
emh203 0:085749c8446f 137 0x1E ,0x05 ,0x02 ,0x02 ,0x05 ,0x1E ,0x1C ,0x02 ,0x04 ,0x14 ,0x1A ,0x00 ,0x04 ,0x1E ,0x04 ,0x1E ,
emh203 0:085749c8446f 138 0x10 ,0x1E ,0x0E ,0x10 ,0x0E ,0x1C ,0x08 ,0x1C ,0x12 ,0x0C ,0x12 ,0x12 ,0x0C ,0x02 ,0x12 ,0x1A ,
emh203 0:085749c8446f 139 0x16 ,0x04 ,0x0E ,0x11 ,0x1F ,0x00 ,0x00 ,0x11 ,0x0E ,0x04 ,0x02 ,0x02 ,0x04 ,0x00 ,0x00 ,0x00 };
emh203 0:085749c8446f 140
emh203 0:085749c8446f 141
emh203 0:085749c8446f 142 BYTE CharacterWidthTable_Font3x5 [128] = {
emh203 0:085749c8446f 143 0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,
emh203 0:085749c8446f 144 0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,
emh203 0:085749c8446f 145 0x03 ,0x01 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x01 ,0x02 ,0x03 ,0x03 ,0x03 ,0x02 ,0x03 ,0x01 ,0x03 ,
emh203 0:085749c8446f 146 0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x01 ,0x02 ,0x03 ,0x03 ,0x03 ,0x03 ,
emh203 0:085749c8446f 147 0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,
emh203 0:085749c8446f 148 0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x02 ,0x03 ,0x02 ,0x03 ,0x03 ,
emh203 0:085749c8446f 149 0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x01 ,0x03 ,0x03 ,0x01 ,0x03 ,0x03 ,0x03 ,
emh203 0:085749c8446f 150 0x03 ,0x03 ,0x03 ,0x02 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x03 ,0x01 ,0x03 ,0x03 ,0x03 };
emh203 0:085749c8446f 151
emh203 0:085749c8446f 152 GFXFont Font5x7;
emh203 0:085749c8446f 153 GFXFont Font3x5;
emh203 0:085749c8446f 154
emh203 0:085749c8446f 155 void GFX_Init()
emh203 0:085749c8446f 156 {
emh203 0:085749c8446f 157
emh203 0:085749c8446f 158 //Staticially Allocate and setup the backbuffer space;
emh203 0:085749c8446f 159
emh203 0:085749c8446f 160 BackBuffer.RenderPlane.BitPlaneSpace = &BackBufferRenderPlaneSpace[0];
emh203 0:085749c8446f 161
emh203 0:085749c8446f 162 BackBuffer.SizeX = BACK_BUFFER_SIZE_X;
emh203 0:085749c8446f 163 BackBuffer.SizeY = BACK_BUFFER_SIZE_Y;
emh203 0:085749c8446f 164
emh203 0:085749c8446f 165 BackBuffer.RenderPlane.SizeX = BACK_BUFFER_SIZE_X;
emh203 0:085749c8446f 166 BackBuffer.RenderPlane.SizeY = BACK_BUFFER_SIZE_Y;
emh203 0:085749c8446f 167
emh203 0:085749c8446f 168
emh203 0:085749c8446f 169 GFX_FullDisplayBufferClear(&BackBuffer);
emh203 0:085749c8446f 170
emh203 0:085749c8446f 171 //Initialize the stock fonts
emh203 0:085749c8446f 172
emh203 0:085749c8446f 173 Font5x7.CharacterWidthTable = (BYTE *)CharacterWidthTable_Font5x7;
emh203 0:085749c8446f 174 Font5x7.FontBuffer = (BYTE *)FontTable_Font5x7;
emh203 0:085749c8446f 175 Font5x7.FontHeight = FONT5x7_FONT_HEIGHT;
emh203 0:085749c8446f 176 Font5x7.FontWidth = FONT5x7_FONT_WIDTH;
emh203 0:085749c8446f 177 Font5x7.BytesPerColumn = FONT5x7_FONT_COLUMN_SIZE_IN_BYTE;
emh203 0:085749c8446f 178
emh203 0:085749c8446f 179 Font3x5.CharacterWidthTable = (BYTE *)CharacterWidthTable_Font3x5;
emh203 0:085749c8446f 180 Font3x5.FontBuffer = (BYTE *)FontTable_Font3x5;
emh203 0:085749c8446f 181 Font3x5.FontHeight = FONT3x5_FONT_HEIGHT;
emh203 0:085749c8446f 182 Font3x5.FontWidth = FONT3x5_FONT_WIDTH;
emh203 0:085749c8446f 183 Font3x5.BytesPerColumn = FONT3x5_FONT_COLUMN_SIZE_IN_BYTE;
emh203 0:085749c8446f 184
emh203 0:085749c8446f 185 GFX_InitPhysicalScreen();
emh203 0:085749c8446f 186
emh203 0:085749c8446f 187 }
emh203 0:085749c8446f 188
emh203 0:085749c8446f 189
emh203 0:085749c8446f 190
emh203 0:085749c8446f 191 void GFX_FullDisplayBufferClear(RenderContext *Image)
emh203 0:085749c8446f 192 {
emh203 0:085749c8446f 193 BitPlane_Clear(&Image->RenderPlane);
emh203 0:085749c8446f 194 }
emh203 0:085749c8446f 195
emh203 0:085749c8446f 196
emh203 0:085749c8446f 197 void GFX_PutPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y)
emh203 0:085749c8446f 198 {
emh203 0:085749c8446f 199 if((x<Image->SizeX) && (y<Image->SizeY) && (x>=0) && (y>=0))
emh203 0:085749c8446f 200 {
emh203 0:085749c8446f 201 BitPlane_Put(&Image->RenderPlane,x,y,TRUE);
emh203 0:085749c8446f 202 }
emh203 0:085749c8446f 203 }
emh203 0:085749c8446f 204
emh203 0:085749c8446f 205
emh203 0:085749c8446f 206
emh203 0:085749c8446f 207 #ifndef _INLINE_GFX_GET_PIXEL
emh203 0:085749c8446f 208 BYTE GFX_GetPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y)
emh203 0:085749c8446f 209 {
emh203 0:085749c8446f 210 BYTE PixelColor = 0;
emh203 0:085749c8446f 211
emh203 0:085749c8446f 212 if((x<Image->SizeX) && (y<Image->SizeY) && (x>=0) && (y>=0))
emh203 0:085749c8446f 213 {
emh203 0:085749c8446f 214
emh203 0:085749c8446f 215 if(BitPlane_Get(&Image->RedBitPlane,x,y))
emh203 0:085749c8446f 216 PixelColor |= BICOLOR_RED;
emh203 0:085749c8446f 217
emh203 0:085749c8446f 218 if(BitPlane_Get(&Image->GreenBitPlane,x,y))
emh203 0:085749c8446f 219 PixelColor |= BICOLOR_GREEN;
emh203 0:085749c8446f 220 }
emh203 0:085749c8446f 221
emh203 0:085749c8446f 222 return PixelColor;
emh203 0:085749c8446f 223 }
emh203 0:085749c8446f 224 #endif
emh203 0:085749c8446f 225
emh203 0:085749c8446f 226
emh203 0:085749c8446f 227 void GFX_DrawHline(RenderContext *Image, SIGNED_WORD XStart, SIGNED_WORD XStop, SIGNED_WORD Y)
emh203 0:085749c8446f 228 {
emh203 0:085749c8446f 229 SIGNED_WORD LineStart;
emh203 0:085749c8446f 230 SIGNED_WORD LineStop;
emh203 0:085749c8446f 231 WORD i;
emh203 0:085749c8446f 232
emh203 0:085749c8446f 233 if((Y<Image->SizeY) && (Y>=0))
emh203 0:085749c8446f 234 {
emh203 0:085749c8446f 235 if(XStart>XStop)
emh203 0:085749c8446f 236 {
emh203 0:085749c8446f 237 LineStart = XStop;
emh203 0:085749c8446f 238 LineStop = XStart;
emh203 0:085749c8446f 239 }
emh203 0:085749c8446f 240 else
emh203 0:085749c8446f 241 {
emh203 0:085749c8446f 242 LineStart = XStart;
emh203 0:085749c8446f 243 LineStop = XStop;
emh203 0:085749c8446f 244 }
emh203 0:085749c8446f 245
emh203 0:085749c8446f 246 if(LineStart<0)
emh203 0:085749c8446f 247 {
emh203 0:085749c8446f 248 LineStart = 0;
emh203 0:085749c8446f 249 }
emh203 0:085749c8446f 250
emh203 0:085749c8446f 251 if(LineStop>Image->SizeX)
emh203 0:085749c8446f 252 {
emh203 0:085749c8446f 253 LineStop = Image->SizeX-1;
emh203 0:085749c8446f 254 }
emh203 0:085749c8446f 255
emh203 0:085749c8446f 256 if(LineStart == LineStop)
emh203 0:085749c8446f 257 {
emh203 0:085749c8446f 258 GFX_PutPixel(Image,LineStart,Y);
emh203 0:085749c8446f 259 }
emh203 0:085749c8446f 260 else
emh203 0:085749c8446f 261 {
emh203 0:085749c8446f 262 for(i=LineStart; i<=LineStop ; i++)
emh203 0:085749c8446f 263 {
emh203 0:085749c8446f 264 GFX_PutPixel(Image,i,Y);
emh203 0:085749c8446f 265 }
emh203 0:085749c8446f 266 }
emh203 0:085749c8446f 267 }
emh203 0:085749c8446f 268
emh203 0:085749c8446f 269 }
emh203 0:085749c8446f 270
emh203 0:085749c8446f 271
emh203 0:085749c8446f 272
emh203 0:085749c8446f 273 void GFX_DrawVline(RenderContext *Image, SIGNED_WORD YStart, SIGNED_WORD YStop, SIGNED_WORD X)
emh203 0:085749c8446f 274 {
emh203 0:085749c8446f 275 SIGNED_WORD LineStart;
emh203 0:085749c8446f 276 SIGNED_WORD LineStop;
emh203 0:085749c8446f 277 SIGNED_WORD i;
emh203 0:085749c8446f 278
emh203 0:085749c8446f 279 if((X<Image->SizeX) && (X>=0))
emh203 0:085749c8446f 280 {
emh203 0:085749c8446f 281
emh203 0:085749c8446f 282 if(YStart>YStop)
emh203 0:085749c8446f 283 {
emh203 0:085749c8446f 284 LineStart = YStop;
emh203 0:085749c8446f 285 LineStop = YStart;
emh203 0:085749c8446f 286 }
emh203 0:085749c8446f 287 else
emh203 0:085749c8446f 288 {
emh203 0:085749c8446f 289 LineStart = YStart;
emh203 0:085749c8446f 290 LineStop = YStop;
emh203 0:085749c8446f 291 }
emh203 0:085749c8446f 292
emh203 0:085749c8446f 293 if(LineStart<0)
emh203 0:085749c8446f 294 {
emh203 0:085749c8446f 295 LineStart = 0;
emh203 0:085749c8446f 296 }
emh203 0:085749c8446f 297
emh203 0:085749c8446f 298
emh203 0:085749c8446f 299 if(LineStop>Image->SizeY)
emh203 0:085749c8446f 300 {
emh203 0:085749c8446f 301 LineStop = Image->SizeY-1;
emh203 0:085749c8446f 302 }
emh203 0:085749c8446f 303
emh203 0:085749c8446f 304 for(i=LineStart; i<=LineStop ; i++)
emh203 0:085749c8446f 305 {
emh203 0:085749c8446f 306 GFX_PutPixel(Image,X,i);
emh203 0:085749c8446f 307 }
emh203 0:085749c8446f 308 }
emh203 0:085749c8446f 309 }
emh203 0:085749c8446f 310
emh203 0:085749c8446f 311
emh203 0:085749c8446f 312 void GFX_DrawLine(RenderContext * Image, SIGNED_WORD X1,SIGNED_WORD Y1, SIGNED_WORD X2,SIGNED_WORD Y2)
emh203 0:085749c8446f 313 {
emh203 0:085749c8446f 314 //A simple Implementation of Bresenham's line Algorithm
emh203 0:085749c8446f 315 SIGNED_WORD StartX,StopX,StartY,StopY;
emh203 0:085749c8446f 316 SIGNED_WORD dX,dY;
emh203 0:085749c8446f 317 SIGNED_WORD Y_Numerator;
emh203 0:085749c8446f 318 SIGNED_WORD X_Numerator;
emh203 0:085749c8446f 319 SIGNED_WORD Y;
emh203 0:085749c8446f 320 SIGNED_WORD X;
emh203 0:085749c8446f 321 SIGNED_WORD i;
emh203 0:085749c8446f 322 BOOL YDir = 0;
emh203 0:085749c8446f 323 //First Make sure that it is left to right
emh203 0:085749c8446f 324 //If not them flop them
emh203 0:085749c8446f 325 if(X2>X1)
emh203 0:085749c8446f 326 {
emh203 0:085749c8446f 327 StartX = X1;
emh203 0:085749c8446f 328 StopX = X2;
emh203 0:085749c8446f 329 StartY = Y1;
emh203 0:085749c8446f 330 StopY = Y2;
emh203 0:085749c8446f 331 }
emh203 0:085749c8446f 332 else
emh203 0:085749c8446f 333 {
emh203 0:085749c8446f 334 StartX = X2;
emh203 0:085749c8446f 335 StopX = X1;
emh203 0:085749c8446f 336 StartY = Y2;
emh203 0:085749c8446f 337 StopY = Y1;
emh203 0:085749c8446f 338 }
emh203 0:085749c8446f 339 GFX_PutPixel(Image, StopX,StopY);
emh203 0:085749c8446f 340 if(StopY>=StartY)
emh203 0:085749c8446f 341 {
emh203 0:085749c8446f 342 dY = StopY - StartY;
emh203 0:085749c8446f 343 YDir = 0;
emh203 0:085749c8446f 344 }
emh203 0:085749c8446f 345 else
emh203 0:085749c8446f 346 {
emh203 0:085749c8446f 347 dY = StartY - StopY;
emh203 0:085749c8446f 348 YDir = 1;
emh203 0:085749c8446f 349 }
emh203 0:085749c8446f 350 dX = StopX - StartX;
emh203 0:085749c8446f 351 //Now, if the slope is less greater than one, we need to swap all X/Y operations
emh203 0:085749c8446f 352 if(dY<=dX)
emh203 0:085749c8446f 353 {
emh203 0:085749c8446f 354 //Slope is less than one, proceed at normal and step along the x axis
emh203 0:085749c8446f 355 Y=StartY; //start the whole part of the Y value at the starting pixeel.
emh203 0:085749c8446f 356 X=StartX;
emh203 0:085749c8446f 357 //We need to start the numerator of the fraction half way through the fraction so evertyhing rounds at
emh203 0:085749c8446f 358 //fraction midpoint
emh203 0:085749c8446f 359 Y_Numerator = dX>>1; //The fraction demonimator is assumeed to be dX
emh203 0:085749c8446f 360 // out fixed point Y value is Y + (Y_Numerator / dX)
emh203 0:085749c8446f 361 //Every time we step the X coordinate by one, we need to step
emh203 0:085749c8446f 362 //out Y coordinate by dY/dX. We do this by just adding dY to our
emh203 0:085749c8446f 363 //numerator. When the numerator gets bigger than the
emh203 0:085749c8446f 364 //denomiator, the increment the whole part by one and decrement the numerator
emh203 0:085749c8446f 365 //by the denominator
emh203 0:085749c8446f 366 for(i=0;i<dX;i++)
emh203 0:085749c8446f 367 {
emh203 0:085749c8446f 368 GFX_PutPixel(Image,X,Y);
emh203 0:085749c8446f 369 X++;
emh203 0:085749c8446f 370 //Now do all the fractional stuff
emh203 0:085749c8446f 371 Y_Numerator += dY;
emh203 0:085749c8446f 372 if(Y_Numerator >= dX)
emh203 0:085749c8446f 373 {
emh203 0:085749c8446f 374 Y_Numerator-=dX;
emh203 0:085749c8446f 375 if(StopY > StartY)
emh203 0:085749c8446f 376 {
emh203 0:085749c8446f 377 Y++;
emh203 0:085749c8446f 378 }
emh203 0:085749c8446f 379 else
emh203 0:085749c8446f 380 {
emh203 0:085749c8446f 381 Y--;
emh203 0:085749c8446f 382 }
emh203 0:085749c8446f 383 }
emh203 0:085749c8446f 384 }
emh203 0:085749c8446f 385 }
emh203 0:085749c8446f 386 else
emh203 0:085749c8446f 387 {
emh203 0:085749c8446f 388 //Same as before by step along the y axis.
emh203 0:085749c8446f 389 Y=StartY;
emh203 0:085749c8446f 390 X=StartX;
emh203 0:085749c8446f 391 X_Numerator = dY>>1;
emh203 0:085749c8446f 392 for(i=0;i<dY;i++)
emh203 0:085749c8446f 393 {
emh203 0:085749c8446f 394 GFX_PutPixel(Image,X,Y);
emh203 0:085749c8446f 395 //Now do all the fractional stuff
emh203 0:085749c8446f 396 if(YDir)
emh203 0:085749c8446f 397 {
emh203 0:085749c8446f 398 Y--;
emh203 0:085749c8446f 399 }
emh203 0:085749c8446f 400 else
emh203 0:085749c8446f 401 {
emh203 0:085749c8446f 402 Y++;
emh203 0:085749c8446f 403 }
emh203 0:085749c8446f 404 X_Numerator += dX;
emh203 0:085749c8446f 405 if(X_Numerator >= dY)
emh203 0:085749c8446f 406 {
emh203 0:085749c8446f 407 X_Numerator-=dY;
emh203 0:085749c8446f 408 if(StopX > StartX)
emh203 0:085749c8446f 409 {
emh203 0:085749c8446f 410 X++;
emh203 0:085749c8446f 411 }
emh203 0:085749c8446f 412 else
emh203 0:085749c8446f 413 {
emh203 0:085749c8446f 414 X--;
emh203 0:085749c8446f 415 }
emh203 0:085749c8446f 416 }
emh203 0:085749c8446f 417 }
emh203 0:085749c8446f 418 }
emh203 0:085749c8446f 419 }
emh203 0:085749c8446f 420
emh203 0:085749c8446f 421
emh203 0:085749c8446f 422
emh203 0:085749c8446f 423
emh203 0:085749c8446f 424
emh203 0:085749c8446f 425 void GFX_DrawBox(RenderContext *Image, GFXDisplayBox *Box)
emh203 0:085749c8446f 426 {
emh203 0:085749c8446f 427 GFX_DrawHline(Image,Box->P1.X,Box->P2.X,Box->P1.Y);
emh203 0:085749c8446f 428 GFX_DrawHline(Image,Box->P1.X,Box->P2.X,Box->P2.Y);
emh203 0:085749c8446f 429 GFX_DrawVline(Image,Box->P1.Y,Box->P2.Y,Box->P1.X);
emh203 0:085749c8446f 430 GFX_DrawVline(Image,Box->P1.Y,Box->P2.Y,Box->P2.X);
emh203 0:085749c8446f 431 }
emh203 0:085749c8446f 432
emh203 0:085749c8446f 433
emh203 0:085749c8446f 434
emh203 0:085749c8446f 435 SIGNED_WORD GFX_DrawCharacter(RenderContext * Image,BYTE Character,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont)
emh203 0:085749c8446f 436 {
emh203 0:085749c8446f 437 BYTE i,j,Mask;
emh203 0:085749c8446f 438 WORD CharStartIndex,ColumnStartIndex,ByteOffset;
emh203 0:085749c8446f 439
emh203 0:085749c8446f 440 CharStartIndex = (Character * (MyFont->BytesPerColumn) * (MyFont->FontWidth));
emh203 0:085749c8446f 441
emh203 0:085749c8446f 442 for(j=0;j<MyFont->CharacterWidthTable[Character];j++)
emh203 0:085749c8446f 443 {
emh203 0:085749c8446f 444 //Draw the current slice
emh203 0:085749c8446f 445 ColumnStartIndex = j* (MyFont->BytesPerColumn);
emh203 0:085749c8446f 446
emh203 0:085749c8446f 447 for(i=0;i<MyFont->FontHeight;i++)
emh203 0:085749c8446f 448 {
emh203 0:085749c8446f 449 ByteOffset = i>>3;
emh203 0:085749c8446f 450 Mask = 0x01 << (i&0x07);
emh203 0:085749c8446f 451
emh203 0:085749c8446f 452 if( (MyFont->FontBuffer[CharStartIndex + ColumnStartIndex + ByteOffset]) & Mask)
emh203 0:085749c8446f 453 {
emh203 0:085749c8446f 454 GFX_PutPixel(Image, StartX, StartY + i);
emh203 0:085749c8446f 455 }
emh203 0:085749c8446f 456 }
emh203 0:085749c8446f 457 StartX++;
emh203 0:085749c8446f 458 }
emh203 0:085749c8446f 459 return StartX;
emh203 0:085749c8446f 460 }
emh203 0:085749c8446f 461
emh203 0:085749c8446f 462
emh203 0:085749c8446f 463 SIGNED_WORD GFX_GetStringWidth(CHAR * String,GFXFont * MyFont)
emh203 0:085749c8446f 464 {
emh203 0:085749c8446f 465 BYTE Ptr = 0;
emh203 0:085749c8446f 466 BYTE NextChar;
emh203 0:085749c8446f 467 SIGNED_WORD StringSize = 0;
emh203 0:085749c8446f 468
emh203 0:085749c8446f 469 NextChar = String[Ptr];
emh203 0:085749c8446f 470 Ptr++;
emh203 0:085749c8446f 471
emh203 0:085749c8446f 472 while((NextChar!=0) && (Ptr <GFX_MAX_STRING_LEN))
emh203 0:085749c8446f 473 {
emh203 0:085749c8446f 474 StringSize += MyFont->CharacterWidthTable[NextChar] + 1;
emh203 0:085749c8446f 475 NextChar = String[Ptr];
emh203 0:085749c8446f 476 Ptr++;
emh203 0:085749c8446f 477 }
emh203 0:085749c8446f 478
emh203 0:085749c8446f 479 return StringSize;
emh203 0:085749c8446f 480 }
emh203 0:085749c8446f 481
emh203 0:085749c8446f 482 void GFX_DrawCenteredString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont)
emh203 0:085749c8446f 483 {
emh203 0:085749c8446f 484 StartX -= (GFX_GetStringWidth(String,MyFont)>>1);
emh203 0:085749c8446f 485 GFX_DrawString(Image,String,StartX,StartY,MyFont);
emh203 0:085749c8446f 486 }
emh203 0:085749c8446f 487
emh203 0:085749c8446f 488 void GFX_DrawString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont)
emh203 0:085749c8446f 489 {
emh203 0:085749c8446f 490
emh203 0:085749c8446f 491 BYTE Ptr = 0;
emh203 0:085749c8446f 492 BYTE NextChar;
emh203 0:085749c8446f 493
emh203 0:085749c8446f 494 NextChar = String[Ptr];
emh203 0:085749c8446f 495
emh203 0:085749c8446f 496 while((NextChar!=0) && (Ptr <GFX_MAX_STRING_LEN))
emh203 0:085749c8446f 497 {
emh203 0:085749c8446f 498 StartX = GFX_DrawCharacter(Image,NextChar,StartX,StartY,MyFont);
emh203 0:085749c8446f 499 Ptr++;
emh203 0:085749c8446f 500 NextChar = String[Ptr];
emh203 0:085749c8446f 501 StartX++;
emh203 0:085749c8446f 502 }
emh203 0:085749c8446f 503
emh203 0:085749c8446f 504 }
emh203 0:085749c8446f 505
emh203 0:085749c8446f 506
emh203 0:085749c8446f 507 CHAR GFXStringBuf[64];
emh203 0:085749c8446f 508
emh203 0:085749c8446f 509 void GFX_printf(RenderContext * Image,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont, const char *FormatString,...)
emh203 0:085749c8446f 510 {
emh203 0:085749c8446f 511 va_list argptr;
emh203 0:085749c8446f 512 va_start(argptr,FormatString);
emh203 0:085749c8446f 513 vsprintf((CHAR *)GFXStringBuf,FormatString,argptr);
emh203 0:085749c8446f 514 va_end(argptr);
emh203 0:085749c8446f 515
emh203 0:085749c8446f 516 GFX_DrawString(Image,GFXStringBuf,StartX,StartY,MyFont);
emh203 0:085749c8446f 517 }
emh203 0:085749c8446f 518
emh203 0:085749c8446f 519
emh203 0:085749c8446f 520
emh203 0:085749c8446f 521 void GFX_DrawListPrimitive(RenderContext * Image,GFXListPrimitive *LP)
emh203 0:085749c8446f 522 {
emh203 0:085749c8446f 523 BYTE Points;
emh203 0:085749c8446f 524 BYTE i;
emh203 0:085749c8446f 525
emh203 0:085749c8446f 526 if(LP->NumPoints >1)
emh203 0:085749c8446f 527 {
emh203 0:085749c8446f 528
emh203 0:085749c8446f 529 switch(LP->DrawMode)
emh203 0:085749c8446f 530 {
emh203 0:085749c8446f 531
emh203 0:085749c8446f 532 default:
emh203 0:085749c8446f 533 case GFX_LIST_PRIMITIVE_CLOSED:
emh203 0:085749c8446f 534 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 535 {
emh203 0:085749c8446f 536 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i-1].Y + LP->Center.Y),
emh203 0:085749c8446f 537 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i].Y + LP->Center.Y));
emh203 0:085749c8446f 538 }
emh203 0:085749c8446f 539 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[LP->NumPoints-1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[LP->NumPoints-1].Y + LP->Center.Y),
emh203 0:085749c8446f 540 (SIGNED_WORD)(LP->PointList[0].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[0].Y + LP->Center.Y));
emh203 0:085749c8446f 541 break;
emh203 0:085749c8446f 542
emh203 0:085749c8446f 543 case GFX_LIST_PRIMITIVE_CONNECTED:
emh203 0:085749c8446f 544 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 545 {
emh203 0:085749c8446f 546 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i-1].Y + LP->Center.Y),
emh203 0:085749c8446f 547 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i].Y + LP->Center.Y));
emh203 0:085749c8446f 548 }
emh203 0:085749c8446f 549 break;
emh203 0:085749c8446f 550
emh203 0:085749c8446f 551 case GFX_LIST_PRIMITIVE_DISCONNECTED:
emh203 0:085749c8446f 552 Points = LP->NumPoints>>1;
emh203 0:085749c8446f 553 for(i=0;i<Points;i++)
emh203 0:085749c8446f 554 {
emh203 0:085749c8446f 555 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i*2].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i*2].Y + LP->Center.Y),
emh203 0:085749c8446f 556 (SIGNED_WORD)(LP->PointList[i*2+1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i*2+1].Y + LP->Center.Y));
emh203 0:085749c8446f 557 }
emh203 0:085749c8446f 558 break;
emh203 0:085749c8446f 559
emh203 0:085749c8446f 560 case GFX_LIST_PRIMITIVE_CLOSED_YFLIPPED:
emh203 0:085749c8446f 561 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 562 {
emh203 0:085749c8446f 563 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i-1].Y + LP->Center.Y),
emh203 0:085749c8446f 564 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i].Y + LP->Center.Y));
emh203 0:085749c8446f 565 }
emh203 0:085749c8446f 566 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[LP->NumPoints-1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[LP->NumPoints-1].Y + LP->Center.Y),
emh203 0:085749c8446f 567 (SIGNED_WORD)(LP->PointList[0].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[0].Y + LP->Center.Y));
emh203 0:085749c8446f 568 break;
emh203 0:085749c8446f 569
emh203 0:085749c8446f 570 case GFX_LIST_PRIMITIVE_CONNECTED_YFLIPPED:
emh203 0:085749c8446f 571 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 572 {
emh203 0:085749c8446f 573 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i-1].Y + LP->Center.Y),
emh203 0:085749c8446f 574 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i].Y + LP->Center.Y));
emh203 0:085749c8446f 575 }
emh203 0:085749c8446f 576 break;
emh203 0:085749c8446f 577
emh203 0:085749c8446f 578 case GFX_LIST_PRIMITIVE_DISCONNECTED_YFLIPPED:
emh203 0:085749c8446f 579 Points = LP->NumPoints>>1;
emh203 0:085749c8446f 580 for(i=0;i<Points;i++)
emh203 0:085749c8446f 581 {
emh203 0:085749c8446f 582 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i*2].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i*2].Y + LP->Center.Y),
emh203 0:085749c8446f 583 (SIGNED_WORD)(LP->PointList[i*2+1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i*2+1].Y + LP->Center.Y));
emh203 0:085749c8446f 584 }
emh203 0:085749c8446f 585 break;
emh203 0:085749c8446f 586
emh203 0:085749c8446f 587 }
emh203 0:085749c8446f 588 }
emh203 0:085749c8446f 589 }
emh203 0:085749c8446f 590
emh203 0:085749c8446f 591
emh203 0:085749c8446f 592
emh203 0:085749c8446f 593
emh203 0:085749c8446f 594 void GFX_DrawScaledListPrimitive(RenderContext * Image,GFXListPrimitive *LP , FIXED_7_8 Scale)
emh203 0:085749c8446f 595 {
emh203 0:085749c8446f 596 BYTE Points;
emh203 0:085749c8446f 597 BYTE i;
emh203 0:085749c8446f 598 GFXRelativePoint TransformedPoint[2] = {0};
emh203 0:085749c8446f 599
emh203 0:085749c8446f 600 if(LP->NumPoints >1)
emh203 0:085749c8446f 601 {
emh203 0:085749c8446f 602 switch(LP->DrawMode)
emh203 0:085749c8446f 603 {
emh203 0:085749c8446f 604
emh203 0:085749c8446f 605 default:
emh203 0:085749c8446f 606 case GFX_LIST_PRIMITIVE_CLOSED:
emh203 0:085749c8446f 607 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 608 {
emh203 0:085749c8446f 609
emh203 0:085749c8446f 610 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[i-1].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 611 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[i-1].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 612 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[i].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 613 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[i].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 614
emh203 0:085749c8446f 615 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y,
emh203 0:085749c8446f 616 TransformedPoint[1].X,TransformedPoint[1].Y);
emh203 0:085749c8446f 617
emh203 0:085749c8446f 618 }
emh203 0:085749c8446f 619
emh203 0:085749c8446f 620 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[LP->NumPoints-1].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 621 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[LP->NumPoints-1].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 622 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[0].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 623 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[0].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 624
emh203 0:085749c8446f 625 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y,
emh203 0:085749c8446f 626 TransformedPoint[1].X,TransformedPoint[1].Y);
emh203 0:085749c8446f 627
emh203 0:085749c8446f 628 break;
emh203 0:085749c8446f 629
emh203 0:085749c8446f 630 case GFX_LIST_PRIMITIVE_CONNECTED:
emh203 0:085749c8446f 631 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 632 {
emh203 0:085749c8446f 633 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[i-1].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 634 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[i-1].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 635 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[i].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 636 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[i].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 637
emh203 0:085749c8446f 638 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y,
emh203 0:085749c8446f 639 TransformedPoint[1].X,TransformedPoint[1].Y);
emh203 0:085749c8446f 640 }
emh203 0:085749c8446f 641 break;
emh203 0:085749c8446f 642
emh203 0:085749c8446f 643 case GFX_LIST_PRIMITIVE_DISCONNECTED:
emh203 0:085749c8446f 644 Points = LP->NumPoints>>1;
emh203 0:085749c8446f 645
emh203 0:085749c8446f 646 for(i=0;i<Points;i++)
emh203 0:085749c8446f 647 {
emh203 0:085749c8446f 648 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[i*2].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 649 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[i*2].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 650 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[(i*2)+1].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 651 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[(i*2)+1].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 652
emh203 0:085749c8446f 653 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y,
emh203 0:085749c8446f 654 TransformedPoint[1].X,TransformedPoint[1].Y);
emh203 0:085749c8446f 655 }
emh203 0:085749c8446f 656 break;
emh203 0:085749c8446f 657
emh203 0:085749c8446f 658 }
emh203 0:085749c8446f 659
emh203 0:085749c8446f 660 }
emh203 0:085749c8446f 661
emh203 0:085749c8446f 662 }
emh203 0:085749c8446f 663
emh203 0:085749c8446f 664 void GFX_DrawRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle, BYTE Color)
emh203 0:085749c8446f 665 {
emh203 0:085749c8446f 666 BYTE Points;
emh203 0:085749c8446f 667 BYTE i;
emh203 0:085749c8446f 668
emh203 0:085749c8446f 669 GFXRelativePoint TransformedPoint[2] = {0};
emh203 0:085749c8446f 670
emh203 0:085749c8446f 671 if(LP->NumPoints >1)
emh203 0:085749c8446f 672 {
emh203 0:085749c8446f 673 //If we are drawing non connected points, there must be an even number of them.
emh203 0:085749c8446f 674 switch(LP->DrawMode)
emh203 0:085749c8446f 675 {
emh203 0:085749c8446f 676 case GFX_LIST_PRIMITIVE_DISCONNECTED:
emh203 0:085749c8446f 677
emh203 0:085749c8446f 678 Points = LP->NumPoints>>1;
emh203 0:085749c8446f 679
emh203 0:085749c8446f 680 for(i=0;i<Points;i++)
emh203 0:085749c8446f 681 {
emh203 0:085749c8446f 682
emh203 0:085749c8446f 683 TransformedPoint[0].X = FMul_15_0to1_14((LP->PointList[i*2].X), Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 684 FMul_15_0to1_14(LP->PointList[i*2].Y, Fixed_1_14_SineTable[Angle]);
emh203 0:085749c8446f 685
emh203 0:085749c8446f 686 TransformedPoint[0].Y = FMul_15_0to1_14(LP->PointList[i*2].X, Fixed_1_14_SineTable[Angle ]) +
emh203 0:085749c8446f 687 FMul_15_0to1_14(LP->PointList[i*2].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]);
emh203 0:085749c8446f 688
emh203 0:085749c8446f 689 TransformedPoint[1].X = FMul_15_0to1_14(LP->PointList[(i*2)+1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 690 FMul_15_0to1_14(LP->PointList[(i*2)+1].Y, Fixed_1_14_SineTable[Angle]);
emh203 0:085749c8446f 691
emh203 0:085749c8446f 692 TransformedPoint[1].Y = FMul_15_0to1_14(LP->PointList[(i*2)+1].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 693 FMul_15_0to1_14(LP->PointList[(i*2)+1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]);
emh203 0:085749c8446f 694
emh203 0:085749c8446f 695
emh203 0:085749c8446f 696 TransformedPoint[0].X += LP->Center.X;
emh203 0:085749c8446f 697 TransformedPoint[0].Y += LP->Center.Y;
emh203 0:085749c8446f 698 TransformedPoint[1].X += LP->Center.X;
emh203 0:085749c8446f 699 TransformedPoint[1].Y += LP->Center.Y;
emh203 0:085749c8446f 700
emh203 0:085749c8446f 701
emh203 0:085749c8446f 702 GFX_DrawLine(Image,(TransformedPoint[0].X + LP->Center.X),(TransformedPoint[0].Y + LP->Center.Y),
emh203 0:085749c8446f 703 (TransformedPoint[1].X + LP->Center.X),(TransformedPoint[1].Y + LP->Center.Y));
emh203 0:085749c8446f 704 }
emh203 0:085749c8446f 705 break;
emh203 0:085749c8446f 706
emh203 0:085749c8446f 707 case GFX_LIST_PRIMITIVE_CONNECTED:
emh203 0:085749c8446f 708
emh203 0:085749c8446f 709 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 710 {
emh203 0:085749c8446f 711
emh203 0:085749c8446f 712 TransformedPoint[0].X = (FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 713 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[Angle]) );
emh203 0:085749c8446f 714
emh203 0:085749c8446f 715 TransformedPoint[0].Y = ( FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 716 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff] ) );
emh203 0:085749c8446f 717
emh203 0:085749c8446f 718 TransformedPoint[1].X = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 719 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[Angle]) );
emh203 0:085749c8446f 720
emh203 0:085749c8446f 721 TransformedPoint[1].Y = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 722 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]));
emh203 0:085749c8446f 723
emh203 0:085749c8446f 724 TransformedPoint[0].X += LP->Center.X;
emh203 0:085749c8446f 725 TransformedPoint[0].Y += LP->Center.Y;
emh203 0:085749c8446f 726 TransformedPoint[1].X += LP->Center.X;
emh203 0:085749c8446f 727 TransformedPoint[1].Y += LP->Center.Y;
emh203 0:085749c8446f 728
emh203 0:085749c8446f 729 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y),
emh203 0:085749c8446f 730 (TransformedPoint[1].X),(TransformedPoint[1].Y));
emh203 0:085749c8446f 731
emh203 0:085749c8446f 732 }
emh203 0:085749c8446f 733 break;
emh203 0:085749c8446f 734 default:
emh203 0:085749c8446f 735 case GFX_LIST_PRIMITIVE_CLOSED:
emh203 0:085749c8446f 736
emh203 0:085749c8446f 737 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 738 {
emh203 0:085749c8446f 739
emh203 0:085749c8446f 740 TransformedPoint[0].X = (FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 741 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[Angle]) );
emh203 0:085749c8446f 742
emh203 0:085749c8446f 743 TransformedPoint[0].Y = ( FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 744 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff] ) );
emh203 0:085749c8446f 745
emh203 0:085749c8446f 746 TransformedPoint[1].X = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 747 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[Angle]) );
emh203 0:085749c8446f 748
emh203 0:085749c8446f 749 TransformedPoint[1].Y = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 750 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]));
emh203 0:085749c8446f 751
emh203 0:085749c8446f 752 TransformedPoint[0].X += LP->Center.X;
emh203 0:085749c8446f 753 TransformedPoint[0].Y += LP->Center.Y;
emh203 0:085749c8446f 754 TransformedPoint[1].X += LP->Center.X;
emh203 0:085749c8446f 755 TransformedPoint[1].Y += LP->Center.Y;
emh203 0:085749c8446f 756
emh203 0:085749c8446f 757 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y),
emh203 0:085749c8446f 758 (TransformedPoint[1].X),(TransformedPoint[1].Y));
emh203 0:085749c8446f 759 }
emh203 0:085749c8446f 760
emh203 0:085749c8446f 761 TransformedPoint[0].X = (FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 762 FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].Y, Fixed_1_14_SineTable[Angle]) );
emh203 0:085749c8446f 763
emh203 0:085749c8446f 764 TransformedPoint[0].Y = ( FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 765 FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff] ) );
emh203 0:085749c8446f 766
emh203 0:085749c8446f 767 TransformedPoint[1].X = (FMul_15_0to1_14(LP->PointList[0].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 768 FMul_15_0to1_14(LP->PointList[0].Y, Fixed_1_14_SineTable[Angle]) );
emh203 0:085749c8446f 769
emh203 0:085749c8446f 770 TransformedPoint[1].Y = (FMul_15_0to1_14(LP->PointList[0].X, Fixed_1_14_SineTable[Angle]) +
emh203 0:085749c8446f 771 FMul_15_0to1_14(LP->PointList[0].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]));
emh203 0:085749c8446f 772
emh203 0:085749c8446f 773 TransformedPoint[0].X += LP->Center.X;
emh203 0:085749c8446f 774 TransformedPoint[0].Y += LP->Center.Y;
emh203 0:085749c8446f 775 TransformedPoint[1].X += LP->Center.X;
emh203 0:085749c8446f 776 TransformedPoint[1].Y += LP->Center.Y;
emh203 0:085749c8446f 777
emh203 0:085749c8446f 778 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y),
emh203 0:085749c8446f 779 (TransformedPoint[1].X),(TransformedPoint[1].Y));
emh203 0:085749c8446f 780 break;
emh203 0:085749c8446f 781 }
emh203 0:085749c8446f 782 }
emh203 0:085749c8446f 783 }
emh203 0:085749c8446f 784 /*
emh203 0:085749c8446f 785 void GFX_DrawScaledRotatedListPrimitive(BiColorRenderContext * Image,GFXListPrimitive *LP , BYTE Angle,GFXFixed_7_8 Scale, BYTE Color)
emh203 0:085749c8446f 786 {
emh203 0:085749c8446f 787 BYTE Points;
emh203 0:085749c8446f 788 BYTE i;
emh203 0:085749c8446f 789
emh203 0:085749c8446f 790 GFXRelativePoint TransformedPoint[2];
emh203 0:085749c8446f 791
emh203 0:085749c8446f 792 if(LP->NumPoints >1)
emh203 0:085749c8446f 793 {
emh203 0:085749c8446f 794 //If we are drawing non connected points, there must be an even number of them.
emh203 0:085749c8446f 795 if(LP->Connected == FALSE)
emh203 0:085749c8446f 796 {
emh203 0:085749c8446f 797 Points = LP->NumPoints>>1;
emh203 0:085749c8446f 798
emh203 0:085749c8446f 799 for(i=0;i<Points;i++)
emh203 0:085749c8446f 800 {
emh203 0:085749c8446f 801
emh203 0:085749c8446f 802 TransformedPoint[0].X = FMul_15_0to0_15(LP->PointList[i*2].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 803 FMul_15_0to0_15(LP->PointList[i*2].Y, Fixed_0_15_SineTable[Angle]);
emh203 0:085749c8446f 804
emh203 0:085749c8446f 805 TransformedPoint[0].Y = FMul_15_0to0_15(LP->PointList[i*2].X, Fixed_0_15_SineTable[Angle ]) +
emh203 0:085749c8446f 806 FMul_15_0to0_15(LP->PointList[i*2].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff]);
emh203 0:085749c8446f 807
emh203 0:085749c8446f 808 TransformedPoint[1].X = FMul_15_0to0_15(LP->PointList[(i*2)+1].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 809 FMul_15_0to0_15(LP->PointList[(i*2)+1].Y, Fixed_0_15_SineTable[Angle]);
emh203 0:085749c8446f 810
emh203 0:085749c8446f 811 TransformedPoint[1].Y = FMul_15_0to0_15(LP->PointList[(i*2)+1].X, Fixed_0_15_SineTable[Angle ]) +
emh203 0:085749c8446f 812 FMul_15_0to0_15(LP->PointList[(i*2)+1].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff]);
emh203 0:085749c8446f 813
emh203 0:085749c8446f 814
emh203 0:085749c8446f 815 TransformedPoint[0].X = FMul_15_0to7_8(TransformedPoint[0].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 816 TransformedPoint[0].Y = FMul_15_0to7_8(TransformedPoint[0].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 817 TransformedPoint[1].X = FMul_15_0to7_8(TransformedPoint[1].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 818 TransformedPoint[1].Y = FMul_15_0to7_8(TransformedPoint[1].Y,Scale) + LP->Center.Y;
emh203 0:085749c8446f 819
emh203 0:085749c8446f 820 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y),
emh203 0:085749c8446f 821 (TransformedPoint[1].X),(TransformedPoint[1].Y),Color);
emh203 0:085749c8446f 822
emh203 0:085749c8446f 823 }
emh203 0:085749c8446f 824
emh203 0:085749c8446f 825 }
emh203 0:085749c8446f 826 else
emh203 0:085749c8446f 827 {
emh203 0:085749c8446f 828 for(i=1;i<LP->NumPoints;i++)
emh203 0:085749c8446f 829 {
emh203 0:085749c8446f 830
emh203 0:085749c8446f 831 TransformedPoint[0].X = ( FMul_15_0to0_15(LP->PointList[i-1].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 832 FMul_15_0to0_15(LP->PointList[i-1].Y, Fixed_0_15_SineTable[Angle]) ) ;
emh203 0:085749c8446f 833
emh203 0:085749c8446f 834 TransformedPoint[0].Y = ( FMul_15_0to0_15(LP->PointList[i-1].X, Fixed_0_15_SineTable[Angle ]) +
emh203 0:085749c8446f 835 FMul_15_0to0_15(LP->PointList[i-1].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff] ) );
emh203 0:085749c8446f 836
emh203 0:085749c8446f 837 TransformedPoint[1].X = (FMul_15_0to0_15(LP->PointList[i].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) -
emh203 0:085749c8446f 838 FMul_15_0to0_15(LP->PointList[i].Y, Fixed_0_15_SineTable[Angle]) ) ;
emh203 0:085749c8446f 839
emh203 0:085749c8446f 840 TransformedPoint[1].Y = (FMul_15_0to0_15(LP->PointList[i].X, Fixed_0_15_SineTable[Angle ]) +
emh203 0:085749c8446f 841 FMul_15_0to0_15(LP->PointList[i].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff]) ) ;
emh203 0:085749c8446f 842
emh203 0:085749c8446f 843
emh203 0:085749c8446f 844 TransformedPoint[0].X = FMul_15_0to7_8(TransformedPoint[0].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 845 TransformedPoint[0].Y = FMul_15_0to7_8(TransformedPoint[0].Y,Scale)+ LP->Center.Y;
emh203 0:085749c8446f 846 TransformedPoint[1].X = FMul_15_0to7_8(TransformedPoint[1].X,Scale) + LP->Center.X;
emh203 0:085749c8446f 847 TransformedPoint[1].Y = FMul_15_0to7_8(TransformedPoint[1].Y,Scale)+ LP->Center.Y;
emh203 0:085749c8446f 848
emh203 0:085749c8446f 849 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y),
emh203 0:085749c8446f 850 (TransformedPoint[1].X),(TransformedPoint[1].Y),Color);
emh203 0:085749c8446f 851
emh203 0:085749c8446f 852 }
emh203 0:085749c8446f 853
emh203 0:085749c8446f 854 }
emh203 0:085749c8446f 855 }
emh203 0:085749c8446f 856 }
emh203 0:085749c8446f 857
emh203 0:085749c8446f 858 */
emh203 0:085749c8446f 859
emh203 0:085749c8446f 860