?? gfx_drawlib.c.svn-base
字號:
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); // 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 RMstatus GFXColorFormatProperty(struct RUA *pRua, struct GFXEngine_ColorFormat_type *format_param){ RMstatus status; struct RUAEvent evt; RMuint8 trycount; trycount = 2; // try command only a couple of times then jump out tryagain: status = RUASetProperty(pRua, gdata.gfx, RMGFXEnginePropertyID_ColorFormat, format_param, sizeof(struct GFXEngine_ColorFormat_type), 0); if (status == RM_PENDING && trycount--) { evt.ModuleID = gdata.gfx; evt.Mask = RUAEVENT_COMMANDCOMPLETION; if (RUAWaitForMultipleEvents(pRua, &evt, 1, 1000000, NULL) != RM_OK) RMDBGLOG((GFXDBG, "gfxColorFormat: FAILED WAITING FOR 1 second... TIMING ISSUE?\n")); goto tryagain; } return status;}//static inline RMstatus SetTextPaletteOut(// struct RUA *pRua,// RMuint32 foregroundcolor,// RMuint32 backgroundcolor,// RMbool transparentbkgnd)//{// struct GFXEngine_Palette_1BPP_type palette_param;// RMstatus status;//// palette_param.Palette[0] = foregroundcolor;// palette_param.Palette[1] = (transparentbkgnd ? backgroundcolor & 0xffffffff : 0);// palette_param.SurfaceID = GFX_SURFACE_ID_NX;//// if(CompareTextPalette(&palette_param)){//// printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> skipping TEXT palette\n");// return RM_OK;// }//
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -