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); }
void Fl_Arc_Dial::draw ( void ) { int X = x(); int Y = y(); int W = w(); int H = h(); draw_box(); draw_label(); X += Fl::box_dx(box()); Y += Fl::box_dy(box()); W -= Fl::box_dw(box()); H -= Fl::box_dh(box()); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_line_style( FL_SOLID, W / 6 ); X += W / 8; Y += H / 8; W -= W / 4; H -= H / 4; if ( box() == FL_NO_BOX ) { /* draw backgrond arc */ fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) ); fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() ); } fl_color( selection_color() ); // fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) ); if ( type() == FL_FILL_DIAL ) fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle ); else { const int d = 6; /* account for edge conditions */ angle = angle < angle1() + d ? angle1() + d : angle; angle = angle > angle2() - d ? angle2() - d : angle; fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) ); } fl_line_style( FL_SOLID, 0 ); fl_color( labelcolor() ); char s[10]; fl_font( FL_HELVETICA, 8 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM ); }
static void draw_round3dbutton( FL_OBJECT * ob ) { int c1; FL_Coord xx, yy, rr, bw = FL_abs( ob->bw ); FL_BUTTON_STRUCT *sp = ob->spec; if ( ob->boxtype == FL_NO_BOX && ( sp->event == FL_ENTER || sp->event == FL_LEAVE ) ) return; c1 = ob->belowmouse ? FL_ROUND3DBUTTON_MCOL : FL_ROUND3DBUTTON_TOPCOL; fl_draw_box(ob->boxtype, ob->x, ob->y, ob->w, ob->h, c1, ob->bw); rr = 0.3 * FL_min( ob->w, ob->h ) + 0.5; xx = ob->x + rr + 4.1; yy = ob->y + 0.5 * ob->h; if ( rr < bw / 2 ) rr = bw / 2 + 1; #if 1 fl_draw_box( FL_OVAL3D_DOWNBOX, xx - rr, yy - rr, 2 * rr, 2 * rr, ob->col1, ob->bw ); #else olw = fl_get_linewidth( ); fl_linewidth( bw ); fl_arc( xx, yy, rr - bw / 2, 450, 2250, FL_BOTTOM_BCOL ); fl_arc( xx, yy, rr - bw / 2, 0, 450, FL_TOP_BCOL ); fl_arc( xx, yy, rr - bw / 2, 2250, 3600, FL_TOP_BCOL ); fl_linewidth( olw ); if ( fli_dithered( fl_vmode ) ) fl_arc( xx, yy, rr - bw / 2, 0, 3600, FL_BLACK ); #endif if ( sp->val ) fl_circf( xx, yy, ( int ) FL_max( 1, 0.85 * rr - 1.0 - 0.5 * bw ), ob->col2 ); if ( fl_is_center_lalign( ob->align ) ) fl_draw_text( FL_ALIGN_LEFT, xx + rr + 1, ob->y, 0, ob->h, ob->lcol, ob->lstyle, ob->lsize, ob->label ); else fl_draw_text_beside( ob->align, ob->x, ob->y, ob->w, ob->h, ob->lcol, ob->lstyle, ob->lsize, ob->label ); if ( ob->type == FL_RETURN_BUTTON ) fl_draw_text( 0, ob->x + ob->w - 0.8 * ob->h, ob->y + 0.2 * ob->h, 0.6 * ob->h, 0.6 * ob->h, ob->lcol, 0, 0, "@returnarrow" ); }
void Frowny::draw_lines() const { Circle::draw_lines(); // 円の部分はCircleと同じ if(color().visibility()) { fl_color(color().as_int()); fl_arc(center().x + radius() / 2 * cos(M_PI / 4) - radius() / 16, center().y - radius() / 2 * sin(M_PI / 4) + radius() / 8, radius() / 8, radius() / 4, 0, 360); // 右目 fl_arc(center().x + radius() / 2 * cos(3 * M_PI / 4) - radius() / 16, center().y - radius() / 2 * sin(3 * M_PI / 4) + radius() / 8, radius() / 8, radius() / 4, 0, 360); // 左目 fl_arc(center().x - radius() / 2, center().y + radius() / 2, radius(), radius(), 45, 135); // 口 } }
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); } }
void Gate::draw_AND_gate(Point& ul) const{ fl_arc(ul.x,ul.y,.8*SCALE,.6*SCALE,180,360); fl_line(ul.x,ul.y+(.6*SCALE)/2,ul.x,ul.y); fl_line(ul.x,ul.y,ul.x+(.8*SCALE),ul.y); fl_line(ul.x+(.8*SCALE),ul.y,ul.x+(.8*SCALE),ul.y+(.6*SCALE)/2); }
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++; } } } }
void DiagramWindow::DrawArc( const unsigned int b1, const unsigned int b2, const float centerX, const float centerY, const float angleBase, const float angleDelta, const float radius) { float angle1 = angleBase - (float)b1 * angleDelta; float xPosn1 = centerX + cos(angle1) * radius; float yPosn1 = centerY - sin(angle1) * radius; float angle2 = angleBase - (float)b2 * angleDelta; float xPosn2 = centerX + cos(angle2) * radius; float yPosn2 = centerY - sin(angle2) * radius; // Calculate a third point on the arc, midway between the endpoints. float midAngle = (angle1 + angle2) / 2.0f; float diffAngleRatio = (angle1 - angle2) / M_PI; float xPosn3 = centerX + cos(midAngle) * radius * (1.0f - diffAngleRatio); float yPosn3 = centerY - sin(midAngle) * radius * (1.0f - diffAngleRatio); double arcX = 0.0f; double arcY = 0.0f; double arcR = 0.0f; ComputeCircle(xPosn1, yPosn1, xPosn2, yPosn2, xPosn3, yPosn3, arcX, arcY, arcR); int boundX = (int)(arcX - arcR); int boundY = (int)(arcY - arcR); int boundSize = (int)(2.0f * arcR); double arc1 = 180.0 / M_PI * atan2(arcY - yPosn1, xPosn1 - arcX); double arc2 = 180.0 / M_PI * atan2(arcY - yPosn2, xPosn2 - arcX); if (arc2 - arc1 > 180.0) arc1 += 360.0; if (arc1 - arc2 > 180.0) arc2 += 360.0; if (arc2 > arc1) { fl_arc(boundX, boundY, boundSize, boundSize, arc1, arc2); } else { fl_arc(boundX, boundY, boundSize, boundSize, arc2, arc1); } }
static void rbox(int x, int y, int w, int h, Fl_Color fill, Fl_Color line) { // figure out diameter of circles for corners: float d = w*(4/5.0f); float d1 = h*(4/5.0f); if (d1 < d) d = d1; if (d > 30) d = 30; float X = float(x); float Y = float(y); w--; h--; fl_arc(X, Y, d, d, 90, 180); fl_arc(X, Y+h-d, d, d, 180, 270); fl_arc(X+w-d, Y+h-d, d, d, 270, 360); fl_arc(X+w-d, Y, d, d, 0, 90); fl_color(fill); fl_fill_stroke(line); }
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()); }
void draw() { fl_push_clip(0, 0, w(), h()); fl_color(FL_DARK3); fl_rectf(0, 0, w(), h()); fl_push_matrix(); // if (args[6]) { fl_translate(w()/2.0f, h()/2.0f); fl_rotate(args[6]); fl_translate(-w()/2.0f, -h()/2.0f); //} fl_arc(args[0],args[1],args[2],args[3],args[4],args[5]); fl_closepath(); fl_arc(120,120,40,40,0,-360); fl_ellipse(20,20,args[2],args[3]); // hardware circle fl_color(FL_WHITE); fl_fill_stroke(FL_RED); fl_pop_matrix(); fl_pop_clip(); }
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); } }
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); } }
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 AnimationSet::DrawCover(int nPosX, int nPosY) { auto nOldColor = fl_color(); fl_color(FL_YELLOW); fl_begin_polygon(); fl_arc(nPosX * 1.0, nPosY * 1.0, m_R * 1.0, 0.0, 360.0); fl_end_polygon(); fl_color(FL_BLUE); fl_begin_line(); fl_arc(nPosX * 1.0, nPosY * 1.0, m_R * 1.0, 0.0, 360.0); fl_end_line(); // we put a cross to indicate the location fl_line(nPosX, nPosY - m_R, nPosX, nPosY + m_R); fl_line(nPosX - m_R, nPosY, nPosX + m_R, nPosY); fl_color(nOldColor); }
void Fl_Envelope::Fl_Handle::draw() { if (m_Coincident) { fl_color(FL_BLACK); fl_rect(x(),y(),w()+1,h()+1); fl_line(x(),y(),x()+w(),y()+h()); fl_line(x(),y()+h(),x()+w(),y()); } else { fl_color(FL_RED); fl_arc( x(),y(),w()+1,h()+1,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 };
void Ellipse::draw_lines() const { if (color().visibility()) fl_arc(point(0).x,point(0).y,w+w,h+h,0,360); }
void Circle::draw_lines() const { if (color().visibility()) fl_arc(point(0).x,point(0).y,r+r,r+r,0,360); }
void Fl_DialX::draw ( void ) { int X,Y,S; { int ox, oy, ww, hh, side; ox = x(); oy = y(); ww = w(); hh = h(); if (ww > hh) { side = hh; ox = ox + (ww - side) / 2; } else { side = ww; oy = oy + (hh - side) / 2; } side = w() > h() ? hh : ww; X = ox; Y = oy; S = side; } draw_box(); draw_label(); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_draw_box( box(), X, Y, S, S, color() ); /* shrink a bit */ int OX = x(); int OY = y(); X += S / 8; Y += S / 8; int OS = S; S -= S / 4; fl_line_style( FL_SOLID, S / 12 ); /* background arc */ fl_color( fl_darker( color() ) ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() ); /* foreground arc */ fl_color( selection_color() ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle ); fl_line_style( FL_SOLID, 0 ); if ( active_r() ) { int W = OS; int H = OS; fl_push_matrix(); fl_translate(OX+W/2, OY+H/2); fl_scale(W, H); fl_rotate(310+angle); fl_color( fl_color_add_alpha( FL_WHITE, 127 )); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon(); fl_color( FL_WHITE ); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon(); fl_pop_matrix(); } fl_color( fl_contrast( labelcolor(), color() ) ); if ( Fl::belowmouse() == this ) { char s[10]; fl_font( FL_HELVETICA, 10 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_color( FL_FOREGROUND_COLOR ); fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER ); } }
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 }
void PDFwin::draw() { Fl_Double_Window::draw(); int ww=w()-2; int hh=h()-2; if(!mModel) return; if(mState=="load") { fl_draw("loading page (please wait)", 0,0,w(), h(), FL_ALIGN_CENTER); return; } CImage* bmp=mModel->getPage(ww, hh, mCurrPage); std::list<SelectionRectangle> ::iterator i; for(i=mRects.begin(); i!=mRects.end(); ++i) (*i).updateScreenCoord(*this); int x=toWindowCoord(0,0).x; int y=toWindowCoord(0,0).y; //fl_draw_image(bmp->getDataPtr(), x, y, bmp->getWidth() , bmp->getHeight(), 3, bmp->getRowSize()); fl_draw_CImage(*bmp, TRect(0, 0, bmp->GetWidth(), bmp->GetHeight()), x, y); // draw rects int c=0; for(i=mRects.begin(); i!=mRects.end(); ++i) { SelectionRectangle& mRect=*i; if(mRect.isValid()) { c++; Fl_Boxtype type=FL_SHADOW_FRAME; if(i!=mSelectedRect) type=FL_BORDER_FRAME; fl_draw_box( type, mRect.left, mRect.top, mRect.Width(), mRect.Height(), FL_BLACK); TString temp; temp.format("Crop %d", c); fl_draw(temp, mRect.left, mRect.top, mRect.Width(), mRect.Height(), FL_ALIGN_TOP); if(i==mSelectedRect) { for(int j=0; j<2; j++) { int x=mRect.left; int y=mRect.top; if(j==1) { x=mRect.right; y=mRect.bottom; } fl_color(FL_WHITE); fl_begin_polygon(); fl_arc(x, y, 3, 0,360); fl_end_polygon(); fl_color(FL_BLACK); fl_begin_line(); fl_arc(x-3, y-3, 7, 7, 0,360); fl_end_line(); } } } } /*TString temp; temp.format("selected %d", mSelectedRect); fl_draw(temp, 0,0,w(), h(), FL_ALIGN_CENTER); */ FlLayout* layout=mLayout->findLayout("Automatic segmentation"); double cropT=layout->findSlider("Crop T")->value()/100.0; double cropB=layout->findSlider("Crop B")->value()/100.0; double cropL=layout->findSlider("Crop L")->value()/100.0; double cropR=layout->findSlider("Crop R")->value()/100.0; int wCropL=toWindowCoord(cropL,cropT).x; int wCropT=toWindowCoord(cropL,cropT).y; int wCropR=toWindowCoord(cropR,cropB).x; int wCropB=toWindowCoord(cropR,cropB).y; fl_draw_box( FL_BORDER_FRAME, 0, 0, ww, wCropT, FL_BLACK); fl_draw_box( FL_BORDER_FRAME, 0, hh-wCropB, ww, wCropB, FL_BLACK); fl_draw_box( FL_BORDER_FRAME, 0, 0, wCropL, hh, FL_BLACK); fl_draw_box( FL_BORDER_FRAME, ww-wCropR, 0, wCropR, hh, FL_BLACK); }
FL_EXPORT_C(void,flc_arc_by_radius)(double x,double y,double r,double start,double end){ fl_arc(x,y,r,start,end); }
FL_EXPORT_C(void,flc_arc_by_width_height)(int x,int y,int w,int h,double a1,double a2){ fl_arc(x,y,w,h,a1,a2); }
void Gate::draw_OR_gate(Point& ul) const{ fl_arc(ul.x,ul.y-(.6*SCALE)/2,.8*SCALE,.9*SCALE,180,360); fl_arc(ul.x,ul.y-(.6*SCALE)/2,.8*SCALE,.6*SCALE,180,360); fl_line(ul.x+(.8*SCALE)/4,ul.y,ul.x+(.8*SCALE)/4,ul.y+(.6*SCALE)/3); fl_line(ul.x+3*(.8*SCALE)/4,ul.y,ul.x+3*(.8*SCALE)/4,ul.y+(.6*SCALE)/3); }
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(); }