Esempio n. 1
0
void WidgetTable::draw_cell(TableContext context,
	int R, int C, int X, int Y, int W, int H)
{
	switch (context)
	{
	case CONTEXT_STARTPAGE:
		fl_font(FL_HELVETICA, 12);		// font used by all headers
		col_width_all(50);				// sets the width of the columns
		break;

	case CONTEXT_RC_RESIZE:
	{
		int X, Y, W, H;
		int index = 0;
		for (int r = 0; r<rows(); r++)
		{
			for (int c = 0; c<cols(); c++)
			{
				if (index >= children()) break;
				find_cell(CONTEXT_TABLE, r, c, X, Y, W, H);
				child(index++)->resize(X, Y, W, H);
			}
		}
		init_sizes();			// tell group children resized
		return;
	}

	case CONTEXT_ROW_HEADER:
		fl_push_clip(X, Y, W, H);
		{
			static char s[40];
			sprintf(s, "Row %d", R);
			fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, row_header_color());
			fl_color(FL_BLACK);
			fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
		}
		fl_pop_clip();
		return;

	case CONTEXT_COL_HEADER:
		fl_push_clip(X, Y, W, H);
		{
			static char s[40];
			sprintf(s, "Column %d", C);
			fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, col_header_color());
			fl_color(FL_BLACK);
			fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
		}
		fl_pop_clip();
		return;

	case CONTEXT_CELL:
		return;		// fltk handles drawing the widgets

	default:
		return;
	}
}
Esempio n. 2
0
void Fl_Tool_Bar::draw()
{
    int n;

    if(opened())
    {
        // make it not draw the inside label:
        int saved = flags(); align(FL_ALIGN_TOP);

        if(damage() & ~FL_DAMAGE_CHILD) {
            draw_frame();
            fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh());
            for (n = children(); n--;) draw_child(*child(n));
            draw_box();
            draw_inside_label();
            fl_pop_clip();

            if(m_menubut->visible()) {
                fl_push_clip(w()-box()->dw()-(m_menubut->visible()?20:0), box()->dy(), 30, h()-box()->dh());
                draw_child(*m_menubut);
                draw_box();
                fl_pop_clip();
            }

            for (n = 0; n < children(); n++) draw_outside_label(*child(n));
        } else {
            fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh());

            for(n = 0; n < children(); n++) {
                Fl_Widget& w = *child(n);
                if (w.damage() & FL_DAMAGE_CHILD_LABEL) {
                    draw_outside_label(w);
                    w.set_damage(w.damage() & ~FL_DAMAGE_CHILD_LABEL);
                }
                update_child(w);
            }

            fl_pop_clip();
        }

        flags(saved);

        if (damage() & (FL_DAMAGE_EXPOSE|FL_DAMAGE_HIGHLIGHT|FL_DAMAGE_ALL))
        {
            Fl_Flags f = 0;
            if (pushed) f.set(FL_VALUE);
            if (highlighted) f.set(FL_HIGHLIGHT);
            draw_glyph(0, 0, 0, glyph_size(), h(), f);
        }

    } else
        Fl_Bar::draw();
}
Esempio n. 3
0
void PanelButton::draw()
{
    Fl_Boxtype box = up;
    Fl_Flags flags;
    Fl_Color color;

    if (belowmouse())
    {
        // Highlight button when below mouse
        flags = FL_HIGHLIGHT;
        color = highlight_color();
        if (!color) color = this->color();
//        box = down;
    } else {
        flags = 0;
        color = this->color();
    }
    
    if (value()) box=down; // Push down button when pressed

    if(!box->fills_rectangle()) {
        fl_push_clip(0, 0, this->w(), this->h());
        parent()->draw_group_box();
        fl_pop_clip();
    }

    box->draw(0, 0, this->w(), this->h(), color, flags);

    int x,y,w,h;
    x = y = 0;
    w = this->w(); h = this->h();
    box->inset(x,y,w,h);
    draw_inside_label(x,y,w,h,flags);
}
void Fl_ImageViewer::draw()
{
    fl_push_clip( x(), y(), w(), h() );
    Fl_Scroll::draw();

    if ( isdrawruler == true )
    {
        fl_color( FL_BLUE );
        fl_line_style( 0, 3, NULL );

        fl_line( coordclicked_x, coordclicked_y, coordmoving_x, coordmoving_y );
    }
    else
    if ( isdrawclickpointer == true )
    {
        fl_color( colorclicked );
        fl_line_style( 0, 1, NULL );

        fl_line( coordclicked_x , y() , coordclicked_x, coordclicked_y - 1 );
        fl_line( coordclicked_x, coordclicked_y + 1 , coordclicked_x, y() + h() );
        fl_line( x(), coordclicked_y, coordclicked_x - 1, coordclicked_y );
        fl_line( coordclicked_x + 1, coordclicked_y, x() + w(), coordclicked_y );
    }

    fl_pop_clip();
}
Esempio n. 5
0
void Flcc_ValueBox::draw()
{
    int d = damage();
    int x1 = 0; int y1 = 0; int w1 = w(); int h1 = h();

    box()->inset(x1,y1,w1,h1);

    Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
    c->hsv2rgb(c->hue(), c->saturation(), 1.0f, tr, tg, tb);

    if(d & FL_DAMAGE_ALL) {
        draw_frame();
        generate();     
    }

    if (d == FL_DAMAGE_VALUE) fl_push_clip(x1,y1+py,w1,6);
    bg->draw(x1,y1,w1,h1);
    if (d == FL_DAMAGE_VALUE) fl_pop_clip();

    int Y = int((1-c->v()) * (h1-6));
    if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
    button_box()->draw(x1, y1+Y, w1, 6, color(), 0);

    py = Y;
}
Esempio n. 6
0
File: ntk-perf.C Progetto: 0mk/non
   void draw ( void )
        {          
            if ( use_cairo )
                fl_push_use_cairo(true);

            fl_rectf( x(), y(), w(), h(), FL_BLACK );

            unsigned long long then = get_ts();

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

            int count = 400;

            /* draw stuff */
            int i = 0;
            for ( ; i < count; ++i )
                fl_draw_box( boxtype, x(), y(), w(), h(), fl_lighter( FL_BLACK ) );

            fl_pop_clip();

            unsigned long long now = get_ts();

            double elapsedms = (now - then) / 1000.0;

            static char text[256];
            sprintf( text, "Drew %i boxes in in %fms", i, elapsedms );

            fl_color( FL_RED );
            fl_draw( text, x(), y(), w(), h(), FL_ALIGN_CENTER | FL_ALIGN_INSIDE );

            draw_label();

            if ( use_cairo )
                fl_pop_use_cairo();
        }
