Пример #1
0
/*背景の関数*/
void background(void){
  newrgbcolor(win, 35, 71, 148); 
  fillrect(win, 0, 650, 800, 150);
  
  newrgbcolor(win, 188, 118, 60);  
  fillrect(win, 0, 0, 800, 650);
}
Пример #2
0
void 
GameSession::draw()
{
  world->draw();
  drawstatus();

  if(game_pause)
    {
      int x = screen->h / 20;
      for(int i = 0; i < x; ++i)
        {
          fillrect(i % 2 ? (pause_menu_frame * i)%screen->w : -((pause_menu_frame * i)%screen->w) ,(i*20+pause_menu_frame)%screen->h,screen->w,10,20,20,20, rand() % 20 + 1);
        }
      fillrect(0,0,screen->w,screen->h,rand() % 50, rand() % 50, rand() % 50, 128);
      blue_text->drawf("PAUSE - Press 'P' To Play", 0, 230, A_HMIDDLE, A_TOP, 1);
    }

  if(Menu::current())
    {
      Menu::current()->draw();
      mouse_cursor->draw();
    }

  updatescreen();
}
Пример #3
0
void Button::draw()
{
  if(state == BUTTON_HOVER)
    if(!popup_timer.check())
      show_info = true;

  fillrect(rect.x,rect.y,rect.w,rect.h,75,75,75,200);
  fillrect(rect.x+1,rect.y+1,rect.w-2,rect.h-2,175,175,175,200);

  for(std::vector<Surface*>::iterator it = icon.begin(); it != icon.end(); ++it)
    (*it)->draw(rect.x,rect.y);

  if(game_object != NULL)
  {
    game_object->draw_on_screen(rect.x,rect.y);
  }

  if(show_info)
  {
    char str[80];
    int i = -32;

    if(0 > rect.x - (int)strlen(info.c_str()) * white_small_text->w)
      i = rect.w + strlen(info.c_str()) * white_small_text->w;

    if(!info.empty())
      white_small_text->draw(info.c_str(), i + rect.x - strlen(info.c_str()) * white_small_text->w, rect.y, 1);
    sprintf(str,"(%s)", SDL_GetKeyName(shortcut));
    white_small_text->draw(str, i + rect.x - strlen(str) * white_small_text->w, rect.y + white_small_text->h+2, 1);
  }
  if(state == BUTTON_PRESSED || state == BUTTON_DEACTIVE)
    fillrect(rect.x,rect.y,rect.w,rect.h,75,75,75,200);
  else if(state == BUTTON_HOVER)
    fillrect(rect.x,rect.y,rect.w,rect.h,150,150,150,128);
}
Пример #4
0
// draw a rectangle
void drawrect(struct drawdata *d,
	      uint8_t x, uint8_t y, uint8_t w, uint8_t h,
	      uint8_t c) {
  fillrect(d,x,    y,    w,1,c);
  fillrect(d,x,    y,    1,h,c);
  fillrect(d,x+w-1,y,    1,h,c);
  fillrect(d,x,    y+h-1,w,1,c);
}
Пример #5
0
void bargraph_t::refresh(SDL_Rect *r)
{
	if(!_enabled)
	{
		clear();
		return;
	}
	float v = _value;
	int red, green, blue;
	if(v > 1.0f)
	{
		blue = 50 + (v - 1.0f) * 512;
		if(_redmax)
		{
			red = 255;
			green = blue / 2;
		}
		else
		{
			green = 255;
			red = blue / 2;
		}
		v = 1.0f;
	}
	else
	{
		if(_redmax)
		{
			red = (int)(v * 300.0);
			green = (int)((1.0 - v) * 400.0);
		}
		else
		{
			red = (int)((1.0 - v) * 300.0);
			green = (int)(v * 400.0);
		}
		blue = 50;
	}
	if(green > 180)
		green = 180;
	if(red > 230)
		red = 230;
	if(blue > 255)
		blue = 255;
	_y = (int)((height() - 2) * (1.0f - v));
	foreground(bgcolor);
	fillrect(0, 0, width(), height());
	foreground(map_rgb(red, green, blue));
	fillrect(1, _y + 1, width() - 2, height() - _y - 2);
}
Пример #6
0
void dashboard_window_t::render_progress()
{
	SDL_Rect r;
	int x, y, w, h;

	x = 0;
	w = (int)(_percent * 0.01f * width() + 0.5f);
	if(w < 4)
		w = 4;
	else if(w > width())
		w = width();

	h = 16;
	y = height() - h;

	r.x = x;
	r.y = y;
	r.w = w;
	r.h = h;

	foreground(map_rgb(0x000099));
	rectangle(x, y, w, h);

	++x;
	++y;
	w -= 2;
	h -= 2;
	foreground(map_rgb(0x0000cc));
	rectangle(x, y, w, h);

	++x;
	++y;
	w -= 2;
	h -= 2;
	foreground(map_rgb(0x0000ff));
	fillrect(x, y, w, h);
	
	r.x = 0;
	r.y = height() - 40;
	r.w = width();
	r.h = 12;
	foreground(map_rgb(0x000000));
	fillrect(r.x, r.y, r.w, r.h);
	if(_msg)
	{
		font(B_NORMAL_FONT);
		center(height() - 40, _msg);
	}
}
Пример #7
0
void ButtonPanel::draw()
{

  if(hidden == false)
  {
    fillrect(rect.x,rect.y,rect.w,rect.h,100,100,100,200);
    for(std::vector<Button*>::iterator it = item.begin(); it != item.end(); ++it)
    {
      (*it)->draw();
      if(hlast && it == last_clicked)
      {
        fillrect((*it)->get_pos().x,(*it)->get_pos().y,(*it)->get_pos().w,(*it)->get_pos().h,100,100,100,128);
      }
    }
  }
}
Пример #8
0
static void button_draw (struct ts_button *button)
{
	//if button is active s==3 else s==0.
	int s = (button->flags & BUTTON_ACTIVE) ? 3 : 0;
	//draw rectangle's outline with palette[3] color when it's active or palette[0] when it's not.
	rect (button->x, button->y, button->x + button->w - 1,
			button->y + button->h - 1, button_palette [s]);
	//fill in the rectagle with palette[4] or [1].
	fillrect (button->x + 1, button->y + 1,
			button->x + button->w - 2,
			button->y + button->h - 2, button_palette [s + 1]);
	//and draw fonts inside the button with palette[5] or [2].
	if(strcmp(button->text,"Exit")==0)
	{//when it's exit button.
		//let's draw decent exit button.
		//put_string(button->x + 2,button->y + 2,button->text, button_palette[s + 2]);
		line(button->x, button->y, button->x+button->w-1, button->y+button->h-1,button_palette[s+2]);
		line(button->x, button->y+button->h -1, button->x+button->w-1, button->y,button_palette[s+2]);
	}
	else{		
		put_string_center (button->x + button->w / 2,
				button->y + button->h / 2,
				button->text, button_palette [s + 2]);
	}
}
Пример #9
0
static void draw_picture(control obj, rect r)
{
	image   img;
	bitmap	store = NULL;
	rgb     old = currentcolour();

	img = obj->img;
	if (has_transparent_pixels(img)) {
		store = newbitmap(r.width, r.height, 0);
		drawto(store);
		setcolour(getbackground(obj));
		fillrect(r);
	}

	if (img) {
		/* Draw the button image. */
		if (ischecked(obj))
			drawdarker(img, r, getrect(img));
		else if (isenabled(obj))
			drawimage(img, r, getrect(img));
		else
			drawimage(img, r, getrect(img)); /* never grey */
	}

	if (store != NULL) {
		drawto(obj);
		copyrect(store, pt(0,0), getrect(store));
		del(store);
	}

	setcolour(old);
}
Пример #10
0
/*
 * draw_menu - draw menu on screen
 *
 * Returns MENU_CANCEL if the user cancelled, or the item number of the
 * selected item.
 *
 */
