GRASS Programmer's Manual  6.4.2(2012)
pngdriver/Box.c
Go to the documentation of this file.
00001 
00002 #include "pngdriver.h"
00003 
00004 void PNG_Box_abs(int x1, int y1, int x2, int y2)
00005 {
00006     int tmp;
00007     int x, y;
00008 
00009     if (x1 > x2)
00010         tmp = x1, x1 = x2, x2 = tmp;
00011 
00012     if (y1 > y2)
00013         tmp = y1, y1 = y2, y2 = tmp;
00014 
00015     if (x2 < 0 || x1 > width)
00016         return;
00017 
00018     if (y2 < 0 || y1 > height)
00019         return;
00020 
00021     if (x1 < clip_left)
00022         x1 = clip_left;
00023 
00024     if (x2 > clip_rite)
00025         x2 = clip_rite;
00026 
00027     if (y1 < clip_top)
00028         y1 = clip_top;
00029 
00030     if (y2 > clip_bot)
00031         y2 = clip_bot;
00032 
00033     for (y = y1; y < y2; y++) {
00034         unsigned int *p = &grid[y * width + x1];
00035 
00036         for (x = x1; x < x2; x++)
00037             *p++ = currentColor;
00038     }
00039 
00040     modified = 1;
00041 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines