📄 guigraphics.c
字号:
/*
* Start of Zoran Standard Header
* Copyright (c) 2005 Zoran Corporation
*
*
* All rights reserved. Proprietary and confidential.
*
* DESCRIPTION for guigraphics.c
* Miscellaneous GUI graphics routines
*
* NEW HISTORY COMMENT (description must be followed by a blank line)
* <Enter change description here>
* ===== HISTORY of changes in //depot/imgeng/sw/se_gw/gui/guigraphics.c
*
* 15/Dec/05 #7 dstrauss Added GUIDisplayYUVImage().
* 13/Dec/05 #6 dstrauss Added GUITextWidth(), GuiTextHeight(),
* and GUIEraseRectangle().
* 12/Dec/05 #5 dstrauss Deleted uiwindows.h
* 12/Dec/05 #4 dstrauss Allow the cursor to be "normal", "modified",
* or "erase" color.
* 9/Dec/05 #3 dstrauss Added GUIStatusText().
* 6/Dec/05 #2 dstrauss Added GUICursorBox(); allow GUIText to "erase"
* text.
* 5/Dec/05 #1 dstrauss Created.
*
*
* End of Zoran Standard Header
*/
#include "standard.h"
#include "guigraphics.h"
#include "vopu.h"
#include "uitypes.h"
#include "uigdi.h"
#include "splashlogo.h"
/* Background color for the "main" screen */
#define BACKGROUND_COLOR (RGB(0xff,0xff,0xff))
/* Background color for the "status" area */
#define STATUS_BACKGROUND (RGB(0xc0, 0xc0, 0xc0))
/* Cursor-box color */
#define CURSOR_COLOR (RGB(0xff,0xff,0))
/* Cursor-box color when the display value has been modified */
#define CURSOR_MODIFIED_COLOR (RGB(0xff,0,0))
extern FONTINFO g_biuFont0;
extern PGDIDRVR LCDRGBDriverInit(void);
extern PGDIDRVR LCDYUVDriverInit(void);
PGDIDRVR guiRGBDriver;
PGDIDRVR guiYUVDriver;
static void paintStatusBackground(void)
{
GDIrect(guiRGBDriver,0, (VopuHeight() - 38), VopuWidth(), 38,
STATUS_BACKGROUND);
}
/* paint the standard screen background */
void GUIPaintBackground(void)
{
GDIsetBkg(guiRGBDriver, BACKGROUND_COLOR); /* set opaque background */
/* fill the display with the background */
GDIrect(guiRGBDriver, 0, 0, VopuWidth(), VopuHeight(), BACKGROUND_COLOR);
paintStatusBackground();
}
/* paint the logo at a specified location */
void GUIPaintLogo(int x, int y)
{
COLORREF oldBackground;
/* save current background, then set transparent background */
oldBackground = GDIgetBkg(guiRGBDriver);
GDIsetBkg(guiRGBDriver, 0xff000000 | RGB(0xff, 0xff, 0xff));
GDIimage(guiRGBDriver, x, y,
g_SplashLogo.m_w, g_SplashLogo.m_h,
g_SplashLogo.m_bits,
g_SplashLogo.m_c == icRLE,
g_SplashLogo.m_w, g_SplashLogo.m_h,
g_SplashLogo.m_s);
GDIsetBkg(guiRGBDriver, oldBackground); /* restore original background */
}
/* initialization -- init our graphics setup */
void GUIinitGraphics(void)
{
/* we initialize two drivers for the LCD; each one expects
* a different format for the source data
*/
if (LCDinitialize()) {
guiRGBDriver = LCDRGBDriverInit();
guiYUVDriver = LCDYUVDriverInit();
}
GDIinstallFont(guiRGBDriver, 0, &g_biuFont0);
GDIsetFont(guiRGBDriver, 0);
}
/* draw a text string at x,y. If "erase" is true, draw
* in the main menu background color (which "erases" the text).
*/
void GUIText(int x, int y, const char *text, int erase)
{
COLORREF oldBackground;
COLORREF textColor;
if (erase) {
textColor = BACKGROUND_COLOR;
} else {
textColor = RGB(0,0,0);
}
/* save current background, then set transparent background */
oldBackground = GDIgetBkg(guiRGBDriver);
GDIsetBkg(guiRGBDriver, 0xff000000 | BACKGROUND_COLOR);
GDItext(guiRGBDriver, x, y, 100, 100, (char *)text, textColor);
GDIsetBkg(guiRGBDriver, oldBackground); /* restore original background */
}
/* draw a cursor outline at location x,y in the color specified by "color"
*/
void GUICursorBox(int x, int y, int xlen, int ylen, eCursorColor color)
{
COLORREF boxColor;
switch (color) {
default:
case eCCNormal:
boxColor = CURSOR_COLOR;
break;
case eCCModified:
boxColor = CURSOR_MODIFIED_COLOR;
break;
case eCCErase:
boxColor = BACKGROUND_COLOR;
break;
}
GDIrect(guiRGBDriver, x, y, xlen, 2, boxColor);
GDIrect(guiRGBDriver, x + xlen, y , 2, ylen, boxColor);
GDIrect(guiRGBDriver, x, y, 2, ylen, boxColor);
GDIrect(guiRGBDriver, x, y + ylen, xlen, 2, boxColor);
}
/* draw text in the status box.
*/
void GUIStatusText(const char *text)
{
COLORREF oldBackground;
paintStatusBackground(); /* paint the status area */
/* save current background, then set transparent background */
oldBackground = GDIgetBkg(guiRGBDriver);
GDIsetBkg(guiRGBDriver, 0xff000000 | STATUS_BACKGROUND);
GDItext(guiRGBDriver, 4, (VopuHeight() - 38),
100, 100, (char *)text, RGB(0,0,0));
GDIsetBkg(guiRGBDriver, oldBackground); /* restore original background */
}
int GUITextWidth(const char *text)
{
return GDItextWidth(guiRGBDriver, (char *)text);
}
int GUITextHeight(const char *text)
{
return GDItextHeight(guiRGBDriver, (char *)text);
}
void GUIEraseRectangle(int x, int y, int w, int h)
{
GDIrect(guiRGBDriver, x, y, w, h, BACKGROUND_COLOR);
}
/* Display a YUV-encoded line-interleaved image.
* Scale the height by 2/3 to adjust for non-square
* pixels on the LCD.
*/
void GUIDisplayYUVImage(int x, int y, int w, int h, unsigned char* src)
{
GDIimage(guiYUVDriver, x, y, w, (h * 2)/3, src, FALSE, w, h, w * 3);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -