예제 #1
0
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *surface, *target;
    cairo_t *cr2;

    /* First draw a shape in blue on the original destination. */
    cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
    draw_square (cr);

    /* Then, create an offset surface and repeat the drawing in red. */
    target = cairo_get_group_target (cr);
    surface = cairo_surface_create_similar (target,
					    cairo_surface_get_content (target),
					    SIZE / 2, SIZE / 2);
    cr2 = cairo_create (surface);

    cairo_set_source_rgb (cr2, 1, 0, 0); /* red */
    draw_square (cr2);

    cairo_destroy (cr2);

    cairo_surface_set_device_offset (surface, + SIZE / 2, + SIZE / 2);

    /* Finally, copy the offset surface to the original destination.
    * The final result should be a blue square with the upper-left
    * quarter red. */
    cairo_set_source_surface (cr, surface, SIZE / 2, SIZE / 2);

    cairo_paint (cr);

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
예제 #2
0
파일: menger.c 프로젝트: Ankirama/Epitech
int     menger(int x, int y, int size, int n, unsigned int **img)
{
  int   grey;
  t_point	p;

  n--;
  p.x = x;
  p.y = y;
  if (n > 1)
    {
      grey = (int)255 / n;
      grey = grey * 256 * 256 + grey * 256 + grey;
      draw_square(img, &p, size, (uint32_t)grey);
    }
  else if (n == 1)
    draw_square(img, &p, size, 0x00FFFFFF);
  if (size == 1)
    draw_square(img, &p, size, 0x00FFFFFF);
  if (n > 0)
    {
      menger(x - 2 * size / 3, y - 2 * size / 3, size / 3, n, img);
      menger(x - 2 * size / 3, y + size / 3, size / 3, n, img);
      menger(x - 2 * size / 3, y + size + size / 3, size / 3, n, img);
      menger(x + size / 3, y - 2 * size / 3, size / 3, n, img);
      menger(x + size / 3, y + size + size / 3, size / 3, n, img);
      menger(x + size + size / 3 , y - 2 * size / 3, size / 3, n, img);
      menger(x + size + size / 3, y + size / 3, size / 3, n, img);
      menger(x + size + size / 3, y + size + size / 3 ,size / 3, n, img);
    }
  return (0);
}
예제 #3
0
int	main(void)
{
  t_bmp_header header;
  t_bmp_info_header info;
  unsigned int *buffer;
  unsigned int **img;
  t_point p = {0, 0};
  size_t size = 64;
  int d;

  buffer = malloc(size * size * sizeof(*buffer));
  img = malloc(size * sizeof(*img));
  memset(buffer, 0, size * size * sizeof(*buffer));
  for (size_t i = 0; i < size; ++i)
    img[i] = buffer + i * size;
  make_bmp_header(&header, size);
  make_bmp_info_header(&info, size);
  draw_square(img, &p, size, 0x0000FFFF);
  p.x = 10;
  p.y = 10;
  draw_square(img, &p, 22, 0x00FF0000);
 d = open("square.bmp", O_CREAT | O_TRUNC | O_WRONLY, 0644);
 write(d, &header, sizeof(header));
 write(d, &info, sizeof(info));
 write(d, buffer, size * size * sizeof(*buffer));
 close(d);
 return EXIT_SUCCESS;
}
예제 #4
0
파일: draw.c 프로젝트: Remaii/FdF
int			draw(t_mlx *f)
{
	int		x;
	int		y;

	x = 0;
	if (f->draw == 1)
		new_img(f);
	while (x < f->x - 1)
	{
		y = 0;
		while (y <= f->y - 1)
		{
			draw_square(f, get_pt(x, y, f->map[x][y]),\
						get_pt(x + 1, y, f->map[x + 1][y]),\
						get_pt(x, y + 1, f->map[x][y + 1]));
			draw_square(f, get_pt(x + 1, y + 1, f->map[x + 1][y + 1]),\
						get_pt(x + 1, y, f->map[x + 1][y]),\
						get_pt(x, y + 1, f->map[x][y + 1]));
			y++;
		}
		x++;
	}
	f->draw = 1;
	mlx_put_image_to_window(f->mlx, f->win, f->img, 0, 0);
	display(f);
	return (0);
}
예제 #5
0
static void draw_tiles(void)
{
	color_t i, fg = GET_COLOR_FOR(fg_pair);
	Vector2i outer = colors_pos, inner;

	for (i = 0; i < COLOR_COUNT; i++) {
		if (i == fg || cidx != CIDX_DEFAULT && i == stgs.colors->def) {
			continue;
		}
		if (cidx == CIDX_DEFAULT || !color_exists(stgs.colors, i)) {
			wattrset(dialogw, GET_PAIR_FOR(i));
			draw_square(dialogw, outer, DIALOG_TILE_SIZE);
			if (picked_color == i) {
				wattron(dialogw, A_REVERSE);
				draw_border(dialogw, outer, DIALOG_TILE_SIZE, DIALOG_TILE_SIZE);
			}
		} else {
			inner.y = outer.y+1, inner.x = outer.x+1;
			wattrset(dialogw, GET_PAIR_FOR(stgs.colors->def));
			draw_square(dialogw, outer, DIALOG_TILE_SIZE);
			wattrset(dialogw, GET_PAIR_FOR(i));
			draw_square(dialogw, inner, DIALOG_TILE_SIZE - 2);
		}
		if (outer.x+DIALOG_TILE_SIZE+1 >= DIALOG_WINDOW_WIDTH) {
			outer.y += DIALOG_TILE_SIZE, outer.x = colors_pos.x;
		} else {
			outer.x += DIALOG_TILE_SIZE;
		}
	}
}
예제 #6
0
파일: MlxLib.cpp 프로젝트: Geod24/Nibbler
void	MlxLib::draw_walls(void)
{
  for (unsigned int w_x = 0; w_x < _w; w_x++)
    draw_square(w_x, 0, WALL_COLOR);
  for (unsigned int w_x = 0; w_x < _w; w_x++)
    draw_square(w_x, (_h - 1), WALL_COLOR);
  for (int w_y = 1; w_y < (_h - 1); w_y++) {
    draw_square(0, w_y, WALL_COLOR);
    draw_square((_w - 1), w_y, WALL_COLOR);
  }
}
예제 #7
0
파일: MlxLib.cpp 프로젝트: Geod24/Nibbler
int	MlxLib::draw_snake(const std::list<Position>& pos)
{
  std::list<Position>::const_iterator	b = pos.begin();
  std::list<Position>::const_iterator	end = pos.end();

  draw_square((*b).x, (*b).y, HEAD_COLOR);
  b++;
  end--;
  draw_square((*end).x, (*end).y, TAIL_COLOR);
  for_each(b, end, std::bind(static_cast<void (MlxLib::*)(const Position&, int)>(&MlxLib::draw_square), this, std::placeholders::_1, BODY_COLOR));
  return (LIB_SUCCESS);
}
예제 #8
0
파일: VisBox3d.cpp 프로젝트: trbabb/gltoy
void VisBox3d::draw_wireframe(){
	Vec2d min2 = this->mins.resized<2>();
	Vec2d max2 = this->maxs.resized<2>();
	draw_square(min2, max2, mins.z, GL_LINE_LOOP);
	draw_square(min2, max2, maxs.z, GL_LINE_LOOP);
	for (int i = 0; i < 4; i++){
		double x = i & 1 ? mins.x : maxs.x;
		double y = i & 2 ? mins.y : maxs.y;
		glBegin(GL_LINES);
			glVertex3d(x, y, maxs.z);
			glVertex3d(x, y, mins.z);
		glEnd();
	}
}
예제 #9
0
파일: main.c 프로젝트: dlight/p3
void
draw_trem(cairo_t* cr, unsigned k)
{
	double p = pos[k];

	double x = dim[k][0], y = dim[k][1];
	double i, j;
	if (p < 100) {
		i = p + x;
		j = y;
	}
	else if (p < 200) {
		i = x + 100;
		j = y + (p - 100);
	}
	else if (p < 300) {
		i = x + 100 - (p - 200);
		j = y + 100;
	}
	else {
		i = x;
		j = y + 100 - (p - 300);
	}


	draw_square(cr, k, i, j);
}
예제 #10
0
파일: main_test.c 프로젝트: Mouradif/Hexter
void	ft_execute(int fd)
{
	t_grid			*grid;
	t_point			point;

	grid = init_grid(fd);
	ft_set_params(grid);
	if (!g_errno)
		read_first_line(grid);
	if (!g_errno)
		ft_read(grid);
	if (!g_errno)
		test_full(grid);
	if (g_errno)
		ft_putstr("Map error\n");
	else
	{
		ft_remap(grid);
		point = find_max(grid);
		draw_square(grid, point.x, point.y, point.max);
		print_index(grid);
	}
	if (fd > 0)
		close(fd);
	free_grid(grid);
}
예제 #11
0
Xint8 invader_hit_projectile_down(int i, int j)
{
	int n;
	/* Check if projectile hit left, center or right part of invader */
	for(n = -1; n < 2; n++)
	{
		if(projectiles_map[i+n][j] == 1)
		{
			projectiles_map[i+n][j] = 0;
			projectiles_of_ship_num[i+n]--;
			invaders_num--;
			erase_projectile(XPAR_VGA_PERIPH_MEM_0_S_AXI_MEM0_BASEADDR, i+n, j);

			for(n = 0; n < 500; n++)
			{
				draw_square(XPAR_VGA_PERIPH_MEM_0_S_AXI_MEM0_BASEADDR, i, j);
				erase_square(XPAR_VGA_PERIPH_MEM_0_S_AXI_MEM0_BASEADDR, i, j);
			}

			xil_printf("\nINVADER HIT PROJECTILE DOWN! projectiles_num: %d\n\r", projectiles_of_ship_num[i+n]);
			return 1;
		}
	}
	return 0;
}
예제 #12
0
파일: draw.c 프로젝트: NodziGames/antricht
void			draw_grid(t_main *p)
{
	t_draw_grid p1;

	p1.startx = 50;
	p1.starty = 500;
	p1.tempx = p->x;
	while (p->y > 0)
	{
		p1.drawy = p1.starty;
		p1.drawx = p1.startx;
		p1.tempx = p->x;
		while (p1.tempx > 0)
		{
			p1.color = 0x80FFFFFF;
			p1.height = get(p->fd);
			if (p1.height != 0)
				p1.color = 0x00FFFFFF;
			draw_square(p1, p->size, p->a);
			p1.tempx -= 1;
			p1.drawx += p->size;
			p1.drawy -= (p->size / 2);
		}
		p1.starty += (p->size / 2);
		p1.startx += p->size;
		p->y -= 1;
	}
}
예제 #13
0
int draw_box3(u8* top, int offset, char *message) {
    char mess[200];
    char part[3][45];
    strcpy(mess, message);
    int lines = (int)(strlen(mess) / 45) + 1;
    mess[strlen(mess)] = '\0';
    if(lines > 3) {
        lines = 3;
    }
    
    int height = 20 * lines;
    Color hulp = background_message;
    if(offset - height > 0) {
        draw_square(25, offset - height, 375, height, hulp, top);
        
        int i, index, length;
        for(i = 0; i < lines; i++) {
            index = 45 * i;
            length = 45;

            if(strlen(mess) - index < length) {
                length = strlen(mess) - index;
            }

            strncpy(part[i], mess + 45 * i, strlen(mess) - 45 * i);
            part[i][length] = '\0';

            DrawString(top, part[i], 28, offset - height + i * 20 + 12, white);
        }
    }
    
    return offset - height - 2;
}
예제 #14
0
void draw_messages(u8* top) {
    //lets start drawing the current messages
    int i;
    
    int current = messages_count;
    if(current > 38) { //temp fix for to many messages
        current = 38;
    }
    for(i = current; i > 0; i--) { //draw those stripes on the left
        draw_square(4, HEIGHT - 25 - i * 5, 12, 2, message_stripes, top);
    }
    
    current = messages_count;
    if(current > 9) { //temp fix for to many messages
        //if(selected_message < messages_count - 9) {
            //current = messages_count - selected_message;
        //}
        //else {
            messages_start = current - 9;
            current = 9;
        //}
    }
    for(i = current; i > 0 && i > current - 9; i--) { //there only fit 9 messages maximum on the screen
        draw_box(top, i);
    }
}
예제 #15
0
static void draw_color_tile(Vector2i top_left, color_t c)
{
	chtype pair;
	bool is_def = c == stgs.colors->def;
	int y = top_left.y, x = top_left.x, s = MENU_TILE_SIZE;

	/* Draw tile */
	wattrset(menuw, pair = GET_PAIR_FOR(c));
	if (is_def) {
		wattron(menuw, A_REVERSE);
	}
	draw_square(menuw, top_left, s);

	/* Draw direction arrow */
	if (!is_def) {
		wattron(menuw, A_REVERSE);
		mvwaddch(menuw, y+s/2, x+s/2, turn2arrow(stgs.colors->turn[c]));
	}

	/* Draw frame */
	wattrset(menuw, is_def ? pair : fg_pair);
	mvwhline(menuw, y,     x,     ACS_BLOCK, s);
	mvwvline(menuw, y,     x,     ACS_BLOCK, s);
	mvwhline(menuw, y+s-1, x,     ACS_BLOCK, s);
	mvwvline(menuw, y,     x+s-1, ACS_BLOCK, s);
}
예제 #16
0
파일: menu.c 프로젝트: MarcBrout/tekdoom
void			input_menu(t_data *data, t_mrect *rect,
				   int offset, int margin)
{
  int			n;

  n = -1;
  rect[0].pos.y = margin;
  while (++n < data->menu_length)
    {
      rect[n].size.x = 200;
      rect[n].size.y = (data->config->height - offset
			      - (margin * (data->menu_length + 1))) / data->menu_length;
      rect[n].pos.x = data->config->width / 2 - rect[n].size.x / 2;
      if (n != 0)
	rect[n].pos.y = rect[n - 1].pos.y + rect[n].size.y + margin;
      rect[n].color[0] = WHITE;
      rect[n].color[1] = RED;
      rect[n].contour = 3;
      if (n == data->selected_index)
	rect[n].selected = true;
      else
	rect[n].selected = false;
      draw_square(data->pix_ar, &rect[n]);
      input_menu_next(data, &rect[n]);
    }
}
예제 #17
0
Xint8 projectile_hit_invader(int i, int j)
{
	int n;

	/* Check if projectile hit left, center or right part of invader */
	for(n = -1; n < 2; n++)
	{
		if(invaders_map[i+n][j])
		{
			invaders_map[i+n][j] = 0;
			erase_square(XPAR_VGA_PERIPH_MEM_0_S_AXI_MEM0_BASEADDR, i+n, j);
			invaders_num--;
			projectiles_of_ship_num[i]--;

			for(n = 0; n < 500; n++)
			{
				draw_square(XPAR_VGA_PERIPH_MEM_0_S_AXI_MEM0_BASEADDR, i, j);
				erase_square(XPAR_VGA_PERIPH_MEM_0_S_AXI_MEM0_BASEADDR, i, j);
			}

			xil_printf("\nPROJECTILE HIT INVADER\n\r");
			return 1;
		}
	}
	return 0;
}
예제 #18
0
파일: world.c 프로젝트: puyo/tankdemo
/* draw everything */
void render(BITMAP *bmp)
{
   char buf[80];
   MATRIX_f roller, camera;
   int x, y, w, h;
   float xfront, yfront, zfront;
   float xup, yup, zup;

   /* clear the background */
   clear(bmp);

   set_projection_viewport(0, 0, SCREEN_W, SCREEN_H);

   /* calculate the in-front vector */
   xfront = sin(heading) * cos(pitch);
   yfront = sin(pitch);
   zfront = cos(heading) * cos(pitch);

   /* rotate the up vector around the in-front vector by the roll angle */
   get_vector_rotation_matrix_f(&roller, xfront, yfront, zfront, roll*128.0/M_PI);
   apply_matrix_f(&roller, 0, -1, 0, &xup, &yup, &zup);

   /* build the camera matrix */
   get_camera_matrix_f(&camera,
		       xpos, ypos, zpos,        /* camera position */
		       xfront, yfront, zfront,  /* in-front vector */
		       xup, yup, zup,           /* up vector */
		       fov,                     /* field of view */
		       aspect);                 /* aspect ratio */

   /* draw the grid of squares */
   for (x=0; x<GRID_SIZE; x++)
      for (y=0; y<GRID_SIZE; y++)
	 draw_square(bmp, &camera, x * TILE_SIZE, y * TILE_SIZE);

   /* overlay some text */
   set_clip_rect(bmp, 0, 0, bmp->w, bmp->h);
   sprintf(buf, "Field of view: %d (f/F changes)", fov);
   textout_ex(bmp, font, buf, 0, 16, 255, -1);
   sprintf(buf, "Aspect ratio: %.2f (a/A changes)", aspect);
   textout_ex(bmp, font, buf, 0, 24, 255, -1);
   sprintf(buf, "X position: %.2f (x/X changes)", xpos);
   textout_ex(bmp, font, buf, 0, 32, 255, -1);
   sprintf(buf, "Y position: %.2f (y/Y changes)", ypos);
   textout_ex(bmp, font, buf, 0, 40, 255, -1);
   sprintf(buf, "Z position: %.2f (z/Z changes)", zpos);
   textout_ex(bmp, font, buf, 0, 48, 255, -1);
   sprintf(buf, "Heading: %.2f deg (left/right changes)", DEG(heading));
   textout_ex(bmp, font, buf, 0, 56, 255, -1);
   sprintf(buf, "Pitch: %.2f deg (pgup/pgdn changes)", DEG(pitch));
   textout_ex(bmp, font, buf, 0, 64, 255, -1);
   sprintf(buf, "Roll: %.2f deg (r/R changes)", DEG(roll));
   textout_ex(bmp, font, buf, 0, 72, 255, -1);
   sprintf(buf, "Front vector: %.2f, %.2f, %.2f", xfront, yfront, zfront);
   textout_ex(bmp, font, buf, 0, 80, 255, -1);
   sprintf(buf, "Up vector: %.2f, %.2f, %.2f", xup, yup, zup);
   textout_ex(bmp, font, buf, 0, 88, 255, -1);
}
예제 #19
0
void display_segmentation(SDL_Surface *img, struct vector *V) {
    size_t i = 0;
    while (i < V->size) {
	if (V->data[i].w1 >= 0) {
	    draw_square(img, V->data[i]);
	}
	i++;
    }
}
예제 #20
0
파일: lab3.c 프로젝트: worm6206/lab3
//draw circle implementation (this draws circle but not as good as draw_circle2)
void draw_circle (float r,float color[3]){
  glPushMatrix();
  glScalef(r*1.414,r*1.414,0);
  for (int i = 0; i < 360; ++i)
  {
    draw_square(color);
    glRotatef(1,0,0,1);
  }
  glPopMatrix();
}
예제 #21
0
void display(void) {
	Point p1 = {100, 100};
	GLint length = 100; // size of square

	glClear(GL_COLOR_BUFFER_BIT);
	glBegin(GL_POINTS);
		draw_square(p1, length);
	glEnd();
	glFlush();
}
예제 #22
0
int test_square(unsigned short x, unsigned short y, unsigned short size, unsigned long color) {
	char* video_mem = NULL;
	int failure =0;
	if((video_mem=(char *)vg_init(VBE_MODE_RES_1024x768)) == NULL)
	{
		printf("test_init(): vg_init() failed");
		return 1;
	}
	
	if(draw_square(video_mem,x,y,size, color))
		failure =1;
	int kbd_irq_set = 0;
	if((kbd_irq_set = kbd_subscribe_int(0)) < 0){//subscribe kbd interrupts
		printf("generic_interrupt_loop(): kbd_subscribe_int() failed \n");
		failure = 1;
	}
	int ipc_status;
	message msg;
	int r;
	if(!failure){
		do{
			/* Get a request message. */
			if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) {
				printf("driver_receive failed with: %d", r);
				continue;
			}
			if (is_ipc_notify(ipc_status)) { /* received notification */
				switch (_ENDPOINT_P(msg.m_source)) {
				case HARDWARE: /* hardware interrupt notification */
					if (msg.NOTIFY_ARG & kbd_irq_set) { /* subscribed kbd interrupt */
						if(kbd_int_handler())
							failure = 1;
					}
					break;
				default:
					break; /* no other notifications expected: do nothing */
				}
			} else {/* received a standard message, not a notification */
				/* no standard messages expected: do nothing */
			}
		} while(get_scancode() != ESC_BREAK);
	}
	if(kbd_unsubscribe_int()){//unsubscribe interrupts
		printf("test_square(): kbd_unsubscribe_int() failed\n");
		failure = 1;
	}
	printf("Done\n");
	if(vg_exit()){
		printf("test_square(): vg_exit() failed");
		return 1;
	}
	return failure;
}
예제 #23
0
파일: menu.c 프로젝트: MarcBrout/tekdoom
void			input_menu_next(t_data *data, t_mrect *ref)
{
  t_mrect		box;

  box.size = pos_(60, ref->size.y);
  box.pos = pos_(ref->pos.x + 20, ref->pos.y);
  box.color[0] = WHITE;
  box.color[1] = WHITE;
  box.contour = 0;
  box.selected = false;
  draw_square(data->pix_ar, &box);
}
예제 #24
0
파일: lab3.c 프로젝트: worm6206/lab3
//draw cube based on squares
void draw_cube(float size, float color[3],glm::mat4 M){
  //glLoadMatrixf
  glPushMatrix();
  glMultMatrixf(&M[0][0]);
  glPushMatrix();
  glPushMatrix();

  glTranslatef(0,0,-0.5);
  draw_square(color);
  glTranslatef(0,0,1);
  draw_square(color);

  glPopMatrix();
  glRotatef(90,1,0,0);
  glTranslatef(0,0,-0.5);
  draw_square(color);
  glTranslatef(0,0,1);
  draw_square(color);

  glPopMatrix();
  glRotatef(90,0,1,0);
  glTranslatef(0,0,-0.5);
  draw_square(color);
  glTranslatef(0,0,1);
  draw_square(color);

  glPopMatrix();
}
예제 #25
0
void	draw_square(float x0, float y0, float x1, float y1, float xc, float yc, float threshold)
{

	// Draw this square.
	glColor3f(1, 1, 0);
	glBegin(GL_LINE_STRIP);
	glVertex3f(x0, y0, 1);
	glVertex3f(x1, y0, 1);
	glVertex3f(x1, y1, 1);
	glVertex3f(x0, y1, 1);
	glVertex3f(x0, y0, 1);
	glEnd();

	if (x1 - x0 > 10)
	{
		// Decide if we should split.

		float	sx = (x0 + x1) / 2;
		float	sy = (y0 + y1) / 2;

		float	dx = sx - xc;
		float	dy = sy - yc;
		float	dist = sqrtf(dx * dx + dy * dy);

		if (dist < threshold)
		{
			// Subdivide.
			float	half_x = (x1 - x0) / 2;
			float	half_y = (y1 - y0) / 2;
			for (int j = 0; j < 2; j++)
			{
				for (int i = 0; i < 2; i++)
				{
					draw_square(x0 + i * half_x, y0 + j * half_y,	
						    x0 + i * half_x + half_x, y0 + j * half_y + half_y,
						    xc, yc,
						    threshold / 2);
				}
			}

			return;
		}
		else
		{
			// Draw a little circle at our center.
			draw_circle(sx, sy, threshold / 16.0f);
		}
	}
}
예제 #26
0
파일: lem_mlx.c 프로젝트: kizdolf/Lem-in
void		paint_mlx(t_frmlr *fml, t_mlx ml)
{
	int		i;

	i = 0;
	while(fml->salles[i])
	{
		draw_square(fml->salles[i]->crd.x * 30, fml->salles[i]->crd.y * 30, SIZE_ROOM, ml, fml->salles[i]->full, COLOR_SQUARE);
		mlx_string_put(ml.mlx, ml.win, fml->salles[i]->crd.x * 30 + 5, fml->salles[i]->crd.y * 30 + 15, COLOR_SQUARE, fml->salles[i]->name);
		i++;
	}
	i = 0;
	while (fml->tubes[i])
		draw_line(fml->tubes[i++], fml, ml);
}
예제 #27
0
// draws the player to the screen
void Player::drawPlayer() {
	set_fill_color(WHITE);

	int size = this->size;
	int xSize = this->facingEast ? size : size * -1;
	int x = this->pos.x;
	int y = this->pos.y;

	// draw the bill
	Point billP1 = Point::Point(x - xSize, y - size / 2);
	Point billP2 = Point::Point(x + xSize / 2, y - size);
	draw_rectangle_filled(billP1, billP2);

	// draw the head
	draw_square(x, y - size, size / 2);

	// draw the eyes
	draw_circle_filled(x - xSize / 4, y - (size * 12 / 11), size / 8);
	draw_circle_filled(x + xSize / 8, y - (size * 12 / 11), size / 8);

	// draw the left arm
	draw_square(x - xSize, y, size / 2);

	// draw the right arm
	draw_square(x + xSize, y, size / 2);

	// draw the left foot
	Point leftFootP1 = Point::Point(x - xSize, y + size);
	Point leftFootP2 = Point::Point(x + (xSize * 1/10), y + (size * 12/10));
	draw_rectangle_filled(leftFootP1, leftFootP2);

	// draw the right arm
	Point rightFootP1 = Point::Point(x + xSize, y + size);
	Point rightFootP2 = Point::Point(x + (xSize * 1/10), y + (size * 12/10));
	draw_rectangle_filled(rightFootP1, rightFootP2);
}
예제 #28
0
void	draw_stuff(float xcenter, float ycenter, float lod_tweak)
{
	// Draw a series of concentric circles w/ ^2 radiuses.
	float	radius = 1000.0f * lod_tweak;

	while (radius > 10.0f)
	{
		draw_circle(xcenter, ycenter, radius);
		radius /= 2.0f;
	}

	// Draw quadsquares; recursively split based on distance to
	// {xcenter,ycenter}.
	draw_square(0, 0, 1000, 1000, xcenter, ycenter, 1000 * lod_tweak);
}
예제 #29
0
파일: page.cpp 프로젝트: LevGas/painter
void CPage::update()
{   
    if (m_pData->count() > m_nItemCount)
    {
        CShape_Base *pShape = m_pData->lastShape();
        Q_ASSERT(pShape != 0);
        switch (pShape->type())
        {
        case CShape_Base::eRect:
        {
            CRectangle *pRect = static_cast<CRectangle*>(pShape);
            draw_rect(pRect);

            break;
       }
       case CShape_Base::eCircle:
       {
            CCircle *pCircle = static_cast<CCircle*>(pShape);
            draw_circle(pCircle);

            break;
        }
        case CShape_Base::eSquare:
        {
            CSquare *pSquare = static_cast<CSquare*>(pShape);
            draw_square(pSquare);

            break;
        }
        case CShape_Base::eLine:
        {
            CLine *pLine = static_cast<CLine*>(pShape);
            draw_line(pLine);

            break;
        }
        default:
            break;
        }
    }
    else
    {
        m_pScene->clear();
        m_nItemCount = 0;
        draw_cord_system();
    }
}
예제 #30
0
파일: main.c 프로젝트: dlight/p3
void draw_flag(cairo_t* cr, unsigned p)
{
	int k = holding_lock[p];

	if (k == -1)
		return;

	double i, j;

	if (p == 0)
		i = 112, j = 80;
	else if (p == 1)
		i = 212, j = 80;
	else
		i = 162, j = 180;
	
	draw_square(cr, k, i, j);	
}