📄 display.c
字号:
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_DrawRect |
+--------------------------------------------------------------------+
PURPOSE : This function is used to draw a rectangle. The upper left
corner of the rectangle is defined by the parameters
in_X1/in_Y1. The lower right corner of the rectangle is
defined by the parameters in_X2/in_Y2.
The display磗 origin is the upper left corner with the
co-ordinates (0,0). The function uses the current
foreground color, which can be set using the
dspl_SetFrgColor (), to draw the rectangle.
*/
GLOBAL UBYTE dspl_roundRectFill (int px,
int py,
int sx,
int sy,
int border)
{
int i,j,col;
col = dspl_GetBgdColour();
scrDrawFilledRect(px-border,py, sx+border*2,sy, col );
scrDrawFilledRect(px,py-border, sx,sy+border*2, col );
for (i=0;i<border;i++)
for (j=0;j<border-i;j++)
{
scrPoint(px-i, py-j,col);
scrPoint(px+sx+i, py-j,col);
scrPoint(px+sx+i, py+sy+j,col);
scrPoint(px-i, py+sy+j,col);
}
return DRV_OK;
}
GLOBAL UBYTE dspl_roundRect (int px,
int py,
int sx,
int sy,
int border)
{
scrLine(px ,py-border, px+sx,py-border);
scrLine(px,py+sy+border, px+sx,py+sy+border);
scrLine(px-border ,py, px-border,py+sy);
scrLine(px+sx+border,py, px+sx+border,py+sy);
scrLine(px ,py-border, px-border ,py );
scrLine(px,py+sy+border, px-border,py+sy );
scrLine(px+sx,py+sy+border, px+sx+border,py+sy );
scrLine(px+sx+border,py, px+sx,py-border );
return DRV_OK;
}
GLOBAL UBYTE dspl_DrawRect (USHORT in_X1,
USHORT in_Y1,
USHORT in_X2,
USHORT in_Y2)
{
scrRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1);
return DRV_OK;
}
GLOBAL UBYTE dspl_DrawFilledRect (USHORT in_X1,
USHORT in_Y1,
USHORT in_X2,
USHORT in_Y2)
{
scrDrawFilledRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1, dspl_GetFgdColour() );
return DRV_OK;
}
GLOBAL UBYTE dspl_DrawFilledBgdRect (USHORT in_X1,
USHORT in_Y1,
USHORT in_X2,
USHORT in_Y2)
{
scrDrawFilledRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1, dspl_GetBgdColour() );
return DRV_OK;
}
GLOBAL UBYTE dspl_DrawFilledColRect (USHORT in_X1,
USHORT in_Y1,
USHORT in_X2,
USHORT in_Y2,
U32 Col)
{
scrDrawFilledRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1, Col );
return DRV_OK;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_DrawEllipse |
+--------------------------------------------------------------------+
PURPOSE : This function is used to draw an ellipse. The center of
the ellipse is the center of the bounding rectangle
specified by the parameters.
The display磗 origin is the upper left corner with the
co-ordinates (0,0). The function uses the current
foreground color, which can be set using the
dspl_SetFrgColor (), to draw the ellipse.
*/
GLOBAL UBYTE dspl_DrawEllipse (USHORT in_X1,
USHORT in_Y1,
USHORT in_X2,
USHORT in_Y2)
{
return DSPL_FCT_NOTSUPPORTED;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_BitBlt |
+--------------------------------------------------------------------+
PURPOSE : This function is used to display a bitmap at the
specified location using the raster operation provided.
The bitmap format is customer specific but must include
the size of the bitmap.
*/
GLOBAL UBYTE dspl_BitBlt2(short in_X,
short in_Y,
USHORT in_Width,
USHORT in_Height,
void * in_BmpPtr,
USHORT in_index,
int bmpFormat)
{
t_font_bitmap current_bitmap;
char *bmpPtr;
int bmpSize;
int fScale = 1;
int attr = SHOWBITMAP_NORMAL;
bmpPtr = (char *)in_BmpPtr;
if (bmpFormat == BMP_FORMAT_256_COLOUR)
{
bmpSize = in_Height*in_Width; //bitmaps are 256 colour
bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states
}
else if (bmpFormat == BMP_FORMAT_32BIT_COLOUR)
{
bmpSize = in_Height*in_Width; //bitmaps are 256 colour
bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states
}
else if (bmpFormat == BMP_FORMAT_16BIT_LCD_COLOUR)
{
#ifdef DSAMPLE_COLOUR32
fastCopyBitmap(in_X,in_Y, // start position of bitmap
in_Width, in_Height, //size of bitmap
(char*) in_BmpPtr,
in_X,in_Y, // start position of output area
in_Width, in_Height, //size of output area
dspl_GetBgdColour(), bmpFormat);
return DRV_OK;
#else
bmpSize = in_Height*in_Width*4; //bitmaps are 16bit colour
bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states
#endif
}
else if (bmpFormat == BMP_FORMAT_16BIT_LCD_COMPRESSED_COLOUR)
{
#ifdef DSAMPLE_COLOUR16
fastCopyBitmap(in_X,in_Y, // start position of bitmap
in_Width, in_Height, //size of bitmap
(char*) in_BmpPtr,
in_X,in_Y, // start position of output area
in_Width, in_Height, //size of output area
dspl_GetBgdColour(), bmpFormat);
return DRV_OK;
#else
bmpSize = in_Height*in_Width*2; //bitmaps are 16bit colour
bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states
#endif
}
else //b+w image
{
#ifdef MMI_TRACE
mmi_trace("b+w image");
#endif
if (bmpFormat == BMP_FORMAT_BW_2x4 )
{
//Temp fix to display larger b+w bitmaps (160x124)
attr = SHOWBITMAP_SCALE_2x4;
in_Width = in_Width /2;
in_Height = in_Height /4;
#ifdef MMI_TRACE
mmi_trace("Icontype = scale 2x4");
#endif
}
bmpSize = in_Height*((in_Width+7) >> 3); //bitmaps are unpacked
bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states
}
current_bitmap.height = in_Height;
current_bitmap.width = in_Width;
current_bitmap.bitmapSize = 0;// bmpSize;
current_bitmap.bitmap = bmpPtr;
current_bitmap.format = bmpFormat;
dspl_show_bitmap(in_X,in_Y, ¤t_bitmap, attr);
return DRV_OK;
}
GLOBAL UBYTE dspl_BitBlt (USHORT in_X,
USHORT in_Y,
USHORT in_Width,
USHORT in_Height,
USHORT in_Index,
void * in_BmpPtr,
USHORT in_Rop)
{
#ifdef BSAMPLE
//Use old procedure
scrBmpDraw ((int)in_X, (int) in_Y, (int) in_Width,
(int)in_Height, (int)in_Index,
(char *)in_BmpPtr, (int)in_Rop);
return DRV_OK;
#else
return (dspl_BitBlt2( (short) in_X, (short) in_Y, in_Width, in_Height, in_BmpPtr, in_Index, BMP_FORMAT_BW_UNPACKED));
#endif
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_SelectFontbyID |
+--------------------------------------------------------------------+
PURPOSE : This function is used to select a font used for
displaying text. Text can be displayed using the
functions dspl_TextOut_Cmode.
Driver specific fonts are identified be a font ID
(parameter in_Font). The definition of fonts and font
identifiers is not in scope of G23. Fonts and font
identifiers have to be defined by the customer. The
specific implementation of the display driver and the MMI
using the driver have the knowledge about the available
fonts, their identification and how to use them.
*/
GLOBAL UBYTE dspl_SelectFontbyID (UBYTE in_Font)
{
return DSPL_FCT_NOTSUPPORTED;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_SelectFontbyImage |
+--------------------------------------------------------------------+
PURPOSE : This function is used to select a font used for
displaying text. Text can be displayed using the
functions dspl_TextOut_Cmode.
Application specific fonts are identified by the parameter
in_FontPtr, the address of the buffer containing the
application specific font. The structure of the font image
in not in the scope of G23. The structure of the font images
have to be defined by the customer implementing the driver.
*/
GLOBAL UBYTE dspl_SelectFontbyImage (UBYTE * in_FontPtr)
{
return DSPL_FCT_NOTSUPPORTED;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_GetFontImage |
+--------------------------------------------------------------------+
PURPOSE : This function is used to copy the image of a font into an
application specific font buffer. The application may modify
the font. In case of a successful completion the function
returns DRV_OK. In case the size of the buffer where the
font image shall be copied to is too small the driver returns
DRV_INVALID_PARAMS. In case a specific driver implementation
does not support this functionality the driver returns
DSPL_FCT_NOTSUPPORTED.
*/
GLOBAL UBYTE dspl_GetFontImage (UBYTE in_Font,
USHORT in_Size,
UBYTE * out_FontPtr)
{
return DSPL_FCT_NOTSUPPORTED;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_GetFontHeight |
+--------------------------------------------------------------------+
PURPOSE : This function is used to retrieve the vertical size of
the currently selected font. The function returns the
height measured in logical units depending on the device
capabilities (e.g. pixels or multiple of characters). Call
the function dspl_SelectFont() to select a font.
*/
GLOBAL UBYTE dspl_GetFontHeight (void)
{
return scrFntHeight();
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_GetTextExtent |
+--------------------------------------------------------------------+
PURPOSE : This function is used to calculate the size of a 0-terminated
string, to which the parameter in_Text points. The function
returns the size needed to display the text. The value of
the size is measured in units depending on the device
capabilities (e.g. pixels or multiple of characters). Call
the function dspl_SelectFont() to select a font.
*/
GLOBAL USHORT dspl_GetTextExtent_old (char * in_Text, USHORT in_Length)
{
if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER)
return in_Length;
else
return scrFntGetLen ( in_Text, ( int ) in_Length );
}
GLOBAL USHORT dspl_GetTextExtent (char * in_Text, USHORT in_Length)
{
int nPixel=0;
int nChar = in_Length;
if (in_Text==NULL)
return(0);
if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER )
{
return in_Length;
}
scrGetRealLength(in_Text, &nChar, &nPixel);
return (nPixel);
}
int dspl_GetTextExtent2 (char * in_Text, USHORT in_Length)
{
return (dspl_GetTextExtent ( in_Text, in_Length));
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_GetNcharToFit |
+--------------------------------------------------------------------+
PURPOSE : This function is used to calculate the number of characters of the input
string that will fit into the specified width.
*/
/*SPR 1541, added function*/
//Calculate number of chars that fit in the available space.
GLOBAL USHORT dspl_GetNcharToFit (char * in_Text, USHORT pixelWidth)
{
int nPixel=pixelWidth;
int nChar= 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -