Exemple #1
0
void add_noise_dialog::preview_window::paint (sxsdk::graphic_context_interface &gc, const sx::rectangle_class *visible_rectangle, void *) {
	if(!preview_image)	return;

	if(dirty) {
		const sx::vec<int,2> size(preview_image->get_size());
		boost::scoped_array<sxsdk::rgb_class> buffer_rgb(new sxsdk::rgb_class[size.x * size.y]);		// cut alpha channel.
		preview_image->get_real_colors(0, 0, size.x, size.y, buffer_rgb.get());
		preview_image->set_real_colors(0, 0, size.x, size.y, buffer_rgb.get());
		dirty = false;
	}

	// 画像の縦横比に合わせて、余白部分を塗りつぶし 
	const sx::vec<int,2> preview_size = stored_image->uniscale_rectangle(get_client_rectangle(false), sx::rectangle_class(sx::vec<int,2>(0,0), stored_image->get_size())).size();
	const sx::vec<int,2> background_size = get_client_rectangle(false).size();
	sx::rectangle_class draw_rectangle(sx::vec<int, 2>(0, 0), preview_size);
	const sx::vec<int,2> margin = (background_size - draw_rectangle.size()) / 2;
//	draw_rectangle.offset(margin);
	draw_rectangle += margin;

	gc.set_color(sxsdk::rgb_class(0.2f, 0.2f, 0.2f));
	if(margin.x > 0) {
		sx::rectangle_class mask({ 0, 0 }, { margin.x, background_size.y });
		gc.paint_rectangle(mask);
		gc.paint_rectangle(mask + sx::vec<int,2>(draw_rectangle.max.x, 0));
	}
	if(margin.y > 0) {
		sx::rectangle_class mask({ 0, 0 }, { background_size.x, margin.y });
		gc.paint_rectangle(mask);
		gc.paint_rectangle(mask + sx::vec<int,2>(0, draw_rectangle.max.y));
	}
	gc.restore_color(); // set_color() に対応して必ず呼び出す 

	// プレビューイメージを描画 
	gc.draw_image(preview_image, draw_rectangle);
}
Exemple #2
0
void
twidget::draw_debug_border(surface& frame_buffer, int x_offset, int y_offset)
{
	SDL_Rect r = redraw_action_ == tredraw_action::partly
						 ? calculate_clipping_rectangle(x_offset, y_offset)
						 : calculate_blitting_rectangle(x_offset, y_offset);

	switch(debug_border_mode_) {
		case 0:
			/* DO NOTHING */
			break;

		case 1:
			draw_rectangle(
					r.x, r.y, r.w, r.h, debug_border_colour_, frame_buffer);
			break;

		case 2:
			sdl_fill_rect(frame_buffer, &r, debug_border_colour_);
			break;

		default:
			assert(false);
	}
}
Exemple #3
0
static void decode_and_draw(rectangle_t* obj, const area_t * limiting_canvas_area)
{
	area_t canvas_area = widget_compute_canvas_area(obj->glyph, limiting_canvas_area);
	canvas_t *canv = canvas_new(&canvas_area);

	if (obj->corner_radius)
	{
		if (obj->is_filled) {
			draw_solid_round_rectangle(canv, color_to_pixel(obj->fill_color), obj->corner_radius);
		}
		if (obj->has_border) {
			draw_round_rectangle(canv,  color_to_pixel(obj->border_color), obj->border_tickness, obj->corner_radius);
		}
	}
	else
	{
		if (obj->is_filled) {
			draw_solid_rectangle(canv, color_to_pixel(obj->fill_color));
		}
		if (obj->has_border) {
			draw_rectangle(canv, color_to_pixel(obj->border_color), obj->border_tickness);
		}
	}

	canvas_delete(canv);
}
Exemple #4
0
static void i_mousemove(void* widget, GdkEventButton *event, gpointer data) {
  int x = event->x;
  int y = event->y;
  revert_pixbuf();
  draw_rectangle(sx,sy,x,y);
  /*printf("mouse move %d %d \n",x,y);*/
}
Exemple #5
0
 void draw() const // draw the rectangle
 {
   shape:: draw();
   draw_rectangle(xCo, yCo, xCo + width, yCo + height);
   set_color(cWHITE); // draw diagonal
   draw_line(xCo, yCo, xCo + width, yCo + height);
 }
