Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void square(struct Png *image, struct Png *image2, int width_pixel, int size) {
- int x1, x2, x3, x4, y1, y2, y3, y4;
- for (int y = 0; y < image->height; y++) {
- png_byte *row = image->row_pointers[y];
- for (int x = 0; x < image->width; x++) {
- png_byte *ptr = &(row[x * width_pixel]);
- if (ptr[0] == 255 && ptr[1] == 0 && ptr[2] == 0) {
- x1 = x - size / 2;
- y1 = y + size / 2;
- x2 = x + size / 2;
- y2 = y1;
- x3 = x2;
- y3 = y - size / 2;
- x4 = x1;
- y4 = y3;
- paint_line(image2, 3, x1, y1, x2, y2, 1, 255, 0, 0);
- paint_line(image2, 3, x2, y2, x3, y3, 1, 255, 0, 0);
- paint_line(image2, 3, x3, y3, x4, y4, 1, 255, 0, 0);
- paint_line(image2, 3, x1, y1, x4, y4, 1, 255, 0, 0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement