static void PrvImgTest(WND wnd) { int fd; ruint16 i, j; char tmp[10]; struct img_data *picture; unsigned char *p; COLORVAL color; GdiLockScreen(wnd); MemSet(tmp, 0, 10); fd = RalOpenFile("test.jpg"); if (fd == -1 ) { GdiTextOut(wnd, "File Not Found", StrLen("File Not Found"), 10, 10); return ; } //GdiTextOut(wnd, "check", StrLen("test"), 140, 10); picture = img_jpeg_read(fd, 240, 320); if (picture == NULL) { GdiTextOut(wnd, "JPG Read fail", StrLen("JPG Read fail"), 20, 300); return ; } StrIToA(picture->size, tmp); GdiTextOut(wnd, tmp, StrLen(tmp), 140, 10); p = picture->data; for(i=0; i<picture->height; i++) { for(j=0; j<picture->width; j++) { color = *p <<8 | (*(p+1) ); GdiSetPixel(wnd, j, i, color ); p += 2; } } if (picture) { if (picture->data) free(picture->data); free(picture); } GdiUnlockScreen(wnd); }
static void PrvDrawSampleSlideTextMenu(WND wnd) { int i = 0; ruint16 nY = 0; GdiLockScreen(wnd); GdiClrScreen(wnd, COLOR_WHITE); for ( i = 0; i <= 6; i++) { if (nY == 10) GdiTextOut(wnd, SlideStrMenu[i], StrLen(SlideStrMenu[i]), 0, nY); else GdiTextOut(wnd, SlideStrMenu[i], StrLen(SlideStrMenu[i]), 0, nY+=15); } GdiUnlockScreen(wnd); }
static void PrvSamCtlPaint(WND wnd) { int i; GdiLockScreen(wnd); GdiClrScreen(wnd, COLOR_WHITE); for (i = 0; i < ListStringCount; i++) GdiTextOut(wnd, ListString[i], StrLen(ListString[i]), 10, (rint16)(10 + 15 * i)); GdiUnlockScreen(wnd); }
void GdiContext2D::fillText(const wchar_t* psz, double x, double y) { Check(); const int ix = x;//ToPixelX(x); const int iy = y;//ToPixelY(y); // COLORREF color = ColorToColorRef(fillStyle.m_Color); COLORREF oldcolor = SetTextColor(m_hDC, color); int oldbkmode = SetBkMode(m_hDC, TRANSPARENT); HFONT oldfont = (HFONT) SelectObject(m_hDC, (HFONT)font.m_pNativeObject); // GdiTextOut(m_hDC, textAlign, textBaseline, psz, wcslen(psz), ix, iy); // SetTextColor(m_hDC, oldcolor); SetBkMode(m_hDC, oldbkmode); SelectObject(m_hDC, oldfont); }
static int DrawSampleListCB(WND wnd, int nLine, rect rtLineRect, void *pData) { int err; int nFocus; int nItemNum; int nTopIndex; COLORVAL oldBG; COLORVAL oldFG; unsigned short x; unsigned short y; int mode1; int mode2; rect* sMarginText; int nCurrWidth = 0; nFocus = CtlGeti(gpListWND, CTL_LIST_CMD_GET_FOCUS, &err); nItemNum = CtlGeti(gpListWND, CTL_LIST_CMD_GET_ITEMNUM, &err); nTopIndex = CtlGeti(gpListWND, CTL_LIST_CMD_GET_TOPINDEX, &err); sMarginText = CtlGetPtr(gpListWND, CTL_LIST_CMD_GET_RECTMARGIN_TEXT, &err); if(nLine > nItemNum-1) return 0; if(nFocus == nLine+nTopIndex) { oldFG = GdiSetFgColor(wnd, COLOR_WHITE); oldBG = GdiSetBkColor(wnd, COLOR_BLUE); } GdiFillRect(wnd, &rtLineRect, GdiGetBkColor(wnd)); FntSetFont(&FntGlobalContext, FntIDAlpha); x = rtLineRect.left + sMarginText->left; y = rtLineRect.top + sMarginText->top; GdiTextOut(wnd, SlideStr[nLine+nTopIndex], StrLen(SlideStr[nLine+nTopIndex]), x, y); if(nFocus == nLine+nTopIndex) { GdiSetFgColor(wnd, oldFG); GdiSetBkColor(wnd, oldBG); } if ( (nFocus == nLine+nTopIndex) ) { nCurrWidth = FntGetTextWidth(&FntGlobalContext, SlideStr[nLine+nTopIndex], strlen( SlideStr[nLine+nTopIndex])); mode1 = CtlGeti(gpSlideWND1, CTL_SLIDETEXT_CMD_GET_MODE, &err); GdiFillRect(wnd, &rtLineRect, GdiGetBkColor(wnd)); CtlSeti(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_X, 5, &err); CtlSeti(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_Y, 1, &err); CtlSeti(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_LEFT, UNIT_TEST_LEFT, &err); CtlSeti(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_TOP, rtLineRect.top, &err); CtlSeti(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_RIGHT, UNIT_TEST_RIGHT, &err); CtlSeti(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_BOTTOM, rtLineRect.bottom, &err); CtlSetPtr(gpSlideWND1, CTL_SLIDETEXT_CMD_SET_DATA, (void *)SlideStr[nLine+nTopIndex], &err); //if ( mode1 == CTL_SLIDETEXT_PAUSE ) // CtlDo(gpSlideWND1, CTL_SLIDETEXT_CMD_DO_STOP, 0, 0, &err); CtlDo(gpSlideWND1, CTL_SLIDETEXT_CMD_DO_PLAY, 0, 0, &err); if ( gMultiSlide ) { mode2 = CtlGeti(gpSlideWND2, CTL_SLIDETEXT_CMD_GET_MODE, &err); //GdiFillRect(wnd, &rtLineRect, GdiGetBkColor(wnd)); CtlSeti(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_X, 2, &err); CtlSeti(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_Y, 1, &err); CtlSeti(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_LEFT, UNIT_TEST_LEFT + UNIT_TEST_RIGHT +10, &err); CtlSeti(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_TOP, rtLineRect.top, &err); CtlSeti(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_RIGHT, UNIT_TEST_RIGHT, &err); CtlSeti(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_BOTTOM, rtLineRect.bottom, &err); CtlSetPtr(gpSlideWND2, CTL_SLIDETEXT_CMD_SET_DATA, (void *)SlideStr[nLine+nTopIndex], &err); //if ( mode2 == CTL_SLIDETEXT_PAUSE ) // CtlDo(gpSlideWND2, CTL_SLIDETEXT_CMD_DO_STOP, 0, 0, &err); CtlDo(gpSlideWND2, CTL_SLIDETEXT_CMD_DO_PLAY, 0, 0, &err); } } return 0; }
static void PrvImgListView(WND wnd) { FntID PrevFntID = 1; rint32 i; rint32 width=0; rint32 j=0; unsigned short tmp1,tmp2; GdiLockScreen(wnd); GdiClrScreen(wnd, COLOR_WHITE); for(i=0; i<MAX_LST_NUMBER; i++) { if(fileList[i][0] != 0) { if(fileListIdentifier[i] & 0x10 /*==1*/ ) GdiTextOut(wnd, "D",StrLen("D"),(ruint16)(LIST_TEXT_X),(ruint16)(LIST_TEXT_Y+(LIST_TEXT_SPACE*i))); else { GdiTextOut(wnd, "F",StrLen("F"),(ruint16)(LIST_TEXT_X),(ruint16)(LIST_TEXT_Y+(LIST_TEXT_SPACE*i))); } } width=0; j=0; while(fileList[i][j] != 0) { if(fileList[i][j]>0x80) // Hangul { PrevFntID = FntGetFont(&FntGlobalContext); FntSetFont(&FntGlobalContext, FntIDUnicode12Han/*FntIDUnicode16*/); tmp1 = fileList[i][j]; tmp1 = tmp1<<8; j++; tmp1= tmp1 | fileList[i][j]; HanCodeConvert(tmp1, (ruint32 *)&tmp2,EUC,IW); tmp2-=0xac00; } else { PrevFntID = FntGetFont(&FntGlobalContext); FntSetFont(&FntGlobalContext, FntIDUnicode12BL/*FntIDAlpha*/); tmp2 = fileList[i][j]; } width = width + GdiTextOutW(wnd, (ruint16)(LIST_TEXT_X+15 + width),(ruint16)(LIST_TEXT_Y+(LIST_TEXT_SPACE*i)), &tmp2, 1);//한 글자 식 한다. j++; FntSetFont(&FntGlobalContext, PrevFntID); if(width >= FILE_NAME_WIDTH_MAX) { GdiTextOut(wnd, "~",StrLen("~"),(ruint16)(LIST_TEXT_X+15 + width),(ruint16)(LIST_TEXT_Y+(LIST_TEXT_SPACE*i))); break; } } if(imgfocusedList == i) { GdiDrawLine(wnd,(rint32)(LIST_TEXT_X +15), (rint32)(LIST_TEXT_FOCUS_Y+(imgfocusedList*LIST_TEXT_FOCUS_LINE_SPACE)), (rint32)(LIST_TEXT_X +15 + width) , (rint32)(LIST_TEXT_FOCUS_Y+(imgfocusedList*LIST_TEXT_FOCUS_LINE_SPACE))); } } // Drawing ScrollBar { rint32 tmp; rect txvrect1; rect txvrect2; if(imgtotalFileNum%MAX_LST_NUMBER) { tmp = (imgtotalFileNum/MAX_LST_NUMBER) + 1; } else { tmp = imgtotalFileNum/MAX_LST_NUMBER; } txvrect1.bottom=SCROLL_BAR_RECT_HEIGHT; txvrect1.left=SCROLL_BAR_RECT_WIDTH; txvrect1.right=SCROLL_BAR_RECT_X; txvrect1.top=SCROLL_BAR_RECT_Y; GdiRectangle(wnd,&txvrect1); GdiSetFgColor(wnd,COLOR_RED) ; txvrect2.top=txvrect1.top + (imglistCount/MAX_LST_NUMBER)*((txvrect1.bottom - txvrect1.top)/tmp); txvrect2.bottom=txvrect2.top + (txvrect1.bottom-txvrect1.top)/tmp; txvrect2.left=txvrect1.left-2; txvrect2.right=txvrect1.right+2; if(imgtotalFileNum == (imglistCount+1)) { txvrect2.bottom = txvrect1.bottom; GdiRectangle(wnd,&txvrect2); } else { GdiRectangle(wnd,&txvrect2); } } GdiSetFgColor(wnd,COLOR_BLACK) ; // Drawing ScrollBar... GdiUnlockScreen(wnd); }
static void PrvImgView(WND wnd) { int fd, len; ruint16 i, j; char tmp[10]; struct img_data *picture; unsigned char *p; COLORVAL color; MemSet(tmp, 0, 10); fd = RalOpenFile((char *)&fileList[imgfocusedList]); if (fd == -1 ) { GdiTextOut(wnd, "File Not Found", StrLen("File Not Found"), 20, 300); return ; } //GdiTextOut(wnd, "check", StrLen("test"), 140, 10); picture = NULL; len = StrLen(fileList[imgfocusedList]); p = &fileList[imgfocusedList][len-3]; if ( !StrNCmp(p, "jpg", 3) || !StrNCmp(p, "JPG", 3) ) { picture = img_jpeg_read(fd, 240, 320); } else if ( !StrNCmp(p, "gif", 3) || !StrNCmp(p, "GIF", 3) ) { picture = img_gif_read(fd, 240, 320); } else if ( !StrNCmp(p, "png", 3) || !StrNCmp(p, "PNG", 3) ) { picture = img_png_read(fd, 240, 320); } if (picture == NULL) { GdiTextOut(wnd, "Image File Read fail", StrLen("Image File Read fail"), 20, 300); return ; } imgStateID = IMAGEVIEW_STATE_FILE_SHOW; GdiLockScreen(wnd); GdiClrScreen(wnd, COLOR_BLACK); StrIToA(picture->size, tmp); //GdiTextOut(wnd, tmp, StrLen(tmp), 100, 310); p = picture->data; for(i=0; i<picture->height; i++) { for(j=0; j<picture->width; j++) { color = *p <<8 | (*(p+1) ); GdiSetPixel(wnd, j, i, color ); p += 2; } } GdiTextOut(wnd, fileList[imgfocusedList], StrLen(fileList[imgfocusedList]), 80, 300); if (picture) { if (picture->data) free(picture->data); free(picture); } GdiUnlockScreen(wnd); }