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

📄 gfx_drawlib.c.svn-base

📁 sigmadesign smp8623 gui source code ,bingo
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
	{		for (i = 0; i < RMasciiLength(prop.text); i++)		{			prop.text[i] = ((prop.text[i] >= '0' && prop.text[i] <= '9') ? '*' : '\0');		}	}	rect.x += 5;	status = gfxTTDrawString(pRua, &rect, &prop, NULL);	//		status = DrawString(pRua, &rect, &txt, fontindex);	//	}	return BitBlt(pRua);}/* draw text */RMstatus gfxDrawString(struct RUA *pRua, RMuint16 xOrigen, RMuint16 yOrigen, RMStringObject *obj){	RMstatus status = RM_OK;	//	RMuint8 fontindex;//, predeffontindex;	GFXLib_rect rect, rc, rctext;	//	GFXLib_textdata txt;	//	RMtextitem lines[MAX_STR_LINES];	//	RMuint8 count = 0;	RMuint8 i;	//	RMuint16 maxwidth, maxheight;	//	RMuint8 fontheight;	RMuint32 color;	Prop prop;	prop.trunc = TRUNC_NONE;	if (obj->visible == FALSE)		return RM_OK;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	rect.x = obj->x + xOrigen;	rect.y = obj->y + yOrigen;	rect.width = obj->width;	rect.height = obj->height;	//	status = GetFontIndex(pRua, obj->fontfile, obj->charwidth, &fontindex);	//	if(RMFAILED(status))	//		return status;	//	status = SetOutputSurface(pRua);	//	if(RMFAILED(status))	//		return status;	if (obj->outlinecolor & 0xff000000)	{		rc.x = rect.x - 2;		rc.y = rect.y - 2;		rc.width = rect.width + 4;		rc.height = rect.height + 4;		color = obj->hasfocus ? obj->selectioncolor : obj->outlinecolor;		RectOutline(pRua, &rc, color, FALSE, FALSE, 0); // only rounded supported -- last param not important since we are not blending	}	// fill the palette	//	SetTextPalette(pRua, obj->foregroundcolor, obj->backgroundcolor, obj->transparentbackground);	// [RC] assuming 1bpp	//	SetTextColorFormat(pRua);	//	status = getPredefinedFontIndex(GetBmpPath(fontindex), &predeffontindex);	//	if(RMFAILED(status))	//		return status;	//	fontheight = getFontHeight(predeffontindex);	//	gfxGetTextExtents(pRua, &prop, &rctext);	//	//	// break up string	//	maxwidth = rect.width;	//	maxheight = yOrigen + obj->y + obj->height;	//	//	rect.x = obj->x + xOrigen;	//	rect.width = maxwidth;	//	rect.height = rctext.height;	//	count = getTextLines(obj->text, predeffontindex, maxwidth, MAX_STR_LENGTH, MAX_STR_LINES, lines);	//	for(i = 0; i < count; i++){	RMMemset(&prop, 0, sizeof(Prop));	RMCopyAscii(prop.text, obj->text/*lines[0]*/);	prop.alignment = obj->textalign;	prop.fgColor = obj->backgroundcolor;	prop.bgColor = obj->foregroundcolor;// & 0x00FFFFFF;	//		txt.transparentbackground = obj->transparentbackground;	prop.scale = atoi(obj->fontfile);	gfxGetTextExtents(pRua, &prop, &rctext);	// break up string	//	maxwidth = rect.width;	//	maxheight = yOrigen + obj->y + obj->height;	//	rect.x = obj->x;// + xOrigen;	//	rect.width = maxwidth;	//	rect.height = rctext.height;	// calculate position and correct accordingly	//		rect.y = rect.height + obj->y + yOrigen;	//		printf("<<<<<<<<<<<<<<<<<<<<<<<(x, y, w, h) (%ld, %ld, %ld, %ld)\n", rect.x, rect.y, rect.width, rect.height);	// verify we are not going beyond clipping area	//		if((rect.y + rect.height) > maxheight){	//			status = RM_ERROR;	//			break;	//		}	//		txt.hasfocus = obj->hasfocus;	//		txt.outlinecolor = obj->outlinecolor;	//		txt.selectioncolor = obj->selectioncolor;	//		txt.inputchar = obj->inputchar;	//		txt.password = (obj->type == STRING_PASSWORD);	//		txt.input = (obj->type != STRING_UNKNOWN);	if (obj->type == STRING_PASSWORD)	{		for (i = 0; i < RMasciiLength(prop.text); i++)		{			prop.text[i] = ((prop.text[i] >= '0' && prop.text[i] <= '9') ? '*' : '\0');		}	}	rect.x += 5;	status = gfxTTDrawString(pRua, &rect, &prop, NULL);	//		status = DrawString(pRua, &rect, &txt, fontindex);	//	}	return BitBlt(pRua);}RMstatus gfxReplaceString(struct RUA *pRua, RMPageObject *page, RMStringObject *obj, RMascii *str){	//	RMstatus status = RM_OK;	//	RMuint8 fontindex, predeffontindex;	//	GFXLib_rect rect, rc;	//	GFXLib_textdata txt;	//	RMtextitem lines[MAX_STR_LINES];	//	RMuint8 count = 0;	//	RMuint8 i;	//	RMuint16 maxheight, maxwidth;	//	RMuint8 fontheight;	//	RMuint32 color;	//	//	if(obj->visible == FALSE)	//		return RM_OK;	//	//	rect.x = obj->x;	//	rect.y = obj->y;	//	rect.width = obj->width;	//	rect.height = obj->height;	//	//	// repaint area occupied by string	//	DrawPageRect(pRua, page, &rect);	//	//	if(obj->outlinecolor & 0xff000000){	//		rc.x = rect.x - 2;	//		rc.y = rect.y - 2;	//		rc.width = rect.width + 4;	//		rc.height = rect.height + 4;	//		color = obj->hasfocus ? obj->selectioncolor : obj->outlinecolor;	//		RectOutline(pRua, &rc, color, TRUE, FALSE, 0);	// only rounded supported -- last param not important since we are not blending	//	}	//	//	status = GetFontIndex(pRua, obj->fontfile, obj->charwidth, &fontindex);	//	if(RMFAILED(status))	//		return status;	//	//	//	// fill the palette and color format	//	SetTextPalette(pRua, obj->foregroundcolor, obj->backgroundcolor, obj->transparentbackground);	// [RC] assuming 1bpp	//	SetTextColorFormat(pRua);	//	//	status = getPredefinedFontIndex(GetBmpPath(fontindex), &predeffontindex);	//	//	if(RMFAILED(status))	//		return status;	//	fontheight = getFontHeight(predeffontindex);	//	//	// break up string	//	maxwidth = rect.width;	//	maxheight = obj->y + obj->height;	//	//	rect.x = obj->x;	//	rect.width = maxwidth;	//	rect.height = fontheight;	//	//	count = getTextLines(str, predeffontindex, maxwidth, MAX_STR_LENGTH, MAX_STR_LINES, lines);	//	for(i = 0; i < count; i++){	//		RMMemset(&txt, 0, sizeof(txt));	//		RMNCopyAscii(txt.text, lines[i], MAX_STR_LENGTH);	//		txt.alignment = obj->textalign;	//		txt.foregroundcolor = obj->foregroundcolor;	//		txt.backgroundcolor = obj->backgroundcolor;	//		txt.transparentbackground = obj->transparentbackground;	//		txt.hasfocus = obj->hasfocus;	//		txt.outlinecolor = obj->outlinecolor;	//		txt.selectioncolor = obj->selectioncolor;	//		txt.inputchar = obj->inputchar;	//		txt.password = (obj->type == STRING_PASSWORD);	//		txt.input = (obj->type != STRING_UNKNOWN);	//	//		// calculate position and correct accordingly	//		rect.y = rect.height * i + obj->y;	////		printf("<<<<<<<<<<<<<<<<<<<<<<<(x, y, w, h) (%ld, %ld, %ld, %ld)\n", rect.x, rect.y, rect.width, rect.height);	//	//		// verify we are not going beyond clipping area	//		if((rect.y + rect.height) > maxheight){	//			status = RM_ERROR;	//			break;	//		}	//	//		status = DrawString(pRua, &rect, &txt, fontindex);	//	}	//	//	return status;	RMstatus status = RM_OK;	//	RMuint8 fontindex;//, predeffontindex;	GFXLib_rect rect, /*rc,*/rctext;	//	GFXLib_textdata txt;	//	RMtextitem lines[MAX_STR_LINES];	//	RMuint8 count = 0;	//	RMuint8 i;	//	RMuint16 maxwidth, maxheight;	//	RMuint8 fontheight;	//	RMuint32 color;	Prop prop;	prop.trunc = TRUNC_NONE;	if (obj->visible == FALSE)		return RM_OK;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	rect.x = obj->x;	rect.y = obj->y;	rect.width = obj->width;	rect.height = obj->height;	//	status = GetFontIndex(pRua, obj->fontfile, obj->charwidth, &fontindex);	//	if(RMFAILED(status))	//		return status;	//	status = SetOutputSurface(pRua);	//	if(RMFAILED(status))	//		return status;	//	if(obj->outlinecolor & 0xff000000){	//		rc.x = rect.x - 2;	//		rc.y = rect.y - 2;	//		rc.width = rect.width + 4;	//		rc.height = rect.height + 4;	//		color = obj->hasfocus ? obj->selectioncolor : obj->outlinecolor;	//		RectOutline(pRua, &rc, color, TRUE, FALSE, 0);	// only rounded supported -- last param not important since we are not blending	//	}	// fill the palette	//	SetTextPalette(pRua, obj->foregroundcolor, obj->backgroundcolor, obj->transparentbackground);	// [RC] assuming 1bpp	//	SetTextColorFormat(pRua);	//	status = getPredefinedFontIndex(GetBmpPath(fontindex), &predeffontindex);	//	if(RMFAILED(status))	//		return status;	//	fontheight = getFontHeight(predeffontindex);	//	gfxGetTextExtents(pRua, &prop, &rctext);	//	//	// break up string	//	maxwidth = rect.width;	//	maxheight = yOrigen + obj->y + obj->height;	//	//	rect.x = obj->x + xOrigen;	//	rect.width = maxwidth;	//	rect.height = rctext.height;	//	count = getTextLines(obj->text, predeffontindex, maxwidth, MAX_STR_LENGTH, MAX_STR_LINES, lines);	//	for(i = 0; i < count; i++){	RMMemset(&prop, 0, sizeof(Prop));	RMCopyAscii(prop.text, str/*lines[0]*/);	prop.alignment = obj->textalign;	prop.fgColor = obj->backgroundcolor;	prop.bgColor = obj->foregroundcolor;// & 0x00FFFFFF;	//		txt.transparentbackground = obj->transparentbackground;	prop.scale = atoi(obj->fontfile);	gfxGetTextExtents(pRua, &prop, &rctext);	// break up string	//	maxwidth = rect.width;	//	maxheight = yOrigen + obj->y + obj->height;	//	rect.x = obj->x;// + xOrigen;	//	rect.width = maxwidth;	//	rect.height = rctext.height;	// calculate position and correct accordingly	//		rect.y = rect.height + obj->y + yOrigen;	//		printf("<<<<<<<<<<<<<<<<<<<<<<<(x, y, w, h) (%ld, %ld, %ld, %ld)\n", rect.x, rect.y, rect.width, rect.height);	// verify we are not going beyond clipping area	//		if((rect.y + rect.height) > maxheight){	//			status = RM_ERROR;	//			break;	//		}	//		txt.hasfocus = obj->hasfocus;	//		txt.outlinecolor = obj->outlinecolor;	//		txt.selectioncolor = obj->selectioncolor;	//		txt.inputchar = obj->inputchar;	//		txt.password = (obj->type == STRING_PASSWORD);	//		txt.input = (obj->type != STRING_UNKNOWN);	gfxHideString(pRua, page, obj);	status = gfxTTDrawString(pRua, &rect, &prop, NULL);	//		status = DrawString(pRua, &rect, &txt, fontindex);	//	}	return BitBlt(pRua);}RMstatus gfxReplacePopupString(struct RUA *pRua, RMBitmapObject *bitmap, RMStringObject *obj, RMascii *str){	RMstatus status = RM_OK;	RMuint8 bmpindex;//fontindex, , predeffontindex	GFXLib_rect rect, rc, rctext;	//	GFXLib_textdata txt;	RMuint16 x, y;	//	RMtextitem lines[MAX_STR_LINES];	//	RMuint8 count = 0;	RMuint8 i;	//	RMuint16 maxheight, maxwidth;	//	RMuint8 fontheight;	RMuint32 color;	Prop prop;	prop.trunc = TRUNC_NONE;	if (obj->visible == FALSE)		return RM_OK;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	//	// repaint area occupied by string	////	printf("replacing %s file %s\n", obj->text, bitmap->file);	status = GetBitmapIndex(pRua, bitmap->file, &bmpindex, TRUE);	if (RMFAILED(status))		return status;	x = bitmap->x + obj->x;	y = bitmap->y + obj->y;	rect.x = obj->x;	rect.y = obj->y;	rect.width = obj->width;	rect.height = obj->height;	if (obj->type != STRING_SELECTION)		DrawBitmapRecktBlendBack(pRua, x, y, &rect, 0, TRUE, bmpindex);	//status = DrawBitmapRect(pRua, x, y, &rect, 0, TRUE, bmpindex);	if (RMFAILED(status))		return status;	rect.x = bitmap->x + obj->x;	rect.y = bitmap->y + obj->y;	//	status = GetFontIndex(pRua, obj->fontfile, obj->charwidth, &fontindex);	//	if(RMFAILED(status))	//		return status;	//	//	status = SetOutputSurface(pRua);	//	if(RMFAILED(status))	//		return status;	//	if (obj->outlinecolor & 0xff000000)	{		rc.x = x - 2;		rc.y = y - 2;		rc.width = rect.width + 4;		rc.height = rect.height + 4;		color = obj->hasfocus ? obj->selectioncolor : obj->outlinecolor;		RectOutline(pRua, &rc, color, FALSE, FALSE, 0); // only rounded supported -- last param not important since we are not blending	}	//	// fill the palette and color format	////	SetTextPalette(pRua, obj->foregroundcolor, obj->backgroundcolor, obj->transparentbackground);	// [RC] assuming 1bpp	////	SetTextColorFormat(pRua);	//	////	status = getPredefinedFontIndex(GetBmpPath(fontindex), &predeffontindex);	//	////	if(RMFAILED(status))	////		return status;	//	RMMemset(&prop, 0, sizeof(Prop));	RMCopyAscii(prop.text, obj->text/*lines[0]*/);	prop.alignment = obj->textalign;	prop.fgColor = obj->backgroundcolor;	prop.bgColor = obj->foregroundcolor;// & 0x00FFFFFF;	//		txt.transparentbackground = obj->transparentbackground;	prop.scale = atoi(obj->fontfile);	gfxGetTextExtents(pRua, &prop, &rctext);	//	//	gfxGetTextExtents(pRua, &prop, &rctext);	////	fontheight = getFontHeight(predeffontindex);	//	//	// break up string	//	maxwidth = rect.width;	//	maxheight = y + obj->height;	//	//	rect.width = maxwidth;	//	rect.height = rctext.height;	//	//	count = getTextLines(str, predeffontindex, maxwidth, MAX_STR_LENGTH, MAX_STR_LINES, lines);	//	for(i = 0; i < count; i++){	//		RMMemset(&txt, 0, sizeof(txt));	//		RMNCopyAscii(txt.text, lines[i], MAX_STR_LENGTH);	//		txt.alignment = obj->textalign;	//		txt.foregroundcolor = obj->foregroundcolor;	//		txt.backgroundcolor = obj->backgroundcolor;	//		txt.transparentbackground = obj->transparentbackground;	//		txt.hasfocus = obj->hasfocus;	//		txt.outlinecolor = obj->outlinecolor;	//		txt.selectioncolor = obj->selectioncolor;	//		txt.inputchar = obj->inputchar;	//		txt.password = (obj->type == STRING_PASSWORD);	//		txt.input = (obj->type != STRING_UNKNOWN);	//	//		// calculate position and correct accordingly to be relative to 0,0	//		rect.x = x;	//		rect.y = rect.height * i + y;	//	//		// verify we are not going beyond clipping area	//		if((rect.y + rect.height) > maxheight){	//			status = RM_ERROR;	//			break;	//		}	//	////		printf("<<<<<<<<<<<<<<<<<<<<<<<(x, y, w, h) (%ld, %ld, %ld, %ld)\n", rect.x, rect.y, rect.width, rect.height);	//		status = DrawString(pRua, &rect, &txt, fontindex);	//	}	//	//	return status;	if (obj->type == STRING_PASSWORD)	{		for (i = 0; i < RMasciiLength(prop.text); i++)		{			prop.text[i] = ((prop.text[i] >= '0' && prop.text[i] <= '9') ? '*' : '\0');		}	}	rect.x += 5;	status = gfxTTDrawString(pRua, &rect, &prop, NULL);	return BitBlt(pRua);}static inline struct ttf_glyph_metrics *RMTTGetGlyphMetrics(struct RMTTFont *rmfont, RMuint32 char_code){	RMuint32 glyph_index;	glyph_index = char_code;/* get_glyph_index(char_code); */	if (glyph_index == INVALID_GLYPH)		return NULL;	return &(rmfont->glyph_table[glyph_index].metrics);}

⌨️ 快捷键说明

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