예제 #1
0
	void Box::draw_lines() const{
		if(fill_color().visibility()) {    // fill
			fl_color(fill_color().as_int());
			fl_rectf(point(0).x + r, point(0).y, w - r - r, h);								// 丸角四角形内の縦の長方形
			fl_rectf(point(0).x, point(0).y + r, w, h - r - r);								// 丸角四角形内の横の長方形
			fl_pie(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90);				// 右上円
			fl_pie(point(0).x, point(0).y, r + r, r + r, 90, 180);							// 左上円
			fl_pie(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270);				// 左下円
			fl_pie(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360);	// 右下円
			fl_color(color().as_int());    // reset color
		}

		if(color().visibility()) {    // lines on top of fill
			fl_color(color().as_int());
			fl_line(point(0).x + r, point(0).y, point(0).x + w - r, point(0).y);			// 上線
			fl_line(point(0).x + r, point(0).y + h, point(0).x + w - r, point(0).y + h);	// 下線
			fl_line(point(0).x, point(0).y + r, point(0).x, point(0).y + h - r);			// 左線
			fl_line(point(0).x + w, point(0).y + r, point(0).x + w, point(0).y + h - r);	// 右線
			fl_arc(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90);				// 右上角丸
			fl_arc(point(0).x, point(0).y, r + r, r + r, 90, 180);							// 左上角丸
			fl_arc(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270);				// 左下角丸
			fl_arc(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360);	// 右下角丸
		}

		int ofnt = fl_font();
		int osz = fl_size();
		fl_font(fnt.as_int(), fnt_sz);
		fl_draw(lab.c_str(), point(0).x + r, point(0).y + h - r);
		fl_font(ofnt, osz);
	}