Esempio n. 7
0
void
Track::draw ( void )
{
    fl_push_clip( x(), y(), w(), h() );
    
    Fl_Color saved_color = color();

    if ( ! Track::colored_tracks )
        color( FL_GRAY );

    if ( _selected )
    {
        Fl_Color c = color();

        color( FL_RED );

        Fl_Group::draw();

        color( c );
    }
    else
        Fl_Group::draw();

    if ( ((Track_Header*)child(0))->input_connector_handle == receptive_to_drop )
    {
        Fl_Widget *o = ((Track_Header*)child(0))->input_connector_handle;
        fl_draw_box( FL_OVAL_BOX, o->x(), o->y(), o->w(), o->h(), fl_color_add_alpha( FL_GREEN, 127 ) );
    }

    if ( ! Track::colored_tracks )
        color( saved_color );

    fl_pop_clip();
}
Esempio n. 8
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();
}
Esempio n. 9
0
void Flcc_HueBox::draw()
{
    if (damage() & FL_DAMAGE_ALL) {
        draw_frame();
    }

    int x1 = 0; int y1 = 0; int w1 = w(); int h1 = h();
    box()->inset(x1,y1,w1,h1);

    if (damage() == FL_DAMAGE_VALUE) fl_push_clip(x1+px,y1+py,BUTTON_SIZE,BUTTON_SIZE);
    if(bg) bg->draw(x1,y1,w1,h1);
    if (damage() == FL_DAMAGE_VALUE) fl_pop_clip();

    Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();

#ifdef CIRCLE
    int X = int(.5f*(cos(c->hue()*float(M_PI/3.0))*c->saturation()+1) * (w1-BUTTON_SIZE));
    int Y = int(.5f*(1-sin(c->hue()*float(M_PI/3.0))*c->saturation()) * (h1-BUTTON_SIZE));
#else
    int X = int(c->hue()/6.0f*(w1-BUTTON_SIZE));
    int Y = int((1-c->saturation())*(h1-BUTTON_SIZE));
#endif

    if (X < 0) X = 0; else if (X > w1-BUTTON_SIZE) X = w1-BUTTON_SIZE;
    if (Y < 0) Y = 0; else if (Y > h1-BUTTON_SIZE) Y = h1-BUTTON_SIZE;

    button_box()->draw(x1+X, y1+Y, BUTTON_SIZE, BUTTON_SIZE, button_color(), 0);
    px = X;
    py = Y;
}
Esempio n. 10
0
void Flu_Wrap_Group :: draw()
{
  // we first try to fit all children assuming no scrollbar. if they do not all fit,
  // we have to turn the scrollbar on and try again
  if( layout( false, false ) )
    {
      scrollbar.show();
      layout( true, false );
    }
  else
    scrollbar.hide();

  // hack to look right when resizing smaller
  if( scrollbar.value() > scrollbar.maximum() )
    {
      ((Fl_Valuator*)&scrollbar)->value( scrollbar.maximum() );
      layout( scrollbar.visible(), scrollTo!=NULL );
    }
  else if( scrollTo )
    layout( scrollbar.visible(), true );

  scrollTo = NULL;

  if( damage() & ~FL_DAMAGE_CHILD)
    {
      draw_box();
      draw_label();
    }
  fl_push_clip( x()+Fl::box_dx(box()), y()+Fl::box_dy(box()),
		w()-Fl::box_dw(box()), h()-Fl::box_dh(box()) );
  draw_children();
  fl_pop_clip();
}
Esempio n. 11
0
void CairoBox::draw(void) 
  {
  // using fltk functions, set up white background with thin black frame
  fl_push_no_clip();            /* remove any clipping region set by the expose events... */
  fl_push_clip(x(), y(), w(), h());
  fl_color(FL_WHITE);
  fl_rectf(x(), y(), w(), h());
  fl_color(FL_BLACK);
  fl_rect(x(), y(), w(), h());

  // set up cairo structures
  surface = set_surface(w(), h());
  cr      = cairo_create(surface);
  /* All Cairo co-ordinates are shifted by 0.5 pixels to correct anti-aliasing */
  cairo_translate(cr, 0.5, 0.5);
  cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); // set drawing color to black
  cairo_new_path(cr);

  // virtual function defined in driver program
  graphic(cr, x(), y(), w(), h());

  // release the cairo context
  cairo_destroy(cr);
  cairo_surface_destroy(surface);
//  cr = NULL;

  // remove clip regions
  fl_pop_clip();                          // local clip region
  fl_pop_clip();                          // "no_clip" region
  }
