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); }
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); }
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); }
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); } }
/* * 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; }
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 }