Exemple #6
0
//----------------------------------------------------
//pravokotna pika
void pika_p(float *sl, int w, int h, float size, float amp)
{
int i;

for (i=0;i<w*h;i++) sl[i]=0.5-amp/2.0;	//background
draw_rectangle(sl, w, h, w/2-size/2, h/2-size/2, size, size, 0.5+amp/2.0);

}
Exemple #7
0
void consume_power_task(void *pvParam)
{
    prepare_mobile(false);
    power_screen(true);
    LED_Light(led_white, true);
    draw_rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    while(1);
}
Exemple #8
0
//----------------------------------------------------------
//draws a transparent mesurement grid
//*a = alpha channel
void grid(unsigned char *sl, int w, int h, unsigned char *a)
{
int i,j;
unsigned char black,white,tr;

black=0;
white=255;
tr=200;		//how opaque are the marks

for (i=0;i<(w*h);i++) sl[i]=black;	//black background
for (i=0;i<(w*h);i++) a[i]=0;		//transparent

for (i=0;i<h;i=i+2)
	for (j=0;j<w;j=j+10)
		{
		sl[i*w+j]=white;
		a[i*w+j]=tr;
		}
for (i=0;i<h;i=i+10)
	for (j=0;j<w;j=j+2)
		{
		sl[i*w+j]=white;
		a[i*w+j]=tr;
		}

for (i=0;i<h;i=i+50)
	for (j=0;j<w;j=j+50)
		{
		draw_rectangle(sl,w,h,i,j-1,1,3,white);
		draw_rectangle(sl,w,h,i-1,j,3,1,white);
		draw_rectangle(a,w,h,i,j-1,1,3,tr);
		draw_rectangle(a,w,h,i-1,j,3,1,tr);
		}

for (i=0;i<h;i=i+100)
	for (j=0;j<w;j=j+100)
		{
		draw_rectangle(sl,w,h,i,j-4,1,9,white);
		draw_rectangle(sl,w,h,i-4,j,9,1,white);
		draw_rectangle(sl,w,h,i-1,j-1,3,3,white);
		draw_rectangle(a,w,h,i,j-4,1,9,tr);
		draw_rectangle(a,w,h,i-4,j,9,1,tr);
		draw_rectangle(a,w,h,i-1,j-1,3,3,tr);
		}

}
void ShZshapeManager::draw_shape(const char* content)
{
	if (content == "cube")
	{
		draw_cube();
	}

	if (content == "cylinder")
	{
		draw_cylinder();
	}

	if (content == "pipe")
	{
		draw_pipe();
	}

	if (content == "cone")
	{
		draw_cone();
	}

	if (content == "circle")
	{
		draw_circle();
	}

	if (content == "ring")
	{
		draw_ring();
	}

	if (content == "pyramid")
	{
		draw_pyramid();
	}

	if (content == "triangle")
	{
		draw_triangle();
	}

	if (content == "rectangle")
	{
		draw_rectangle();
	}

	if (content == "polygon")
	{
		draw_polygon();
	}

	if (content == "multigonalStar")
	{
		draw_multigonalStar();
	}
}
/*
 * Initializes the persistent text / graphics for each mode
 */