static void draw_menu(char *title, char **items, size_t num_items)  {
  size_t i;
  int x, y, w, h, by;

  /* draw the outline */
  gfx_fillRect(0xaf,MENU_X + 1, MENU_Y + 1, MENU_WIDTH, MENU_HEIGHT); // fillrect(0xaf,SHADOW_RECT);
  gfx_fillRect(0x00,MENU_X, MENU_Y, MENU_WIDTH, MENU_HEIGHT);   // fillrect(0x00,MENU_RECT);
  gfx_drawRect(0xff,MENU_X, MENU_Y, MENU_WIDTH, MENU_HEIGHT);   // drawrect(0xff,MENU_RECT);

  /* calculate x/y */
  x = MENU_X + MENU_ITEM_PAD;
  y = MENU_Y + MENU_ITEM_PAD * 2;
  getstringsize(title, &w, &h);
  h += MENU_ITEM_PAD * 2;

  /* draw menu stipple */
  for (i = MENU_Y; i < (size_t) y + h; i += 2)
    drawline(MENU_X, i, MENU_X + MENU_WIDTH-1, i,0xff);

  /* clear title rect */
  fillrect((OSD_BITMAP1_WIDTH - w) / 2 - 2, y - 2, w + 4, h,0x00);

  /* draw centered title on screen */
  putsxy((OSD_BITMAP1_WIDTH - w)/2, y, title);

  /* calculate base Y for items */
  by = y + h + MENU_ITEM_PAD;
  
  /* iterate over each item and draw it on the screen */
  for (i = 0; i < num_items; i++)
    putsxy(x+2, by + h * i, items[i]);
}
Пример #11
0
void draw(void *_prms)
{
  param_set *p = (param_set *) _prms;
  int i;
  double psc = 2 * R / Hmax, vdistmax;

  gclr(*p->win);
  copylayer(*p->win, 2, 1);
  for (i = 0; i < DN; i++) {
    putimg24m(*p->win, x[i] - 4, y[i] - 4, 8, 8, Xpm_image_stone4);
  }
  copylayer(*p->win, 1, 0);

  gclr(*p->win2);
  vdistmax = vdist[0];
  for (i = 0; i < Hmax; i++) {
    if (vdistmax < vdist[i])
      vdistmax = vdist[i];
  }
  newcolor(*p->win2, "steelblue4");
  for (i = 0; i < Hmax; i++) {
    fillrect(*p->win2, psc * i, 0, psc, vdist[i] / vdistmax * R);
  }
  newcolor(*p->win2, "steelblue");
  for (i = 0; i < Hmax; i++) {
    drawrect(*p->win2, psc * i, 0, psc, vdist[i] / vdistmax * R);
  }
  copylayer(*p->win2, 1, 0);
}
Пример #12
0
void LCDST7565::drawOffsetBar(control_type_e control)
{
	int fillw;
	float value = 1.f;//midi->offset( CT_PITCH );
	int y;

	if( control == CT_PITCH )
	{
		value = 0.77f;
		y = 12;
	}
	else
	{
		value = -0.2f;
		y = 34;
	}

	drawrect(GUI_VALBAR_X-2, y, GUI_VALBAR_WIDTH+3, GUI_VALBAR_HEIGHT, BLACK);
	if(value >= 0)
	{
		fillw = (int)  ((GUI_VALBAR_WIDTH * value) / 2.f) + 1;
		float x = GUI_VALBAR_X + GUI_VALBAR_WIDTH / 2.f - 1;
		fillrect((int)x, y, fillw, GUI_VALBAR_HEIGHT, BLACK);
	}
	else
	{
		value *= -1;
		fillw = (int)  ((GUI_VALBAR_WIDTH * value) / 2.f) + 1;
		float x = GUI_VALBAR_X + GUI_VALBAR_WIDTH / 2.f - fillw;
		fillrect((int)x, y, fillw, GUI_VALBAR_HEIGHT, BLACK);
		//fillrect(GUI_VALBAR_X-1, y, GUI_VALBAR_WIDTH+2, GUI_VALBAR_HEIGHT, BLACK);
	}

	for(int x = GUI_VALBAR_X + 4; x < GUI_VALBAR_X+GUI_VALBAR_WIDTH-1; x += 5)
	{
		setpixel(x, y-1, BLACK);
		setpixel(x, y + GUI_VALBAR_HEIGHT, BLACK);
	}
	//draw left marker
	drawline(GUI_VALBAR_X-2, y-2, GUI_VALBAR_X-2, y + GUI_VALBAR_HEIGHT+1, BLACK);
	//draw right marker
	drawline(GUI_VALBAR_X + GUI_VALBAR_WIDTH, y-2, GUI_VALBAR_X + GUI_VALBAR_WIDTH, y + GUI_VALBAR_HEIGHT+1, BLACK);
	//draw middle marker
	//setpixel(GUI_VALBAR_HALF, y-1,BLACK);
	setpixel(GUI_VALBAR_HALF+1, y-1, BLACK);
	setpixel(GUI_VALBAR_HALF+1, y + GUI_VALBAR_HEIGHT, BLACK);
}
Пример #13
0
static void draw_rr_pin (int inode, enum color_types color) {

/* Draws an IPIN or OPIN rr_node.  Note that the pin can appear on more    *
 * than one side of a clb.  Also note that this routine can change the     *
 * current color to BLACK.                                                 */

 int ipin, i, j, iside, iclass, iblk;
 float xcen, ycen;
 char str[BUFSIZE];

 i = rr_node[inode].xlow;
 j = rr_node[inode].ylow;
 ipin = rr_node[inode].ptc_num;
 setcolor (color);

 if (clb[i][j].type == CLB) {
    iclass = clb_pin_class[ipin];

    for (iside=0;iside<=3;iside++) {
       if (pinloc[iside][ipin] == 1) {   /* Pin exists on this side. */
          get_rr_pin_draw_coords (inode, iside, &xcen, &ycen);
          fillrect (xcen-pin_size, ycen-pin_size, xcen+pin_size, ycen+pin_size);
          sprintf (str, "%d", ipin);
          setcolor (BLACK);
          drawtext (xcen, ycen, str, 2*pin_size);
          setcolor (color);
       }
    }
 }

 else {               /* IO pad. */
    iblk = clb[i][j].u.io_blocks[ipin];

    if (i == 0) 
       iside = RIGHT;
    else if (j == 0)
       iside = TOP;
    else if (i == nx+1)
       iside = LEFT;
    else
       iside = BOTTOM;

    get_rr_pin_draw_coords (inode, iside, &xcen, &ycen);
    fillrect (xcen-pin_size, ycen-pin_size, xcen+pin_size, ycen+pin_size);
 }
}
Пример #14
0
void process()
{
	static int n;
	printf("process %d: f1=%f i1=%d sel=%d\n", n, f1, i1, sel);
	fillrect((n*20)%(IMG_W-80), 300, 80, 80, 0xff);
	usleep(1000*300);
	n++;
}
Пример #15
0
void draw_box(struct canvas_t* cvs, int x, int y, int w, int h,
               unsigned long outln, unsigned long fill) {
  if (PIXA(fill) != 0) {
    fillrect(cvs, x, y, w, h, UNPACK_RGBA(fill));
  }
  if (PIXA(outln) != 0) {
    drawrect(cvs, x, y, w, h, UNPACK_RGBA(outln));
  }
}
Пример #16
0
static void draw_image_button(button obj, rect r)
{
	image   img;
	bitmap	store = NULL;
	rect    ir;
	rgb     up, down;
	rgb     old = currentcolour();

	img = obj->img;
	if (has_transparent_pixels(img)) {
		store = newbitmap(r.width, r.height, 0);
		drawto(store);
		setcolour(getbackground(obj));
		fillrect(r);
	}

	if (img) {
		ir = insetr(r,2);
		if (ishighlighted(obj)) /* button is pressed */
			ir.x += 1, ir.y += 1;

		/* Draw the button image. */
		if (ischecked(obj))
			drawdarker(img, ir, getrect(img));
		else if (isenabled(obj))
			drawimage(img, ir, getrect(img));
		else
			drawgreyscale(img, ir, getrect(img));

		if (ishighlighted(obj)) { /* fill the gap */
			ir.x -= 1, ir.y -= 1;
			setcolour(getbackground(obj));
			drawline(topleft(ir),topright(ir));
			drawline(topleft(ir),bottomleft(ir));
		}
	}

	/* Draw button border. */
	setcolour(getforeground(obj));
	setlinewidth(1);
	drawrect(r);

	/* Draw button shadow. */
	up = White, down = Grey;
	if (ishighlighted(obj))
		up = Grey, down = LightGrey;
	draw_shadow(insetr(r,1), up, down, 1);

	if (store != NULL) {
		drawto(obj);
		copyrect(store, pt(0,0), getrect(store));
		del(store);
	}

	setcolour(old);
}
Пример #17
0
void PlotRna(char* seqName, char* sequence, short* structure, char* filename, float score)
{
  /*A:red, U: Green, G:Blue, C:Yellow*/
  int i, j;
  int length;
  int sizex, sizey;
  
  
  fname = filename;
  length = (int)strlen(sequence) ;
  sizex = length;
  sizey = length;
  /*printf("here......length %d\n",length);*/
  drawInit(length, length, seqName, filename, score);
  /* print out stems */
  int st, stp;
  char* c = (char*)malloc(sizeof(char)*1000);


  i = 0; j = 0;
  while(i < length) {
    while(i < length && (structure[i] == 0 || structure[i] < i)) i++;
    st = i;    
    while(i < length && (structure[i]-1 == structure[i+1])) i++; 
    stp = i;
    if (i >= length) break;
    
    sprintf(c, "%d-%d; %d-%d ",st+1, stp+1, structure[stp],structure[st]);
    i++; j++;
    if ((j%2) == 1) drawtext (sizex*CELLSIZE/4,sizey*CELLSIZE/10.0+((int)(j/2)+1)*CELLSIZE*sizey/30,c,1.0e6);
    else drawtext (sizex*CELLSIZE/2,sizey*CELLSIZE/10.0+((int)(j/2))*CELLSIZE*sizey/30,c,1.0e6);
    flushinput();

  }

 
 
  
  for(i=0; i<length; i++) {
    if(sequence[i] == 'A' || sequence[i] == 'a') 
      setcolor(RED);
    else if(sequence[i] == 'U'|| sequence[i] == 'u' || sequence[i] == 'T' || sequence[i] == 't')
      setcolor(GREEN);
    else if(sequence[i] == 'G' || sequence[i] == 'g')
      setcolor(BLUE);
    else if(sequence[i] == 'C' || sequence[i] == 'c')
      setcolor(YELLOW);
    else
      setcolor(BLACK);
    fillrect((i+0.2)*CELLSIZE, (sizey/2 - 0.8)*CELLSIZE, (i+0.8)*CELLSIZE, (sizey/2 - 0.2)*CELLSIZE);
    flushinput();
  }
  plotBP(sequence, structure);
  close_postscript();
  close_graphics();
}
Пример #18
0
/*
 *  Draw a button shadow.
 */