예제 #2
0
void Fl_MIDIKeyboard::draw(void) {                          // fltk draw() override
    Fl_Scroll::draw();

    fl_push_clip(x()+Fl::box_dx(box()), y()+Fl::box_dy(box()), w()-Fl::box_dw(box()), h()-Fl::box_dh(box()));
    int X = keyboard->x(), Y = keyboard->y();
    int press_diam = _b_width-2;
    int press_w_h_offs = _b_height + (_key_height - _b_height - press_diam) / 2;
    int press_w_w_offs = (int)((_key_width-press_diam) / 2);
    int press_b_h_offs = _b_height - press_diam - 2;
    uchar bk = is_black(_bottomkey) ? _bottomkey-1 : _bottomkey;    // need to begin with a white key

    fl_color(FL_BLACK);
    if (_type == MKB_HORIZONTAL) {
        int y_b_offs = Y + _b_height;
        for (int i = bk, cur_x = X + keyscoord[bk]; i <= _topkey; i++, cur_x = X + keyscoord[i]) {
            if (is_black(i)) {
                fl_rectf(cur_x, Y, _b_width, _b_height);
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(cur_x, Y + press_b_h_offs, press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
            }
            else {
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(cur_x + press_w_w_offs, Y + press_w_h_offs, press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
                isCF(i) ? fl_line(cur_x, Y, cur_x, Y + _key_height) :
                          fl_line(cur_x, y_b_offs, cur_x, Y + _key_height);

            }
        }
    }
    else {
        Y += keyboard->h();
        int x_b_offs = X + _b_height;
        for (int i = bk, cur_y = Y - keyscoord[bk]; i <= _topkey; i++, cur_y = Y - keyscoord[i]) {
            if (is_black(i)) {
                fl_rectf(X, cur_y - _b_width, _b_height, _b_width);
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(X + press_b_h_offs, cur_y - press_diam,  press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
            }
            else {
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(X + press_w_h_offs, cur_y - press_w_w_offs - press_diam, press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
                isCF(i) ? fl_line(X, cur_y, X + _key_height, cur_y) :
                          fl_line(x_b_offs, cur_y, X + _key_height, cur_y);
            }
        }
    }
    fl_pop_clip();
}
예제 #3
0
파일: ge_mixed.cpp 프로젝트: rzr/giada
void gDial::draw() {
	double angle = (angle2()-angle1())*(value()-minimum())/(maximum()-minimum()) + angle1();

	fl_color(COLOR_BG_0);
	fl_pie(x(), y(), w(), h(), 270-angle1(), angle > angle1() ? 360+270-angle : 270-360-angle);

	fl_color(COLOR_BD_0);
	fl_arc(x(), y(), w(), h(), 0, 360);
	fl_pie(x(), y(), w(), h(), 270-angle, 270-angle1());
}
예제 #4
0
void star::draw() {
    int border = r/40;
    fl_color(color+20);
    fl_pie(x-border, y-border, r+(border*2), r+(border*2), 0.0, 360.0);
    
    if((darkness < 0.5 && fade > 0) || (darkness > 0.95 && fade < 0))
            fade *= -1;
    darkness -= 0.02*fade;
    fl_color(fl_color_average(color,FL_WHITE, darkness));
    
    fl_pie(x, y, r, r, 0.0, 360.0);
}
예제 #5
0
void SoftBox::draw_lines() const
{

	if (fill_color().visibility()) {
		fl_color(fill_color().as_int());

		fl_begin_polygon();

			fl_vertex(point(0).x - (w/2) + r, point(0).y - (h/2));
			fl_vertex(point(0).x + (w/2) - r, point(0).y - (h/2));
			
			fl_vertex(point(0).x + (w/2), point(0).y - (h/2) + r);
			fl_vertex(point(0).x + (w/2), point(0).y + (h/2) - r);
			
			fl_vertex(point(0).x + (w/2) - r, point(0).y + (h/2));
			fl_vertex(point(0).x - (w/2) + r, point(0).y + (h/2));
			
			fl_vertex(point(0).x - (w/2),     point(0).y + (h/2) - r);
			fl_vertex(point(0).x - (w/2),     point(0).y - (h/2) + r);
					
		fl_end_polygon();

		fl_pie(point(0).x - (w/2),         point(0).y - (h/2),         r+r-1,r+r-1,90,180);
		fl_pie(point(0).x + (w/2) - r - r, point(0).y - (h/2),         r+r-1,r+r-1,0,90);
		fl_pie(point(0).x - (w/2),         point(0).y + (h/2) - r - r, r+r-1,r+r-1,180,270);
		fl_pie(point(0).x + (w/2) - r - r, point(0).y + (h/2) - r - r, r+r-1,r+r-1,270,360);

		fl_color(color().as_int());

	}

	if (color().visibility()){

		fl_color(color().as_int());

		// Draw Lines
		fl_line(point(0).x - (w/2) + r, point(0).y - (h/2),     point(0).x + (w/2) - r, point(0).y - (h/2));
		fl_line(point(0).x - (w/2),     point(0).y - (h/2) + r, point(0).x - (w/2),     point(0).y + (h/2) - r);
		fl_line(point(0).x - (w/2) + r, point(0).y + (h/2),     point(0).x + (w/2) - r, point(0).y + (h/2));
		fl_line(point(0).x + (w/2),     point(0).y - (h/2) + r, point(0).x + (w/2),     point(0).y + (h/2) - r);
		
		// Draw Arcs
		fl_arc(point(0).x - (w/2),         point(0).y - (h/2),         r+r,r+r,90,180);
		fl_arc(point(0).x + (w/2) - r - r, point(0).y - (h/2),         r+r,r+r,0,90);
		fl_arc(point(0).x - (w/2),         point(0).y + (h/2) - r - r, r+r,r+r,180,270);
		fl_arc(point(0).x + (w/2) - r - r, point(0).y + (h/2) - r - r, r+r,r+r,270,360);

	}

}
예제 #6
0
	void Binary_tree::draw_lines() const{
		if(fill_color().visibility()) {	// fill
			fl_color(fill_color().as_int());

			for(int i = 0; i < number_of_points(); ++i)
				fl_pie(point(i).x, point(i).y, radius * 2 - 1, radius * 2 - 1, 0, 360);	// ノード(円)を描画

			fl_color(color().as_int());	// reset color
		}

		if(color().visibility()) {
			fl_color(color().as_int());

			int parent = 0;	// point(i)に対する親ノードのインデックス
			for(int i = 0; i < number_of_points(); ++i){
				fl_arc(point(i).x, point(i).y, radius * 2, radius * 2, 0, 360);			// ノード(円)を描画

				// エッジ(線)を描画
				if(i != 0){
					fl_line(point(parent).x + radius, point(parent).y + radius * 2, point(i).x + radius, point(i).y);
					if(i % 2 == 0) parent++;
				}
			}
		}
	}
예제 #7
0
	virtual void draw() 
	{
		fl_color(FL_BLACK);

		// draw face
		short centerX, centerY;
		float radius;
		centerX = w()/2;
		centerY = h()/2;
		radius = MIN(w(), h())/4;
		fl_pie(centerX - radius, centerY-radius, radius*2, radius*2, 0, 360);

		// draw hands
		int hourX, hourY, minuteX, minuteY, secondX, secondY;
		hourX = centerX + 0.35 * radius * cos(RADIAN(hourHand));
		hourY = centerY + 0.35 * radius * sin(RADIAN(hourHand));
		minuteX = centerX + 0.65 * radius * cos(RADIAN(minuteHand));
		minuteY = centerY + 0.65 * radius * sin(RADIAN(minuteHand));
		secondX = centerX + 0.85 * radius * cos(RADIAN(secondHand));
		secondY = centerY + 0.85 * radius * sin(RADIAN(secondHand));
		fl_color(FL_GREEN);
		fl_line_style(FL_SOLID, 3);
		fl_line(centerX, centerY, hourX, hourY);
		fl_line(centerX, centerY, minuteX, minuteY);
		fl_color(FL_RED);
		fl_line_style(FL_SOLID, 1);
		fl_line(centerX, centerY, secondX, secondY);
	}
예제 #8
0
파일: Control_Point.C 프로젝트: imv/non
void
Control_Point::draw_box ( void )
{
    if ( selected() )
        fl_color( selection_color() );
    else
        fl_color( box_color() );

    fl_pie( x() - w() / 2, y() - h() / 2, w(), h(), 0, 360 );

    if ( this == Sequence_Widget::belowmouse() ||
         this == Sequence_Widget::pushed() )
    {
        char val[10];
        snprintf( val, sizeof( val ), "%+.2f", 1.0 - _y * 2 );

        Fl_Align a = 0;

        if ( x() < _sequence->x() + ( _sequence->w() / 2 ) )
            a |= FL_ALIGN_RIGHT;
        else
            a |= FL_ALIGN_LEFT;

        if ( y() < _sequence->y() + ( _sequence->h() / 2 ) )
            a |= FL_ALIGN_BOTTOM;
        else
            a |= FL_ALIGN_TOP;
            
        draw_label( val, a, FL_FOREGROUND_COLOR );
    }
}
예제 #9
0
	void draw() {
		//BX+arms->lines[0]->x1

		fl_color(255, 255, 255);
		//int x1 = (int)arms->lines[0]->x1, BY-arms->lines[0]->y1;
		//int y1 = y()-5;
		fl_pie(BX+arms->lines[1]->x1-5, BY-arms->lines[1]->y1-5, 10, 10, 0, 360);

		//int x1 = x()-5;
		//int y1 = y()-5;
		fl_pie(BX+arms->lines[2]->x1-5, BY-arms->lines[2]->y1-5, 10, 10, 0, 360);

		//int x1 = x()-5;
		//int y1 = y()-5;
		fl_pie(BX+arms->lines[3]->x1-5, BY-arms->lines[3]->y1-5, 10, 10, 0, 360);


	}
예제 #10
0
	void Arc::draw_lines() const {
		if(fill_color().visibility()){
			fl_color(fill_color().as_int());
			fl_pie(point(0).x, point(0).y, w + w, h + h, a1, a2);
			fl_color(color().as_int());	// reset color
		}

		if(color().visibility()) {
			fl_color(color().as_int());
			fl_arc(point(0).x, point(0).y, w + w, h + h, a1, a2);
		}
	}
예제 #11
0
/*
class win: public Fl_Window
{
	int handle(int event)
	{
		switch(event)
		{
		case FL_PUSH:
		case FL_DRAG:
			int x=Fl::event_x()-BX;
			int y=BY-Fl::event_y();
			printf("pos : %d %d\n", x, y);
			if(y>=0)
				arms->movetoPt(x,y);
		}
		return 1;
	}
public:
	win(int x, int y, int w, int h, const char* text) : Fl_Window(x, y, w, h, text){}

};
*/
void Drawing::draw()
{
	fl_color(FL_WHITE);
	//draw_line(XX+0,0,0,150);
	for (int i=0; i<pairs.size();i++){
		fl_pie(pairs[i].x, pairs[i].y, 10, 10, 0, 360);
	}


	
	draw_line(arms->lines[1]->x1, arms->lines[1]->y1, arms->lines[1]->x2, arms->lines[1]->y2);
	fl_color(FL_WHITE);
	//draw_line(XX+0,150,0,100);
	draw_line(arms->lines[2]->x1, arms->lines[2]->y1, arms->lines[2]->x2, arms->lines[2]->y2);
	fl_color(FL_WHITE);
	//draw_line(XX+0,250,0,75);
	draw_line(arms->lines[3]->x1, arms->lines[3]->y1, arms->lines[3]->x2, arms->lines[3]->y2);


	fl_color(255, 255, 255);
	//int x1 = (int)arms->lines[0]->x1, BY-arms->lines[0]->y1;
	//int y1 = y()-5;
	fl_pie(BX+arms->lines[1]->x1-5, BY-arms->lines[1]->y1-5, 10, 10, 0, 360);

	//int x1 = x()-5;
	//int y1 = y()-5;
	fl_pie(BX+arms->lines[2]->x1-5, BY-arms->lines[2]->y1-5, 10, 10, 0, 360);

	//int x1 = x()-5;
	//int y1 = y()-5;
	fl_pie(BX+arms->lines[3]->x1-5, BY-arms->lines[3]->y1-5, 10, 10, 0, 360);
	//fl_arc(point(0).x,point(0).y,r+r,r+r,0,360);
	//fl_arc(100, 100, 200, 200, 0, 360);
	//fl_pie(0,0,200,200,0,360);

	fl_pie(BX+arms->lines[3]->x2-5, BY-arms->lines[3]->y2-5, 10, 10, 0, 360);

	
	fl_end_line();
}
예제 #12
0
void Ellipse::draw_lines() const
{
   if (fill_color().visibility()) {	// fill
		fl_color(fill_color().as_int());
		fl_pie(point(0).x,point(0).y,w+w-1,h+h-1,0,360);
		fl_color(color().as_int());	// reset color
	}

	if (color().visibility()) {
		fl_color(color().as_int());
		fl_arc(point(0).x,point(0).y,w+w,h+h,0,360);
	}
}
예제 #13
0
void Circle::draw_lines() const
{
  	if (fill_color().visibility()) {	// fill
		fl_color(fill_color().as_int());
		fl_pie(point(0).x,point(0).y,r+r-1,r+r-1,0,360);
		fl_color(color().as_int());	// reset color
	}

	if (color().visibility()) {
		fl_color(color().as_int());
		fl_arc(point(0).x,point(0).y,r+r,r+r,0,360);
	}
}
void
RadarDisplay::draw() {
 Fl_Window::draw();
    fl_color(FL_BLACK);
//	fl_rectf(10,10,w()-20,h()-20);
	fl_pie(10,10,w()-20, h()-20, 0, 360);

	int inner = impl_->pixel_radius_ / 3;

    fl_color(FL_GREEN);
	fl_arc((impl_->pixel_radius_ + 10) - inner,
		(impl_->pixel_radius_ + 10) - inner,
		(2 * inner),
		(2 * inner), 0, 360);
	//fl_arc(75,75,w()-150, h()-150, 0, 360);

	fl_line(impl_ -> pixel_radius_ + 10 ,10 ,impl_ -> pixel_radius_ +10 ,(2 * impl_ -> pixel_radius_) +10 );
	fl_line(10, impl_ -> pixel_radius_ + 10 ,(2 * impl_ -> pixel_radius_) + 10 , impl_ -> pixel_radius_ + 10 );

	fl_color(FL_RED);
	if (impl_->current_data_set_)
	{
		try 
		{
			// draw planes
			impl_->current_data_mutex_->lock();

			CORBA::ULong index ;
			for (index=0;index < impl_->current_data->length(); index++)
			{
				Simulation::RadarData *temp_data = impl_->current_data;
//				std::cout << "cur " << ((*temp_data)[index].position.longitude) << std::endl;
		//		fl_rectf((*temp_data)[index].position.longitude,impl_->current_data[index].position.latitude,5,5);
				int x_pix = (((((*temp_data)[index].position.longitude)-(impl_->longitude_) )* impl_->scale_ ) + impl_->pixel_radius_) + 10;
				int y_pix = (((((*temp_data)[index].position.latitude)-(impl_->latitude_) )* (impl_->scale_ * -1)) + impl_->pixel_radius_) + 10;
				std::cout << "x: " << x_pix << " y: " << y_pix << std::endl;
				fl_rectf(x_pix,y_pix,5,5);
			}
		} catch (...) {};
		impl_->current_data_mutex_->unlock();
		
	}
	//test 
};
예제 #15
0
파일: Fl_Dial.cpp 프로젝트: edeproject/svn
void Fl_Dial::draw()
{
    int X = 0; int Y = 0; int W = w(); int H = h();
    if (!(type() == FILL && box() == FL_OVAL_BOX))
    {
        if (damage()&FL_DAMAGE_ALL) draw_box();
        box()->inset(X,Y,W,H);
    }
    Fl_Color fillcolor = selection_color();
    Fl_Color linecolor = highlight_color();
    if (!active_r())
    {
        fillcolor = fl_inactive(fillcolor);
        linecolor = fl_inactive(linecolor);
    }
    double angle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1;
    if (type() == FILL)
    {
        if (damage()&FL_DAMAGE_EXPOSE && box() == FL_OVAL_BOX)
        {
            fl_push_clip(0, 0, w(), h());
            parent()->draw_group_box();
            fl_pop_clip();
        }
        fl_color(color());
        fl_pie(X, Y, W-1, H-1, 270-a1, angle > a1 ? 360+270-angle : 270-360-angle);
        fl_color(fillcolor);
        fl_pie(X, Y, W-1, H-1, 270-angle, 270-a1);
        if (box() == FL_OVAL_BOX)
        {
            fl_ellipse(X, Y, W-1, H-1);
            fl_color(linecolor); fl_stroke();
        }
    }
    else
    {
        if (!(damage()&FL_DAMAGE_ALL))
        {
            fl_ellipse(X+1, Y+1, W-2, H-2);
            fl_color(color()); fl_fill();
        }
        fl_push_matrix();
        fl_translate(X+W/2-.5, Y+H/2-.5);
        fl_scale(W-1, H-1);
        fl_rotate(45-angle);
        if (type() == LINE)
        {
            fl_vertex(0.0,   0.0);
            fl_vertex(-0.04, 0.0);
            fl_vertex(-0.25, 0.25);
            fl_vertex(0.0,   0.04);
        }
        else
        {
            fl_circle(-0.20, 0.20, 0.07);
        }
        fl_color(fillcolor); fl_fill_stroke(linecolor);
        fl_pop_matrix();
    }
    if (focused())
    {
        fl_ellipse(X+2, Y+2, W-5, H-5);
        fl_color(linecolor);
        fl_line_style(FL_DASH);
        fl_stroke();
        fl_line_style(0);
    }
}
예제 #16
0
파일: Panner.C 프로젝트: 0mk/non
void
Panner::draw ( void )
{
    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    fl_push_clip( x(),y(),w(),h() );

    draw_the_box( tx, ty, tw, th );

//    draw_box();
    draw_label();

    /* if ( _bypassed ) */
    /* { */
    /*     draw_box(); */
    /*     fl_color( 0 ); */
    /*     fl_font( FL_HELVETICA, 12 ); */
    /*     fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); */
    /*     goto done; */
    /* } */
   
    /* tx += b; */
    /* ty += b; */
    /* tw -= b * 2; */
    /* th -= b * 2; */

    fl_line_style( FL_SOLID, 1 );

    fl_color( FL_WHITE );

    for ( unsigned int i = 0; i < _points.size(); i++ )
    {
        Point *p = &_points[i];

        if ( ! p->visible )
            continue;

        Fl_Color c = fl_color_add_alpha( p->color, 100 );

        fl_color(c);

        int px, py, pw, ph;
        point_bbox( p, &px, &py, &pw, &ph );
      
        {
            float po = 5;

            fl_push_clip( px - ( po * 12 ), 
                          py - ( po * 12 ),
                          pw + ( po * 24 ), ph + (po * 24 ));

            fl_pie( px + 5, py + 5, pw - 10, ph - 10, 0, 360 );


            fl_pie( px, py, pw, ph, 0, 360 );

            fl_pop_clip();

            if ( projection() == POLAR )
            {
           
                fl_color( fl_color_average( fl_rgb_color( 127,127,127 ), p->color, 0.50 ) );
                fl_begin_loop();
                fl_circle( tx + tw/2, ty + th/2, tw/2.0f * ( ( p->radius() / range() )));
                fl_end_loop();
            }

        }
    
        const char *s = p->label;

        fl_color( fl_color_add_alpha( fl_rgb_color( 220,255,255 ), 127 ) );
        fl_font( FL_HELVETICA_BOLD_ITALIC, 10 );
        fl_draw( s, px + 20, py + 1, 50, ph - 1, FL_ALIGN_LEFT );

        if ( tw > 100 )
        {
            char pat[50];
            snprintf( pat, sizeof(pat), "%.1f°:%.1f° %.1fm", p->azimuth(), p->elevation(), p->radius() );
            
//        fl_color( fl_color_add_alpha( fl_rgb_color( 220,255,255 ), 127 ) );
            fl_font( FL_COURIER, 9 );

            fl_draw( pat, px + 20, py + 15, 50, ph - 1, FL_ALIGN_LEFT | FL_ALIGN_WRAP );

            /* fl_font( FL_HELVETICA_ITALIC, 9 ); */
            /* snprintf(pat, sizeof(pat), "range: %.1f meters", range() ); */
            /* fl_draw( pat, tx, ty, tw, th, FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE ); */
                
            /* if ( _projection == POLAR ) */
            /* { */
            /*     fl_draw( "Polar perspective; azimuth, elevation and radius input. Right click controls radius.", tx, ty, tw, th, FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); */
            /* } */
            /* else */
            /* { */
            /*     fl_draw( "Polar orthographic; angle and distance input.", tx, ty, tw, th, FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); */
            /* } */
        }

    }
    
    if ( tw > 200 )
        draw_children();

    fl_line_style( FL_SOLID, 0 );

    fl_pop_clip();
}
예제 #17
0
	void draw() {
		fl_color(255, 255, 255);
		int x1 = x()-15;
		int y1 = y()-15;
		fl_pie(x1, y1, 30, 30, 0, 360);
	}
예제 #18
0
파일: Fl_DrawC.cpp 프로젝트: deech/fltkhs
 FL_EXPORT_C(void,flc_pie)(int x,int y,int w,int h,double a1,double a2){
   fl_pie(x,y,w,h,a1,a2);
 }
예제 #19
0
void WidgetPDial::draw()
{
#ifdef NTK_GUI
    box( FL_NO_BOX );

    Fl_Dial::draw();
    
    return;
#else
    const int cx = x(), cy = y(), sx = w(), sy = h();
    const double a1 = angle1(), a2 = angle2();
    const double val = (value() - minimum()) / (maximum() - minimum());
    // even radius produces less artifacts if no antialiasing is avail
    const int rad = (sx > sy ? sy : sx) &~1;

    /* clears the button background */
    pdialcolor(160, 160, 160);
    fl_pie(cx - 2, cy - 2, rad + 4, rad + 4, 0, 360);

    /* dark outline */
    fl_color(60, 60, 60);
    fl_pie(cx - 1, cy - 1, rad + 2, rad + 2, 0, 360);

    /* Draws the button faceplate, min/max */
    pdialcolor(110, 110, 115);
    fl_pie(cx, cy, rad, rad, 270 - a2, 270 - a1);

    /* knob center */
    if (rad > 8) {
        pdialcolor(140, 140, 145);
        fl_pie(cx + 4, cy + 4, rad - 8, rad - 8, 0, 360);
    }

    /* value circle */
    double a = -(a2 - a1) * val - a1;
    fl_line_style(0, 2, 0);
    pdialcolor(0, 200, 0);
    fl_arc(cx + 1, cy + 1, rad - 2, rad - 2, a - 90, a1 - 180);
    fl_line_style(0);

    /* draw value line */
    int ll = rad/4;
    if (ll < 2) ll = 2;

    fl_push_matrix();

    fl_translate(cx + rad / 2, cy + rad / 2);
    fl_rotate(a - 90.0f);

    fl_translate(rad / 2, 0);

    fl_begin_polygon();
    pdialcolor(0, 0, 0);
    fl_vertex(-ll, 0);
    fl_vertex(0, 0);
    fl_end_polygon();

    fl_pop_matrix();

#endif
}
예제 #20
0
파일: Panner.C 프로젝트: orlammd/non-mixer
void
Panner::draw ( void )
{
    draw_box();
//    draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK );
    draw_label();


    if ( _bypassed )
    {
        fl_color( 0 );
        fl_font( FL_HELVETICA, 12 );
        fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER );
        return;
    }

    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    fl_push_clip( tx, ty, tw, th );

    fl_color( FL_RED );

    const int b = 10;

    tx += b;
    ty += b;
    tw -= b * 2;
    th -= b * 2;

    /* draw perimeter */
    {
        Fl_Color c1, c2;
        int iter;

        if ( Fl::belowmouse() == this )
        {
            iter = 12;
            c1 = fl_darker( FL_RED );
            c2 = FL_GRAY;
        }
        else
        {
            iter = 6;
            c1 = FL_GRAY;
            c2 = FL_BLACK;
        }

        Fl_Color c = c1;

        for ( int i = iter; i--; )
        {
            fl_color( c );

            fl_arc( tx + (i * (tw / iter)) / 2, ty + (i * (th / iter)) / 2, tw - (i * (tw / iter)), th - (i * ( th / iter )), 0, 360 );

            c = fl_color_average( c1, c2, (float)i / iter);
        }
    }

/*     fl_color( FL_WHITE ); */

/*     fl_arc( tx, ty, tw, th, 0, 360 ); */

    if ( _configs[ _outs ][0] >= 0 )
    {
        for ( int i = _outs; i--; )
        {
            int a = _configs[ _outs ][ i ];

            Point p( 1.2f, (float)a );

            float px, py;

            p.axes( &px, &py );

            fl_push_matrix();

            const int bx = tx + ((tw / 2) * px + (tw / 2));
            const int by = ty + ((th / 2) * py + (th / 2));

            fl_translate( bx, by );

            fl_scale( 5, 5 );

            a = 90 - a;

            fl_rotate( a );

            draw_speaker( FL_WHITE );

            fl_rotate( -a );

            fl_pop_matrix();

        }
    }

    /* ensure that points are drawn *inside* the circle */

    for ( int i = _ins; i--; )
    {
        Point *p = &_points[ i ];

        Fl_Color c = (Fl_Color)(10 + i);

        int px, py, pw, ph;
        point_bbox( p, &px, &py, &pw, &ph );

        /* draw point */
        if ( p != drag )
            fl_color( c );
        else
            fl_color( FL_WHITE );

        fl_pie( px, py, pw, ph, 0, 360 );

        /* draw echo */
        fl_color( c = fl_darker( c ) );
        fl_arc( px - 5, py - 5, pw + 10, ph + 10, 0, 360 );
        if ( Fl::belowmouse() == this )
        {
            fl_color( c = fl_darker( c ) );
            fl_arc( px - 10, py - 10, pw + 20, ph + 20, 0, 360 );
            fl_color( c = fl_darker( c ) );
            fl_arc( px - 30, py - 30, pw + 60, ph + 60, 0, 360 );
        }

        /* draw number */
        char pat[4];
        snprintf( pat, 4, "%d", i + 1 );

        fl_color( FL_BLACK );
        fl_font( FL_HELVETICA, ph + 2 );
        fl_draw( pat, px + 1, py + 1, pw - 1, ph - 1, FL_ALIGN_CENTER );

        /* draw line */

/*         fl_color( FL_WHITE ); */
/*         fl_line( bx + pw() / 2, by + ph() / 2, tx + (tw / 2), ty + (th / 2) ); */

    }

    fl_pop_clip();
}
예제 #21
0
파일: fl_gauge.cpp 프로젝트: qartis/dori
void Fl_Gauge::draw(void)
{
    int X = x();
    int Y = y();
    int W = w();
    int H = h();

    draw_box();

    X += Fl::box_dx(box());
    Y += Fl::box_dy(box());
    W -= Fl::box_dw(box());
    H -= Fl::box_dh(box());

    double frac = (value() - minimum()) / (maximum() - minimum());
    double angle = (angle2() - angle1()) * frac +  angle1();

    float cx = X + W/2.0f;
    float cy = Y + H/2.0f;

    float d = (float)((W < H)? W : H);

    double num_major_ticks = (maximum() - minimum()) / major_step_size;
    double num_minor_ticks = (maximum() - minimum()) / minor_step_size;

    double minor_angle = (angle2() - angle1()) / num_minor_ticks;
    double major_angle = (angle2() - angle1()) / num_major_ticks;
    int i;

    fl_color(FL_WHITE);
    fl_line_style(FL_SOLID, 1);

/* minor ticks */
    fl_push_matrix();
    fl_color(FL_WHITE);
    fl_translate(cx, cy);
    fl_scale(d, d);
    fl_rotate(-angle1());
    for (i = 0; i <= num_minor_ticks; i++) {
        fl_begin_line();
        fl_vertex(0, 0.40);
        fl_vertex(0, 0.45);
        fl_end_line();
        fl_rotate(-minor_angle);
    }
    fl_pop_matrix();

/* major ticks */
    fl_push_matrix();
    fl_color(FL_WHITE);
    fl_line_style(FL_SOLID, 3);
    fl_translate(cx, cy);
    fl_scale(d, d);
    fl_rotate(-angle1());
    for (i = 0; i <= num_major_ticks; i++) {
        fl_begin_line();
        fl_vertex(0, 0.40);
        fl_vertex(0, 0.47);
        fl_end_line();
        fl_rotate(-major_angle);
    }
    fl_pop_matrix();

/* tick labels */
    char buf[128];
    fl_color(FL_WHITE);
    for (i = 0; i <= num_major_ticks; i++) {
        snprintf(buf, sizeof(buf), "%.0lf", minimum() + i * major_step_size);
        double angle = 360.0 + -angle1() - 90 - i * major_angle;
        double rad = angle * M_PI/180.0;
        int width = 0;
        int height = 0;
        fl_measure(buf, width, height);
        if (width < 1) {
            width = 9;
        }
        if (height < 1) {
            height = 16;
        }
        double radius = d / 3;
        double x = cx + radius * cos(rad);
        double y = cy - radius * sin(rad);
        if (rad < M_PI/2.0 || rad > 3 * M_PI/2.0) {
            x = cx + (radius - width/2.0) * cos(rad);
        }
        x -= width/2.0;
        fl_draw(buf, x, y + height/2.0);
    }

    fl_push_matrix();
    fl_translate(cx, cy);
    fl_scale(d, d);

    fl_color(FL_WHITE);

    fl_rotate(-angle);

/* arrow */
    fl_begin_polygon();
    fl_vertex(-0.02, 0.03);
    fl_vertex(-0.02, 0.35);
    fl_vertex( 0.00, 0.37);
    fl_vertex( 0.02, 0.35);
    fl_vertex( 0.02, 0.03);
    fl_end_polygon();

/* border */
    fl_begin_loop();
    fl_circle(0.0, 0.0, 0.48);
    fl_end_loop();

    fl_pop_matrix();

    fl_color(FL_GRAY);
    fl_pie(cx - d * 0.05, cy - d * 0.05, d * 0.1, d * 0.1, 0, 360.0);
    fl_color(FL_BLACK);
    fl_pie(cx - d * 0.025, cy - d * 0.025, d * 0.05, d * 0.05, 0, 360.0);

    draw_label();
}