void run_option_1(double ect, double u) { SDL_Surface *ecran = NULL, *rectangle = NULL; if (SDL_Init(SDL_INIT_VIDEO) == -1) { fprintf(stderr, "Erreur d'initialisation de la SDL : %s\n", SDL_GetError()); exit(EXIT_FAILURE); } ecran = SDL_SetVideoMode(WIN_WIDTH, WIN_HEIGHT, 32, SDL_HWSURFACE| SDL_DOUBLEBUF); if (ecran == NULL) { fprintf(stderr, "Impossible de charger le mode vidéo : %s\n", SDL_GetError()); exit(EXIT_FAILURE); } rectangle = SDL_CreateRGBSurface(SDL_HWSURFACE, 1,2, 32, 0, 0, 0, 0); SDL_WM_SetCaption("205 Qi 2013 Belia-_r", NULL); SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 12,2,45)); draw_legend(ecran); draw_lgd(ecran); draw_axe_x(ecran, rectangle, WIN_HEIGHT - 50); draw_lgd_x(ecran, rectangle, WIN_HEIGHT - 50); draw_axe_y(ecran, rectangle, 50); draw_lgd_y(ecran, rectangle, 50, 25); draw_fleche_x(ecran, rectangle, WIN_HEIGHT - 50); draw_fleche_y(ecran, rectangle, 50); draw_func_rep(ecran, rectangle, ect, u); Pause(); SDL_FreeSurface(rectangle); SDL_Quit(); }
void Frame::draw( cairo_t *cairo ) { #ifdef DEBUG_FRAME std::cout << "\nFRAME::DRAW()\n\n"; std::cout << "width = " << _width << "\n"; std::cout << "height = " << _height << "\n"; #endif // Build colormap legend build_colormap_legend(); // Draw background cairo_rectangle( cairo, _offx, _offy, _width, _height ); cairo_set_source_rgb( cairo, _bg[0], _bg[1], _bg[2] ); cairo_fill( cairo ); // Get drawable bounding boxes and set ruler ranges calculate_autoranging(); // Calculate frame location and size calculate_frame( cairo ); // Draw contents with clipping on set_frame_clipping( cairo ); for( size_t a = 0; a < _dobj.size(); a++ ) { cairo_save( cairo ); PlotAxis xaxis = _dobj[a]._xaxis; PlotAxis yaxis = _dobj[a]._yaxis; double range[4]; _ruler[xaxis].get_ranges( range[0], range[2] ); _ruler[yaxis].get_ranges( range[1], range[3] ); Coordmapper cm( _cm[xaxis], _cm[yaxis] ); _dobj[a]._graph->plot( cairo, &cm, range ); cairo_restore( cairo ); } unset_frame_clipping( cairo ); draw_legend( cairo ); draw_colormap_legend( cairo ); // Draw frame (on top of user drawn image) draw_frame( cairo ); }
void DebugRFFC5072RegistersWidget::paint(Painter& painter) { draw_legend(painter); const auto registers = radio::first_if.registers(); draw_values(painter, registers); }
void RegistersWidget::paint(Painter& painter) { const Coord left = (size().w - config.row_width()) / 2; draw_legend(left, painter); draw_values(left, painter); }
void bot_gl_scrollplot2d_gl_render_at_window_pos (BotGlScrollPlot2d *self, int x, int y, int width, int height) { glPushAttrib (GL_ENABLE_BIT); glEnable (GL_BLEND); glDisable (GL_DEPTH_TEST); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // figure out how big the drawing window (viewport) is GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); // transform into window coordinates, where <0, 0> is the top left corner // of the window and <viewport[2], viewport[3]> is the bottom right corner // of the window glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0, viewport[2], 0, viewport[3]); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glTranslatef(0, viewport[3], 0); glScalef(1, -1, 1); // transform into normalized plot coordinates where <0, 0> is the top left // corner of the plot, and <1, 1> is the bottom right corner of the plot. glPushMatrix (); glTranslatef (x, y, 1); glScalef (width, height, 1); // draw background glColor4f (self->bg_rgba[0], self->bg_rgba[1], self->bg_rgba[2], self->bg_rgba[3]); glBegin(GL_QUADS); glVertex2f (0, 0); glVertex2f (1, 0); glVertex2f (1, 1); glVertex2f (0, 1); glEnd(); // draw plots g_hash_table_foreach (self->plots, _plot2d_render_window, self); // draw border glColor4f (self->border_rgba[0], self->border_rgba[1], self->border_rgba[2], self->border_rgba[3]); glBegin (GL_LINE_LOOP); glVertex2f (0, 0); glVertex2f (1, 0); glVertex2f (1, 1); glVertex2f (0, 1); glEnd (); // return to window coordinates glPopMatrix (); draw_title (self, x, y, width, height); draw_axis_labels (self, x, y, width, height); draw_legend (self, x, y, width, height); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib (); }
int plp_draw(double *signal, int *signal_lengths, int ylog_scale) { int count; int i,j; int col; int dowind; for (i=0;i<2*NOF_INPUT_ITF;i++) { if (signal_lengths[i] > INPUT_MAX_SAMPLES) { moderror_msg("plplot buffer configured for %d samples but received %d in signal %d\n", INPUT_MAX_SAMPLES,signal_lengths[i],i); return -1; } } dowind=0; xmax=-1; for(i=0;i<2*NOF_INPUT_ITF;i++) { if (signal_lengths[i]) { dowind=1; xmax = (PLFLT) MAX(xmax,signal_lengths[i]); for (j=0;j<signal_lengths[i];j++) { ymin = (PLFLT) MIN(ymin,signal[i*INPUT_MAX_SAMPLES+j]); ymax = (PLFLT) MAX(ymax,signal[i*INPUT_MAX_SAMPLES+j]); } } } if (!dowind) { xmin=0; xmax=100; ymin=-1; ymax=1; } plclear(); plscolbg(255, 255, 255); plvsta(); plwid(1); plwind(xmin, xmax, ymin*1.1, ymax*1.1); plcol0(1); if (ylog_scale) { plbox(logaxis_x, 0., 0, logaxis_y, 0., 0); } else { plbox(axis_x, 0., 0, axis_y, 0., 0); } plcol0(4); plbox("g", 0, 0, "g", 0, 0); plcol0(1); pllab(xlabel, ylabel, ""); draw_legend(); plwid(4); col=3; for (i=0;i<2*NOF_INPUT_ITF;i++) { if (signal_lengths[i]) { plcol0(line_colors[i]); plline(signal_lengths[i], t, &signal[i*INPUT_MAX_SAMPLES]); col++; if (col==4) col++; } } plflush(); // force an update of the tk driver }