Esempio n. 12
0
void FontDisplay::draw() {
  draw_box();
  int ix = 0, iy = 0, iw = w(), ih = h();
  box()->inset(ix, iy, iw, ih);
  fl_push_clip(ix, iy, iw, ih);
  const char* saved_encoding = fl_encoding();
  if (encoding) fl_encoding(encoding);
  fl_font(font, size);
  fl_color(FL_BLACK);
  char buffer[32];
//#if HAVE_XUTF8
  char outbuf[64];
//#endif
  for (int Y = 1; Y < 8; Y++) {
      for (int X = 0; X < 32; X++) buffer[X] = (32*Y+X);
//#if HAVE_XUTF8
      int len = fl_latin12utf((uint8*)buffer, 32, outbuf);
      fl_draw(outbuf, len, 3, 3+fl_height()*Y);
//#else
//      fl_draw(buffer, 32, 3, 3+fl_height()*Y);
//#endif
  }
  fl_encoding(saved_encoding);
  fl_pop_clip();
}
Esempio n. 13
0
File: Module.C Progetto: 0mk/non
void
Module::draw_box ( int tx, int ty, int tw, int th )
{
    fl_color( fl_contrast( FL_FOREGROUND_COLOR, color() ) );

    fl_push_clip( tx, ty, tw, th );

    Fl_Color c = color();

    if ( ! active_r() )
        c = fl_inactive( c );

    int spacing = w() / instances();
    for ( int i = instances(); i--; )
    {
        fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, c );
    }


    if ( audio_input.size() && audio_output.size() )
    {
        /* maybe draw control indicators */
        if ( control_input.size() )
        {
            fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + 4, 5, 5, is_being_controlled() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );

            /* fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + th - 8, 5, 5, is_being_controlled_osc() ? FL_YELLOW : fl_inactive( FL_YELLOW ) ); */
        }

        if ( control_output.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + tw - 8, ty + 4, 5, 5, is_controlling() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
    }

    fl_push_clip( tx + Fl::box_dx(box()), ty + Fl::box_dy(box()), tw - Fl::box_dw(box()), th - Fl::box_dh(box()) );

    Fl_Group::draw_children();

    fl_pop_clip();

    if ( focused_r( this ) )
        draw_focus_frame( tx,ty,tw,th, selection_color() );

    fl_pop_clip();
}
Esempio n. 14
0
    void draw() {
        if(!(damage()&FL_DAMAGE_ALL)) return;

        int X=0,Y=0,W=w(),H=h();
        box()->inset(X,Y,W,H);

        if(image()) {
            draw_frame();
            fl_push_clip(X,Y,W,H);

            Fl_Image *im = image();

            W=im->width();
            H=im->height();
            int pbw = w() - 10;
            int pbh = h() - 10;
            if(W > pbw || H > pbh) {
                W = pbw;
                H = W * im->height() / im->width();
                if(H > pbh) {
                    H = pbh;
                    W = H * im->width() / im->height();
                }
            }
            X=(w()/2)-W/2;
            Y=(h()/2)-H/2;
            if(X<5) X=5;
            if(Y<5) Y=5;

            im->mask_type(MASK_NONE);
            im->draw(X,Y,W,H,FL_ALIGN_SCALE);

            fl_clip_out(X,Y,W,H);

            X=0,Y=0,W=w(),H=h();
            box()->inset(X,Y,W,H);

            fl_color(color());
            fl_rectf(X,Y,W,H);

            fl_pop_clip();

        } else {

            draw_box();

            if(w()<=120) label_size(8);
            if(w()>120) label_size(10);
            if(w()>180) label_size(12);
            if(w()>250) label_size(14);

            if(label()[0]=='?'&&label()[1]=='\0') label_size(100);

            draw_label(X, Y, W, H, align());
        }
    }
Esempio n. 15
0
void
SpectrumView::draw ( void ) 
{
    //Clear Widget
    Fl_Box::draw();

    int W = w() - padding_right;
    int H = h() - padding_bottom;

    if ( !_bands ) {
        analyze_data( W );
    }

    //Draw grid
    fl_color(fl_color_add_alpha(fl_rgb_color( 100,100,100), 50 ));

    draw_semilog();

    fl_push_clip( x(),y(),W,H);

            
    fl_color(fl_color_add_alpha( selection_color(), 20 ));
   
    fl_push_matrix();
    fl_translate( x(), y() + 2 );
    fl_scale( W,H- 2 );

    fl_begin_polygon();
    
    fl_vertex(0.0,1.0);

    draw_curve();

    fl_vertex(1.0,1.0);
                  
    fl_end_polygon();

    fl_color(fl_color_add_alpha( selection_color(), 100 ));
    fl_begin_line();
    fl_line_style(FL_SOLID,2);
    
    /* fl_vertex(0.0,1.0); */

    draw_curve();

    /* fl_vertex(1.0,1.0); */

    fl_end_line();
    
    fl_pop_matrix();

    fl_line_style(FL_SOLID,0);

    fl_pop_clip();
}
Esempio n. 16
0
void Fl_Shaded_Box::draw(int x, int y, int w, int h,
                        Fl_Color color, Fl_Flags flags) const
{
    frame->draw(x,y,w,h,color, FL_INVISIBLE|flags);

    if(flags&FL_INVISIBLE) return;

    Fl_Boxtype box;
    if((frame==FL_HIGHLIGHT_BOX && flags&FL_HIGHLIGHT) //hack :)
       || frame!=FL_HIGHLIGHT_BOX)
        frame->inset(x,y,w,h);
    fl_push_clip(x,y,w,h);
    if(vertical) box = FL_VERT_SHADE_FLAT_BOX;
    else box = FL_HOR_SHADE_FLAT_BOX;
    box->draw(x,y,w,h,color,flags);
    fl_pop_clip();
}
Esempio n. 17
0
 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();
 }
