void Print_Statut(void) { STAT_BASEY=CROP_HEIGHT; DrawFBoxBmp(bmp,0,CROP_HEIGHT,CROP_WIDTH,STAT_YSZ,RGB565(0,0,0)); if(MOUSEMODE==-1) Draw_text(bmp,STAT_DECX,STAT_BASEY,0xffff,0x8080,1,2,40,"Joy "); else Draw_text(bmp,STAT_DECX,STAT_BASEY,0xffff,0x8080,1,2,40,"Mouse"); Draw_text(bmp,STAT_DECX+40 ,STAT_BASEY,0xffff,0x8080,1,2,40,(SHIFTON>0?"SHFT":"")); Draw_text(bmp,STAT_DECX+80 ,STAT_BASEY,0xffff,0x8080,1,2,40,"MS:%d",PAS); Draw_text(bmp,STAT_DECX+120,STAT_BASEY,0xffff,0x8080,1,2,40,"Joy:%d",NUMjoy); if(LEDA) { DrawFBoxBmp(bmp,CROP_WIDTH-6*BOXDEC-6-16,CROP_HEIGHT-0,16,16,RGB565(0,7,0));//led A drive Draw_text(bmp,CROP_WIDTH-6*BOXDEC-6-16,CROP_HEIGHT-0,0xffff,0x0,1,2,40," A"); } if(LEDB) { DrawFBoxBmp(bmp,CROP_WIDTH-7*BOXDEC-6-16,CROP_HEIGHT-0,16,16,RGB565(0,7,0));//led B drive Draw_text(bmp,CROP_WIDTH-7*BOXDEC-6-16,CROP_HEIGHT-0,0xffff,0x0,1,2,40," B"); } if(LEDC) { DrawFBoxBmp(bmp,CROP_WIDTH-8*BOXDEC-6-16,CROP_HEIGHT-0,16,16,RGB565(0,7,0));//led C drive Draw_text(bmp,CROP_WIDTH-8*BOXDEC-6-16,CROP_HEIGHT-0,0xffff,0x0,1,2,40," C"); LEDC=0; } }
void CWndTuner::DrawCents(int nCents, bool bShow) { CRect rcScale(200, 120, 340, 132); int x = rcScale.left + (nCents + 50) * rcScale.Width() / 100; BIOS::LCD::Draw(x - 4, rcScale.bottom, bShow ? RGB565(000000) : RGB565(ffffff), RGBTRANS, CShapes::triangle); }
void virtual_kdb(char *buffer,int vx,int vy) { int x, y, page; unsigned coul; #if defined PITCH && PITCH == 4 unsigned *pix=(unsigned*)buffer; #else unsigned short *pix=(unsigned short *)buffer; #endif page = (NPAGE == -1) ? 0 : 5*NPLGN; coul = RGB565(28, 28, 31); BKGCOLOR = (KCOL>0?0xFF808080:0); for(x=0;x<NPLGN;x++) { for(y=0;y<NLIGN;y++) { DrawBoxBmp((char*)pix,XBASE3+x*XSIDE,YBASE3+y*YSIDE, XSIDE,YSIDE, RGB565(7, 2, 1)); Draw_text((char*)pix,XBASE0-2+x*XSIDE ,YBASE0+YSIDE*y,coul, BKGCOLOR ,1, 1,20, SHIFTON==-1?MVk[(y*NPLGN)+x+page].norml:MVk[(y*NPLGN)+x+page].shift); } } DrawBoxBmp((char*)pix,XBASE3+vx*XSIDE,YBASE3+vy*YSIDE, XSIDE,YSIDE, RGB565(31, 2, 1)); Draw_text((char*)pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,1), BKGCOLOR ,1, 1,20, SHIFTON==-1?MVk[(vy*NPLGN)+vx+page].norml:MVk[(vy*NPLGN)+vx+page].shift); }
/*virtual*/ void CWndToolbox::OnPaint() { CRect rcClient(m_rcClient); if ( m_bFirst ) { CDesign::Shadow(rcClient, 0xc0ffffff); // aa rr gg bb //rcClient.Deflate( 2, 2, 2, 2 ); //CDesign::Shadow(rcClient, 0x80ffffff); // aa rr gg bb m_bFirst = false; } if ( m_nFocus == -1 ) m_nFocus = 0; #define FOC(n) (m_nFocus==n)?RGB565(ffffff):RGB565(808080) PrintBold( m_rcClient.left + 8, m_rcClient.top + 2 + 0*16, FOC(0), RGB565(000000), "\x10 Waveform manager"); PrintBold( m_rcClient.left + 8, m_rcClient.top + 2 + 1*16, FOC(1), RGB565(000000), m_bAdcEnabled ? "\x10 Pause" : "\x10 Resume" ); PrintBold( m_rcClient.left + 8, m_rcClient.top + 2 + 2*16, FOC(2), RGB565(000000), "\x10 Reset setings"); PrintBold( m_rcClient.left + 8, m_rcClient.top + 2 + 3*16, FOC(3), RGB565(000000), "\x10 Save setings"); char str[32]; BIOS::DBG::sprintf(str, "bat %d%%", BIOS::SYS::GetBattery()); BIOS::LCD::Line( m_rcClient.left + 4, m_rcClient.bottom - 20, m_rcClient.right - 4, m_rcClient.bottom - 20, RGB565(e0e0e0) ); BIOS::LCD::Line( m_rcClient.left + 4, m_rcClient.bottom - 19, m_rcClient.right - 4, m_rcClient.bottom - 19, RGB565(808080) ); BIOS::LCD::Printf( m_rcClient.left + 8, m_rcClient.bottom - 16, RGB565(000000), RGBTRANS, "\x10 Select \xfe Close"); PrintBold( m_rcClient.left + 8 + 120, m_rcClient.bottom - 16 - 18, RGB565(ffff00), RGB565(000000), str); //BIOS::LCD::Printf( m_rcClient.left + 8 + 130, m_rcClient.top + 8, RGB565(000000), RGBTRANS, str); }
void CWndUserMonitor::Create(CWnd *pParent, ui16 dwFlags) { CWnd::Create("CWndCharMap", dwFlags | CWnd::WsTick, CRect(300, 20, 400, 240), pParent); m_proBaud.Create( (const char**)m_ppszTextBaud, (NATIVEENUM*)&m_nBaud, COUNT(m_ppszTextBaud)-1 ); m_itmBaud.Create("Baudrate", RGB565(808080), &m_proBaud, this); m_itmFormat.Create("~Format\n8-N-1", RGB565(808080), 2, this); m_btnClear.Create("Clear", RGB565(8080ff), 2, this); // m_btnSend.Create("\"Hello\"", RGB565(8080ff), 2, this); m_nBaud = 7; }
/*virtual*/ void CWndModuleSelector::Create(CWnd *pParent, ui16 dwFlags) { CWnd::Create("CWndModuleSelector", dwFlags, CRect(0, 16, 400, 240), pParent); #define _BORDER 20 #define _SPACING 8 #define _LEFT(x) m_rcClient.left+_BORDER+(m_rcClient.Width()-_BORDER*2-_SPACING)*(x)/3 #define _RIGHT(x) _LEFT(x+1)-_SPACING #define _TOP(y) m_rcClient.top+_BORDER+(m_rcClient.Height()-_BORDER*2-_SPACING)*(y)/3 #define _BOTTOM(y) _TOP(y+1)-_SPACING #define _ITEM(x,y) CRect(_LEFT(x), _TOP(y), _RIGHT(x), _BOTTOM(y)) CRect rcItem; rcItem = _ITEM(0, 0); m_itmOscilloscope.Create( "Oscillo\nscope", RGB565(ffffff), rcItem, this ); rcItem = _ITEM(1, 0); m_itmSpectrum.Create( "Spectrum\nanalyser", RGB565(ffffff), rcItem, this ); rcItem = _ITEM(2, 0); m_itmResponse.Create( "Frequency\nresponse", RGB565(808080), rcItem, this ); rcItem = _ITEM(0, 1); m_itmLogic.Create( "Logic\nanalyser", RGB565(808080), rcItem, this ); rcItem = _ITEM(1, 1); m_itmGenerator.Create( "Signal\nGenerator", RGB565(ffffff), rcItem, this ); rcItem = _ITEM(2, 1); m_itmSettings.Create( "Settings", RGB565(ffffff), rcItem, this ); rcItem = _ITEM(0, 2); m_itmUser.Create( "User\napplications", RGB565(ffffff), rcItem, this ); rcItem = _ITEM(1, 2); m_itmAbout.Create( "About", RGB565(ffffff), rcItem, this ); }
void CWndTuner::DrawKey(int nKey, bool bEnabled) { const int arrFull[] = {0, -1, 1, -2, 2, 3, -4, 4, -5, 5, -6, 6}; const char *notes[] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; CRect rc; int nFull = arrFull[nKey]; if (nFull >= 0) { rc = CRect(nFull * 20, 45, nFull * 20 + 18, 80); rc.Offset(40, 100); BIOS::LCD::Bar(rc, bEnabled ? RGB565(ff0000) : RGB565(b0b0b0)); if (bEnabled) { BIOS::LCD::Print(rc.CenterX() - 4 + 1, rc.bottom - 20 + 1, RGB565(800000), RGBTRANS, notes[nKey]); BIOS::LCD::Print(rc.CenterX() - 4, rc.bottom - 20, RGB565(ffff00), RGBTRANS, notes[nKey]); } int nCutLeft = 7, nCutRight = 4; if (nKey == 0 || arrFull[nKey - 1] >= 0) nCutLeft = 0; if (nKey == 11 || arrFull[nKey + 1] >= 0) nCutRight = 0; rc = CRect(nFull * 20 + nCutLeft, 0, nFull * 20 + 18 - nCutRight, 45); rc.Offset(40, 100); BIOS::LCD::Bar(rc, bEnabled ? RGB565(ff0000) : RGB565(b0b0b0)); } else { int nHalf = -nFull - 1; CRect rc(nHalf * 20 + 9 + 4, 0, nHalf * 20 + 18 + 9 - 4, 40); rc.Offset(40, 100); BIOS::LCD::Bar(rc, bEnabled ? RGB565(ff0000) : RGB565(000000)); } }
static void roll_up (vbi_page * pg, int first_row, int last_row) { ushort scol, *canvas = ximgdata + 45 * DISP_WIDTH; vbi_rgba col; int i, j; #if 1 /* soft */ sh_first = first_row; sh_last = last_row; shift = 26; bump(step, FALSE); canvas += 48 + (((last_row * CELL_HEIGHT) + CELL_HEIGHT - step) * DISP_WIDTH); col = pg->color_map[pg->text[last_row * pg->columns].background]; scol = RGB565 (col); for (j = 0; j < step; ++j) { if (pg->text[last_row * pg->columns].opacity == VBI_TRANSPARENT_SPACE) { for (i = 0; i < CELL_WIDTH * pg->columns; ++i) canvas[i] = RGB565 (COLORKEY); } else { for (i = 0; i < CELL_WIDTH * pg->columns; ++i) canvas[i] = scol; } canvas += DISP_WIDTH; } #else /* at once */ memmove (canvas + first_row * CELL_HEIGHT * DISP_WIDTH, canvas + (first_row + 1) * CELL_HEIGHT * DISP_WIDTH, (last_row - first_row) * CELL_HEIGHT * DISP_WIDTH * 2); draw_video (48, 45 + last_row * CELL_HEIGHT, DISP_WIDTH - 48, CELL_HEIGHT); #endif XPutImage (display, window, gc, ximage, 0, 0, 0, 0, DISP_WIDTH, DISP_HEIGHT); }
/*virtual*/ void CWndModuleSelector::OnKey(ui16 nKey) { if ( nKey & BIOS::KEY::KeyEnter ) { const char* strTarget = NULL; if ( GetFocus() == &m_itmOscilloscope ) strTarget = "Oscilloscope"; if ( GetFocus() == &m_itmSpectrum ) strTarget = "Spectrum"; if ( GetFocus() == &m_itmGenerator ) strTarget = "Generator"; if ( GetFocus() == &m_itmSettings ) strTarget = "Settings"; if ( GetFocus() == &m_itmAbout ) strTarget = "About"; if ( GetFocus() == &m_itmUser ) strTarget = "User app"; if (strTarget) { SendMessage( &MainWnd.m_wndToolBar, ToWord('g', 'o'), (NATIVEPTR)strTarget); } else { MainWnd.m_wndMessage.Show(this, "Info", "Sorry, not implemented", RGB565(FFFF00)); } return; } CWnd::OnKey( nKey ); }
void CIELab::initialize(void) { // Initialize the global lookup table from RGB565 to CIE L*a*b* for (unsigned v = 0; v < LUT_SIZE; v++) lut565[v] = CIELab(RGB565((uint16_t)v).rgb()); }
/*virtual*/ void CWndMenuSpectMain::Create(CWnd *pParent, ui16 dwFlags) { CWnd::Create("CWndMenuSpectMain", dwFlags, CRect(320-CWndMenuItem::MarginLeft, 20, 400, 240), pParent); m_itmCH1.Create(&Settings.CH1, this); m_itmCH2.Create(&Settings.CH2, this); m_itmWindow.Create("Hann\nN=1024", RGB565(0000ff), 2, this); }
/*virtual*/ void CWndMenuMask::Create(CWnd *pParent, ui16 dwFlags) { m_Action = ActionNone; m_Display = DisplayNo; CWnd::Create("CWndMenuMask", dwFlags | CWnd::WsListener, CRect(320 - CWndMenuItem::MarginLeft, 20, 400, 240), pParent); m_btnSource.Create("Source\nCH1", RGB565(ffff00), 2, this); m_btnReset.Create("Reset\nmask", RGB565(8080ff), 2, this); m_btnCollect.Create(m_strStart, RGB565(8080ff), 2, this); m_itmAction.Create("Action", RGB565(ffffff), &m_proAction, this); m_proAction.Create((const char **)m_ppszTextAction, (NATIVEENUM *)&m_Action, ActionMax); m_btnExpand.Create( "\x11" "Expand\x10", RGB565(8080ff), 1, this); m_btnBlur.Create("\x11 Blur \x10", RGB565(8080ff), 1, this); m_itmDisplay.Create("Display", RGB565(ffffff), &m_proDisplay, this); m_proDisplay.Create((const char **)m_ppszDispAction, (NATIVEENUM *)&m_Display, DisplayMax); }
void virtual_kdb(char *pix,int vx,int vy) { int y,x,page=NPAGE==-1?0:50; short unsigned coul=RGB565(28, 28, 31); BKGCOLOR=(KCOL>0?0x8080:0); for(x=0; x<NPLGN; x++) { for(y=0; y<NLIGN; y++) { DrawBoxBmp(pix,XBASE3+x*XSIDE,YBASE3+y*YSIDE, XSIDE,YSIDE, RGB565(7, 2, 1)); Draw_text(pix,XBASE0-2+x*XSIDE ,YBASE0+YSIDE*y,coul, BKGCOLOR ,2, 2,20,\ SHIFTON==-1?MVk[(y*NPLGN)+x+page].norml:MVk[(y*NPLGN)+x+page].shift); } } DrawBoxBmp(pix,XBASE3+vx*XSIDE,YBASE3+vy*YSIDE, XSIDE,YSIDE, RGB565(31, 2, 1)); Draw_text(pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,1), BKGCOLOR ,2, 2,20,\ SHIFTON==-1?MVk[(vy*NPLGN)+vx+page].norml:MVk[(vy*NPLGN)+vx+page].shift); }
void Print_Statut(){ DrawFBoxBmp(bmp,0,CROP_HEIGHT,CROP_WIDTH,STAT_YSZ,RGB565(0,0,0)); Draw_text(bmp,STAT_DECX+40 ,10,0xffff,0x8080,1,2,40,(SND>0?"SND":" ")); Draw_text(bmp,STAT_DECX+80 ,10/*STAT_BASEY*/,0xffff,0x8080,1,2,40,(RVSYNC>0?"SYNC ON ":"SYNC OFF")); Draw_text(bmp,STAT_DECX+120,10,0xffff,0x8080,1,2,40,"JOY%c",NUMjoy>0?'1':'2'); Draw_text(bmp,STAT_DECX+40 ,20,0xffff,0x8080,1,2,40,"mx:%d my:%d (%d,%d)",tomx,tomy,fmousex,fmousey); }
/*virtual*/ void CWndListCalSimple::OnMessage(CWnd* pSender, ui16 code, ui32 data) { if ( pSender == NULL && code == WmBroadcast && data == ToWord('d', 'g') ) { OnWave(); return; } if ( pSender == &m_itmReset && code == ToWord('l', 'e') ) { MainWnd.m_wndConfirm.Show( this, "Message", "Connect probe to ground\nReady?", RGB565(ffff00), "Yes", "No"); return; } if ( pSender == &MainWnd.m_wndConfirm && code == ToWord('e', 'd') && data == (ui32)"Yes" ) { m_proReset.m_pName = "Wait..."; m_itmReset.Invalidate(); m_nResetPhase = 0; MainWnd.m_wndConfirm.Hide(); return; } if ( pSender == &MainWnd.m_wndConfirm && code == ToWord('e', 'd') && data == (ui32)"No" ) { MainWnd.m_wndConfirm.Hide(); return; } if ( pSender == &m_itmSave && code == ToWord('l', 'e') ) { SaveCalib(); StopModal(); return; } if ( pSender == &m_itmNumber && code == ToWord('u', 'p') ) { int nNewVal = m_nValue; UTILS.Clamp<int>(m_nValue, 256, 4096); if ( nNewVal != m_nValue ) m_itmNumber.Invalidate(); _UpdateCalib( m_nValue, V_LEVEL ); UpdateZero(); // TODO: neni treba! } if ( ( pSender == &m_itmSource || pSender == &m_itmResolution ) && code == ToWord('u', 'p') ) { LoadCalib(); UpdateZero(); return; } CListBox::OnMessage( pSender, code, data ); }
void CWndListCalAnalog::Finished() { // calibration finished CSettings::LinCalibCurve& calCurve = Settings.CH1Calib.CalData[m_calRange]; if ( m_calChannel == CSettings::Trigger::_CH2 ) calCurve = Settings.CH2Calib.CalData[m_calRange]; calCurve = m_calCurve; MainWnd.Invalidate(); // parent doesn't exist anymore, window is destroyed! MainWnd.m_wndMessage.Show( &MainWnd, "Information", "Calibration finished!", RGB565(ffff00)); }
static void (SpinnerAppOnTick) (App * instance, GfxRect const * region, int16_t * audio_samples, int16_t tilt, int8_t knob_turn_delta, int8_t knob_press_delta, bool force_redraw) { assert(instance); SpinnerApp * app = (SpinnerApp *) instance; uint16_t speed1 = AudioProcPower(audio_samples); if (speed1 < 128) { speed1 = 0; } else { speed1 -= 128; } if (speed1 > 1000) speed1 = 1000; int16_t speed2 = app->speed_widget.val * 100; uint8_t brightness = app->brightness_widget.val * 255 / 100; uint8_t collision = app->collision_widget.val * 255 / 100; unsigned index1 = app->spinner1_count / 1000; unsigned index2 = app->spinner2_count / 1000; if (index1 == index2) { AppSetPixel(index1, RGB888(collision, collision, collision)); } else { AppSetPixel(index1, RGB888(brightness, 0x00, 0x00)); AppSetPixel(index2, RGB888(0x00, 0x00, brightness)); } app->spinner1_count = mod(app->spinner1_count + speed1, 10000); app->spinner2_count = mod(app->spinner2_count - speed2, 10000); GfxRect volume_region, widget_region; GfxSubRegion(region, 0, 0, region->w, 4, &volume_region); GfxSubRegion(region, 0, 4, region->w, region->h - 4, &widget_region); DrawHorizontalVolumeBar(&volume_region, speed1 / 8, RGB565(0x80, 0x80, 0xC0), RGB565_BLACK); app->widget->OnTick(app->widget, &widget_region, knob_turn_delta, knob_press_delta, force_redraw, WIDGET_ACTIVE); }
void CWndManager::Create( CWnd* pParent ) { CListBox::Create("Wave Manager", CWnd::WsHidden | CWnd::WsModal, CRect( (BIOS::LCD::LcdWidth-Width)/2 , (BIOS::LCD::LcdHeight-Height)/2, (BIOS::LCD::LcdWidth+Width)/2, (BIOS::LCD::LcdHeight+Height)/2 ), RGB565(8080d0), pParent); m_nValue = 0; m_itmTabs.Create( (const char**)tabs, RGB565(8080d0), this ); m_proValue.Create( &m_nValue, 0, 100 ); m_itmValue.Create( "File nr.", CWnd::WsVisible, &m_proValue, this ); m_itmSpace1.Create( "", CWnd::WsVisible | CWnd::WsNoActivate, this); m_itmFile.Create( " WAVE000.DAT", CWnd::WsVisible | CWnd::WsNoActivate, this); // m_itmSpace2.Create( "", CWnd::WsVisible | CWnd::WsNoActivate, this); m_proLoad.Create( "Load" ); m_itmLoad.Create( "", CWnd::WsVisible, &m_proLoad, this ); m_proSave.Create( "Save" ); m_itmSave.Create( "", CWnd::WsVisible, &m_proSave, this ); }
int alphaBlend(int fgcolor, byte a) { int r=((fgcolor>>11)&0x1f)<<3; int g=((fgcolor>>5)&0x3f)<<2; int b=(fgcolor&0x1F)<<3; r*=a; r/=100; g*=a; g/=100; b*=a; b/=100; return RGB565(r,g,b); }
void CWndUserMonitor::OnTick() { int ch; bool nLastCrLf = false; while ( (ch = BIOS::SERIAL::Getch()) >= 0 ) { if ( ch == 0x0d || ch == 0x0a ) // cr { if ( nLastCrLf ) continue; nLastCrLf = true; m_x = 0; if ( ++m_y >= 12 ) { m_y = 0; BIOS::LCD::Bar( 4, 24, 4+32*8, 24 + 12*16, RGB565(000000) ); } continue; } else nLastCrLf = false; int x = m_x * 8 + 4; int y = m_y * 16 + 24; char str[2] = {(char)ch, 0}; BIOS::LCD::Print(x, y, RGB565(ffffff), RGB565(000000), str); if ( ++m_x >= 32 ) { m_x = 0; if ( ++m_y >= 12 ) { m_y = 0; BIOS::LCD::Bar( 4, 24, 4+32*8, 24 + 12*16, RGB565(000000) ); } } } }
static int DISPMANX_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) { int i; static unsigned short pal[256]; //Set up the colormap for (i = 0; i < ncolors; i++) { pal[i] = RGB565 ((colors[i]).r, (colors[i]).g, (colors[i]).b); } vc_dispmanx_resource_set_palette( dispvars->resources[flip_page], pal, 0, sizeof pal ); vc_dispmanx_resource_set_palette( dispvars->resources[!flip_page], pal, 0, sizeof pal ); return(1); }
void CWndTuner::DrawScale() { /* -50 -25 0 25 50 |--------|------|------|-------| */ CRect rcScale(200, 120, 340, 132); BIOS::LCD::Bar(rcScale, RGB565(808080)); for (int i = 0; i < 8; i++) { CRect rcSegment; rcSegment.top = rcScale.top; rcSegment.bottom = rcScale.bottom - 2; rcSegment.left = rcScale.left + 1 + (rcScale.Width() - 2) * i / 8 + 1; rcSegment.right = rcScale.left + 1 + (rcScale.Width() - 2) * (i + 1) / 8 - 1; ui16 clr = RGB565(ffffff); BIOS::LCD::Bar(rcSegment, clr); switch (i) { case 2: BIOS::LCD::Print(rcSegment.left - 3 * 4 - 2, rcSegment.top - 20, RGB565(000000), RGBTRANS, "-25"); break; case 4: BIOS::LCD::Print(rcSegment.left - 1 * 4 - 2, rcSegment.top - 20, RGB565(000000), RGBTRANS, "0"); break; case 6: BIOS::LCD::Print(rcSegment.left - 3 * 4 - 2, rcSegment.top - 20, RGB565(000000), RGBTRANS, "+25"); break; } rcSegment.top = rcSegment.bottom - 2; clr = RGB565(ff0000); if (i >= 1 && i <= 6) clr = RGB565(ff8000); if (i >= 2 && i <= 5) clr = RGB565(ffff00); if (i == 3 || i == 4) clr = RGB565(00ff00); BIOS::LCD::Bar(rcSegment, clr); } }
static void draw_video (int x0, int y0, int w, int h) { ushort *canvas = ximgdata + x0 + y0 * DISP_WIDTH; int x, y; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) canvas[x] = RGB565(COLORKEY); canvas += DISP_WIDTH; } }
void CWndTuner::DrawPiano() { for (int i = 0; i < 7; i++) { CRect rc(i * 20, 0, i * 20 + 18, 80); rc.Offset(40, 100); rc.Offset(4, 4); BIOS::LCD::Bar(rc, RGB565(f0f0f0)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(e0e0e0)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(d0d0d0)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(c0c0c0)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(b0b0b0)); } for (int i = 0; i < 6; i++) { if (i == 2) continue; CRect rc(i * 20 + 9 + 4, 0, i * 20 + 18 + 9 - 4, 40); rc.Offset(40, 100); rc.Offset(4, 4); BIOS::LCD::Bar(rc, RGB565(b0b0b0)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(808080)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(606060)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(404040)); rc.Offset(-1, -1); BIOS::LCD::Bar(rc, RGB565(000000)); } }
/*virtual*/ void CWndMenuGeneratorEdit::Create(CWnd *pParent, ui16 dwFlags) { CWnd::Create("CWndMenuGeneratorEdit", dwFlags, CRect(280-CWndMenuItem::MarginLeft, 20, 400, 240), pParent); m_itmCopy.Create("Copy\nCH1", RGB565(b00040), 2, this ); m_itmNormalize.Create("Normalize", RGB565(b00040), 1, this ); m_itmInvert.Create("Invert", RGB565(b00040), 1, this ); m_itmEdit.Create("Edit", RGB565(b00040), 1, this ); m_itmLoad.Create("~Load", RGB565(b00040), 1, this ); m_itmSave.Create("~Save", RGB565(b00040), 1, this ); }
void Print_Statut(void) { STAT_BASEY=CROP_HEIGHT; DrawFBoxBmp(bmp,0,CROP_HEIGHT,CROP_WIDTH,STAT_YSZ,RGB565(0,0,0)); if(MOUSEMODE==-1) Draw_text(bmp,STAT_DECX,STAT_BASEY,0xffff,0x8080,1,2,40,"Joy "); else Draw_text(bmp,STAT_DECX,STAT_BASEY,0xffff,0x8080,1,2,40,"Mouse"); Draw_text(bmp,STAT_DECX+40 ,STAT_BASEY,0xffff,0x8080,1,2,40,(SHIFTON>0?"SHFT":"")); Draw_text(bmp,STAT_DECX+80 ,STAT_BASEY,0xffff,0x8080,1,2,40,"MS:%d",PAS); Draw_text(bmp,STAT_DECX+120,STAT_BASEY,0xffff,0x8080,1,2,40,"Joy:%d",NUMjoy); }
BOOL SizeImg_MemLoad(unsigned char *mem_ptr) { int i, j, k; // Loop counter unsigned short *p_pix; unsigned char *p_img; unsigned int offset; int width, height; if (mem_ptr == NULL) return FALSE; if ((offset = IMG_Header(mem_ptr, &width, &height)) <= 0) { RETAILMSG(1,(L"\nSize image file is not supported format.\n")); return FALSE; } p_img = mem_ptr + offset; for (i=0; i<NUM_SIZE_IMG; i++) { size_img[i] = num_size_data + (i * SIZE_IMG_WIDTH * SIZE_IMG_HEIGHT); } for (i=0; i<SIZE_IMG_HEIGHT; i++) { for (j=0; j<NUM_SIZE_IMG; j++) { p_pix = size_img[j] + (SIZE_IMG_WIDTH * i); for (k=0; k<SIZE_IMG_WIDTH; k++) { *p_pix = RGB565(p_img[0], p_img[1], p_img[2]); p_img += 3; p_pix++; } } } return TRUE; }
void CWndUserMonitor::OnMessage(CWnd* pSender, ui16 code, ui32 data) { if ( code == ToWord('t', 'i') ) { OnTick(); return; } // LAYOUT ENABLE/DISABLE FROM TOP MENU BAR if (code == ToWord('L', 'D') ) { KillTimer(); return; } if (code == ToWord('L', 'E') ) { m_x = 0; m_y = 0; SetTimer(500); return; } if ( pSender == &m_itmBaud && code == ToWord('u', 'p') ) { int nBaudrate = m_pnValueBaud[m_nBaud]; BIOS::SERIAL::Configure( nBaudrate ); } if ( pSender == &m_btnClear && code == CWnd::WmKey && data == BIOS::KEY::KeyEnter ) { m_x = 0; m_y = 0; BIOS::LCD::Bar( 4, 24, 4+32*8, 24 + 12*16, RGB565(000000) ); } /* if ( pSender == &m_btnSend && code == CWnd::WmKey && data == BIOS::KEY::KeyEnter ) { BIOS::SERIAL::Send("Hello"); } */ }
int alphaBlend(int fgcolor, int bgcolor, byte a) { int r=((fgcolor>>11)&0x1f)<<3; int g=((fgcolor>>5)&0x3f)<<2; int b=(fgcolor&0x1F)<<3; r*=a; g*=a; b*=a; int r1=((bgcolor>>11)&0x1f)<<3; int g1=((bgcolor>>5)&0x3f)<<2; int b1=(bgcolor&0x1F)<<3; r1*=(100-a); g1*=(100-a); b1*=(100-a); r+=r1; g+=g1; b+=b1; r/=100; g/=100; b/=100; return RGB565(r,g,b); }
/* Not exactly efficient, but this is only a test */ static void draw_row (ushort * canvas, vbi_page * pg, int row) { int i, j, num_tspaces = 0; vbi_rgba *s = row_buffer; for (i = 0; i < pg->columns; ++i) { if (pg->text[row * pg->columns + i].opacity == VBI_TRANSPARENT_SPACE) { num_tspaces++; continue; } if (num_tspaces > 0) { draw_blank(i - num_tspaces, num_tspaces); num_tspaces = 0; } vbi_draw_cc_page_region (pg, VBI_PIXFMT_RGBA32_LE, row_buffer + i * CELL_WIDTH, sizeof(row_buffer) / CELL_HEIGHT, i, row, 1, 1); } if (num_tspaces > 0) draw_blank(i - num_tspaces, num_tspaces); for (i = 0; i < CELL_HEIGHT; i++) { for (j = 0; j < pg->columns * CELL_WIDTH; j++) canvas[j] = RGB565(s[j]); s += sizeof(row_buffer) / sizeof(row_buffer[0]) / CELL_HEIGHT; canvas += DISP_WIDTH; } }