static void draw_shadow(rect r, rgb col1, rgb col2, int size)
{
	rgb hue = current->hue;

	/* Draw top-left button border. */
	setcolour(col1);
	fillrect(rect(r.x,r.y,r.width,size));
	fillrect(rect(r.x,r.y,size,r.height));

	/* Draw bottom-right button border. */
	setcolour(col2);
	while (size > 0) {
		fillrect(rect(r.x+r.width-1,r.y,1,r.height));
		fillrect(rect(r.x,r.y+r.height-1,r.width,1));
		r = insetr(r,1);
		size--;
	}
	setcolour(hue);
}
Пример #19
0
static void render_volume_slider(struct button *b) 
{
    struct mixer_control *c = (struct mixer_control *)b->user_data;
    long v=mixer_get_value(c);

    draw_button(b);
    fillrect(b->x+2, b->y+b->h-2, 
	     b->x+b->w-2, 
	     b->y + b->h -2 - (b->h* v)/(c->max-c->min),4);
}
Пример #20
0
static void winblitsearch(pdfapp_t *app)
{
	if (gapp.isediting)
	{
		char buf[sizeof(gapp.search) + 50];
		sprintf(buf, "Search: %s", gapp.search);
		XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
		fillrect(0, 0, gapp.winw, 30);
		windrawstring(&gapp, 10, 20, buf);
	}
}
Пример #21
0
static void refresh_screen ()
{
	int i;

	fillrect (0, 0, xres - 1, yres - 1, 0);
	put_string_center (xres/2, yres/4,   "TSLIB test program", 1);
	put_string_center (xres/2, yres/4+20,"Touch screen to move crosshair", 2);

	for (i = 0; i < NR_BUTTONS; i++)
		button_draw (&buttons [i]);
}
Пример #22
0
void game(void){//ゲーム内容
  int j;
  
  gsetnonblock(ENABLE);//ノンブロッキングモードに
  while(1){	
    gclr(win);//画面消去
   
    //防護壁のx座標設定(レベル5になるまで値変化)
    defence_x=rand()%400;
    if(defence_x > 320){//x座標が340を超えたら340以下の数を減らす
      defence_x -= rand()%320;
    }
    LEVEL5();//レベル5の動作
    
    newpen(win, 1);
    level();// レベルの表記
    timecount();//時間の表記
    human();// 棒人間
    input();//入力待ち
    
    for(i=0; i<kosu; i++){
      j = rand() % 16;// 色はランダム
      if(j < 3) j = j + rand() % 10 + 3;//色は3〜15のどれか 
      if(a > 2){	 //レベル3、4でときどき黒になって消えて見える
	if(rand()%5 == 0) j = 0;
      }
      newpen(win, j);
      fillrect(win, x_sq[i], y_sq[i], w_sq[i], h_sq[i]);//四角	 
      fillcirc(win, x_circ[i], y_circ[i], r_circ[i], r_circ[i]);//円	        
      LEVEL4();//レベル4のみ出る円(半分を埋め尽くす円)
      
      //落下速度dx,dy
      y_sq[i] -= dy;
      y_circ[i] -= dy;
      
      LEVEL2();//レベル2以上で変化させる
    }
    atari();//当たり判定
    
    msleep(time);// 0.1秒止める
    
    count++;
    if(count/10 == 20*a){// カウント10回=約1秒とする
      dy += rand()%2+1;//速度変化は毎回変わる
      dx += rand()%2;//揺れる大きさ
      a++;//レベル
      kosu+=rand()%2+1;//増やす個数は毎回変わる 
      dh+=3;//通常四角の縦幅変化量
      dw+=3;//通常四角の横幅変化量
      dr+=3;//通常円の半径の変化量
    }
  }    
}
Пример #23
0
static void button_draw (struct ts_button *button)
{
	int s = (button->flags & BUTTON_ACTIVE) ? 3 : 0;
	rect (button->x, button->y, button->x + button->w - 1,
	      button->y + button->h - 1, button_palette [s]);
	fillrect (button->x + 1, button->y + 1,
		  button->x + button->w - 2,
		  button->y + button->h - 2, button_palette [s + 1]);
	put_string_center (button->x + button->w / 2,
			   button->y + button->h / 2,
			   button->text, button_palette [s + 2]);
}
static void winblit(pdfapp_t *app)
{
	int x0 = gapp.panx;
	int y0 = gapp.pany;
	int x1 = gapp.panx + gapp.image->w;
	int y1 = gapp.pany + gapp.image->h;

	XSetForeground(xdpy, xgc, xbgcolor.pixel);
	fillrect(0, 0, x0, gapp.winh);
	fillrect(x1, 0, gapp.winw - x1, gapp.winh);
	fillrect(0, 0, gapp.winw, y0);
	fillrect(0, y1, gapp.winw, gapp.winh - y1);

	XSetForeground(xdpy, xgc, xshcolor.pixel);
	fillrect(x0+2, y1, gapp.image->w, 2);
	fillrect(x1, y0+2, 2, gapp.image->h);

	if (gapp.iscopying || justcopied)
		invertcopyrect();

	ximage_blit(xwin, xgc,
			x0, y0,
			gapp.image->samples,
			0, 0,
			gapp.image->w,
			gapp.image->h,
			gapp.image->w * gapp.image->n);

	if (gapp.iscopying || justcopied)
		invertcopyrect();
}
Пример #25
0
static void draw_checkbox(control c, rect r)
{
	int w;
	rect box, textrect;
	char *name;
	int style = (AlignLeft | AlignTop);
	font f;
	rgb old = currentcolour();

	/* Calculate rectangles. */
	f = gettextfont(c);
	setfont(f);
	w = strwidth(f,"W");
	if (w > r.width)  w = r.width;
	if (w > r.height) w = r.height;
	box = rect(r.x,r.y+1,w,w);
	if (w < getheight(f) - getdescent(f))
		box.y += getheight(f) - getdescent(f) - w;
	textrect = rect(r.x+w+w/2,r.y,r.width-(w+w/2),r.height);

	/* Clear check area. */
	setlinewidth(1);
	setcolour(White);
	fillrect(insetr(box,1));

	/* Draw check area */
	if (isenabled(c))
		setcolour(Black);
	else
		setcolour(Grey);
	drawrect(box);

	/* 'Pressed button' effect by black border in box. */
	if (ishighlighted(c))
		drawrect(insetr(box,1));

	/* Put tick in box if checked. */
	if (ischecked(c))
		draw_checkmark(insetr(box,1));

	name = getname(c);
	if (isenabled(c)) {
		/* if (hasfocus(c)) {
			style |= Underline;
			setlinewidth(2);
		} */
		setcolour(getforeground(c));
	}
	drawtext(textrect, style, name);

	setcolour(old);
}
Пример #26
0
static void render_tracks(struct button *b) 
{
    draw_button(b); 
    int i;
    for(i=0;songs[i].filename;i++) {
	int y=i*30;
	if(y>b->h) return;
	if(i==current_track) {
	    fillrect(b->x+2,b->y+y+2,b->x+b->w-2,b->y+y+30-2,5);
	}
	put_string(b->x+20,b->y+y +8 ,songs[i].filename,1);
    }
}
Пример #27
0
// draw a circle
void fillcircle(struct drawdata *d,
	      uint8_t x0, uint8_t y0, uint8_t r,
	      uint8_t color) {
  int8_t f = 1 - r;
  int8_t ddF_x = 1;
  int8_t ddF_y = -2 * r;
  int8_t x = 0;
  int8_t y = r;


  for (uint8_t i=y0-r; i<=y0+r; i++) {
    setpixel(d, x0, i, color);
  }
//  uint8_t xg = x;
  while (x<y) {
    if (f >= 0) {
#if 0
      fillrect(d, x0+xg, y0-y,(x-xg)+1,y*2+1, color);
      fillrect(d, x0-x,  y0-y,(x-xg)+1,y*2+1, color);
      fillrect(d, x0+y,  y0-x,
#endif
      y--;
      ddF_y += 2;
      f += ddF_y;
    }
    x++;
    ddF_x += 2;
    f += ddF_x;

    for (uint8_t i=y0-y; i<=y0+y; i++) {
      setpixel(d, x0+x, i, color);
      setpixel(d, x0-x, i, color);
    }
    for (uint8_t i=y0-x; i<=y0+x; i++) {
      setpixel(d, x0+y, i, color);
      setpixel(d, x0-y, i, color);
    }
  }
Пример #28
0
static PyObject* emb_draw_fillrect(PyObject *self, PyObject *args)
{
	int x,y,w,h,r,g,b,a;
	a=255;
	if (!PyArg_ParseTuple(args, "IIIIIII|I:draw_fillrect",&x,&y,&w,&h,&r,&g,&b,&a))
		return NULL;
	if (vid_buf!=NULL)
	{
		fillrect(vid_buf,x,y,w,h,r,g,b,a);
		//fillrect
		return Py_BuildValue("i",1);
	}
	return Py_BuildValue("i",-1);
}
Пример #29
0
static void winblitstatusbar(pdfapp_t *app)
{
	if (gapp.issearching)
	{
		char buf[sizeof(gapp.search) + 50];
		sprintf(buf, "Search: %s", gapp.search);
		XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
		fillrect(0, 0, gapp.winw, 30);
		windrawstring(&gapp, 10, 20, buf);
	}
	else if (showingmessage)
	{
		XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
		fillrect(0, 0, gapp.winw, 30);
		windrawstring(&gapp, 10, 20, message);
	}
	else if (showingpage)
	{
		char buf[42];
		snprintf(buf, sizeof buf, "Page %d/%d", gapp.pageno, gapp.pagecount);
		windrawstringxor(&gapp, 10, 20, buf);
	}
}
Пример #30
0
void screen_window_t::refresh(SDL_Rect *r)
{
	int x, y, w, h;
	foreground(map_rgb(0x000000));
	x = 0;
	y = 0;
	w = width();
	h = _top;
	fillrect(x, y, w, h);

	y = height() - _bottom;
	h = _bottom;
	fillrect(x, y, w, h);

	y = _top;
	w = _left;
	h = height() - _top - _bottom;
	fillrect(x, y, w, h);

	x = width() - _right;
	w = _right;
	fillrect(x, y, w, h);
}