/* Load Flash contents into DDR. Input: start Image start address on flash. size Image size. */ void load(uint start, uint size) { uint step; // Progress bar step size. uint cval; // Current progress value. cls(); // User Upload Menu. drawWindow(&wDDRUpload); // Upload Initialization. pbUpload.val = 0; drawProgressBar(&wDDRUpload, &pbUpload); step = size / 64; cval = step; // Copy flash data to DDR2 memory. // NOTE: Missing bytes, if binary file is not 4 bytes aligned. for(uint i=0; i < (size / 4); i++) { DDR_ADDRESS[i] = flash_read(i + start); // Update status bar. if(i == cval) { pbUpload.val++; drawProgressBar(&wUpload, &pbUpload); cval += step; } } }
void cmd_progress(uint8_t argc, char **argv) { int32_t x, y, w, h, percent, border, borderfill, progressborder, progressfill; // Convert supplied parameters getNumber (argv[0], &x); getNumber (argv[1], &y); getNumber (argv[2], &w); getNumber (argv[3], &h); getNumber (argv[4], &percent); getNumber (argv[5], &border); getNumber (argv[6], &borderfill); getNumber (argv[7], &progressborder); getNumber (argv[8], &progressfill); // ToDo: Validate data! if (border < 0 || border > 0xFFFF || borderfill < 0 || borderfill > 0xFFFF || progressborder < 0 || progressborder > 0xFFFF || progressfill < 0 || progressfill > 0xFFFF) { printf("Invalid Color%s", CFG_PRINTF_NEWLINE); return; } if (percent < 0 || percent > 100) { printf("Invalid Percentage%s", CFG_PRINTF_NEWLINE); return; } // Draw the progress bar (always use rounded corners for simplicity sake) drawProgressBar(x, y, w, h, DRAW_ROUNDEDCORNERS_ALL, DRAW_ROUNDEDCORNERS_ALL, border, borderfill, progressborder, progressfill, percent); }
void KisNodeDelegate::paint(QPainter *p, const QStyleOptionViewItem &o, const QModelIndex &index) const { p->save(); { QStyleOptionViewItemV4 option = getOptions(o, index); QStyle *style = option.widget ? option.widget->style() : QApplication::style(); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, p, option.widget); bool shouldGrayOut = index.data(KisNodeModel::ShouldGrayOutRole).toBool(); if (shouldGrayOut) { option.state &= ~QStyle::State_Enabled; } p->setFont(option.font); drawColorLabel(p, option, index); drawFrame(p, option, index); drawThumbnail(p, option, index); drawText(p, option, index); drawIcons(p, option, index); drawVisibilityIconHijack(p, option, index); drawDecoration(p, option, index); drawExpandButton(p, option, index); drawProgressBar(p, option, index); } p->restore(); }
//-------------------------------------------------------------- void testApp::draw() { //-- bg. ofFill(); int gray = 30; ofSetColor( gray, gray, gray ); ofRect( 0, 0, ofGetWidth(), ofGetHeight() ); //-- video image large. int gap = 10; glPushMatrix(); glTranslatef( gap, gap, 0 ); drawBorder( videoImg.width, videoImg.height ); ofSetColor( 0xFFFFFF ); videoImg.draw( 0, 0 ); //-- video image small. glPushMatrix(); glTranslatef( videoRect.width + gap, 0, 0 ); drawBorder( videoSml.width, videoSml.height ); videoSml.draw( 0, 0 ); drawHaarTracker(); glPushMatrix(); glTranslatef( 0, videoSml.height + gap, 0 ); audio.draw( 512, 256 ); glPopMatrix(); glPopMatrix(); //-- subtitles. ofFill(); ofSetColor( 0xFF00FF ); fontCooperBlack.drawString( subtitleStr, 0, 620 ); drawSpeachBubbles(); glPopMatrix(); drawProgressBar(); screenGrab.save(); }
void testApp::drawOverlays() { if(recording) { drawProgressBar(ofMap(video->getLength(), 0, MAX_VIDEO_LENGTH, 0, 1)); } else if(holdCount>0 && holdCount<HOLD_COUNT) { drawCountdown((float)holdCount/(float)HOLD_COUNT); } presenceDetector.draw(carousel.amountOfVideoFeedShowing()); thanksSign.draw(); }
void KoDocumentSectionDelegate::paint(QPainter *p, const QStyleOptionViewItem &o, const QModelIndex &index) const { p->save(); { QStyleOptionViewItemV4 option = getOptions(o, index); QStyle *style = option.widget ? option.widget->style() : QApplication::style(); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, p, option.widget); p->setFont(option.font); drawText(p, option, index); drawIcons(p, option, index); drawThumbnail(p, option, index); drawDecoration(p, option, index); drawProgressBar(p, option, index); } p->restore(); }
QString CFileTransferAction::getMessage() { QString content; //如果传输成功,且文件是图片,则直接在消息对话框中显示图片 if(m_File->GetError() == CFileTransfer::NoError && m_File->GetState() == CFileTransfer::FinishedState && CTool::isImageFile(m_File->GetLocalFileUrl().toLocalFile())) { return drawImageFile(); } //content += "<table bgcolor='#00ffff'>"; content += "<table>"; content += drawTop(); content += drawProgressBar(); content += drawBottom(); content += "</table>"; return content; }
void SplashScreen::draw() { hkgDisplayContext* ctx = m_window->getContext(); ctx->lock(); ctx->setLightingState( false ); // Adds a ref to m_splashTexture ctx->setCurrentSoleTexture( m_splashTexture, HKG_TEXTURE_MODULATE ); hkgViewport* orthoView = m_window->getWindowOrthoView(); orthoView->setAsCurrent(ctx); bool logoState = m_window->getWantDrawHavokLogo(); m_window->setWantDrawHavokLogo(false); drawSplash(); if (m_progressBarEnabled) { drawProgressBar(); } float restoreBK[3]; m_window->getClearColor(restoreBK); m_window->setClearColor(HKG_VEC3_ZERO); m_window->swapBuffers(); m_window->clearBuffers(); m_window->setClearColor(restoreBK); m_window->setWantDrawHavokLogo(logoState); // Removes a ref from m_splashTexture ctx->setCurrentSoleTexture(HK_NULL, HKG_TEXTURE_MODULATE); ctx->unlock(); }
void LfpDisplayCanvas::renderOpenGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // clear buffers to preset values //glClear(GL_COLOR_BUFFER_BIT); // clear buffers to preset values if (animationIsActive) updateScreenBuffer(); for (int i = 0; i < nChans; i++) { bool isSelected = false; if (selectedChan == i) isSelected = true; if (checkBounds(i)) { //setViewport(i); //drawBorder(isSelected); drawWaveform(i,isSelected); drawChannelInfo(i,isSelected); } } drawScrollBars(); drawProgressBar(); drawTimeline(); // glFlush(); swapBuffers(); }
static int countdown( const char * msg, int row, int timeout ) { unsigned long time; int ch = 0; int col = strlen(msg) + 1; flushKeyboardBuffer(); if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { moveCursor( 0, row ); printf(msg); } else { position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) ); char dummy[80]; getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); // make this screen the new background memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); } int multi_buff = 18 * (timeout); int multi = ++multi_buff; int lasttime=0; for ( time = time18(), timeout++; timeout > 0; ) { if( time18() > lasttime) { multi--; lasttime=time18(); } if (ch = readKeyboardStatus()) break; // Count can be interrupted by holding down shift, // control or alt key if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) { ch = 1; break; } if ( time18() >= time ) { time += 18; timeout--; if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { moveCursor( col, row ); printf("(%d) ", timeout); } } if( bootArgs->Video.v_display == GRAPHICS_MODE ) { drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) ); gui.redraw = true; updateVRAM(); } } flushKeyboardBuffer(); return ch; }
void game::MainLoop(void) { r3dOutToLog("Starting updater, v:%s, cmd:%s\n", UPDATER_VERSION, __r3dCmdLine); CUpdater updater; // parse command line int argc = 0; char** argv = CommandLineToArgvA(__r3dCmdLine, &argc); for(int i=0; i<argc; i++) { /*if(strcmp(argv[i], "-steam") == 0 && (i + 0) < argc) { r3dOutToLog("Trying to init steam\n"); gSteam.InitSteam(); continue; }*/ } if(g_isConsoleUpdater) { cmdLine_MainLoop(updater); return; } updater.Start(); win32_input_Flush(); if(g_taskbar) g_taskbar->SetProgressState(win::hWnd, TBPF_NORMAL); r3dStartFrame(); while(1) { r3dEndFrame(); r3dStartFrame(); g_mb = 0; g_hCursor = gCursorArrow; tempDoMsgLoop(); ::Sleep(1); r3dRenderer->StartRender(); r3dRenderer->StartFrame(); r3dRenderer->SetRenderingMode(R3D_BLEND_ALPHA | R3D_BLEND_NZ); r3dSetFiltering(R3D_POINT); r3dDrawBox2D(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(64, 64, 64)); #if 0 updater.status_ = CUpdater::STATUS_TimeExpired; updater.showProgress_ = false; updater.prgTotal_.cur = 100; updater.prgTotal_.total = 100; r3dscpy(updater.updMsg1_, "Xxxxxxx"); #endif switch(updater.status_) { default: r3d_assert(0); case CUpdater::STATUS_Checking: g_bkgStarting->draw(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(255, 255, 255)); break; case CUpdater::STATUS_NeedLogin: g_bkgLogin->draw(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(255, 255, 255)); drawLoginButtons(updater); break; case CUpdater::STATUS_SerialCheck: g_bkgSerialCheck->draw(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(255, 255, 255)); drawSerialCheckButtons(updater); break; case CUpdater::STATUS_NeedRegister: g_bkgRegister->draw(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(255, 255, 255)); drawRegisterButtons(updater); break; case CUpdater::STATUS_TimeExpired: g_bkgExpired->draw(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(255, 255, 255)); drawTimeExpiredButtons(updater); break; case CUpdater::STATUS_Updating: g_bkgUpdate->draw(0, 0, r3dRenderer->ScreenW, r3dRenderer->ScreenH, r3dColor(255, 255, 255)); drawUpdateButtons(updater); drawServerStatus(updater); drawNews(updater); break; } drawProgressBar(updater); drawCloseButton(); r3dRenderer->EndFrame(); r3dRenderer->EndRender(true); // if exit requested by control-f4 if(g_bExit) { updater.RequestStop(); break; } // activate updater window if other instance requested it if(WaitForSingleObject(g_updaterEvt, 0) == WAIT_OBJECT_0) { SwitchToThisWindow(win::hWnd, TRUE); } // try to remove mouse lock because of // win::HandleActivate code that will lock mouse inside window ClipCursor(NULL); // if signalled to play game if(g_bStartGame) break; if(updater.result_ != CUpdater::RES_UPDATING && updater.result_ != CUpdater::RES_PLAY) break; // wndclass.hCursor must be NULL for this to work //SetCursor(g_hCursor); } updater.Stop(); if(g_taskbar) g_taskbar->SetProgressState(win::hWnd, TBPF_NOPROGRESS); switch(updater.result_) { default: r3d_assert(0); case CUpdater::RES_STOPPED: break; case CUpdater::RES_PLAY: startGame(updater); break; case CUpdater::RES_ERROR: showErrorMessageBox(updater); break; } gHwInfoPoster.Stop(); TerminateProcess(GetCurrentProcess(), 0); return; }
/* NOTE: Automatic deduction of the number of blocks, that need to be erased has not been tested extensive. */ void upload() { uint size; // Image size. uint step; // Progress bar step size. uint cval; // Current progress value. // Clear screen. cls(); // User Upload Menu. drawWindow(&wUpload); // Upload Initialization. drawMessage(&wUpload, &msgUploadWait); pbUpload.val = 0; drawProgressBar(&wUpload, &pbUpload); // Receive 4 bytes of size data. for(uchar i=0; i < 4; i++) { size <<= 8; size += rs232_receive(); } // Check for image size to fit into flash. if(size > FLASH_BLOCK_SIZE * FLASH_BLOCKS) { drawErrorWindow(&errErrorFlashSize); return 0; } // Flash Clean Up. drawMessage(&wUpload, &msgUploadErase); pbUpload.val = 0; // Reset progress bar. drawProgressBar(&wUpload, &pbUpload); // Erase affected flash blocks. for(uint i=0; i < (size / FLASH_BLOCK_SIZE) + 1; i++) { flash_block_erase(i * FLASH_BLOCK_SIZE); // Update the Progress Bar. pbUpload.val = (i >> 1); drawProgressBar(&wUpload, &pbUpload); // Check for errors while erasing. if(flash_wait() & FLASH_ERASE_ERROR) { drawErrorWindow(&errErrorFlashErase); return 0; } } // Write image size at flash address 0x0. for(uchar i=0; i<4; i++) { flash_write(i, size >> ((3-i) * 8) ); checkFlashWrite(); } // Upload data. drawMessage(&wUpload, &msgUploadWrite); pbUpload.val = 0; // Reset progress bar. step = size / 64; // Calculate progress step size. cval = step; // Echoing received image size. for(uchar i=0; i<4; i++) { rs232_transmit( size >> ((3-i) * 8) ); } // Write each single byte to Flash. for(uint i=0; i < size; i++) { flash_write(i + 4, rs232_receive()); // Update status bar. if(i == cval) { pbUpload.val++; drawProgressBar(&wUpload, &pbUpload); cval += step; } checkFlashWrite(); } // Go back to main menu. boot(); }
void medium::populateOSCAR(int _ntmin, int _ntmax) { cout << endl; cout << "populating the hydro array: " << "itime " << _ntmin << " to " << _ntmax << endl; hydro.clear(); ntmin = _ntmin; ntmax = _ntmax; //Open the file stream string line; ifstream infile; infile.open(filename); //Skip the header data if (!infile) cout << "Error opening data file." << endl; else{ for(int l=0; l<14; l++) getline(infile,line); } //Skip to the initial read position int start_read = ntmin*nx*ny*nz; int reads = (ntmax-ntmin+1)*nx*ny*nz; for(int i=0; i<start_read;i++) getline(infile,line); //Read the OSCAR file for(int i=0; i<reads; i++) { double perc = (double)i/(double)reads; int q = reads/40; if(i%q==0)drawProgressBar(40,perc); // Read in a hydro cell if(parse_it) {infile >> it;} if(parse_ix) {infile >> ix;} if(parse_iy) {infile >> iy;} if(parse_iz) {infile >> iz;} if(parse_tau) {infile >> tau;} if(parse_x) {infile >> x;} if(parse_y) {infile >> y;} if(parse_eta) {infile >> eta;} if(parse_e) {infile >> e;} if(parse_p) {infile >> p;} if(parse_T) {infile >> T;} if(parse_R_qgp) {infile >> R_qgp;} if(parse_vx) {infile >> vx;} if(parse_vy) {infile >> vy;} if(parse_y_L) {infile >> y_L;} infile.ignore(1000, '\n'); cell* fluidcell = new cell; // Store the spacetime indices and coords if(toggle_it) {fluidcell->coord.push_back(it);} if(toggle_ix) {fluidcell->coord.push_back(ix);} if(toggle_iy) {fluidcell->coord.push_back(iy);} if(toggle_iz) {fluidcell->coord.push_back(iz);} fluidcell->position = coord2position(fluidcell->coord); // Store additional Lagrangian coordinates if(toggle_tau) fluidcell->lagrange.push_back(tau); if(toggle_x) fluidcell->lagrange.push_back(x); if(toggle_y) fluidcell->lagrange.push_back(y); if(toggle_eta) fluidcell->lagrange.push_back(eta); // Store thermal properties if(toggle_e) fluidcell->thermal.push_back(e); if(toggle_p) fluidcell->thermal.push_back(p); if(toggle_T) fluidcell->thermal.push_back(T); if(toggle_R_qgp) fluidcell->thermal.push_back(R_qgp); // Store flow velocities double gamma_perp=1; if(toggle_vx && toggle_vy && toggle_y_L) gamma_perp= 1/pow(1-vx*vx-vy*vy,0.5); if(toggle_vx && toggle_vy && toggle_y_L) fluidcell->velocity.push_back(gamma_perp*cosh(y_L)); if(toggle_vx && toggle_vy && toggle_y_L) fluidcell->velocity.push_back(gamma_perp*vx); if(toggle_vx && toggle_vy && toggle_y_L) fluidcell->velocity.push_back(gamma_perp*vy); if(toggle_vx && toggle_vy && toggle_y_L) fluidcell->velocity.push_back(gamma_perp*sinh(y_L)); // Add the fluid cell to the hydro vector hydro.push_back(fluidcell); } cout << endl; infile.close(); }
// ekrana çizen fonksiyon. void DrawScreen::drawWindow(cv::Point& coordinate) { // sayilari ciz drawButtonArea(); drawNumbers(); /* renk degistiren cizgi */ /* uchar*row = frames.ptr<uchar>(300); line(frames, cv::Point(440, 300), cv::Point(460, 460), CV_RGB(255 - row[440], 255 - row[440], 255 - row[440]), 3, 2, 0); // dikey 3. */ // secilen sayilari ekrana basar if (num_color) { putText(frames, numbers, cv::Point(75, 85), 7, 3, NUMBER2_COLOR, 3); } else { putText(frames, numbers, cv::Point(75, 85), 7, 3, NUMBER3_COLOR, 3); } if (coordinate.x != -1 && coordinate.y != -1) { int temp = returnPosition(coordinate.x, coordinate.y); // eger temp 0'dan buyukse ve keyTurn onceden bir tusun ustunde bulunmussa timeCounter artilir if (temp > 0 && temp == keyTurn) { timeCounter++; } // eger temp 0'dan buuykse ama keyTurk tempe esit degilse , ilk kez o numaraya giriyor demektir , timeCounter 1 yapilir ve keyTurn'e temp degeri atanir else if (temp > 0) { keyTurn = temp; timeCounter = 1; } // bunlarin hicbiri olmamissa timeCounter ve keyTurn default degerlerine dondurulur else { keyTurn = -1; timeCounter = 0; } // dairesel progress bar ciz drawProgressBar(temp); // eger timeCounter degeri istenen miktara ulasmissa bu deger artik bir input olmus demektir if (timeCounter >= TIME_COUNTER) { // eger bu deger 11'den kucuk ve 0'dan buyuk ise bu bir rakam demektir , 10'a gore mod alinir if (keyTurn < 11 && keyTurn>0) { keyTurn = keyTurn % 10; printf("Deger %d\n", keyTurn); numbers = numbers + intToString(keyTurn); } // 11 ise iptal butonudur else if (keyTurn == 11) { printf("CANCEL\n"); num_color = true; numbers = ""; } // 12 ise silme butonudur else if (keyTurn == 12) { int lng = numbers.length() - 1; if (lng >= 0) { string str2 = numbers.substr(0, numbers.length() - 1); printf("REMOVE\n"); numbers = str2; } } // 13 ise onaylama butonudur else if (keyTurn == 13) { printf("ONAY\n"); num_color = false; } // timeCounter ve keyTurn degerlerini default degerlerine getir timeCounter = 0; keyTurn = -1; } // marker icin arti isaretini ciz if (temp == -1) { drawObject(coordinate.x, coordinate.y); } } // marker bulunamamissa keyTurn ve timeCounter degerlerini default degerlerine getir else { keyTurn = -1; timeCounter = 0; } }