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 "FixedMath.h"
emh203 0:085749c8446f 3
emh203 0:085749c8446f 4 #define _INLINE_GFX_GET_PIXEL
emh203 0:085749c8446f 5 #define _INLINE_GFX_PUT_PIXEL
emh203 0:085749c8446f 6
emh203 0:085749c8446f 7
emh203 0:085749c8446f 8 #ifndef _GFX_H
emh203 0:085749c8446f 9 #define _GFX_H
emh203 0:085749c8446f 10
emh203 0:085749c8446f 11
emh203 0:085749c8446f 12
emh203 0:085749c8446f 13 typedef struct
emh203 0:085749c8446f 14 {
emh203 0:085749c8446f 15 SIGNED_WORD X;
emh203 0:085749c8446f 16 SIGNED_WORD Y;
emh203 0:085749c8446f 17 } GFXDisplayPoint;
emh203 0:085749c8446f 18
emh203 0:085749c8446f 19
emh203 0:085749c8446f 20 typedef struct
emh203 0:085749c8446f 21 {
emh203 0:085749c8446f 22 BitPlane RenderPlane;
emh203 0:085749c8446f 23 WORD SizeX;
emh203 0:085749c8446f 24 WORD SizeY;
emh203 0:085749c8446f 25
emh203 0:085749c8446f 26 } RenderContext;
emh203 0:085749c8446f 27
emh203 0:085749c8446f 28
emh203 0:085749c8446f 29 typedef struct
emh203 0:085749c8446f 30 {
emh203 0:085749c8446f 31 GFXDisplayPoint P1;
emh203 0:085749c8446f 32 GFXDisplayPoint P2;
emh203 0:085749c8446f 33 } GFXDisplayBox;
emh203 0:085749c8446f 34
emh203 0:085749c8446f 35
emh203 0:085749c8446f 36 typedef struct
emh203 0:085749c8446f 37 {
emh203 0:085749c8446f 38 BYTE FontWidth;
emh203 0:085749c8446f 39 BYTE FontHeight;
emh203 0:085749c8446f 40 BYTE BytesPerColumn;
emh203 0:085749c8446f 41 BYTE *FontBuffer;
emh203 0:085749c8446f 42 BYTE *CharacterWidthTable;
emh203 0:085749c8446f 43
emh203 0:085749c8446f 44 } GFXFont;
emh203 0:085749c8446f 45
emh203 0:085749c8446f 46 typedef struct
emh203 0:085749c8446f 47 {
emh203 0:085749c8446f 48 SIGNED_WORD X;
emh203 0:085749c8446f 49 SIGNED_WORD Y;
emh203 0:085749c8446f 50 } GFXRelativePoint;
emh203 0:085749c8446f 51
emh203 0:085749c8446f 52 typedef struct
emh203 0:085749c8446f 53 {
emh203 0:085749c8446f 54 GFXDisplayPoint Center;
emh203 0:085749c8446f 55 BYTE NumPoints;
emh203 0:085749c8446f 56 BYTE DrawMode;
emh203 0:085749c8446f 57 GFXRelativePoint *PointList;
emh203 0:085749c8446f 58 } GFXListPrimitive;
emh203 0:085749c8446f 59
emh203 0:085749c8446f 60
emh203 0:085749c8446f 61 #define GFX_LIST_PRIMITIVE_CONNECTED 0x01
emh203 0:085749c8446f 62 #define GFX_LIST_PRIMITIVE_DISCONNECTED 0x02
emh203 0:085749c8446f 63 #define GFX_LIST_PRIMITIVE_CLOSED 0x03
emh203 0:085749c8446f 64
emh203 0:085749c8446f 65 #define GFX_LIST_PRIMITIVE_CONNECTED_YFLIPPED 0x04
emh203 0:085749c8446f 66 #define GFX_LIST_PRIMITIVE_DISCONNECTED_YFLIPPED 0x05
emh203 0:085749c8446f 67 #define GFX_LIST_PRIMITIVE_CLOSED_YFLIPPED 0x06
emh203 0:085749c8446f 68
emh203 0:085749c8446f 69 #define BICOLOR_BLACK 0
emh203 0:085749c8446f 70 #define BICOLOR_RED 0x1
emh203 0:085749c8446f 71 #define BICOLOR_GREEN 0x2
emh203 0:085749c8446f 72 #define BICOLOR_YELLOW 0x3
emh203 0:085749c8446f 73
emh203 0:085749c8446f 74 #define GFX_MAX_STRING_LEN 32
emh203 0:085749c8446f 75
emh203 0:085749c8446f 76 //System/Hardware specific stuff
emh203 0:085749c8446f 77 void GFX_InitPhysicalScreen();
emh203 0:085749c8446f 78 void GFX_DumpRenderContextToPhysicalScreen(RenderContext *Image);
emh203 0:085749c8446f 79 void GFX_Init();
emh203 0:085749c8446f 80 void GFX_PowerUpScreen();
emh203 0:085749c8446f 81 void GFX_PowerDownScreen();
emh203 0:085749c8446f 82
emh203 0:085749c8446f 83 //Device indepedent Functions
emh203 0:085749c8446f 84 void GFX_FullDisplayBufferClear(RenderContext *Image);
emh203 0:085749c8446f 85 void GFX_PutPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y);
emh203 0:085749c8446f 86 void GFX_DrawHline(RenderContext *Image, SIGNED_WORD XStart, SIGNED_WORD XStop, SIGNED_WORD Y);
emh203 0:085749c8446f 87 void GFX_DrawVline(RenderContext *Image, SIGNED_WORD YStart, SIGNED_WORD YStop, SIGNED_WORD X);
emh203 0:085749c8446f 88 void GFX_DrawLine(RenderContext *Image, SIGNED_WORD X1,SIGNED_WORD Y1, SIGNED_WORD X2,SIGNED_WORD Y2);
emh203 0:085749c8446f 89 void GFX_DrawBox(RenderContext *Image, GFXDisplayBox *Box);
emh203 0:085749c8446f 90 SIGNED_WORD GFX_DrawCharacter(RenderContext *Image, BYTE Character, SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont *MyFont);
emh203 0:085749c8446f 91 SIGNED_WORD GFX_GetStringWidth(CHAR * String,GFXFont * MyFont);
emh203 0:085749c8446f 92 void GFX_DrawString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont);
emh203 0:085749c8446f 93 void GFX_printf(RenderContext * Image,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont, const char *FormatString,...);
emh203 0:085749c8446f 94 void GFX_DrawCenteredString(RenderContext * Image,CHAR * String,SIGNED_WORD StartX, SIGNED_WORD StartY, GFXFont * MyFont);
emh203 0:085749c8446f 95 void GFX_DrawListPrimitive(RenderContext * Image,GFXListPrimitive *LP);
emh203 0:085749c8446f 96 void GFX_DrawScaledListPrimitive(RenderContext * Image,GFXListPrimitive *LP , FIXED_7_8 Scale);
emh203 0:085749c8446f 97 void GFX_DrawRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle);
emh203 0:085749c8446f 98 //void GFX_AddRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle);
emh203 0:085749c8446f 99 //void GFX_DrawScaledRotatedListPrimitive(RenderContext * Image,GFXListPrimitive *LP , BYTE Angle,GFXFixed_7_8 Scale);
emh203 0:085749c8446f 100
emh203 0:085749c8446f 101
emh203 0:085749c8446f 102
emh203 0:085749c8446f 103 #ifdef _INLINE_GFX_GET_PIXEL
emh203 0:085749c8446f 104 inline BYTE GFX_GetPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y)
emh203 0:085749c8446f 105 {
emh203 0:085749c8446f 106 BYTE PixelColor = 0;
emh203 0:085749c8446f 107
emh203 0:085749c8446f 108 if((x<Image->SizeX) && (y<Image->SizeY) && (x>=0) && (y>=0))
emh203 0:085749c8446f 109 {
emh203 0:085749c8446f 110
emh203 0:085749c8446f 111 if(BitPlane_Get(&Image->RenderPlane,x,y))
emh203 0:085749c8446f 112 PixelColor = TRUE;
emh203 0:085749c8446f 113
emh203 0:085749c8446f 114 }
emh203 0:085749c8446f 115
emh203 0:085749c8446f 116 return PixelColor;
emh203 0:085749c8446f 117 }
emh203 0:085749c8446f 118 #else
emh203 0:085749c8446f 119 BYTE GFX_GetPixel(RenderContext *Image, SIGNED_WORD x, SIGNED_WORD y);
emh203 0:085749c8446f 120 #endif
emh203 0:085749c8446f 121
emh203 0:085749c8446f 122
emh203 0:085749c8446f 123 extern RenderContext BackBuffer;
emh203 0:085749c8446f 124 extern GFXFont Font5x7;
emh203 0:085749c8446f 125 extern GFXFont Font3x5;
emh203 0:085749c8446f 126
emh203 0:085749c8446f 127
emh203 0:085749c8446f 128 #define BACK_BUFFER_SIZE_X (64)
emh203 0:085749c8446f 129 #define BACK_BUFFER_SIZE_Y (32)
emh203 0:085749c8446f 130
emh203 0:085749c8446f 131 #define PHYSICAL_DISPLAY_XRES (BYTE)(64)
emh203 0:085749c8446f 132 #define PHYSICAL_DISPLAY_YRES (BYTE)(32)
emh203 0:085749c8446f 133 #define DISPLAY_X_WIDTH_BYTE (PHYSICAL_DISPLAY_XRES>>3)
emh203 0:085749c8446f 134 #define DISPLAY_BUFFER_TOTAL_SIZE (DISPLAY_X_WIDTH_BYTE*PHYSICAL_DISPLAY_YRES*2)
emh203 0:085749c8446f 135 #define GREEN_DATA_BUFFER_OFFSET (DISPLAY_X_WIDTH_BYTE * PHYSICAL_DISPLAY_YRES)
emh203 0:085749c8446f 136 #define PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES (PHYSICAL_DISPLAY_XRES>>3)
emh203 0:085749c8446f 137 #define PHYSICAL_DISPLAY_PLANE_BUFFER_SIZE (PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES * PHYSICAL_DISPLAY_YRES)
emh203 0:085749c8446f 138 #define PHYSICAL_DISPLAY_BUFFER_TOTAL_SIZE (PHYSICAL_DISPLAY_X_WIDTH_IN_BYTES * PHYSICAL_DISPLAY_YRES*2)
emh203 0:085749c8446f 139
emh203 0:085749c8446f 140
emh203 0:085749c8446f 141 #endif
emh203 0:085749c8446f 142
emh203 0:085749c8446f 143