Ejemplo n.º 1
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);
}
Ejemplo n.º 2
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);
}
Ejemplo n.º 3
0
void polygon(int cx, int cy, int corners, int r, int sa)
{

int i,k;

	k=sa;
	plot(cx+icos(k)*r/256,cy+isin(k)*r/256);

	for (i=0;i++<corners;k=(k+360/corners)%360)
		drawto(cx+icos(k)*r/256,cy+isin(k)*r/256);

	drawto(cx+icos(sa)*r/256,cy+isin(sa)*r/256);
}
Ejemplo n.º 4
0
void drawlobes (double a, double b, double l)
{
   double r, theta;
   double x, y;
   int i;

   moveto (Homex + a + b, Homey);
   
   for (i = 1; i <= 360; i++) {
      theta = i * RADIANS;
      r = a + (b * cos (l * theta));
      
      x = r * cos (theta);
      y = r * sin (theta);
      
      drawto (Homex + x, Homey + y);
   }
}
Ejemplo n.º 5
0
/*
 *  Handle the events from a message dialog, hide the window afterwards.
 */
static int handle_message_dialog(window w)
{
    window old;
    dialog_data *d = data(w);

    old = currentdrawing();
    d->hit = NOT_CHOSEN_YET;

    show(w);
    while (d->hit == NOT_CHOSEN_YET) {
	waitevent();
	doevent();
    }
    hide(w);

    if (old) drawto(old);

    return d->hit;
}
Ejemplo n.º 6
0
Archivo: sin.c Proyecto: z88dk/z88dk
void main() {
  int x, y;
  clg();

  for (x = 0; x < 144; x++) {
    y = (int)(24 * (1.0 - sin(x / 144.0 * 3.14 * 8)));
    plot(x, y);
  }

  sleep(1);  // sleep 1 second

  clg();
  plot(0,24);

  for (x = 0; x < 144; x++) {
    y = (int)(24 * (1.0 - sin(x / 144.0 * 3.14 * 8)));
     drawto(x,y);
  }


  while (getk() != 10) {
  };  // enter key is assigned to 10 in the g800 port of z88dk
}