3
Copyright 2000 Li-Cheng (Andy) Tai
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
inline void set_rgb_pixel(unsigned char *rgb, int rowstride, int pixelsize, int width, int height, int x, int y, unsigned char r, unsigned char g, unsigned char b)
26
unsigned char *p = rgb + rowstride * y + x * 3;
41
/* Draw a rectangle on the screen */
42
void draw_brush( image_buf *ibuf,
48
GdkRectangle update_rect;
51
int iwidth = image_buf_width(ibuf);
52
int iheight = image_buf_height(ibuf);
53
int rowstride = image_buf_rowstride(ibuf);
54
int pixelsize = image_buf_pixelsize(ibuf);
55
unsigned char *rgb = image_buf_rgbbuf(ibuf);
57
update_rect.x = x - width / 2;
58
update_rect.y = y - height / 2;
59
update_rect.width = width;
60
update_rect.height = height;
62
for (ty = (int) y - height / 2; ty < (int) y + height / 2; ty++)
63
for (tx = (int) x - width / 2; tx < (int) x + width / 2; tx++)
64
set_rgb_pixel(rgb, rowstride, pixelsize, iwidth, iheight, tx, ty, 255, 255, 0);
67
gtk_widget_draw (ibuf->drawing_area, &update_rect);