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

📄 gfx_drawlib.c.svn-base

📁 sigmadesign smp8623 gui source code ,bingo
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
////	printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> setting TEXT palette\n");//	status = GFX1BPPPaletteProperty(pRua, &palette_param);//	if (RMFAILED(status))//		RMDBGLOG((GFXDBG, "Error sending command set palette\n"));////	RMMemcpy(&g_lastpal, &palette_param, sizeof(palette_param));//	g_last_palbpp = 1;////	return status;//}RMstatus gfxTTDrawString(struct RUA *pRua, GFXLib_rect *position, Prop *prop, GFXLib_rect *out_rect){	RMstatus status;	RMuint8 fontindex;	GFXLib_textdata txt;	//GetFontIndex(pRua, "KiSS_Cinea_18", &fontindex);	//GetFontIndex(pRua, "SigmaOSD118x23", &fontindex);	if(prop->scale >= 18)		GetFontIndex(pRua, "SigmaOSD118x23", &fontindex);	else		GetFontIndex(pRua, "SigmaOSD127x36", &fontindex);	RMMemset(&txt, 0, sizeof(txt));	RMCopyAscii(txt.text, prop->text);	txt.alignment = prop->alignment;	txt.foregroundcolor = prop->bgColor;	txt.backgroundcolor = prop->fgColor;	txt.transparentbackground = TRUE;	//printf(" bg %lu fg %lu\n", prop->fgColor, prop->bgColor);	SetTextPalette(pRua,  prop->fgColor, prop->bgColor, FALSE);	// [RC] assuming 1bpp	SetTextColorFormat(pRua);	status = DrawTextWithPredefinedFont(pRua, position, &txt, fontindex, prop->trunc);	if(RMSUCCEEDED(status))		prop->trunc = TRUNC_NONE;//	//	RMuint32 fgColor, bgColor, char_size;//	RMuint16 i, l;//	RMstatus err = RM_OK;//	Point pos;//	GFXLib_rect rctext;//	RMuint8 inc = 0;//	RMuint8 filter = 10;////	//	RMbool truncate = FALSE;//	union//	{//		RMuint16 l;//		RMint8 b[2];//	} big;//////	if (position->x >= (RMint32) gdata.osdWidth || position->y >= (RMint32) gdata.osdHeight)//	{//		RMDBGLOG((GFXDBG, "Failed to draw string: position is off osd limits\n"));//		return RM_ERROR;//	}////	pos.x = position->x;////	gfxGetTextExtents(pRua, prop, &rctext);////	if (prop->alignment == ALIGN_CENTER)//	{//		pos.x += ((position->width - rctext.width) >> 1);//		if (pos.x < position->x + filter)//			pos.x = position->x;//	}//	else if (prop->alignment == ALIGN_RIGHT)//	{//		pos.x += ((position->width - rctext.width));//	}////	pos.y = position->y + ((position->height - rctext.height) >> 1);////	//	if(rctext.width >= (position->width >> 3) * 7)//	//		truncate = TRUE;////	l = RMasciiLength(prop->text);//	SetTextColorFormat(pRua);//	SetTextPalette(pRua, prop->fgColor, prop->bgColor, TRUE);////	for (i = 0; i < l; i++)//	{//		GFXLib_rect char_out_rect;////		if ((prop->text[i] & 0x80) == 0)//		{//			err = rtk86_draw_tt_char(pRua, (RMuint32) prop->text[i], prop->scale, prop->fgColor, prop->bgColor, &pos, &char_out_rect);//			//			RMDBGLOG((GFXDBG, "One Byte \'%x\'\n", prop->text[i]));//			inc = 1;//		}//		else if (prop->text[i] & 0xC0)//		{//			RMuint8 _t;//			_t = prop->text[i];//			_t <<= 6;//			_t &= 0xC0;//			//			printf("draw string: %X %X\n", prop->text[i], prop->text[i+1]);//			big.b[0] = (prop->text[i + 1] & 0x3F) | _t;//			big.b[1] = (prop->text[i] & 0x1f) >> 2;////			i++;//			err = rtk86_draw_tt_char(pRua, (RMuint32) big.l, prop->scale, prop->fgColor, prop->bgColor, &pos, &char_out_rect);//			inc = 2;//			//			RMDBGLOG((GFXDBG, "TwoBytes \'%X\'\n", big.l));//		}//		else//			err = 1;//		if (RMFAILED(err))//		{//			RMDBGLOG((GFXDBG, "The glyph for character \'%x\' could not be drawn\n", prop->text[i]));//			break;//		}//		pos.x += char_out_rect.width;//		pos.x += (prop->scale >> 4);//		if (pos.x >= (RMint16) (position->x + ((position->width * 96) / 100)) && prop->trunc != TRUNC_NONE)//		{//			////			if(prop->text[i+1] != '\0' && prop->text[i+2] != '\0' && prop->text[i+3] != '\0')//			////			{//			if (prop->trunc == TRUNC_DOTS)//			{//				prop->text[i + 1] = '.';//				prop->text[i + 2] = '.';//				prop->text[i + 3] = '.';//				prop->text[i + 4] = '\0';//				//		trunc = FALSE;//				prop->trunc = TRUNC_NONE;//				l = RMasciiLength(prop->text);//				////			}//			}//			else//			{//				prop->text[i] = '\0';//				//						//		trunc = FALSE;//				prop->trunc = TRUNC_NONE;//				l = RMasciiLength(prop->text);//			}//		}//	}//	//	printf("position %d %d\n",(RMint16)pos.x,(RMint16)pos.y);//	//prop->trunc = TRUNC_NONE;	return RM_OK;}// draw a bitmapRMstatus gfxDrawBitmap(struct RUA *pRua, RMBitmapObject *obj){	RMstatus status = RM_OK;	RMuint8 bmpindex;	if (obj->visible == FALSE)		return RM_OK;	status = GetBitmapIndex(pRua, obj->file, &bmpindex, TRUE);	if (RMFAILED(status))		return status;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	//	printf("bitmap %s transp 0x%lx, use %d\n", obj->file, obj->transparentcolor, obj->usetransparentcolor);	DrawBitmap(pRua, obj->x, obj->y, obj->transparentcolor, obj->usetransparentcolor, 0x80, bmpindex, FALSE, 0);	return BitBlt(pRua);}// draw menuRMstatus gfxDrawMenu(struct RUA *pRua, RMMenuObject *obj, RMMenuItemObject *items, RMuint8 itemcount){	RMstatus status;	//	RMuint8 fontindex;	RMuint8 index;	GFXLib_rect rect;	GFXLib_menudata menudata;	if (obj->visible == FALSE)		return RM_OK;	rect.x = obj->x;	rect.y = obj->y;	rect.width = obj->width;	rect.height = obj->height;	RMMemset(&menudata, 0, sizeof(menudata));	menudata.count = itemcount;	menudata.selecteditem = obj->selecteditem;	menudata.outlinecolor = obj->outlinecolor;	menudata.hasfocus = obj->hasfocus;	menudata.redraw = obj->redraw;	menudata.menuoutlinecolor = obj->menuoutlinecolor;	for (index = 0; index < menudata.count; index++)	{		RMCopyAscii(menudata.items[index], items[index].text);		if (items[index].textvalue != (RMascii *) NULL)			RMCopyAscii(menudata.textvalues[index], items[index].textvalue);		menudata.state[index] = items[index].state;	}	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	DrawMenu(pRua, &rect, &menudata, obj->foregroundcolor, obj->backgroundcolor, atoi(obj->fontfile));	return BitBlt(pRua);}// draw an osd pageRMstatus gfxDrawPage(struct RUA *pRua, RMPageObject *obj){	RMstatus status = RM_OK;	if (obj->visible == FALSE)		return RM_OK;	gdata.pictureMode = FALSE;	// init bitmap array and reset buffer	ResetBmpBuffers();	// restore drawing buffer offset	gdata.baseBuffer.offset = gdata.drawBuffer.size;	ResetBaseBuffer(&gdata.baseBuffer);	AllocateBuffer(&gdata.drawBuffer, gdata.drawBuffer.size, TRUE);	//AllocateBuffer(&gdata.backBuffer, gdata.backBuffer.size, TRUE);	status = LoadPageBackground(pRua, obj->file);	if (RMFAILED(status))		return status;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	// fix tv ratio	DoTVRatio(pRua, gdata.tvType);	status = DrawBitmap(pRua, 0, 0, 0, 0, 0xff, 0, FALSE, 0);	if (RMSUCCEEDED(status))		gdata.osdOn = TRUE;	return BitBlt(pRua);}RMstatus gfxDrawPopup(struct RUA *pRua, RMBitmapObject *obj){	RMstatus status = RM_OK;	RMuint8 bmpindex;	if (obj->visible == FALSE)		return RM_OK;	status = GetBitmapIndex(pRua, obj->file, &bmpindex, TRUE);	if (RMFAILED(status))		return status;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	DrawBitmap(pRua, obj->x, obj->y, obj->transparentcolor, obj->usetransparentcolor, 0x00, bmpindex, TRUE, 0);	return BitBlt(pRua);}RMstatus gfxDrawPopupWithBitmaps(struct RUA *pRua, RMBitmapObject *obj, RMBitmapObject *bitmaps, RMuint8 nbitmaps,		RMButtonObject *buttons, RMuint8 nbuttons){	RMstatus status = RM_OK;	RMuint8 bmpindex;	RMuint8 i;	if (obj->visible == FALSE)		return RM_OK;	status = GetBitmapIndex(pRua, obj->file, &bmpindex, TRUE);	if (RMFAILED(status))		return status;	status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth);	if (RMFAILED(status))		return status;	status = DrawBitmapBlendBack(pRua, obj->x, obj->y, obj->transparentcolor, obj->usetransparentcolor, 0xff, bmpindex, TRUE, 0);	if (RMFAILED(status))		return status;	// draw buttons and bitmaps -- for now only text buttons	for (i = 0; i < nbuttons; i++)		DrawButton(pRua, obj->x, obj->y, &buttons[i], bmpindex);	return BitBlt(pRua);}RMstatus gfxAnimateSubList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return AnimateSubList(pRua, &bmp, obj, items, itemcount, listitemcount);}RMstatus gfxAnimateList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return AnimateList(pRua, &bmp, obj, items, itemcount, listitemcount);}RMstatus gfxScrolList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return ScrolList(pRua, &bmp, obj, items, itemcount, TRUE, listitemcount, direction);}RMstatus gfxScrolBillingList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return ScrolBillingList(pRua, &bmp, obj, items, itemcount, TRUE, listitemcount, direction);}RMstatus gfxScrolSubList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return ScrolSubList(pRua, &bmp, obj, items, itemcount, TRUE, listitemcount, direction);}// draw listRMstatus gfxScrolListList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListObject *subobj, RMListObject *subobj_prev,		RMListItemObject **items, RMListItemObject **subitems, RMListItemObject **subitems_prev, RMuint8 itemcount,		RMuint8 subitemcount, RMuint8 subitemcount_prev, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	//return DrawListList(pRua, &bmp, obj, subobj, items, subitems, itemcount, subitemcount);	return ScrolListList(pRua, &bmp, obj, subobj, subobj_prev, items, subitems, subitems_prev, itemcount, subitemcount,			subitemcount_prev, direction);}// draw listRMstatus gfxDrawListList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListObject *subobj, RMListItemObject **items,		RMListItemObject **subitems, RMuint8 itemcount, RMuint8 subitemcount){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return DrawListList(pRua, &bmp, obj, subobj, items, subitems, itemcount, subitemcount);}// draw listRMstatus gfxMorphListList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListObject *subobj, RMListObject *subobj_prev,		RMListItemObject **items, RMListItemObject **subitems, RMListItemObject **subitems_prev, RMuint8 itemcount,		RMuint8 subitemcount, RMuint8 subitemcount_prev, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return MorphListList(pRua, &bmp, obj, subobj, subobj_prev, items, subitems, subitems_prev, itemcount, subitemcount,			subitemcount_prev, direction);}// draw listRMstatus gfxMorphListString(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListObject *subobj, RMListObject *subobj_prev,		RMListItemObject **items, RMListItemObject **subitems, RMListItemObject **subitems_prev, RMuint8 itemcount,		RMuint8 subitemcount, RMuint8 subitemcount_prev, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return MorphListString(pRua, &bmp, obj, subobj, subobj_prev, items, subitems, subitems_prev, itemcount, subitemcount,			subitemcount_prev, direction);}// draw listRMstatus gfxMorphList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return MorphList(pRua, &bmp, obj, items, itemcount, TRUE, listitemcount);}// draw listRMstatus gfxDrawList(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return DrawList(pRua, &bmp, obj, items, itemcount, TRUE, listitemcount);}RMstatus gfxDrawListBilling(struct RUA *pRua, RMPageObject *page, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount,		RMuint16 listitemcount){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return DrawListBilling(pRua, &bmp, obj, items, itemcount, TRUE, listitemcount);}RMstatus gfxDrawPopupList(struct RUA *pRua, RMBitmapObject *popup, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount){	return DrawList(pRua, popup, obj, items, itemcount, FALSE, 0);}RMstatus gfxScrolTextTableBitmaped(struct RUA *pRua, RMPageObject *page, RMTextTableObject *obj, RMListObject *obj_list,		RMTextItemObject *items, RMTextItemObject *items_old, RMListItemObject **items_list, RMuint8 itemcount,		RMuint8 itemcount_list, RMuint8 direction){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	if (direction == 0)		return ScrolTextTableBitmapedRight(pRua, obj, obj_list, &bmp, items, items_old, items_list, itemcount, itemcount_list, 2);	else		return ScrolTextTableBitmapedLeft(pRua, obj, obj_list, &bmp, items, items_old, items_list, itemcount, itemcount_list,				direction);}RMstatus gfxDrawTextTableBitmaped(struct RUA *pRua, RMPageObject *page, RMTextTableObject *obj, RMListObject *obj_list,		RMTextItemObject *items, RMListItemObject **items_list, RMuint8 itemcount, RMuint8 itemcount_list){	RMBitmapObject bmp;	bmp.x = 0;	bmp.y = 0;	bmp.file = page->file;	return DrawTextTableBitmaped(pRua, obj, obj_list, &bmp, items, items_list, itemcount, itemcount_list);}RMstatus gfxDrawWaitCursor(struct RUA *pRua, RMPageObject* page, RMAnimationObject* anime, RMbool bCenter){	return DrawLoadCursor(pRua, page, anime, bCenter);}RMstatus gfxHideWaitCursor(struct RUA *pRua, RMPageObject* page, RMAnimationObject* anime, RMbool bCenter){	return HideLoadCursor(pRua, page, anime, bCenter);}// draw text table

⌨️ 快捷键说明

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