Eli Hughes / Mbed 2 deprecated RobotPowerLogger-V2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GFX.h Source File

GFX.h

00001 #include "DataTypes.h"
00002 #include "FixedMath.h"
00003 
00004 #define _INLINE_GFX_GET_PIXEL
00005 #define _INLINE_GFX_PUT_PIXEL
00006 
00007 
00008 #ifndef _GFX_H
00009 #define _GFX_H
00010 
00011 
00012 
00013 typedef struct 
00014 {
00015     SIGNED_WORD X;
00016     SIGNED_WORD Y;    
00017 } GFXDisplayPoint;
00018 
00019 
00020 typedef struct 
00021 {
00022     BitPlane RenderPlane;
00023     WORD SizeX;
00024     WORD SizeY;
00025     
00026 } RenderContext;
00027 
00028 
00029 typedef struct 
00030 {
00031     GFXDisplayPoint P1;
00032     GFXDisplayPoint P2;    
00033 } GFXDisplayBox;
00034 
00035 
00036 typedef struct 
00037 {
00038     BYTE FontWidth;
00039     BYTE FontHeight;
00040     BYTE BytesPerColumn;
00041     BYTE *FontBuffer;    
00042     BYTE *CharacterWidthTable;
00043 
00044 } GFXFont;
00045 
00046 typedef struct
00047     {
00048         SIGNED_WORD X;
00049         SIGNED_WORD Y;
00050     } GFXRelativePoint;
00051 
00052 typedef struct 
00053     {
00054             GFXDisplayPoint Center;
00055             BYTE NumPoints;
00056             BYTE DrawMode;
00057             GFXRelativePoint *PointList;
00058     } GFXListPrimitive;
00059 
00060 
00061 #define GFX_LIST_PRIMITIVE_CONNECTED        0x01
00062 #define GFX_LIST_PRIMITIVE_DISCONNECTED        0x02
00063 #define GFX_LIST_PRIMITIVE_CLOSED            0x03
00064 
00065 #define GFX_LIST_PRIMITIVE_CONNECTED_YFLIPPED            0x04
00066 #define GFX_LIST_PRIMITIVE_DISCONNECTED_YFLIPPED        0x05
00067 #define GFX_LIST_PRIMITIVE_CLOSED_YFLIPPED                0x06
00068 
00069 #define BICOLOR_BLACK    0
00070 #define BICOLOR_RED        0x1    
00071 #define BICOLOR_GREEN    0x2
00072 #define BICOLOR_YELLOW    0x3
00073 
00074 #define GFX_MAX_STRING_LEN 32
00075 
00076 //System/Hardware specific stuff
00077 void GFX_InitPhysicalScreen();
00078 void GFX_DumpRenderContextToPhysicalScreen(RenderContext *Image);
00079 void GFX_Init();
00080 void GFX_PowerUpScreen();
00081 void GFX_PowerDownScreen();
00082 
00083 //Device indepedent Functions
00084 void GFX_FullDisplayBufferClear(RenderContext *Image);
00085 void GFX_PutPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y);
00086 void GFX_DrawHline(RenderContext *Image, SIGNED_WORD XStart, SIGNED_WORD XStop, SIGNED_WORD Y);
00087 void GFX_DrawVline(RenderContext *Image, SIGNED_WORD YStart, SIGNED_WORD YStop, SIGNED_WORD X);
00088 void GFX_DrawLine(RenderContext *Image, SIGNED_WORD X1,SIGNED_WORD Y1, SIGNED_WORD X2,SIGNED_WORD Y2);
00089 void GFX_DrawBox(RenderContext *Image, GFXDisplayBox *Box);
00090 SIGNED_WORD GFX_DrawCharacter(RenderContext *Image, BYTE Character, SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont *MyFont);
00091 SIGNED_WORD GFX_GetStringWidth(CHAR * String,GFXFont * MyFont);
00092 void GFX_DrawString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont);
00093 void  GFX_printf(RenderContext * Image,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont, const char *FormatString,...);
00094 void GFX_DrawCenteredString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont);
00095 void GFX_DrawListPrimitive(RenderContext * Image,GFXListPrimitive *LP);
00096 void GFX_DrawScaledListPrimitive(RenderContext * Image,GFXListPrimitive *LP , FIXED_7_8 Scale);
00097 void GFX_DrawRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle);
00098 //void GFX_AddRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle);
00099 //void GFX_DrawScaledRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle,GFXFixed_7_8 Scale);
00100 
00101 
00102 
00103 #ifdef _INLINE_GFX_GET_PIXEL
00104 inline BYTE GFX_GetPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y)
00105 {
00106     BYTE PixelColor = 0;
00107     
00108     if((x<Image->SizeX) && (y<Image->SizeY) && (x>=0) && (y>=0))
00109     {
00110         
00111         if(BitPlane_Get(&Image->RenderPlane,x,y))
00112             PixelColor = TRUE;
00113 
00114     }
00115     
00116     return PixelColor;
00117 }
00118 #else
00119     BYTE GFX_GetPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y);
00120 #endif
00121 
00122 
00123 extern RenderContext BackBuffer;
00124 extern GFXFont Font5x7;
00125 extern GFXFont Font3x5;
00126 
00127 
00128 #define BACK_BUFFER_SIZE_X    (64)
00129 #define BACK_BUFFER_SIZE_Y  (32)
00130 
00131 #define PHYSICAL_DISPLAY_XRES                (BYTE)(64)
00132 #define PHYSICAL_DISPLAY_YRES                (BYTE)(32)
00133 #define DISPLAY_X_WIDTH_BYTE                (PHYSICAL_DISPLAY_XRES>>3)
00134 #define DISPLAY_BUFFER_TOTAL_SIZE             (DISPLAY_X_WIDTH_BYTE*PHYSICAL_DISPLAY_YRES*2)
00135 #define GREEN_DATA_BUFFER_OFFSET              (DISPLAY_X_WIDTH_BYTE * PHYSICAL_DISPLAY_YRES)
00136 #define PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES   (PHYSICAL_DISPLAY_XRES>>3)
00137 #define PHYSICAL_DISPLAY_PLANE_BUFFER_SIZE  (PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES * PHYSICAL_DISPLAY_YRES)
00138 #define PHYSICAL_DISPLAY_BUFFER_TOTAL_SIZE  (PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES * PHYSICAL_DISPLAY_YRES*2)
00139 
00140 
00141 #endif
00142 
00143