Esempio n. 18
0
void
Module::draw_box ( void )
{
    fl_color( fl_contrast( FL_FOREGROUND_COLOR, color() ) );

    int tw, th, tx, ty;

    tw = w();
    th = h();
    ty = y();
    tx = x();

    fl_push_clip( tx, ty, tw, th );

    Fl_Color c = is_default() ? FL_BLACK : color();

    c = active() && ! bypass() ? c : fl_inactive( c );

    int spacing = w() / instances();
    for ( int i = instances(); i--; )
    {
        fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, Fl::belowmouse() == this ? fl_lighter( c ) : c );
    }

    if ( this == Fl::focus() )
    {
        fl_draw_box( FL_UP_FRAME, x(), y(), w(), h(), selection_color() );
    }

    if ( audio_input.size() && audio_output.size() )
    {
        /* maybe draw control indicators */
        if ( control_input.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + 4, 5, 5, is_being_controlled() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
        if ( control_output.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + tw - 8, ty + 4, 5, 5, is_controlling() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
    }

    Fl_Group::draw_children();

    fl_pop_clip();
}
Esempio n. 19
0
void PanelMenu::draw()
{
    Fl_Boxtype box = up;
    Fl_Flags flags;
    Fl_Color color;

    if (!active_r()) {
        // Button is disabled
        flags = FL_INACTIVE;
        color = this->color();
    } else if (m_open) {
        // Menu is open, make the button pushed and highlighted
        flags = FL_HIGHLIGHT;
        color = highlight_color();
        if (!color) color = this->color();
        box = down;
    } else if (belowmouse()) {
        // Menu is not open, but button is below mouse - highlight
        flags = FL_HIGHLIGHT;
        color = highlight_color();
        if (!color) color = this->color();
    } else {
        // Plain
        flags = 0;
        color = this->color();
    }

    if(!box->fills_rectangle()) {
        fl_push_clip(0, 0, this->w(), this->h());
        parent()->draw_group_box();
        fl_pop_clip();
    }

    box->draw(0, 0, this->w(), this->h(), color, flags);

    int x,y,w,h;
    x = y = 0;
    w = this->w(); h = this->h();
    box->inset(x,y,w,h);
    draw_inside_label(x,y,w,h,flags);
}
Esempio n. 20
0
void TaskButton::draw(void) {
	Fl_Color col = value() ? selection_color() : color();
	draw_box(value() ? (down_box() ? down_box() : fl_down(box())) : box(), col);

	if(image()) {
		int X, Y, lw, lh;

		X = x() + 5;
		Y = (y() + h() / 2) - (image()->h() / 2);
		image()->draw(X, Y);

		X += image()->w() + 5;

		if(label()) {
			fl_font(labelfont(), labelsize());
			fl_color(labelcolor());

			lw = lh = 0;
			fl_measure(label(), lw, lh, 0);

			/* use clipping so long labels do not be drawn on the right border, which looks ugly */
			fl_push_clip(x() + Fl::box_dx(box()), 
						 y() + Fl::box_dy(box()), 
						 w() - Fl::box_dw(box()) - 5, 
						 h() - Fl::box_dh(box()));

			Y = (y() + h() / 2) - (lh / 2);
			fl_draw(label(), X, Y, lw, lh, align(), 0, 0);

			fl_pop_clip();
		}
	} else {
		draw_label();
	}

	if(Fl::focus() == this)
		draw_focus();
}
Esempio n. 21
0
void
Chain::draw_connections ( Module *m )
{
    int spacing;
    int offset;

    int X, Y, W, H;

    ((Fl_Packscroller*)chain_tab->child( 0 ))->bbox( X, Y, W, H );

    fl_push_clip( X, Y, W, H );

    Fl_Color c = FL_FOREGROUND_COLOR;
    fl_color( c );

    if ( m->ninputs() )
    {
        spacing = w() / m->ninputs();
        offset = spacing / 2;

        for ( int i = m->ninputs(); i--; )
            fl_rectf( m->x() + offset + ( spacing * i ), m->y() - 3, 2, 3 );
    }

    fl_color( fl_darker( c ) );

    if ( m->noutputs() )
    {
        spacing = w() / m->noutputs();
        offset = spacing / 2;
        for ( int i = m->noutputs(); i--; )
            fl_rectf( m->x() + offset + ( spacing * i ), m->y() + m->h(), 2, 3 );
    }

    fl_pop_clip();
}
Esempio n. 22
0
File: Chain.C Progetto: imv/non
void
Chain::draw_connections ( Module *m )
{
    int spacing;
    int offset;

    int X, Y, W, H;

    ((Fl_Packscroller*)chain_tab->child( 0 ))->bbox( X, Y, W, H );

    fl_push_clip( X, Y, W, H );

    Fl_Color c =fl_color_average( FL_WHITE, FL_YELLOW, 0.50 );
    fl_color( c );

    if ( m->ninputs() )
    {
        spacing = w() / m->ninputs();
        offset = spacing / 2;

        for ( int i = m->ninputs(); i--; )
            fl_rectf( m->x() + offset + ( spacing * i ), m->y() - 5, 2, 5 );
    }

    fl_color( fl_darker( c ) );

    if ( m->noutputs() )
    {
        spacing = w() / m->noutputs();
        offset = spacing / 2;
        for ( int i = m->noutputs(); i--; )
            fl_rectf( m->x() + offset + ( spacing * i ), m->y() + m->h(), 2, 5 );
    }

    fl_pop_clip();
}
Esempio n. 23
0
void UIPartList::draw_cell(TableContext context, int R = 0, int C = 0, int X = 0, int Y = 0, int W = 0, int H = 0){
	static char *cols_mbr[7] = {"Num","Path","Boot","Type","Start LBA","End LBA","Size"};
	static char *cols_gpt[7] = {"Num","Name","Boot","GUID","Start LBA","End LBA","Size"};
	static char *cols_empty[7] = {"","","","","","",""};
	char **cols;
	switch ( context ) {
        case CONTEXT_STARTPAGE:             // Fl_Table telling us its starting to draw page
            fl_font(FL_HELVETICA, 16);
            return;
       
        //case CONTEXT_ROW_HEADER:            // Fl_Table telling us it's draw row/col headers
        case CONTEXT_COL_HEADER:
            fl_push_clip(X, Y, W, H);
            {
				if (_info != null){
					cols = _info->mbr.gpt_protect ? cols_gpt : cols_mbr;
				} else {
					cols = cols_empty;
				}
                fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color());
                fl_color(FL_BLACK);
				fl_draw(cols[C], X, Y, W, H, FL_ALIGN_CENTER);
            }
            fl_pop_clip();
            return;
           
        case CONTEXT_CELL:                  // Fl_Table telling us to draw cells
            fl_push_clip(X, Y, W, H);
            {
                // BG COLOR
                fl_color( row_selected(R) ? selection_color() : FL_WHITE);
                fl_rectf(X, Y, W, H);
                   
                // TEXT
				if (_info != null){
					char *fmt_name = "\\Device\\Harddisk%d\\Partition%d";
					char text[128] = "";
					fl_color(FL_BLACK);
					if (_info->mbr.gpt_protect){
						switch (C){
							case 0:
								itoa(R + 1, text, 10);
								fl_draw(text, X, Y, W, H, FL_ALIGN_CENTER);
								break;
							case 1:
								fl_draw(_info->gpt.part[R].name, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
							case 2:
								fl_draw(_info->gpt.part[R].bios_bootable ? "Yes" : "", X, Y, W, H, FL_ALIGN_CENTER);
								break;
							case 3:
								sprintf(text, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
									_info->gpt.part[R].part_guid.data1,
									_info->gpt.part[R].part_guid.data2,
									_info->gpt.part[R].part_guid.data3,
									_info->gpt.part[R].part_guid.data4[0],
									_info->gpt.part[R].part_guid.data4[1],
									_info->gpt.part[R].part_guid.data4[2],
									_info->gpt.part[R].part_guid.data4[3],
									_info->gpt.part[R].part_guid.data4[4],
									_info->gpt.part[R].part_guid.data4[5],
									_info->gpt.part[R].part_guid.data4[6],
									_info->gpt.part[R].part_guid.data4[7]
								);
								fl_draw(text, X, Y, W, H, FL_ALIGN_CENTER);
								break;
							case 4:
								itoa(_info->gpt.part[R].lba_start, text, 10);
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
							case 5:
								itoa(_info->gpt.part[R].lba_end, text, 10);
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
							case 6:
								format_size(text, _info->gpt.part[R].lba_size * ((uint64)_info->chs.bps));
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
						
						}
					} else {
						switch (C){
							case 0:
								itoa(R + 1, text, 10);
								fl_draw(text, X, Y, W, H, FL_ALIGN_CENTER);
								break;
							case 1:
								sprintf(text, fmt_name, _diskidx, R);
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
							case 2:
								fl_draw(_info->mbr.part[R].bootable ? "Yes" : "", X, Y, W, H, FL_ALIGN_CENTER);
								break;
							case 3:
								sprintf(text, "%02X", _info->mbr.part[R].type);
								fl_draw(text, X, Y, W, H, FL_ALIGN_CENTER);
								break;
							case 4:
								itoa(_info->mbr.part[R].lba_start, text, 10);
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
							case 5:
								itoa(_info->mbr.part[R].lba_end, text, 10);
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
							case 6:
								format_size(text, ((uint64)_info->mbr.part[R].lba_size) * ((uint64)_info->chs.bps));
								fl_draw(text, X + 5, Y, W - 10, H, FL_ALIGN_LEFT);
								break;
						
						}
					}
				}
                   
                // BORDER
                fl_color(FL_LIGHT2);
                fl_rect(X, Y, W, H);
            }
            fl_pop_clip();
            return;
           
    default:
        return;
    }
}
void Fl_Envelope::draw()
{
	fl_push_clip(x(),y(),w()+1,h()+1);
	fl_color(FL_GRAY);
	fl_rectf(x(),y(),w()+1,h()+1);
	
	fl_color(FL_BLACK);
	fl_rect(x(),y(),w()+1,h()+1);
	
	fl_color(FL_WHITE);
	
	int last_x=m_Origin_x, last_y=m_Origin_y, closest=INT_MAX, dist;
	list<Fl_Handle*>::iterator ClosestHandle=m_HandleList.end();

	// draw second markers
	fl_color(150,150,150);		

	for (int n=0; n<5; n++)
	{
		int p=(int)(m_Origin_x+(w()/m_Length*n));
		fl_line(p,y(),p,y()+h());
	}
	
	m_HandlePos.clear();

	m_HandlePos.push_back(Vec2(m_Origin_x,m_Origin_y));
	if (m_Bezier) AddToSpline(Vec2(m_Origin_x,m_Origin_y));
	
	for (unsigned int n=0; n<m_HandleList.size(); n++)
	{	
		// slow - search through drawing line connecting handles from left to right
		for(list<Fl_Handle*>::iterator i = m_HandleList.begin();
			i!=m_HandleList.end(); ++i)
		{
			dist=(*i)->x()-last_x;
			if (dist>-5 && dist<closest)
			{
				closest=dist;
				ClosestHandle=i;
			}			
		}
			
		if (ClosestHandle!=m_HandleList.end())
		{
			closest=INT_MAX;
			fl_color(FL_WHITE);	
			fl_line(last_x,last_y,(*ClosestHandle)->x()+5,(*ClosestHandle)->y()+5);
			
			(*ClosestHandle)->SetIsCoincident(false);
												
			last_x=(*ClosestHandle)->x()+5;
			last_y=(*ClosestHandle)->y()+5;							
			
			m_HandlePos.push_back(Vec2((*ClosestHandle)->x()+5,(*ClosestHandle)->y()+5));
			
			if (m_Bezier)
			{									
				if (!(n%3)) (*ClosestHandle)->SetIsCoincident(true);
				AddToSpline(Vec2((*ClosestHandle)->x()+5,(*ClosestHandle)->y()+5));
			}		
		}	
	}
			
	if (m_Bezier)
	{
		vector<Vec2> BezierLineList;
		CalculateBezierSpline(&BezierLineList,10);
							  
		vector<Vec2>::iterator bi=BezierLineList.begin();
		bi++;		
		fl_color(FL_BLUE);			
		for (;bi!=BezierLineList.end(); bi++)
		{					
			fl_line((int)(bi-1)->x,(int)(bi-1)->y,(int)bi->x,(int)bi->y);
		}
	}
	
	fl_color(FL_BLACK);	
	fl_line(m_Origin_x,m_Origin_y,m_Origin_x,y()+10);
	fl_line(m_Origin_x,m_Origin_y,x()+w()-10,m_Origin_y);
	
	Fl_Group::draw();
	fl_pop_clip();
}
Esempio n. 25
0
void ItemTableView::draw_cell(TableContext context,
	int r, int c, int x, int y, int w, int h
) {
	static char s[(NAME_LENGTH+1)];
	memset(s, 0x00, (NAME_LENGTH+1)*sizeof(char));

	_ITEM_TABLE* item = NULL;

	switch(context) {
		case CONTEXT_STARTPAGE:
			fl_font(FL_HELVETICA, 16);
			return;
		case CONTEXT_COL_HEADER:
			switch(c) {
				case 0: strcpy(s, "Filename"); break;
				//case 0: strcpy(s, "Num");     break;
				//case 1: strcpy(s, "strName"); break;
			}

			fl_push_clip(x, y, w, h);
			{
				fl_draw_box(FL_THIN_UP_BOX, x, y, w, h, col_header_color());
				fl_color(FL_BLACK);
				fl_draw(s, x, y, w, h, FL_ALIGN_CENTER);
			}
			fl_pop_clip();
			return;
		case CONTEXT_ROW_HEADER:
			sprintf(s, "%d", r+1);

			fl_push_clip(x, y, w, h);
			{
				fl_draw_box(FL_THIN_UP_BOX, x, y, w, h, row_header_color());
				fl_color(FL_BLACK);
				fl_draw(s, x, y, w, h, FL_ALIGN_CENTER);
			}
			fl_pop_clip();
			return;
		case CONTEXT_CELL:
			switch(c) {
				case 0: sprintf(s, "%s", disp_files[r]); break;
			}
			/*
			item = ItemTableMap.GetData(r);
			switch(c) {
				case 0: sprintf(s, "  %d", item->m_iNum);  break;
				case 1: sprintf(s, "  %s", item->m_sName); break;
			}
			*/

			fl_push_clip(x, y, w, h);
			{
				fl_color(row_selected(r) ? selection_color() : cell_bgcolor);
				fl_rectf(x, y, w, h);
				fl_color(cell_fgcolor);
				fl_draw(s, x, y, w, h, FL_ALIGN_LEFT);
				fl_color(color());
				fl_rect(x, y, w, h);
			}
			fl_pop_clip();
			return;
		case CONTEXT_TABLE:
			printf("Table Context Called?\n");
			return;
		case CONTEXT_ENDPAGE:
		case CONTEXT_RC_RESIZE:
		case CONTEXT_NONE:
			return;
	}
}
Esempio n. 26
0
bool Fl_Slider::draw(int ix, int iy, int iw, int ih, Fl_Flags flags, bool slot)
{
    // for back compatability, use type flag to set slider size:
    if (type()&FILL) slider_size(0);

    // if user directly set selected_color we use it:
    if (style()->selection_color) flags.set(FL_SELECTED);

    // figure out where the slider should be:
    int sx = ix, sy = iy, sw = iw, sh = ih;
    int sp;
    if (horizontal())
    {
        sx = sp = ix+slider_position(value(),iw);
        sw = slider_size_;
        if (!sw)                 // fill slider
        {
            sw = sx-ix; sx = ix;
        }
    }
    else
    {
        sy = sp = iy+slider_position(value(),ih);
        sh = slider_size_;
        if (!sh) sh = iy+ih-sy;  // fill slider
    }

    if (damage()&FL_DAMAGE_ALL)
    {
        fl_push_clip(0, 0, w(), h());
        // draw the slider
        draw_glyph(0, sx, sy, sw, sh, flags);
        // clip out the area of the slider
        fl_clip_out(sx, sy, sw, sh);

    }
    else if (sp != old_position)
    {

        // update a moving slider:
        // draw slider in new position
        draw_glyph(0, sx, sy, sw, sh, flags);
        // clip to the region the old slider was in:
        if (horizontal())
        {
            if (slider_size_) fl_push_clip(old_position, sy, sw, sh);
            else fl_push_clip(ix, iy, old_position, ih);
        }
        else
        {
            if (slider_size_) fl_push_clip(sx, old_position, sw, sh);
            else fl_push_clip(ix, old_position, iw, iy+ih-old_position);
        }
        // don't erase new slider
        fl_clip_out(sx, sy, sw, sh);
    }
    else
    {
        // update for the highlight turning on/off
        if (damage() & FL_DAMAGE_HIGHLIGHT) draw_glyph(0, sx, sy, sw, sh, flags);
        // otherwise no changes
        return false;
    }
    old_position = sp;

    // we draw a slot if it seems the box has no border:
    if (slot)
    {
        const int slot_size_ = 6;
        int slx, sly, slw, slh;
        int dx = (slider_size_-slot_size_)/2; if (dx < 0) dx = 0;
        if (horizontal())
        {
            slx = dx;
            slw = iw-2*dx;
            slx += ix;
            sly = iy+(ih-slot_size_+1)/2;
            slh = slot_size_;
        }
        else
        {
            sly = dx;
            slh = ih-2*dx;
            sly += iy;
            slx = ix+(iw-slot_size_+1)/2;
            slw = slot_size_;
        }
        button_box()->draw(slx, sly, slw, slh, FL_BLACK,
            flags&FL_INACTIVE|FL_VALUE);
        fl_clip_out(slx, sly, slw, slh);
    }
    return true;
}
Esempio n. 27
0
// Anybody can call this to force the label to draw anywhere, this is
// used by Fl_Group and Fl_Tabs to draw outside labels:
void Fl_Widget::draw_label(int X, int Y, int W, int H, Fl_Flags flags) const
{
	fl_font(label_font(), float(label_size()));
	if (!active_r()) flags.set(FL_INACTIVE);

	Fl_Color color;
    // Figure out if alignment puts the label inside the widget:
	if (!(this->flags()&15) || (this->flags() & FL_ALIGN_INSIDE))
	{
        // yes, inside label is affected by selection or highlight:
		if (flags&FL_SELECTED)
			color = selection_text_color();
		else if (flags&FL_HIGHLIGHT && highlight_label_color())
		    color = highlight_label_color();
		else
			color = label_color();
		if (focused()) flags.set(FL_SELECTED);
	}
	else
	{
		color = label_color();
	}

	if (flags & FL_ALIGN_CLIP) fl_push_clip(X, Y, W, H);

	if (image_)
	{
		fl_color(fl_inactive(color, flags));

		if(flags & FL_ALIGN_TILED || flags & FL_ALIGN_SCALE) {
			image_->draw(X, Y, W, H, flags);
		} else {

			int w = W;
			int h = H;
			image_->measure(w, h);

            // If all the flags are off, draw the image and label centered "nicely"
            // by measuring their total size and centering that rectangle:
			if (!(flags & (FL_ALIGN_LEFT|FL_ALIGN_RIGHT|FL_ALIGN_TOP|FL_ALIGN_BOTTOM|
						FL_ALIGN_INSIDE)) && !label_.empty())
			{
				int d = (H-int(h+fl_height()))>>1;
				if (d >= 0)
				{
                    // put the image atop the text
                                    Y += d;
                                    H -= d;
                                    flags.set(FL_ALIGN_TOP);
				}
				else
				{
                    // put image to left
					int text_w = W; int text_h = H;
					fl_measure(label_.c_str(), text_w, text_h, flags);
					int d = (W-(h+text_w))>>1;
					if (d > 0) {X += d; W -= d;}
					flags.set(FL_ALIGN_LEFT);
				}
			}

			int cx,cy;               // point in image to put at X,Y

			if (flags & FL_ALIGN_RIGHT) {
				cx = w-W;
				if (flags & FL_ALIGN_LEFT && cx < 0) cx = 0;
			}
			else if (flags & FL_ALIGN_LEFT) cx = 0;
			else cx = w/2-W/2;

			if (flags & FL_ALIGN_BOTTOM) {
				cy = h-H;
				if (flags & FL_ALIGN_TOP && cy < 0) cy = 0;
			}
			else if (flags & FL_ALIGN_TOP) cy = 0;
			else cy = h/2-H/2;

			image_->draw(X-cx, Y-cy, W, H, 0,0,0,0,flags);

            // figure out the rectangle that remains for text:
			if (flags & FL_ALIGN_LEFT) { X += (w+2); W -= (w+4); }
			else if (flags & FL_ALIGN_RIGHT) W -= (w+4);
			else if (flags & FL_ALIGN_TOP) {Y += h; H -= h;}
			else if (flags & FL_ALIGN_BOTTOM) H -= h;
			else { /*flags |= FL_ALIGN_TOP;*/
				Y += (h-cy); H -= (h-cy);
			}
		}
	}
Esempio n. 28
0
 FL_EXPORT_C(void,flc_push_clip)(int x,int y,int w,int h){
   fl_push_clip(x,y,w,h);
 }
Esempio n. 29
0
/*
============================================================================
Our custom draw routine
============================================================================
*/
void VTTpddServerLog::draw(void)
{
	int				xMargin = 7;
	int				topEntry, lines, line, idx;
	int				dataIdx, x, count, tempRef = m_nextRef;
	int				wx, wy, dataStart, labelStart, dataX, labelX, asciiX;
	char			str[10];
	VTTpddLogEntry*	pEntry, rxEntry, txEntry;

	// Do default FLTK stuff
	Fl_Double_Window::draw();

	// Push a clipping rect
	fl_push_clip(m_pLog->x(), m_pLog->y(), m_pLog->w(), m_pLog->h());

	// Draw the log background
	fl_color(m_colors.background);
	fl_font(FL_COURIER, m_fontSize);
	fl_rectf(m_pLog->x(), m_pLog->y(), m_pLog->w(), m_pLog->h());

	// Calculate the number of lines that fit in the window
	lines = m_pLog->h() / m_height;
	wy = m_pLog->y();
	wx = m_pLog->x();

	// Get the top entry of the display
	topEntry = m_pScroll->value();

	// Create fake rx and tx entries
	rxEntry.m_ref = tempRef;
	if (m_rxCount > 0)
		tempRef++;
	rxEntry.m_pData = m_rxBuffer;
	rxEntry.m_rxTx = 0;
	rxEntry.m_count = m_rxCount;

	txEntry.m_ref = tempRef;
	txEntry.m_pData = m_txBuffer;
	txEntry.m_rxTx = 1;
	txEntry.m_count = m_txCount;

	// Precalculate x offsets
	labelStart = 6;
	dataStart = labelStart + 4;
	labelX = labelStart * m_width + wx + xMargin;
	dataX = dataStart * m_width + wx + xMargin;
	asciiX = dataX + (2 + m_bytesPerLine * 3) * m_width;

	// Loop for all lines that can be displayed
	line = 1;
	idx = 0;

	count = m_log.GetSize();
	while (line <= lines && topEntry + idx < count + 2)
	{
		// Get the next log item to be displayed
		if (topEntry + idx == count)
			pEntry = &rxEntry;
		else if (topEntry + idx == count+1)
			pEntry = &txEntry;
		else
			pEntry = (VTTpddLogEntry *) m_log[topEntry + idx];
		dataIdx = 0;

		// Draw RX or TX as per the entry
		if (pEntry->m_count > 0)
		{
			// Draw the reference number
			if (pEntry->m_ref != -1)
			{
				// Print the reference number
				fl_color(m_colors.ref);
				sprintf(str, "%4d:", pEntry->m_ref);
				fl_draw(str, wx + xMargin, wy + line * m_height);
			}

			// Draw either TX or RX
			if (pEntry->m_rxTx)
			{
				// It's a TX entry
				fl_color(m_colors.txLabel);
				fl_draw("TX:", labelX, wy + line * m_height);
				fl_color(m_colors.txHex);
			}
			else
			{
				// It's an RX entry
				fl_color(m_colors.rxLabel);
				fl_draw("RX:", labelX, wy + line * m_height);
				fl_color(m_colors.rxHex);
			}
		}

		// Loop for all data
		while (dataIdx < pEntry->m_count && line <= lines)
		{
			// Select the proper color
			if (pEntry->m_rxTx)
				fl_color(m_colors.txHex);
			else
				fl_color(m_colors.rxHex);

			// Draw bytesPerLine hex values on the current line
			int c = 0;
			for (x = dataIdx; x < pEntry->m_count && c < m_bytesPerLine; x++)
			{
				// Format the data  to draw the HEX data
				sprintf(str, "%02X", (unsigned char) pEntry->m_pData[x]);
				fl_draw(str, dataX + c++ * m_width*3, wy + line * m_height);
			}

			// Select the proper color
			if (pEntry->m_rxTx)
				fl_color(m_colors.txAscii);
			else
				fl_color(m_colors.rxAscii);

			// Draw bytesPerLine ASCII values
			c = 0;
			for (x = dataIdx; x < pEntry->m_count && c < m_bytesPerLine; x++)
			{
				// Format the data  to draw the HEX data
				if (pEntry->m_pData[x] >= ' ' && pEntry->m_pData[x] <= '~')
					sprintf(str, "%c", pEntry->m_pData[x]);
				else
					strcpy(str, ".");
				fl_draw(str, asciiX + c++ * m_width, wy + line * m_height);
			}

			// Increment to next dataIdx
			dataIdx = x;
			line++;
		}

		// Advance to next entry
		idx++;
	}

	// Pop the clipping rect
	fl_pop_clip();
}
Esempio n. 30
0
void Fl_Rotated_Text::draw(int x, int y, int W, int H, int cx, int cy){
  
  if(!text_) return;
  if(!rot_){ // standard drawing)
    int olf_font = fl_font();
    int old_size = fl_size();
    fl_font(font_,size_);
    fl_push_clip(x, y, W-cx, H-cy);
    fl_draw(text_, x - cx, y - cy, w(), h(), (Fl_Align)align_, (Fl_Image *) 0, 0);
    fl_pop_clip();
    fl_font(olf_font, old_size);
    return;
  }
  if(!array){ // not drawn yet, building rotated bitmap "cache"
    int w_, h_;
    if(rot_ & 1){
      w_ = h();
      h_ = w();
    }else{
      w_ = w();
      h_ = h();
    }
    int bsize = ((w()+7)/8)  * h();
    array = ar2 = new uchar[bsize];
    alloc_array = 1;
    //memset(ar2, 0, bsize);

    int old_font = fl_font();
    int old_size = fl_size();

    Fl_Color old_color = fl_color();
    Fl_Offscreen offscreen = fl_create_offscreen(w_,h_);
    fl_begin_offscreen(offscreen);
    fl_color(0x000000);
    fl_rectf(0,0,w_,h_);
    fl_font(font_, size_);
    fl_color(0x00FF0000); // we use green color to plot to the offscreen

    fl_draw(text_,0, 0, w_, h_, (Fl_Align)align_, (Fl_Image *)0, 0);
    uchar * rgb = fl_read_image(0, 0, 0, w_, h_, 0);
    fl_end_offscreen();
    fl_delete_offscreen(offscreen);
    fl_font(old_font, old_size);
    fl_color(old_color);

    int i,j;

    uchar * start = rgb;
    int i_iter = 0;
    int j_iter = 0;
    switch(rot_){
    case 3:
      start +=  w_ * (h_ - 1)*3 + 1;
      i_iter = - w_ * 3;
      j_iter =  3;
      break;
    case 2:
      start +=  (w_ * h_ - 1)*3 + 1;
      i_iter = -3;
      j_iter = - w_ * 3;
      break;
    case 1:
      start +=  (w_ - 1)*3 + 1;
      i_iter = w_ * 3;
      j_iter = -3;
      break;
    }

    uchar * stj = start;
    uchar c;
    uchar * where;
    uchar * sti;

    for(j = 0; j< h(); j++, stj += j_iter){
      uchar val = 0;
      c = 8;
      where = ar2 + j*((w()+7)/8);
      for(i = 0, sti = stj; i< w(); i++, sti +=i_iter){
        if(*sti >127) val |= c;
        if(c & (uchar)128){ // pushing value to the array
          *where = val;
          where++;
          c =1;
          val = 0;
        }else
          c <<=1;
      }
      if(w() % 8){ //need to push last byte
        * where = val;
        where++;
      }
    }
    
    delete[] rgb;
  }

  Fl_Bitmap::draw(x, y, W, H, cx, cy); // finaly drawing the bitmap

};