欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

display.c

是一个手机功能的模拟程序
C
第 1 页 / 共 5 页
字号:

GW 05/09/01 Added size x and size y parameters to allow for chinese chars.
*/

GLOBAL UBYTE dspl_SetCursorPos (USHORT   in_X,
                                USHORT   in_Y,
                                USHORT   in_SizeX,
                                USHORT   in_SizeY
                               )
{
/*GW Removed windows test code
#if defined (WIN32)
  char bmp[5];
  int warn99;
  int ofsY;
  {
    bmp[2] = 0x00;
    bmp[3] = 0x00;
    if (in_SizeX == 6)
    {
      if (in_SizeY==8)
        ofsY = 0;
      else
        ofsY = 4;
      bmp[0] = 0x00;
      bmp[1] = '-';
      dspl_TextOut ( in_X, (USHORT)(in_Y+ofsY), 0x80, bmp);
    }
    else
    {
      bmp[0] = 0x4E;
      bmp[1] = 0x00;
      dspl_TextOut ( in_X, in_Y, 0x80, bmp);
    }
    return (DRV_OK);
  }
#endif
*/
    if(displayData.DisplayType EQ DSPL_TYPE_CHARACTER)
    {
        LCD_Cursor (in_Y, in_X);               /* set cursor position */
        if(extDisplay)                        /* if external display */
            dspl_SendDisplayReq (in_X, in_Y, NULL);
    }
    else
	{
		/* 2003/12/29 sunsj modify */
		//scrLine(in_X,in_Y+in_SizeY,in_X+in_SizeX-1,in_Y+in_SizeY);
        scrLine(in_X,in_Y+in_SizeY-1,in_X+in_SizeX-1,in_Y+in_SizeY-1);
	}
    return DRV_OK;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_ShowCursor            |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to change the status of the cursor.
            The cursor can be visible or invisible. The function returns
            the previous status of the cursor.

*/

GLOBAL UBYTE dspl_ShowCursor (UBYTE in_Show)
{
    return DSPL_CURSOR_VISIBLE;
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_SetBkgColor           |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to change the color used for
            background painting. If the color is out of range, the
            driver returns DRV_INVALID_PARAMS and leaves the color
            unchanged.

*/
GLOBAL UINT32 dspl_SetBkgColor (UINT32 in_Color)
{
    UINT32 Cur_BkgColor;
    Cur_BkgColor=dspl_GetBkgColor();
    r2d_set_background_color(r2d_g_lcd_gc,in_Color);
    return Cur_BkgColor;
}

/* Robert.Chen add, for setting sub LCD background color, 2003-12-14 */
#if R2D_SUBLCD_SUPPORT
GLOBAL UINT32 dspl_sub_SetBkgColor (UINT32 new_bkgc)
{
    UINT32 cur_bkgc;
    cur_bkgc = dspl_sub_GetBkgColor();
    r2d_set_background_color(r2d_g_sublcd_gc, new_bkgc);
    return cur_bkgc;
}
#endif


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_SetFrgColor           |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to change the color used for
            foreground painting, e.g. text color. If the color is
            out of range, the driver returns DRV_INVALID_PARAMS and
            leaves the color unchanged.
            set a call-back function which

*/
GLOBAL UINT32 dspl_SetFrgColor (UINT32 in_Color)
{
    UINT32 Cur_FrgColor;
    Cur_FrgColor = dspl_GetFrgColor();  
    r2d_set_foreground_color(r2d_g_lcd_gc,in_Color);
    return(Cur_FrgColor);
}

/* Robert.Chen add, for setting sub LCD fgd color, 2003-12-14 */
#if R2D_SUBLCD_SUPPORT
GLOBAL UINT32 dspl_sub_SetFrgColor (UINT32 new_frgc)
{
    UINT32 cur_frgc;
    cur_frgc = dspl_sub_GetFrgColor();  
    r2d_set_foreground_color(r2d_g_sublcd_gc, new_frgc);
    return(cur_frgc);
}
#endif

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_GetFrgColor                |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to get the foreground color of the r2d_g_lcd_gc,chenjun add
            this in the demand of shitong,0603

*/
GLOBAL UINT32   dspl_GetFrgColor(void)
{
    return(UINT32)r2d_get_foreground_color(r2d_g_lcd_gc);
}

/* Robert.Chen add, for getting sub LCD fgd color, 2003-12-14 */
#if R2D_SUBLCD_SUPPORT
GLOBAL UINT32   dspl_sub_GetFrgColor(void)
{
    return(UINT32)r2d_get_foreground_color(r2d_g_sublcd_gc);
}
#endif
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_GetFrgColor                |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to get the background color of the r2d_g_lcd_gc, chenjun add
            this  in the demand of shitong,0603

*/
GLOBAL UINT32 dspl_GetBkgColor(void)
{
    return(UINT32)r2d_get_background_color(r2d_g_lcd_gc);
} 

/* Robert.Chen add, for getting sub LCD bkg color, 2003-12-14 */
#if R2D_SUBLCD_SUPPORT
GLOBAL UINT32 dspl_sub_GetBkgColor(void)
{
    return(UINT32)r2d_get_background_color(r2d_g_sublcd_gc);
}
#endif
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_DrawIcon              |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to draw a driver internal icon.
            The origin of the icon is the upper left corner, defined
            by the parameters in_X/in_Y.

*/

GLOBAL UBYTE dspl_DrawIcon (UBYTE  in_IconID,
                            USHORT in_X,
                            USHORT in_Y)
{
    return DSPL_FCT_NOTSUPPORTED;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103)       MODULE  : DRV_DSPL                   |
| STATE   : code                ROUTINE : dspl_DrawLine              |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to draw a line from a specific
            location defined by the parameters in_X1/in_Y1, to a
            specific location 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 line.

*/

GLOBAL UBYTE dspl_DrawLine (USHORT in_X1,
                            USHORT in_Y1,
                            USHORT in_X2,
                            USHORT in_Y2)
{
    scrLine(in_X1,in_Y1,in_X2,in_Y2);

    return DRV_OK;
}

/*
+--------------------------------------------------------------------+
| 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_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;
}

/******************************************************/
/*                                                    */
/*Function Name:  dspl_DrawFillRect                            */
/*Purpose:        DrawFillRect    */
/*Parameter:     USHORT in_X1  in_Y1  in_X2,   in_Y2        */
/*return   :     UBYTE                      */
/*                                                    */
/*Author   :    zhou yue                     */
/*Date     :     Aug.4st,2002                           */
/******************************************************/


GLOBAL UBYTE dspl_DrawFillRect (USHORT in_X1,
                                USHORT in_Y1,
                                USHORT in_X2,
                                USHORT in_Y2)
{
    USHORT i,py,DX1=in_X1,DX2=in_X2,DY1=in_Y1,DY2=in_Y2;
    if(in_X1>in_X2)
    {
        DX1=in_X2;
        DX2=in_X1;
    }

    if(in_Y1>in_Y2)
    {
        DY1=in_Y2;
        DY2=in_Y1;
    }
    for(i=0,py=DY1;i<(DY2-DY1);i++,py++)
    {
        scrLine(DX1,py,DX2,py);
    }
    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.


*///2003 02.28 zhaowm add for displaying browser's image 

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)
{
    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;
}

/*
+--------------------------------------------------------------------+
| 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          |

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -