Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GFX.c
00001 #include "DataTypes.h" 00002 #include "GFX.h" 00003 #include "SmartSwitch.h" 00004 #include "FixedMath.h" 00005 00006 //Linking Functions to Physical Screen 00007 //*********************************************************************************** 00008 00009 void GFX_InitPhysicalScreen() 00010 { 00011 InitSmartSwitch(); 00012 } 00013 00014 void GFX_DumpRenderContextToPhysicalScreen(RenderContext *Image) 00015 { 00016 int x,y; 00017 00018 SmartSwitch_SS = 0; 00019 SmartSwitchWriteByte(SMART_SWITCH_CMD_DISPLAY_DATA); 00020 00021 for(y=0;y<PHYSICAL_DISPLAY_YRES;y++) 00022 { 00023 for(x=0;x<PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES;x++) 00024 { 00025 SmartSwitchWriteByte(Image->RenderPlane.BitPlaneSpace[(y*PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES) + (PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES - x - 1)]); 00026 } 00027 } 00028 SmartSwitch_SS = 1; 00029 } 00030 00031 void GFX_PowerUpScreen() 00032 { 00033 PowerUpSmartSwitch(); 00034 } 00035 00036 void GFX_PowerDownScreen() 00037 { 00038 PowerDownSmartSwitch(); 00039 } 00040 00041 //Device Independent Functions 00042 //*********************************************************************************** 00043 00044 //Reserve Space for the backbuffer 00045 00046 RenderContext BackBuffer; 00047 BYTE BackBufferRenderPlaneSpace[PHYSICAL_DISPLAY_PLANE_BUFFER_SIZE]; 00048 00049 00050 //FontData 00051 00052 #define FONT5x7_FONT_WIDTH 5 00053 #define FONT5x7_FONT_HEIGHT 8 00054 #define FONT5x7_FONT_ELEMENTS 128 00055 #define FONT5x7_FONT_COLUMN_SIZE_IN_BYTE 1 00056 00057 BYTE FontTable_Font5x7 [640] = { 00058 0x00 ,0x08 ,0x0C ,0xFA ,0x81 ,0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00101 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 , 00102 0x05 ,0x01 ,0x03 ,0x05 ,0x05 ,0x05 ,0x05 ,0x01 ,0x02 ,0x02 ,0x05 ,0x05 ,0x02 ,0x05 ,0x01 ,0x04 , 00103 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x01 ,0x01 ,0x04 ,0x04 ,0x04 ,0x05 , 00104 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x04 ,0x05 ,0x05 ,0x05 , 00105 0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x05 ,0x03 ,0x04 ,0x05 ,0x03 ,0x05 , 00106 0x02 ,0x05 ,0x04 ,0x04 ,0x05 ,0x04 ,0x04 ,0x04 ,0x04 ,0x01 ,0x04 ,0x04 ,0x01 ,0x05 ,0x04 ,0x05 , 00107 0x05 ,0x05 ,0x04 ,0x04 ,0x03 ,0x04 ,0x05 ,0x05 ,0x05 ,0x05 ,0x03 ,0x03 ,0x01 ,0x05 ,0x05 ,0x05 }; 00108 00109 #define FONT3x5_FONT_WIDTH 3 00110 #define FONT3x5_FONT_HEIGHT 5 00111 #define FONT3x5_ELEMENTS 128 00112 #define FONT3x5_FONT_COLUMN_SIZE_IN_BYTE 1 00113 00114 00115 BYTE FontTable_Font3x5 [384] = { 00116 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , 00117 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00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00158 //Staticially Allocate and setup the backbuffer space; 00159 00160 BackBuffer.RenderPlane.BitPlaneSpace = &BackBufferRenderPlaneSpace[0]; 00161 00162 BackBuffer.SizeX = BACK_BUFFER_SIZE_X; 00163 BackBuffer.SizeY = BACK_BUFFER_SIZE_Y; 00164 00165 BackBuffer.RenderPlane.SizeX = BACK_BUFFER_SIZE_X; 00166 BackBuffer.RenderPlane.SizeY = BACK_BUFFER_SIZE_Y; 00167 00168 00169 GFX_FullDisplayBufferClear(&BackBuffer); 00170 00171 //Initialize the stock fonts 00172 00173 Font5x7.CharacterWidthTable = (BYTE *)CharacterWidthTable_Font5x7; 00174 Font5x7.FontBuffer = (BYTE *)FontTable_Font5x7; 00175 Font5x7.FontHeight = FONT5x7_FONT_HEIGHT; 00176 Font5x7.FontWidth = FONT5x7_FONT_WIDTH; 00177 Font5x7.BytesPerColumn = FONT5x7_FONT_COLUMN_SIZE_IN_BYTE; 00178 00179 Font3x5.CharacterWidthTable = (BYTE *)CharacterWidthTable_Font3x5; 00180 Font3x5.FontBuffer = (BYTE *)FontTable_Font3x5; 00181 Font3x5.FontHeight = FONT3x5_FONT_HEIGHT; 00182 Font3x5.FontWidth = FONT3x5_FONT_WIDTH; 00183 Font3x5.BytesPerColumn = FONT3x5_FONT_COLUMN_SIZE_IN_BYTE; 00184 00185 GFX_InitPhysicalScreen(); 00186 00187 } 00188 00189 00190 00191 void GFX_FullDisplayBufferClear(RenderContext *Image) 00192 { 00193 BitPlane_Clear(&Image->RenderPlane); 00194 } 00195 00196 00197 void GFX_PutPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y) 00198 { 00199 if((x<Image->SizeX) && (y<Image->SizeY) && (x>=0) && (y>=0)) 00200 { 00201 BitPlane_Put(&Image->RenderPlane,x,y,TRUE); 00202 } 00203 } 00204 00205 00206 00207 #ifndef _INLINE_GFX_GET_PIXEL 00208 BYTE GFX_GetPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y) 00209 { 00210 BYTE PixelColor = 0; 00211 00212 if((x<Image->SizeX) && (y<Image->SizeY) && (x>=0) && (y>=0)) 00213 { 00214 00215 if(BitPlane_Get(&Image->RedBitPlane,x,y)) 00216 PixelColor |= BICOLOR_RED; 00217 00218 if(BitPlane_Get(&Image->GreenBitPlane,x,y)) 00219 PixelColor |= BICOLOR_GREEN; 00220 } 00221 00222 return PixelColor; 00223 } 00224 #endif 00225 00226 00227 void GFX_DrawHline(RenderContext *Image, SIGNED_WORD XStart, SIGNED_WORD XStop, SIGNED_WORD Y) 00228 { 00229 SIGNED_WORD LineStart; 00230 SIGNED_WORD LineStop; 00231 WORD i; 00232 00233 if((Y<Image->SizeY) && (Y>=0)) 00234 { 00235 if(XStart>XStop) 00236 { 00237 LineStart = XStop; 00238 LineStop = XStart; 00239 } 00240 else 00241 { 00242 LineStart = XStart; 00243 LineStop = XStop; 00244 } 00245 00246 if(LineStart<0) 00247 { 00248 LineStart = 0; 00249 } 00250 00251 if(LineStop>Image->SizeX) 00252 { 00253 LineStop = Image->SizeX-1; 00254 } 00255 00256 if(LineStart == LineStop) 00257 { 00258 GFX_PutPixel(Image,LineStart,Y); 00259 } 00260 else 00261 { 00262 for(i=LineStart; i<=LineStop ; i++) 00263 { 00264 GFX_PutPixel(Image,i,Y); 00265 } 00266 } 00267 } 00268 00269 } 00270 00271 00272 00273 void GFX_DrawVline(RenderContext *Image, SIGNED_WORD YStart, SIGNED_WORD YStop, SIGNED_WORD X) 00274 { 00275 SIGNED_WORD LineStart; 00276 SIGNED_WORD LineStop; 00277 SIGNED_WORD i; 00278 00279 if((X<Image->SizeX) && (X>=0)) 00280 { 00281 00282 if(YStart>YStop) 00283 { 00284 LineStart = YStop; 00285 LineStop = YStart; 00286 } 00287 else 00288 { 00289 LineStart = YStart; 00290 LineStop = YStop; 00291 } 00292 00293 if(LineStart<0) 00294 { 00295 LineStart = 0; 00296 } 00297 00298 00299 if(LineStop>Image->SizeY) 00300 { 00301 LineStop = Image->SizeY-1; 00302 } 00303 00304 for(i=LineStart; i<=LineStop ; i++) 00305 { 00306 GFX_PutPixel(Image,X,i); 00307 } 00308 } 00309 } 00310 00311 00312 void GFX_DrawLine(RenderContext * Image, SIGNED_WORD X1,SIGNED_WORD Y1, SIGNED_WORD X2,SIGNED_WORD Y2) 00313 { 00314 //A simple Implementation of Bresenham's line Algorithm 00315 SIGNED_WORD StartX,StopX,StartY,StopY; 00316 SIGNED_WORD dX,dY; 00317 SIGNED_WORD Y_Numerator; 00318 SIGNED_WORD X_Numerator; 00319 SIGNED_WORD Y; 00320 SIGNED_WORD X; 00321 SIGNED_WORD i; 00322 BOOL YDir = 0; 00323 //First Make sure that it is left to right 00324 //If not them flop them 00325 if(X2>X1) 00326 { 00327 StartX = X1; 00328 StopX = X2; 00329 StartY = Y1; 00330 StopY = Y2; 00331 } 00332 else 00333 { 00334 StartX = X2; 00335 StopX = X1; 00336 StartY = Y2; 00337 StopY = Y1; 00338 } 00339 GFX_PutPixel(Image, StopX,StopY); 00340 if(StopY>=StartY) 00341 { 00342 dY = StopY - StartY; 00343 YDir = 0; 00344 } 00345 else 00346 { 00347 dY = StartY - StopY; 00348 YDir = 1; 00349 } 00350 dX = StopX - StartX; 00351 //Now, if the slope is less greater than one, we need to swap all X/Y operations 00352 if(dY<=dX) 00353 { 00354 //Slope is less than one, proceed at normal and step along the x axis 00355 Y=StartY; //start the whole part of the Y value at the starting pixeel. 00356 X=StartX; 00357 //We need to start the numerator of the fraction half way through the fraction so evertyhing rounds at 00358 //fraction midpoint 00359 Y_Numerator = dX>>1; //The fraction demonimator is assumeed to be dX 00360 // out fixed point Y value is Y + (Y_Numerator / dX) 00361 //Every time we step the X coordinate by one, we need to step 00362 //out Y coordinate by dY/dX. We do this by just adding dY to our 00363 //numerator. When the numerator gets bigger than the 00364 //denomiator, the increment the whole part by one and decrement the numerator 00365 //by the denominator 00366 for(i=0;i<dX;i++) 00367 { 00368 GFX_PutPixel(Image,X,Y); 00369 X++; 00370 //Now do all the fractional stuff 00371 Y_Numerator += dY; 00372 if(Y_Numerator >= dX) 00373 { 00374 Y_Numerator-=dX; 00375 if(StopY > StartY) 00376 { 00377 Y++; 00378 } 00379 else 00380 { 00381 Y--; 00382 } 00383 } 00384 } 00385 } 00386 else 00387 { 00388 //Same as before by step along the y axis. 00389 Y=StartY; 00390 X=StartX; 00391 X_Numerator = dY>>1; 00392 for(i=0;i<dY;i++) 00393 { 00394 GFX_PutPixel(Image,X,Y); 00395 //Now do all the fractional stuff 00396 if(YDir) 00397 { 00398 Y--; 00399 } 00400 else 00401 { 00402 Y++; 00403 } 00404 X_Numerator += dX; 00405 if(X_Numerator >= dY) 00406 { 00407 X_Numerator-=dY; 00408 if(StopX > StartX) 00409 { 00410 X++; 00411 } 00412 else 00413 { 00414 X--; 00415 } 00416 } 00417 } 00418 } 00419 } 00420 00421 00422 00423 00424 00425 void GFX_DrawBox(RenderContext *Image, GFXDisplayBox *Box) 00426 { 00427 GFX_DrawHline(Image,Box->P1.X,Box->P2.X,Box->P1.Y); 00428 GFX_DrawHline(Image,Box->P1.X,Box->P2.X,Box->P2.Y); 00429 GFX_DrawVline(Image,Box->P1.Y,Box->P2.Y,Box->P1.X); 00430 GFX_DrawVline(Image,Box->P1.Y,Box->P2.Y,Box->P2.X); 00431 } 00432 00433 00434 00435 SIGNED_WORD GFX_DrawCharacter(RenderContext * Image,BYTE Character,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont) 00436 { 00437 BYTE i,j,Mask; 00438 WORD CharStartIndex,ColumnStartIndex,ByteOffset; 00439 00440 CharStartIndex = (Character * (MyFont->BytesPerColumn) * (MyFont->FontWidth)); 00441 00442 for(j=0;j<MyFont->CharacterWidthTable[Character];j++) 00443 { 00444 //Draw the current slice 00445 ColumnStartIndex = j* (MyFont->BytesPerColumn); 00446 00447 for(i=0;i<MyFont->FontHeight;i++) 00448 { 00449 ByteOffset = i>>3; 00450 Mask = 0x01 << (i&0x07); 00451 00452 if( (MyFont->FontBuffer[CharStartIndex + ColumnStartIndex + ByteOffset]) & Mask) 00453 { 00454 GFX_PutPixel(Image, StartX, StartY + i); 00455 } 00456 } 00457 StartX++; 00458 } 00459 return StartX; 00460 } 00461 00462 00463 SIGNED_WORD GFX_GetStringWidth(CHAR * String,GFXFont * MyFont) 00464 { 00465 BYTE Ptr = 0; 00466 BYTE NextChar; 00467 SIGNED_WORD StringSize = 0; 00468 00469 NextChar = String[Ptr]; 00470 Ptr++; 00471 00472 while((NextChar!=0) && (Ptr <GFX_MAX_STRING_LEN)) 00473 { 00474 StringSize += MyFont->CharacterWidthTable[NextChar] + 1; 00475 NextChar = String[Ptr]; 00476 Ptr++; 00477 } 00478 00479 return StringSize; 00480 } 00481 00482 void GFX_DrawCenteredString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont) 00483 { 00484 StartX -= (GFX_GetStringWidth(String,MyFont)>>1); 00485 GFX_DrawString(Image,String,StartX,StartY,MyFont); 00486 } 00487 00488 void GFX_DrawString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont) 00489 { 00490 00491 BYTE Ptr = 0; 00492 BYTE NextChar; 00493 00494 NextChar = String[Ptr]; 00495 00496 while((NextChar!=0) && (Ptr <GFX_MAX_STRING_LEN)) 00497 { 00498 StartX = GFX_DrawCharacter(Image,NextChar,StartX,StartY,MyFont); 00499 Ptr++; 00500 NextChar = String[Ptr]; 00501 StartX++; 00502 } 00503 00504 } 00505 00506 00507 CHAR GFXStringBuf[64]; 00508 00509 void GFX_printf(RenderContext * Image,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont, const char *FormatString,...) 00510 { 00511 va_list argptr; 00512 va_start(argptr,FormatString); 00513 vsprintf((CHAR *)GFXStringBuf,FormatString,argptr); 00514 va_end(argptr); 00515 00516 GFX_DrawString(Image,GFXStringBuf,StartX,StartY,MyFont); 00517 } 00518 00519 00520 00521 void GFX_DrawListPrimitive(RenderContext * Image,GFXListPrimitive *LP) 00522 { 00523 BYTE Points; 00524 BYTE i; 00525 00526 if(LP->NumPoints >1) 00527 { 00528 00529 switch(LP->DrawMode) 00530 { 00531 00532 default: 00533 case GFX_LIST_PRIMITIVE_CLOSED: 00534 for(i=1;i<LP->NumPoints;i++) 00535 { 00536 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i-1].Y + LP->Center.Y), 00537 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i].Y + LP->Center.Y)); 00538 } 00539 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), 00540 (SIGNED_WORD)(LP->PointList[0].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[0].Y + LP->Center.Y)); 00541 break; 00542 00543 case GFX_LIST_PRIMITIVE_CONNECTED: 00544 for(i=1;i<LP->NumPoints;i++) 00545 { 00546 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i-1].Y + LP->Center.Y), 00547 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i].Y + LP->Center.Y)); 00548 } 00549 break; 00550 00551 case GFX_LIST_PRIMITIVE_DISCONNECTED: 00552 Points = LP->NumPoints>>1; 00553 for(i=0;i<Points;i++) 00554 { 00555 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i*2].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i*2].Y + LP->Center.Y), 00556 (SIGNED_WORD)(LP->PointList[i*2+1].X + LP->Center.X),(SIGNED_WORD)(LP->PointList[i*2+1].Y + LP->Center.Y)); 00557 } 00558 break; 00559 00560 case GFX_LIST_PRIMITIVE_CLOSED_YFLIPPED: 00561 for(i=1;i<LP->NumPoints;i++) 00562 { 00563 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i-1].Y + LP->Center.Y), 00564 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i].Y + LP->Center.Y)); 00565 } 00566 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), 00567 (SIGNED_WORD)(LP->PointList[0].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[0].Y + LP->Center.Y)); 00568 break; 00569 00570 case GFX_LIST_PRIMITIVE_CONNECTED_YFLIPPED: 00571 for(i=1;i<LP->NumPoints;i++) 00572 { 00573 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i-1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i-1].Y + LP->Center.Y), 00574 (SIGNED_WORD)(LP->PointList[i].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i].Y + LP->Center.Y)); 00575 } 00576 break; 00577 00578 case GFX_LIST_PRIMITIVE_DISCONNECTED_YFLIPPED: 00579 Points = LP->NumPoints>>1; 00580 for(i=0;i<Points;i++) 00581 { 00582 GFX_DrawLine(Image,(SIGNED_WORD)(LP->PointList[i*2].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i*2].Y + LP->Center.Y), 00583 (SIGNED_WORD)(LP->PointList[i*2+1].X + LP->Center.X),(SIGNED_WORD)(-LP->PointList[i*2+1].Y + LP->Center.Y)); 00584 } 00585 break; 00586 00587 } 00588 } 00589 } 00590 00591 00592 00593 00594 void GFX_DrawScaledListPrimitive(RenderContext * Image,GFXListPrimitive *LP , FIXED_7_8 Scale) 00595 { 00596 BYTE Points; 00597 BYTE i; 00598 GFXRelativePoint TransformedPoint[2] = {0}; 00599 00600 if(LP->NumPoints >1) 00601 { 00602 switch(LP->DrawMode) 00603 { 00604 00605 default: 00606 case GFX_LIST_PRIMITIVE_CLOSED: 00607 for(i=1;i<LP->NumPoints;i++) 00608 { 00609 00610 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[i-1].X,Scale) + LP->Center.X; 00611 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[i-1].Y,Scale) + LP->Center.Y; 00612 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[i].X,Scale) + LP->Center.X; 00613 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[i].Y,Scale) + LP->Center.Y; 00614 00615 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y, 00616 TransformedPoint[1].X,TransformedPoint[1].Y); 00617 00618 } 00619 00620 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[LP->NumPoints-1].X,Scale) + LP->Center.X; 00621 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[LP->NumPoints-1].Y,Scale) + LP->Center.Y; 00622 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[0].X,Scale) + LP->Center.X; 00623 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[0].Y,Scale) + LP->Center.Y; 00624 00625 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y, 00626 TransformedPoint[1].X,TransformedPoint[1].Y); 00627 00628 break; 00629 00630 case GFX_LIST_PRIMITIVE_CONNECTED: 00631 for(i=1;i<LP->NumPoints;i++) 00632 { 00633 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[i-1].X,Scale) + LP->Center.X; 00634 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[i-1].Y,Scale) + LP->Center.Y; 00635 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[i].X,Scale) + LP->Center.X; 00636 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[i].Y,Scale) + LP->Center.Y; 00637 00638 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y, 00639 TransformedPoint[1].X,TransformedPoint[1].Y); 00640 } 00641 break; 00642 00643 case GFX_LIST_PRIMITIVE_DISCONNECTED: 00644 Points = LP->NumPoints>>1; 00645 00646 for(i=0;i<Points;i++) 00647 { 00648 TransformedPoint[0].X = FMul_15_0to7_8(LP->PointList[i*2].X,Scale) + LP->Center.X; 00649 TransformedPoint[0].Y = FMul_15_0to7_8(LP->PointList[i*2].Y,Scale) + LP->Center.Y; 00650 TransformedPoint[1].X = FMul_15_0to7_8(LP->PointList[(i*2)+1].X,Scale) + LP->Center.X; 00651 TransformedPoint[1].Y = FMul_15_0to7_8(LP->PointList[(i*2)+1].Y,Scale) + LP->Center.Y; 00652 00653 GFX_DrawLine(Image,TransformedPoint[0].X,TransformedPoint[0].Y, 00654 TransformedPoint[1].X,TransformedPoint[1].Y); 00655 } 00656 break; 00657 00658 } 00659 00660 } 00661 00662 } 00663 00664 void GFX_DrawRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle, BYTE Color) 00665 { 00666 BYTE Points; 00667 BYTE i; 00668 00669 GFXRelativePoint TransformedPoint[2] = {0}; 00670 00671 if(LP->NumPoints >1) 00672 { 00673 //If we are drawing non connected points, there must be an even number of them. 00674 switch(LP->DrawMode) 00675 { 00676 case GFX_LIST_PRIMITIVE_DISCONNECTED: 00677 00678 Points = LP->NumPoints>>1; 00679 00680 for(i=0;i<Points;i++) 00681 { 00682 00683 TransformedPoint[0].X = FMul_15_0to1_14((LP->PointList[i*2].X), Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00684 FMul_15_0to1_14(LP->PointList[i*2].Y, Fixed_1_14_SineTable[Angle]); 00685 00686 TransformedPoint[0].Y = FMul_15_0to1_14(LP->PointList[i*2].X, Fixed_1_14_SineTable[Angle ]) + 00687 FMul_15_0to1_14(LP->PointList[i*2].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]); 00688 00689 TransformedPoint[1].X = FMul_15_0to1_14(LP->PointList[(i*2)+1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00690 FMul_15_0to1_14(LP->PointList[(i*2)+1].Y, Fixed_1_14_SineTable[Angle]); 00691 00692 TransformedPoint[1].Y = FMul_15_0to1_14(LP->PointList[(i*2)+1].X, Fixed_1_14_SineTable[Angle]) + 00693 FMul_15_0to1_14(LP->PointList[(i*2)+1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff]); 00694 00695 00696 TransformedPoint[0].X += LP->Center.X; 00697 TransformedPoint[0].Y += LP->Center.Y; 00698 TransformedPoint[1].X += LP->Center.X; 00699 TransformedPoint[1].Y += LP->Center.Y; 00700 00701 00702 GFX_DrawLine(Image,(TransformedPoint[0].X + LP->Center.X),(TransformedPoint[0].Y + LP->Center.Y), 00703 (TransformedPoint[1].X + LP->Center.X),(TransformedPoint[1].Y + LP->Center.Y)); 00704 } 00705 break; 00706 00707 case GFX_LIST_PRIMITIVE_CONNECTED: 00708 00709 for(i=1;i<LP->NumPoints;i++) 00710 { 00711 00712 TransformedPoint[0].X = (FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00713 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[Angle]) ); 00714 00715 TransformedPoint[0].Y = ( FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[Angle]) + 00716 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff] ) ); 00717 00718 TransformedPoint[1].X = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00719 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[Angle]) ); 00720 00721 TransformedPoint[1].Y = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[Angle]) + 00722 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff])); 00723 00724 TransformedPoint[0].X += LP->Center.X; 00725 TransformedPoint[0].Y += LP->Center.Y; 00726 TransformedPoint[1].X += LP->Center.X; 00727 TransformedPoint[1].Y += LP->Center.Y; 00728 00729 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y), 00730 (TransformedPoint[1].X),(TransformedPoint[1].Y)); 00731 00732 } 00733 break; 00734 default: 00735 case GFX_LIST_PRIMITIVE_CLOSED: 00736 00737 for(i=1;i<LP->NumPoints;i++) 00738 { 00739 00740 TransformedPoint[0].X = (FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00741 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[Angle]) ); 00742 00743 TransformedPoint[0].Y = ( FMul_15_0to1_14(LP->PointList[i-1].X, Fixed_1_14_SineTable[Angle]) + 00744 FMul_15_0to1_14(LP->PointList[i-1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff] ) ); 00745 00746 TransformedPoint[1].X = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00747 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[Angle]) ); 00748 00749 TransformedPoint[1].Y = (FMul_15_0to1_14(LP->PointList[i].X, Fixed_1_14_SineTable[Angle]) + 00750 FMul_15_0to1_14(LP->PointList[i].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff])); 00751 00752 TransformedPoint[0].X += LP->Center.X; 00753 TransformedPoint[0].Y += LP->Center.Y; 00754 TransformedPoint[1].X += LP->Center.X; 00755 TransformedPoint[1].Y += LP->Center.Y; 00756 00757 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y), 00758 (TransformedPoint[1].X),(TransformedPoint[1].Y)); 00759 } 00760 00761 TransformedPoint[0].X = (FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00762 FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].Y, Fixed_1_14_SineTable[Angle]) ); 00763 00764 TransformedPoint[0].Y = ( FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].X, Fixed_1_14_SineTable[Angle]) + 00765 FMul_15_0to1_14(LP->PointList[LP->NumPoints-1].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff] ) ); 00766 00767 TransformedPoint[1].X = (FMul_15_0to1_14(LP->PointList[0].X, Fixed_1_14_SineTable[(Angle + 64)&0xff]) - 00768 FMul_15_0to1_14(LP->PointList[0].Y, Fixed_1_14_SineTable[Angle]) ); 00769 00770 TransformedPoint[1].Y = (FMul_15_0to1_14(LP->PointList[0].X, Fixed_1_14_SineTable[Angle]) + 00771 FMul_15_0to1_14(LP->PointList[0].Y, Fixed_1_14_SineTable[(Angle + 64)&0xff])); 00772 00773 TransformedPoint[0].X += LP->Center.X; 00774 TransformedPoint[0].Y += LP->Center.Y; 00775 TransformedPoint[1].X += LP->Center.X; 00776 TransformedPoint[1].Y += LP->Center.Y; 00777 00778 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y), 00779 (TransformedPoint[1].X),(TransformedPoint[1].Y)); 00780 break; 00781 } 00782 } 00783 } 00784 /* 00785 void GFX_DrawScaledRotatedListPrimitive(BiColorRenderContext * Image,GFXListPrimitive *LP , BYTE Angle,GFXFixed_7_8 Scale, BYTE Color) 00786 { 00787 BYTE Points; 00788 BYTE i; 00789 00790 GFXRelativePoint TransformedPoint[2]; 00791 00792 if(LP->NumPoints >1) 00793 { 00794 //If we are drawing non connected points, there must be an even number of them. 00795 if(LP->Connected == FALSE) 00796 { 00797 Points = LP->NumPoints>>1; 00798 00799 for(i=0;i<Points;i++) 00800 { 00801 00802 TransformedPoint[0].X = FMul_15_0to0_15(LP->PointList[i*2].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) - 00803 FMul_15_0to0_15(LP->PointList[i*2].Y, Fixed_0_15_SineTable[Angle]); 00804 00805 TransformedPoint[0].Y = FMul_15_0to0_15(LP->PointList[i*2].X, Fixed_0_15_SineTable[Angle ]) + 00806 FMul_15_0to0_15(LP->PointList[i*2].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff]); 00807 00808 TransformedPoint[1].X = FMul_15_0to0_15(LP->PointList[(i*2)+1].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) - 00809 FMul_15_0to0_15(LP->PointList[(i*2)+1].Y, Fixed_0_15_SineTable[Angle]); 00810 00811 TransformedPoint[1].Y = FMul_15_0to0_15(LP->PointList[(i*2)+1].X, Fixed_0_15_SineTable[Angle ]) + 00812 FMul_15_0to0_15(LP->PointList[(i*2)+1].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff]); 00813 00814 00815 TransformedPoint[0].X = FMul_15_0to7_8(TransformedPoint[0].X,Scale) + LP->Center.X; 00816 TransformedPoint[0].Y = FMul_15_0to7_8(TransformedPoint[0].Y,Scale) + LP->Center.Y; 00817 TransformedPoint[1].X = FMul_15_0to7_8(TransformedPoint[1].X,Scale) + LP->Center.X; 00818 TransformedPoint[1].Y = FMul_15_0to7_8(TransformedPoint[1].Y,Scale) + LP->Center.Y; 00819 00820 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y), 00821 (TransformedPoint[1].X),(TransformedPoint[1].Y),Color); 00822 00823 } 00824 00825 } 00826 else 00827 { 00828 for(i=1;i<LP->NumPoints;i++) 00829 { 00830 00831 TransformedPoint[0].X = ( FMul_15_0to0_15(LP->PointList[i-1].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) - 00832 FMul_15_0to0_15(LP->PointList[i-1].Y, Fixed_0_15_SineTable[Angle]) ) ; 00833 00834 TransformedPoint[0].Y = ( FMul_15_0to0_15(LP->PointList[i-1].X, Fixed_0_15_SineTable[Angle ]) + 00835 FMul_15_0to0_15(LP->PointList[i-1].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff] ) ); 00836 00837 TransformedPoint[1].X = (FMul_15_0to0_15(LP->PointList[i].X, Fixed_0_15_SineTable[(Angle + 64)&0xff]) - 00838 FMul_15_0to0_15(LP->PointList[i].Y, Fixed_0_15_SineTable[Angle]) ) ; 00839 00840 TransformedPoint[1].Y = (FMul_15_0to0_15(LP->PointList[i].X, Fixed_0_15_SineTable[Angle ]) + 00841 FMul_15_0to0_15(LP->PointList[i].Y, Fixed_0_15_SineTable[(Angle + 64)&0xff]) ) ; 00842 00843 00844 TransformedPoint[0].X = FMul_15_0to7_8(TransformedPoint[0].X,Scale) + LP->Center.X; 00845 TransformedPoint[0].Y = FMul_15_0to7_8(TransformedPoint[0].Y,Scale)+ LP->Center.Y; 00846 TransformedPoint[1].X = FMul_15_0to7_8(TransformedPoint[1].X,Scale) + LP->Center.X; 00847 TransformedPoint[1].Y = FMul_15_0to7_8(TransformedPoint[1].Y,Scale)+ LP->Center.Y; 00848 00849 GFX_DrawLine(Image,(TransformedPoint[0].X),(TransformedPoint[0].Y), 00850 (TransformedPoint[1].X),(TransformedPoint[1].Y),Color); 00851 00852 } 00853 00854 } 00855 } 00856 } 00857 00858 */ 00859 00860
Generated on Thu Jul 14 2022 09:05:34 by
1.7.2