void status_init_mode_flight(){
	//Clear buffer
	draw_rectangle(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);
	
	//Write text labels
	draw_text(STATUS_PITCH_X, STATUS_PITCH_Y, (char*) "Pitch", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
	draw_text(STATUS_ROLL_X, STATUS_ROLL_Y, (char*) "Roll", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps,  1,OVERLAY_OR);
	
	// degree symbols
	draw_rectangle(63,  6, 65,  8, DRAW_UNFILLED, VALUE_ON, OVERLAY_OR);
	draw_rectangle(63, 23, 65, 25, DRAW_UNFILLED, VALUE_ON, OVERLAY_OR);
	
	//Draw invalid batteries
	status_set_pilot_battery_level(-1);
	status_set_control_battery_level(-1);
	
	glcd_write_buffer();
}
Exemple #11
0
static void show_cursor(int index, int color)
{
    if (index < 0) return;
    
    int x = (index % 4) * SLOT_W;
    int y = 219 - (index / 4 + 1) * SLOT_H;
    
    draw_rectangle(x, y, SLOT_W, SLOT_H - 2, color, 0);
}
void status_init_mode_version(){
	//Clear buffer
	draw_rectangle(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);

	//Write text labels
	draw_text(STATUS_CONFIG_MODE_TITLE_X, STATUS_CONFIG_MODE_TITLE_Y, (char*) "Version", FONT_SMALL_WIDTH, FONT_SMALL_HEIGHT, ORIENTATION_NORMAL, font_small, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
	
	glcd_write_buffer();
}
/*
 * Abstract implementation to hightlight the shape.
 * Draws a larger rectangle around shape.
 */
void Rectangle::highlight()
{
	draw_rectangle(
		color_yellow,
		false,
		_position.x - 5, _position.y - 5,
		_width + 10, _height + 10
		);
}
Exemple #14
0
void Canvas::draw_zoom_rectangle( wxDC *dc )
{
    wxRect drawn_rect = get_rect_by_corners( drag_start, drag_end );
    wxRect max_rect( 
        wxSize( contents->GetWidth(), contents->GetHeight() )
            * zoom_in_level / zoom_out_level );
    if ( drawn_rect.Intersects( max_rect ) )
        draw_rectangle( drawn_rect.Intersect( max_rect ), dc );
}
Exemple #15
0
void main_draw_shape(struct template_t *tmp_tpl) {
	char *sval = NULL;
	if(template_get_setting_string(tmp_tpl, "shape", &sval) == 0) {
		int filled = 0, x = 0, y = 0, width = fb_width(), height = fb_height(), border = 0, fcolor = 0;
		int x1 = 0, x2 = 0, y1 = 0, y2 = 0, radius = 0, thickness = 1, zindex = 0;
		unsigned short *color = NULL;

		if(strcmp(sval, "rectangle") == 0 || strcmp(sval, "circle") == 0) {
			template_get_setting_number(tmp_tpl, "x", &x);
			template_get_setting_number(tmp_tpl, "y", &y);
			template_get_setting_number(tmp_tpl, "border", &border);
			template_get_setting_number(tmp_tpl, "filled", &filled);
		} else if(strcmp(sval, "line") == 0) {
			template_get_setting_number(tmp_tpl, "x1", &x1);
			template_get_setting_number(tmp_tpl, "x2", &x2);
			template_get_setting_number(tmp_tpl, "y1", &y1);
			template_get_setting_number(tmp_tpl, "y2", &y2);
			template_get_setting_number(tmp_tpl, "thickness", &thickness);
		}
		if(strcmp(sval, "rectangle") == 0) {
			template_get_setting_number(tmp_tpl, "width", &width);
			template_get_setting_number(tmp_tpl, "height", &height);
		} else if(strcmp(sval, "circle") == 0) {
			template_get_setting_number(tmp_tpl, "radius", &radius);
		}

		if(template_get_setting_color(tmp_tpl, "color", &color) != 0) {
			color = malloc(sizeof(unsigned short)*3);
			color[0] = 0, color[1] = 0, color[2] = 0;
			fcolor = 1;
		}

		template_get_setting_number(tmp_tpl, "z-index", &zindex);

		if(nodaemon == 0) {
			if(strcmp(sval, "rectangle") == 0) {
				if(filled) {
					draw_rectangle_filled(x, y, zindex, width, height, draw_color(color[0], color[1], color[2]));
				} else {
					draw_rectangle(x, y, zindex, width, height, border, draw_color(color[0], color[1], color[2]));
				}
			} else if(strcmp(sval, "circle") == 0) {
				if(filled) {
					draw_circle_filled(x, y, zindex, radius, draw_color(color[0], color[1], color[2]));
				} else {
					draw_circle(x, y, zindex, radius, border, draw_color(color[0], color[1], color[2]));
				}
			} else if(strcmp(sval, "line") == 0) {
				draw_line(x1, y1, x2, y2, zindex, thickness, draw_color(color[0], color[1], color[2]));
			}
		}
		if(fcolor) {
			free(color);
		}
	}
}
/// mini helper function for debuggging, add a rectangle to an existing file
void draw_box(const IntegralChannelsFeature::rectangle_t &box, string png_filename )
{
    gil::rgb8_image_t image;
    gil::png_read_image(png_filename, image);

    draw_rectangle(gil::view(image), rgb8_colors::pink, box);

    gil::png_write_view(png_filename, gil::const_view(image));
    return;
}
void draw_roundrect_precise(gs_scalar x1, gs_scalar y1,gs_scalar x2, gs_scalar y2, float rad, bool outline)
{
  if (x1>x2) {
    float t=x2;
    x2=x1;
    x1=t;
  }
  if (y1>y2) {
    float t=y2;
    y2=y1;
    y1=t;
  }
  if (x2-x1<rad*2){rad=(x2-x1)/2;}
  if (y2-y1<rad*2){rad=(y2-y1)/2;}
  if (rad<0){rad=0;}
  float r2=rad*rad,r12=rad*M_SQRT1_2,
      bx1=x1+rad,by1=y1+rad,
      bx2=x2-rad,by2=y2-rad;
  if (outline) {
	draw_primitive_begin(pr_linelist);
    draw_vertex(x1,by1);draw_vertex(x1,by2);
    draw_vertex(x2,by1);draw_vertex(x2,by2);
    draw_vertex(bx1,y1);draw_vertex(bx2,y1);
    draw_vertex(bx1,y2);draw_vertex(bx2,y2);
    draw_primitive_end();
	draw_primitive_begin(pr_pointlist);
    for(float xc=0,yc=rad;xc<=r12;xc++) {
        if (xc*xc+yc*yc>r2) yc--;
        draw_vertex(bx2+xc,by2+yc);
        draw_vertex(bx2+xc,by1-yc);
        draw_vertex(bx1-xc,by2+yc);
        draw_vertex(bx1-xc,by1-yc);
        draw_vertex(bx2+yc,by2+xc);
        draw_vertex(bx2+yc,by1-xc);
        draw_vertex(bx1-yc,by2+xc);
        draw_vertex(bx1-yc,by1-xc);
    }
    draw_primitive_end();
  } else {
	draw_primitive_begin(pr_linelist);
    for(float xc=0,yc=rad;xc<=r12;xc++) {
      if (xc*xc+yc*yc>r2) yc--;
      draw_vertex(bx2+xc,by2+yc);
      draw_vertex(bx2+xc,by1-yc);
      draw_vertex(bx1-xc,by2+yc);
      draw_vertex(bx1-xc,by1-yc);
      draw_vertex(bx2+yc,by2+xc);
      draw_vertex(bx2+yc,by1-xc);
      draw_vertex(bx1-yc,by2+xc);
      draw_vertex(bx1-yc,by1-xc);
    }
    draw_primitive_end();
    draw_rectangle(bx1,y1,bx2,y2,false);
  }
}
void _frame_rect(screen_rectangle *rectangle, short color_index)
{
	// Get color
	SDL_Color color;
	_get_interface_color(color_index, &color);
	uint32 pixel = SDL_MapRGB(draw_surface->format, color.r, color.g, color.b);

	// Draw rectangle
	SDL_Rect r = {rectangle->left, rectangle->top, rectangle->right - rectangle->left, rectangle->bottom - rectangle->top};
	draw_rectangle(draw_surface, &r, pixel);
}
Exemple #19
0
int
maintime::idle_progress (midipulse ticks)
{
    if (ticks >= 0)                     /* ca 2016-03-17 to make bar appear */
    {
        const int yoff = 4;
        int tick_x = (ticks % m_ppqn) * m_box_width / m_ppqn;
        int beat_x = ((ticks / m_beat_width) % m_ppqn) * m_box_less_pill / m_ppqn;
        int bar_x  = ((ticks / m_bar_width)  % m_ppqn) * m_box_less_pill / m_ppqn;
        m_tick = ticks;
        clear_window();
        draw_rectangle(black(), 0, yoff, m_box_width, m_box_height, false);
        if (tick_x <= m_flash_x)       /* for flashing the maintime bar     */
            draw_rectangle(grey(), 2, yoff+2, m_flash_width, m_flash_height);

        draw_rectangle(black(), beat_x + 2, yoff+2, m_pill_width, m_flash_height);
        draw_rectangle(bar_x + 2, yoff+2, m_pill_width, m_flash_height);
    }
    return true;
}
void status_init_mode_calibrate(){
	//Clear buffer
	draw_rectangle(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);

	//Write text labels
	draw_text(STATUS_CONFIG_MODE_TITLE_X, STATUS_CONFIG_MODE_TITLE_Y, (char*) "Calibration", FONT_SMALL_WIDTH, FONT_SMALL_HEIGHT, ORIENTATION_NORMAL, font_small, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
	draw_text(STATUS_CONFIG_MODE_TEXT_X + 0 * STATUS_CONFIG_MODE_COLUMN_WIDTH, STATUS_CONFIG_MODE_TEXT_Y + 1 * STATUS_CONFIG_MODE_ROW_HEIGHT + 1, (char*) "Ensure craft is level and press", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
	draw_text(STATUS_CONFIG_MODE_TEXT_X + 0 * STATUS_CONFIG_MODE_COLUMN_WIDTH, STATUS_CONFIG_MODE_TEXT_Y + 2 * STATUS_CONFIG_MODE_ROW_HEIGHT + 1, (char*) "triangle to calibrate", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);	
	
	glcd_write_buffer();
}
Exemple #21
0
void afficheBoutonRecommencer()
{
	POINT P1 = {730,530};
	POINT P2 = {860,580};
	draw_fill_rectangle(P1,P2,couleur_RGB(38,196,236));
	draw_rectangle(P1,P2,black);
	P1.x = 737;
	P1.y = 566;
	aff_pol("RECOMMENCER",15,P1,noir);
	affiche_all();
}
void status_set_comm_state(uint8_t tx, uint8_t rx){
	//Clear existing
	draw_rectangle(STATUS_COMM_X, STATUS_COMM_Y, STATUS_COMM_X + 6, STATUS_COMM_Y + 11, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);

	//Write values
	if (tx) draw_text(STATUS_COMM_X, STATUS_COMM_Y, (char*) "TX", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
	if (rx) draw_text(STATUS_COMM_X, STATUS_COMM_Y + 7, (char*) "RX", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
	
	//Flush
	glcd_write_buffer_bounds(STATUS_COMM_X, STATUS_COMM_Y, STATUS_COMM_X + 6, STATUS_COMM_Y + 10);
}
Exemple #23
0
void run(void) {
    XEvent xe;
    while(1){
        while(QLength(disp)) {
            XNextEvent(disp, &xe);
        }
        int bat = get_battery_percent(bat_id);
        height = bat*3;
        resize(width, height);
        XMoveResizeWindow(disp, win, x-width, y-height, width, height);

        colorR = color_in_range("#ff0000", "#00ff00", bat);

        draw_rectangle(0,0,width,height,1,colorW);
        draw_rectangle(border,border,
                width-(2*border),height-(2*border),1,colorR);
        remap(win, width, height);
        usleep(60000000);
    }
}
//-------------------------------------------------------------------
// Draw menu scroll bar if needed, and title bar
static void gui_draw_initial()
{ 
    count = gui_menu_disp_rows();

    if (count > num_lines)
    {
        y = ((camera_screen.height-(num_lines-1)*rbf_font_height())>>1);
        wplus = 8; 
        // scrollbar background 
        draw_rectangle((x+w), y, (x+w)+wplus, y+num_lines*rbf_font_height()-1, MAKE_COLOR(BG_COLOR(user_color(conf.menu_color)), BG_COLOR(user_color(conf.menu_color))), RECT_BORDER0|DRAW_FILLED);
    }
Exemple #25
0
/*--------------------------------------------------------------
 Routine : draw_symbol
 Purpose : Draws the symbol.
---------------------------------------------------------------*/
void
draw_symbol(Canvas canvas, CanvasCoord symbol_centre, SYMBOL *symbol)
{
    SEGMENT     *seg_list;
    ARC         *arc;
    RECTANGLE   *rect;
    POLYLINE    *poly;
    LINE        *line;

    ASSERT( symbol != NULL );

    seg_list = symbol->segment_list;
    while (seg_list != NULL) {
        /* Identify and draw the segment type */
        switch (seg_list->type) {
        case CLEAR_ARC_SEG :
            arc =  (ARC *)(seg_list->seg);
            clear_arc(canvas, arc, symbol_centre);
            break;
        case FILL_ARC_SEG :
            arc =  (ARC *)(seg_list->seg);
            fill_arc(canvas, arc, symbol_centre, symbol->type);
            break;
        case ARC_SEG :
            arc =  (ARC *)(seg_list->seg);
            draw_arc(canvas, arc, symbol_centre);
            break;
        case RECTANGLE_SEG :
            rect =  (RECTANGLE *)(seg_list->seg);
            draw_rectangle(canvas, rect, symbol_centre);
            break;
        case FILL_RECTANGLE_SEG :
            rect =  (RECTANGLE *)(seg_list->seg);
            fill_rectangle(canvas, rect, symbol_centre, symbol->type);
            break;
		case FILL_POLYLINE_SEG :
            poly = (POLYLINE *)(seg_list->seg);
            fill_polyline(canvas, poly, symbol_centre, symbol->type);
            break;
		case POLYLINE_SEG :
            poly =  (POLYLINE *)(seg_list->seg);
            draw_polyline(canvas, poly, symbol_centre);
            break;
        case LINE_SEG :
            line =  (LINE *)(seg_list->seg);
            draw_line(canvas, line, symbol_centre);
            break;
        default:
            printf("\n*** draw_symbol : Invalid segment type ***\n\n");
            exit(1);
        }
        seg_list = seg_list->next;
    }
}
void status_set_battery_level(double voltage, uint8_t x, uint8_t y, uint8_t pilot){
	//Clear existing
	draw_rectangle(x, y, x + 11, y + 31, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);
	
	//Redraw edge
	draw_rectangle(x, y + 1, x + 11, y + 31, DRAW_UNFILLED, VALUE_ON, OVERLAY_OR);
	draw_line(x + 3, y, x + 8, y, VALUE_ON, OVERLAY_OR);
	
	//Fill according to level
	if (voltage < 0.0){
		//Draw an X for invalid values
		draw_line(x, y + 1, x + 11, y + 31, VALUE_ON, OVERLAY_OR);
		draw_line(x + 11, y + 1, x, y + 31, VALUE_ON, OVERLAY_OR);
	}
	else {
		//We need to convert from voltage to a graph.  For the pilot we assume, 10V is empty, 11.3V is full.  There are 31 lines 
		// to work with here, so we apply the following logic:
		// 11.3 - 10 = 1.3 (so we have a valid range of 1.7V)
		// 1.3 / 31 ~= 0.04194V / line
		//So, when computing the lines we take raw battery value, subtract 10, and multiply by 0.0448 to determine
		// how many lines it should cover.
		//
		//For the controller, the same logic applies, but with smaller numbers: max 4.8, min 4.0.
		// 4.8 - 4.0 - 0.8
		// 0.8 / 31 ~= 0.026V / line
		int8_t lines = (pilot ? (uint8_t) ((voltage - 10) / 0.04194) : (uint8_t) ((voltage - 4) / 0.026));
		if (lines > 31) lines = 31;
		if (lines < 0) lines = 0;
		draw_rectangle(x + 1, y + 33 - lines, x + 10, y + 31, DRAW_FILLED, VALUE_ON, OVERLAY_OR);

		//Print name
		draw_text(x + 2, y + 25, (char*) (pilot ? "P" : "C"), FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_XOR);
		
		//Print voltage CW 90 degrees
		sprintf(temp, (char*) "%4.1f", voltage);
		draw_text(x + 3, y + 7, temp, FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_DOWN, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_XOR);
	}
	
	//Flush
	glcd_write_buffer_bounds(x, y, x + 11, y + 32);
}
Exemple #27
0
/**
 * Clear text lines in the screen.
 * @param l1  start line
 * @param l2  end line
 * @param c   color
 */
void TextMan::clear_lines(int l1, int l2, int c) {
	/* do we need to adjust for +8 on topline?
	 * inc for endline so it matches the correct num
	 * ie, from 22 to 24 is 3 lines, not 2 lines.
	 */

	l1 *= CHAR_LINES;
	l2 *= CHAR_LINES;
	l2 += CHAR_LINES - 1;

	draw_rectangle(0, l1, GFX_WIDTH - 1, l2, c);
}
Exemple #28
0
static void dlarea_mouse_released(point_t point, guint time)
{
	if (! dlarea_pressed)
		return;

	draw_rectangle(&dlarea);

	ALAREA_ON_NEW_POINT(point);

	if (AREA_BIG_ENOUGH()) {
		map_draw_back_layers(g_view.da->window);
		draw_rectangle(&dlarea);
		last_dlarea = dlarea;
		dl_area_choosed = TRUE;
	} else {
		/* restore previous area if it is valid */
		dlarea = last_dlarea;
	}

	dlarea_pressed = FALSE;
}
Exemple #29
0
void afficheBoutonRecommencerSombre()
{
	POINT P1 = {730,530};
	POINT P2 = {860,580};
	draw_fill_rectangle(P1,P2,couleur_RGB(25,180,220));
	draw_rectangle(P1,P2,black);
	P1.x = 737;
	P1.y = 566;
	aff_pol("RECOMMENCER",15,P1,noir);
	affiche_all();
	attendre(150);
}
Exemple #30
0
void draw_bar(float x_offset, float z_offset, float height, float red, float green, float blue)
{
  Vertex_t  verts[36];
  int verts_idx = 0;

  float width = 0.1f;
  D3DCOLOR color;

  if (g_mode == D3DFILL_POINT)
    color = D3DXCOLOR(0.2f, 1.0f, 0.2f, 1.0f);

  if (g_mode != D3DFILL_POINT)
  {
    color = D3DXCOLOR(red, green, blue, 1.0f);
    verts_idx += draw_rectangle(&verts[verts_idx], x_offset, height, z_offset, x_offset + width, height, z_offset + 0.1f, color);
  }
  verts_idx += draw_rectangle(&verts[verts_idx], x_offset, 0.0f, z_offset, x_offset + width, 0.0f, z_offset + 0.1f, color);

  if (g_mode != D3DFILL_POINT)
  {
    color = D3DXCOLOR(0.5f * red, 0.5f * green, 0.5f * blue, 1.0f);
    verts_idx += draw_rectangle(&verts[verts_idx], x_offset, 0.0f, z_offset + 0.1f, x_offset + width, height, z_offset + 0.1f, color);
  }
  verts_idx += draw_rectangle(&verts[verts_idx], x_offset, 0.0f, z_offset, x_offset + width, height, z_offset, color);

  if (g_mode != D3DFILL_POINT)
  {
    color = D3DXCOLOR(0.25f * red, 0.25f * green, 0.25f * blue, 1.0f);
    verts_idx += draw_rectangle(&verts[verts_idx], x_offset, 0.0f, z_offset , x_offset, height, z_offset + 0.1f, color);
  }
  verts_idx += draw_rectangle(&verts[verts_idx], x_offset + width, 0.0f, z_offset , x_offset + width, height, z_offset + 0.1f, color);

  g_device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, verts_idx / 3, verts, sizeof(Vertex_t));
}