Example #1
0
	void cross(graphics& graph, int x, int y, uint32_t size, uint32_t thickness, nana::color_t color)
	{
		if(thickness + 2 <= size)
		{
			int gap = (size - thickness) / 2;

			nana::point ps[12];
			ps[0].x = x + gap;
			ps[1].x = ps[0].x + thickness - 1;
			ps[1].y = ps[0].y = y;

			ps[2].x = ps[1].x;
			ps[2].y = y + gap;

			ps[3].x = ps[2].x + gap;
			ps[3].y = ps[2].y;

			ps[4].x = ps[3].x;
			ps[4].y = ps[3].y + thickness - 1;

			ps[5].x = ps[1].x;
			ps[5].y = ps[4].y;

			ps[6].x = ps[5].x;
			ps[6].y = ps[5].y + gap;

			ps[7].x = x + gap;
			ps[7].y = ps[6].y;

			ps[8].x = ps[7].x;
			ps[8].y = ps[4].y;

			ps[9].x = x;
			ps[9].y = ps[4].y;

			ps[10].x = x;
			ps[10].y = y + gap;

			ps[11].x = x + gap;
			ps[11].y = y + gap;

			nana::color_t dkcolor = graph.mix(color, 0x0, 0.5);
			for(int i = 0; i < 11; ++i)
				graph.line(ps[i], ps[i + 1], dkcolor);
			graph.line(ps[11], ps[0], dkcolor);

			graph.rectangle(ps[10].x + 1, ps[10].y + 1, (gap << 1) + thickness - 2, thickness - 2, color, true);
			graph.rectangle(ps[0].x + 1, ps[0].y + 1, thickness - 2, (gap << 1) + thickness - 2, color, true);

		}
	}
Example #2
0
    void draw_bar( graphics& gx, UINT width, UINT height, int n_bar, int total_bars, color c, double val )
    {
        double bar_width = double(width) / (2*total_bars);
        double bar_height = double(height - 2) * val * (double(step)/double(steps-1));

        double bar_x1 = bar_width/2 + n_bar * 2 * bar_width;
        double bar_x2 = bar_x1 + bar_width;
        double bar_y2 = height - 0.5;
        double bar_y1 = bar_y2 - bar_height;

        color c_outline(0,0,0,0);

        gx.line_color(c_outline);
        gx.line_width(3);
        
        COLOR_STOP cs[3] = 
        {
          { gcolor(c) , 0.0f },
          { gcolor(0xff,0xff,0xff), 0.33f },
          { gcolor(c), 1.0f }
        };
        gx.fill_linear_gradient( bar_x1,bar_y1,bar_x2,bar_y1, cs, 3);

        gx.rectangle(bar_x1,bar_y1,bar_x2,bar_y2,6,6,0,0);
    }