?? gfx_drawlib.c.svn-base
字號(hào):
// // rect.x = obj->x + xOrigen + scaleoffset + dialwidth * obj->stepnumber + dialwidth;// // rect.y = obj->y + yOrigen + (obj->height - rctext.height) / 2;// rect.width = CLIP(scalewidth - dialwidth * obj->stepnumber - 1, 2, scalewidth);// printf("steps: %d width: %d start: %lu width: %lu\n",obj->stepnumber, scalewidth, rect.x, rect.width);// // rect.height = rctext.height;// gfxDrawRect(pRua, rect.x, rect.y, rect.width, rect.height - SLIDER_BORDER_OFFSET + SLIDER_BORDER, obj->backgroundcolor);// }//}RMstatus gfxDrawOSDMenu(struct RUA *pRua, RMTVList* tvList){ RMuint16 i, count; GFXLib_rect rect; Prop prop; RMstatus status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); // status = SetOutputSurface(pRua); if (RMFAILED(status)) return status; prop.trunc = TRUNC_NONE; RMMemset(&prop, 0, sizeof(Prop)); //RMCopyAscii(prop.text, "ABC"); prop.bgColor = 0xffffffff; prop.fgColor = 0x00FFFFFF; prop.alignment = ALIGN_LEFT; prop.scale = 20; gfxDrawRect(pRua, 400, 40, 250, 400, 0xBB000000); //hardcoded position for (i = tvList->firstvisible, count = 0; count < tvList->numItemsPerPage; i++, count++) { if (i == tvList->nbItems) i = 0; rect.y = 40 + count * 400 / tvList->numItemsPerPage; rect.x = 400; rect.width = 250; rect.height = 400 / tvList->numItemsPerPage; if (i == tvList->current) gfxDrawRect(pRua, rect.x, rect.y, rect.width, rect.height, 0xBB444444); rect.x += 20; sprintf(prop.text, "%.2d. %s", (RMuint16) tvList->items[i].number, tvList->items[i].name); //RMCopyAscii(prop.text, tvList->items[i].name); gfxTTDrawString(pRua, &rect, &prop, NULL); rect.x -= 20; } return BitBlt(pRua);}RMstatus gfxHideSlider(struct RUA *pRua, RMPageObject *page, RMSliderObject *obj){ GFXLib_rect rect; RMstatus status; rect.x = 0; rect.y = 0; rect.width = gdata.osdWidth; rect.height = gdata.osdHeight; status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); // status = SetOutputSurface(pRua); if (RMFAILED(status)) return status; if (page == NULL) BlankRect(pRua, &rect); else DrawPageRect(pRua, page, &rect); BitBlt(pRua); subs.osd = FALSE; return RM_OK;}RMstatus gfxBlankRect(struct RUA *pRua, RMuint16 x, RMuint16 y, RMuint16 width, RMuint16 height){ GFXLib_rect rect; RMstatus status; rect.x = x; rect.y = y; rect.width = width; rect.height = height; status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); // status = SetOutputSurface(pRua); if (RMFAILED(status)) return status; BlankRect(pRua, &rect); BitBlt(pRua); // status = SetOutputSurface(pRua); return RM_OK;}RMstatus gfxGetBitmapDimensions(struct RUA *pRua, RMBitmapObject *obj, RMuint16 *width, RMuint16 *height){ RMstatus status = RM_OK; RMuint8 bmpindex; status = GetBitmapIndex(pRua, obj->file, &bmpindex, FALSE); if (RMFAILED(status)) return status; *width = GetBmpWidth(bmpindex); *height = GetBmpHeight(bmpindex); return RM_OK;}RMstatus gfxDrawPicture(struct RUA *pRua, RMascii *path, GFXLib_scaletype stype, RMuint32 msDelay){ GFXLib_rect rect; RMstatus status; RMuint32 bmpsize = 0; gdata.pictureMode = TRUE; // init bitmap array and reset buffer // here we reset buffer to use the whole base buffer, ignoring what // was allocated for the drawing buffer ResetBmpBuffers(); ResetBaseBuffer(&gdata.baseBuffer); SetBmpPicture(path); status = LoadImage(pRua, 0, &bmpsize); if (RMFAILED(status)) return status; if (msDelay) Wait(msDelay); // no more pictures if (gdata.pictureMode == FALSE) return RM_OK; rect.x = 0; rect.y = 0; rect.width = gdata.osdWidth; rect.height = gdata.osdHeight; // NEEDS CHANGE!!!!! // clear screen BlankRect(pRua, &rect); return DrawPicture(pRua, stype);}extern RMcriticalsection g_cs_media;void DrawMediaControls(struct RUA *pRua, RMPlayControls* play/*RMPanelObject** panels, RMuint8 nPanels, RMButtonObject** buttons, RMuint8 nButtons, RMSliderObject** sliders, RMuint8 nSliders, RMbool tv*/){ RMuint8 bmpindex[3]; RMuint8 i; RMstatus status; subs.osd = TRUE; status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); if (RMFAILED(status)) return; if(play->page) { GFXLib_rect rect; rect.x = rect.y = 0; rect.width = gdata.osdWidth; rect.height = gdata.osdHeight; LoadPageBackground(pRua, play->page->file); DrawPageRect(pRua, play->page, &rect); } else { Fill(pRua, 0, 0, gdata.osdWidth, gdata.osdHeight, 0x00FFFFFF); } RMEnterCriticalSection(g_cs_media); for (i = 0; i < play->nPanels; i++) { if (play->tv) { if (play->panels[i]->visible) if (play->panels[i]->file) { status = GetBitmapIndex(pRua, play->panels[i]->file, &bmpindex[i], TRUE); if (RMSUCCEEDED(status)) { if(play->page) DrawBitmap(pRua, play->panels[i]->x, play->panels[i]->y, 0, FALSE, 0, bmpindex[i], TRUE, 0); else DrawBitmap(pRua, play->panels[i]->x, play->panels[i]->y, 0, FALSE, 0, bmpindex[i], FALSE, 0); } } } else if (play->panels[i]->file) { status = GetBitmapIndex(pRua, play->panels[i]->file, &bmpindex[i], TRUE); if (RMSUCCEEDED(status)) { if(play->page) DrawBitmap(pRua, play->panels[i]->x, play->panels[i]->y, 0, FALSE, 0, bmpindex[i], TRUE, 0); else DrawBitmap(pRua, play->panels[i]->x, play->panels[i]->y, 0, FALSE, 0, bmpindex[i], FALSE, 0); } } } { RMBitmapObject bmp; bmp.x = 0; bmp.y = 0; bmp.file = play->page->file; for (i = 0; i < play->nSliders; i++) { if(play->page) { gfxDrawSlider(pRua, 0, 0, play->sliders[i], &bmp); } else gfxDrawSlider(pRua, 0, 0, play->sliders[i], NULL); } } for (i = 0; i < play->nButtons; i++) { DrawButton(pRua, 0, 0, play->buttons[i], 0); //gfxDrawButton(pRua, buttons[i]); } if(play->file) { RMuint8 bmpindex_play; status = GetBitmapIndex(pRua, play->file, &bmpindex_play, TRUE); if (RMSUCCEEDED(status)) { if(play->page) DrawBitmap(pRua, play->x, play->y, 0, FALSE, 0, bmpindex_play, TRUE, 0); else DrawBitmap(pRua, play->x, play->y, 0, FALSE, 0, bmpindex_play, FALSE, 0); } if(play->name && play->artist) { Prop prop; GFXLib_rect rctext; GFXLib_rect rect; prop.trunc = TRUNC_NONE; RMMemset(&prop, 0, sizeof(Prop)); prop.bgColor = 0xFFFFFFFF; prop.fgColor = 0x00ffffff; prop.alignment = ALIGN_LEFT; prop.scale = 18; RMCopyAscii(prop.text, "ABC"); gfxGetTextExtents(pRua, &prop, &rctext); rect.x = play->x + GetBmpWidth(bmpindex_play) + 20; //hack text with shadow is wider then gfxGetTextExents returns rect.y = play->y + 20; rect.width = gdata.osdWidth - 2 * play->y; rect.height = rctext.height; RMCopyAscii(prop.text, play->artist); gfxTTDrawStringBorder(pRua, &rect, &prop, NULL); rect.y += rect.height * 1.5; RMCopyAscii(prop.text, play->name); gfxTTDrawStringBorder(pRua, &rect, &prop, NULL); } } RMLeaveCriticalSection(g_cs_media); BitBlt(pRua);}RMstatus gfxDrawPageWithBitmaps(struct RUA *pRua, RMPageObject *obj, RMBitmapObject **bitmaps, RMuint8 nbitmaps, RMButtonObject **buttons, RMuint8 nbuttons){ RMstatus status; RMuint8 bmpindex; RMuint8 i, j, index; GFXLib_objectdata objdata[MAX_BITMAPS]; RMuint8 count = 0; RMuint16 l1, t1, r1, b1; RMuint16 l2, t2, r2, b2; RMbool drawn, bkgnddrawn; // RMbool bkgnddrawn; RMuint8 lastbmpindex; RMuint8 lastbtnindex; RMbool reset = FALSE; if (obj->visible == FALSE) return RM_OK; gdata.pictureMode = FALSE; bkgnddrawn = 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; lastbmpindex = 0; lastbtnindex = 0; do { count = 0; reset = FALSE; // load bitmaps for (i = lastbmpindex; i < nbitmaps; i++) { status = GetBitmapIndex(pRua, bitmaps[i]->file, &bmpindex, FALSE); if (status == RM_FATALOUTOFMEMORY && i > 0) { lastbmpindex = i; reset = TRUE; break; } objdata[count].type = TYPE_BITMAP; objdata[count].index = i; objdata[count].zindex = bitmaps[i]->zIndex; objdata[count].loadindex = bmpindex; count++; } for (i = lastbtnindex; i < nbuttons; i++) { objdata[count].is3state = FALSE; objdata[count].containstext = FALSE; if (buttons[i]->file != 0) { if (buttons[i]->selectedFile == 0) { objdata[count].is3state = TRUE; status = GetBitmapIndex(pRua, buttons[i]->file, &bmpindex, FALSE); } else { if (buttons[i]->state == STATE_SELECTED) status = GetBitmapIndex(pRua, buttons[i]->selectedFile, &bmpindex, FALSE); else status = GetBitmapIndex(pRua, buttons[i]->file, &bmpindex, FALSE); } if (status == RM_FATALOUTOFMEMORY && i > 0) { lastbtnindex = i; reset = TRUE; break; } } else objdata[count].containstext = TRUE; objdata[count].type = TYPE_BUTTON; objdata[count].index = i; objdata[count].zindex = buttons[i]->zIndex; objdata[count].loadindex = bmpindex; count++; } // Sort list qsort(objdata, count, sizeof(GFXLib_objectdata), CompFunc); // draw background if (bkgnddrawn == FALSE) { // fix tv ratio DoTVRatio(pRua, gdata.tvType); status = DrawBitmap(pRua, 0, 0, 0, 0, 0xff, 0, FALSE, 0); if (RMFAILED(status)) return status; // give some time for the page to be loaded before any blending Wait(10); bkgnddrawn = TRUE; gdata.osdOn = TRUE; } // draw all other bitmaps for (i = 0; i < count; i++) { index = objdata[i].index; if (objdata[i].type == TYPE_BUTTON) { if (objdata[i].containstext == FALSE) { drawn = FALSE; l1 = buttons[index]->x; t1 = buttons[index]->y; r1 = l1 + GetBmpWidth(objdata[i].loadindex); b1 = t1 + GetBmpHeight(objdata[i].loadindex); // check for bitmaps under button for (j = 0; j < i; j++) { if (objdata[j].type == TYPE_BITMAP) { l2 = bitmaps[objdata[j].index]->x; t2 = bitmaps[objdata[j].index]->y; r2 = l2 + GetBmpWidth(objdata[j].loadindex); b2 = t2 + GetBmpHeight(objdata[j].loadindex); if (CheckRectsIntersect(l1, t1, r1, b1, l2, t2, r2, b2)) { gfxUpdateButton(pRua, obj, bitmaps[objdata[j].index], 1, buttons[index]); drawn = TRUE; } } } if (drawn == FALSE) { if (objdata[i].is3state == FALSE) { DrawBitmap(pRua, buttons[index]->x, buttons[index]->y, buttons[index]->transparentcolor, buttons[index]->usetransparentcolor, 0x80, objdata[i].loadindex, TRUE, 0); } else { DrawBitmappedButton(pRua, buttons[index], objdata[i].loadindex, TRUE); } } } else { // text button DrawButton(pRua, 0, 0, buttons[index], 0); } } else if (objdata[i].type == TYPE_BITMAP) { DrawBitmap(pRua, bitmaps[index]->x, bitmaps[index]->y, bitmaps[index]->transparentcolor, bitmaps[index]->usetransparentcolor, 0x80, objdata[i].loadindex, FALSE, 0); } } // force clearing of global bitmap buffer from index 1 (after background) if (reset) { ResetNonBackgroundBuffers(); } } while (reset); return BitBlt(pRua);}RMstatus gfxUpdateButton(struct RUA *pRua, RMPageObject *obj, RMBitmapO
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -