Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void paint_pixel_white(struct Png *image, int x, int y, int width_pixel, int Red, int Green, int
- Blue) {
- if (x < 0 || x >= image->width || y < 0 || y >= image->height)
- return;
- png_byte *row = image->row_pointers[y];
- png_byte *ptr = &(row[x * width_pixel]);
- if (!(ptr[0] == 255 && ptr[1] == 255 && ptr[2] == 255)) {
- ptr[0] = Red;
- ptr[1] = Green;
- ptr[2] = Blue;
- }
- }
- void white2(struct Png *image, int width_pixel, int thick, int r, int g, int b) {
- 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] == 255 && ptr[2] == 255) {
- for (int y1 = y - thick; y1 < (1 + y + thick); y1++) {
- for (int x1 = x - thick; x1 < (1 + x + thick); x1++) {
- if ((x - x1) * (x - x1) + (y - y1) * (y - y1) <= (thick * thick)) {
- paint_pixel_white(image, x1, y1, width_pixel, r, g, b);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement