⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpcgc.c

📁 使用键盘上的上、下、左、右四个按键
💻 C
字号:
///////////////////////////////////////////////////////////////////////////////////
//
//        Copyright (C) 1999 SEIKO EPSON Corp.
//        All Rights Reserved
//
//        File name :gpcgc.c
//        Function  :
//            This is a graphic context control program
//        Revision history
//            Ver 0.10 1999/06/29  H.Matsuoka           Start
//            Ver 0.11 1999/09/02  SungYoung Shin       Update        
//            Ver 0.12 1999/12/03  SungYoung Shin       Add 2Byte Font Process
//            Ver 0.13 1999/12/14  SungYoung Shin       Add function point Process
//            Ver 0.20 2000/02/28  SungYoung Shin       Update for FONTX2 Check
//            Ver 1.10 2000/07/10  SungYoung Shin       Add GCBKColor to gpcGCValues for gpcTextDraw
//                                                      Add gpcSetBkColor(),gpcGetBkColor()
//            Ver 1.90 2001/06/01  CYu                  customize to plus version
//
///////////////////////////////////////////////////////////////////////////////////

#include <gpc.h>

//#include "gpcdrv.h"

gpcGCValues gpcGC;
int gpcWidth;
int gpcHeight;

//-------------------------------------------------------------------------
//    gpcInitGc()
//
//  Initialize Graphic Memory, BPP.
//
//  Parameters:
//      
//    Returns:
//      GPC_ERR_OK
//-------------------------------------------------------------------------
U16 gpcInitGc() 
{
    extern U8 GPCFONT11A[];  // 1Byte Fontx in the gpcfonts.c
    extern U8 GPCFONT11K[];  // 2Byte Fontx in the gpcfonts.c
    U16 iWidth, iHeight;

    gpcSetColor( GPC_RED );
    gpcSetBkColor( GPC_WHITE );
    gpcSetLineWidth( GPC_NORM_WIDTH );
    gpcSetLineStyle( GPC_SOLID_LINE );

    // Get screen size
    seGetScreenSize(&iWidth, &iHeight);
    gpcWidth  = iWidth  - 1;
    gpcHeight = iHeight - 1;
    gpcGC.GCScreenWidth  = iWidth  - 1;
    gpcGC.GCScreenHeight = iHeight - 1;

    gpcSetFont( GPCFONT11A, GPCFONT11K );

//    seInit( 0 );

    return GPC_ERR_OK;
}

//------------------------------------------------------------------------------
// Function name  : gpcSetColor
// Description    : convert the color set by application to physical color, and
//                  record it into graphic context
// Return type    : U16
// Argument       : U16 color
// Remarks        : 
// So also        : 
//------------------------------------------------------------------------------
U16 gpcSetColor( RGB rgb )
{
    gpcGC.GCColorRGB = rgb;
    seRGBtoIndex( rgb, &gpcGC.GCColorIndex );

    return GPC_ERR_OK;
}

//------------------------------------------------------------------------------
// Function name  : gpcGetColor
// Description    : 
// Return type    : U16
// Argument       : RGB *rgb
// Remarks        : 
// So also        : gpcSetColor
//------------------------------------------------------------------------------
U16 gpcGetColor( RGB *rgb )
{
    *rgb = gpcGC.GCColorRGB;
    return GPC_ERR_OK;
}

//------------------------------------------------------------------------------
// Function name  : gpcSetBkColor
// Description    : 
// Return type    : U16
// Argument       : RGB rgb
// Remarks        : 
// So also        : 
//------------------------------------------------------------------------------
U16 gpcSetBkColor( RGB rgb )
{
    gpcGC.GCBkColorRGB = rgb;
    seRGBtoIndex( rgb, &gpcGC.GCBkColorIndex );

    return GPC_ERR_OK;
}

//------------------------------------------------------------------------------
// Function name  : gpcGetBkColor
// Description    : Get BackGround Color of the Current Text
// Return type    : U16
// Argument       : RGB *rgb
// Remarks        : 
// So also        : 
//------------------------------------------------------------------------------
U16 gpcGetBkColor( RGB *rgb )
{
    *rgb = gpcGC.GCBkColorRGB;
    return GPC_ERR_OK;
}

//-------------------------------------------------------------------------
//    gpcSetLineWidth()
//
//  Set Line Width .
//
//  Parameters:
//      width    - Line width to set.
//    Returns:
//      GPC_ERR_OK
//-------------------------------------------------------------------------
U16 gpcSetLineWidth( U8 width )
{
    gpcGC.GCLineWidth = width;
    return GPC_ERR_OK;
}

//-------------------------------------------------------------------------
//    gpcGetLineWidth()
//
//  Get Line Width .
//
//  Parameters:
//      width    - Get Line width.
//    Returns:
//      GPC_ERR_OK
//-------------------------------------------------------------------------
U16 gpcGetLineWidth( U8 *width )
{
    *width = gpcGC.GCLineWidth;
    return GPC_ERR_OK;
}

//-------------------------------------------------------------------------
//    gpcSetLineStyle()
//
//  Set Line Style .
//
//  Parameters:
//      style    - Set Line Style.
//    Returns:
//      GPC_ERR_OK
//-------------------------------------------------------------------------
U16 gpcSetLineStyle( U16 style )
{
    gpcGC.GCLineStyle = style;
    return GPC_ERR_OK;
}

//-------------------------------------------------------------------------
//    gpcGetLineStyle()
//
//  Get Line Style .
//
//  Parameters:
//      style    - Get Line Style.
//    Returns:
//      GPC_ERR_OK
//-------------------------------------------------------------------------
U16 gpcGetLineStyle( U16 *style )
{
    *style = gpcGC.GCLineStyle;
    return GPC_ERR_OK;
}

//-------------------------------------------------------------------------
//    gpcGetVersion()
//
//  Get Version .
//
//  Parameters:
//      
//    Returns:
//      GPC_VERSION  : version
//-------------------------------------------------------------------------
U16 gpcGetVersion(void){
    return GPC_VERSION;
}

//- end of file ------------------------------------------------------------------------

⌨️ 快捷键说明

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