Commit 5e64804c authored by EDT 1999 Adrian Likins's avatar EDT 1999 Adrian Likins Committed by Adrian Likins
Browse files

app/gimpbrushpip.[ch] app/airbrush.c app/pencil.c fix pencil tool for use

Wed Sep  1 00:56:37 EDT 1999 Adrian Likins <adrian@gimp.org>

        * app/gimpbrushpip.[ch]
        * app/airbrush.c
        * app/pencil.c
        * app/paintbrush.c: fix pencil tool for use with
           pixmaps again
parent 6a712088
Wed Sep 1 00:56:37 EDT 1999 Adrian Likins <adrian@gimp.org>
* app/gimpbrushpip.[ch]
* app/airbrush.c
* app/pencil.c
* app/paintbrush.c: fix pencil tool for use with
pixmaps again
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/tile_swap.c (tile_swap_open): Use _O_TEMPORARY. Removed
......
......@@ -297,8 +297,8 @@ airbrush_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
color_area_with_pixmap (paint_core, gimage, drawable, area);
mode = INCREMENTAL;
color_area_with_pixmap (paint_core, gimage, drawable, area, SOFT);
}
else
{
......
......@@ -25,6 +25,7 @@
#include <string.h>
#include <ctype.h>
#include "apptypes.h"
#include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
......@@ -69,7 +70,8 @@ static void paint_line_pixmap_mask(GImage *dest,
int x,
int y,
int bytes,
int width);
int width,
int mode);
static void
gimp_brush_pixmap_destroy (GtkObject *object)
......@@ -585,7 +587,8 @@ void
color_area_with_pixmap (PaintCore *paint_core,
GImage *dest,
GimpDrawable *drawable,
TempBuf *area)
TempBuf *area,
int mode)
{
PixelRegion destPR;
......@@ -624,7 +627,7 @@ color_area_with_pixmap (PaintCore *paint_core,
{
paint_line_pixmap_mask (dest, drawable, pixmap,
d, offsetx, y + offsety,
destPR.bytes, destPR.w);
destPR.bytes, destPR.w, mode);
d += destPR.rowstride;
}
}
......@@ -638,7 +641,8 @@ paint_line_pixmap_mask (GImage *dest,
int x,
int y,
int bytes,
int width)
int width,
int mode)
{
guchar *b, *p;
int x_index;
......@@ -661,24 +665,45 @@ paint_line_pixmap_mask (GImage *dest,
/* ditto, except for the brush mask, so we can pre-multiply the alpha value */
mask = temp_buf_data((brush->gbrush).mask) +
(y % brush->pixmap_mask->height) * brush->pixmap_mask->width;
for (i = 0; i < width; i++)
if(mode == SOFT)
{
for (i = 0; i < width; i++)
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = mask[x_index];
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
if(alpha = d[bytes-1] * factor)
{
d[0] *= alpha;
d[1] *= alpha;
d[2] *= alpha;
}
/* printf("i: %i d->r: %i d->g: %i d->b: %i d->a: %i\n",i,(int)d[0], (int)d[1], (int)d[2], (int)d[3]); */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
}
}
else
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = mask[x_index];
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
alpha = d[bytes-1] * factor;
d[0] *= alpha;
d[1] *= alpha;
d[2] *= alpha;
/* printf("i: %i d->r: %i d->g: %i d->b: %i d->a: %i\n",i,(int)d[0], (int)d[1], (int)d[2], (int)d[3]); */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
for (i = 0; i < width; i++)
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = 255;
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
}
}
}
......@@ -25,6 +25,7 @@
#include <string.h>
#include <ctype.h>
#include "apptypes.h"
#include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
......@@ -69,7 +70,8 @@ static void paint_line_pixmap_mask(GImage *dest,
int x,
int y,
int bytes,
int width);
int width,
int mode);
static void
gimp_brush_pixmap_destroy (GtkObject *object)
......@@ -585,7 +587,8 @@ void
color_area_with_pixmap (PaintCore *paint_core,
GImage *dest,
GimpDrawable *drawable,
TempBuf *area)
TempBuf *area,
int mode)
{
PixelRegion destPR;
......@@ -624,7 +627,7 @@ color_area_with_pixmap (PaintCore *paint_core,
{
paint_line_pixmap_mask (dest, drawable, pixmap,
d, offsetx, y + offsety,
destPR.bytes, destPR.w);
destPR.bytes, destPR.w, mode);
d += destPR.rowstride;
}
}
......@@ -638,7 +641,8 @@ paint_line_pixmap_mask (GImage *dest,
int x,
int y,
int bytes,
int width)
int width,
int mode)
{
guchar *b, *p;
int x_index;
......@@ -661,24 +665,45 @@ paint_line_pixmap_mask (GImage *dest,
/* ditto, except for the brush mask, so we can pre-multiply the alpha value */
mask = temp_buf_data((brush->gbrush).mask) +
(y % brush->pixmap_mask->height) * brush->pixmap_mask->width;
for (i = 0; i < width; i++)
if(mode == SOFT)
{
for (i = 0; i < width; i++)
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = mask[x_index];
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
if(alpha = d[bytes-1] * factor)
{
d[0] *= alpha;
d[1] *= alpha;
d[2] *= alpha;
}
/* printf("i: %i d->r: %i d->g: %i d->b: %i d->a: %i\n",i,(int)d[0], (int)d[1], (int)d[2], (int)d[3]); */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
}
}
else
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = mask[x_index];
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
alpha = d[bytes-1] * factor;
d[0] *= alpha;
d[1] *= alpha;
d[2] *= alpha;
/* printf("i: %i d->r: %i d->g: %i d->b: %i d->a: %i\n",i,(int)d[0], (int)d[1], (int)d[2], (int)d[3]); */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
for (i = 0; i < width; i++)
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = 255;
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
}
}
}
......@@ -47,6 +47,7 @@ TempBuf *gimp_brush_pixmap_pixmap (GimpBrushPixmap *);
void color_area_with_pixmap (PaintCore *paint_core,
GImage *dest,
GimpDrawable *drawable,
TempBuf *area);
TempBuf *area,
int mode);
#endif /* __GIMPBRUSHPIPE_H__ */
......@@ -25,6 +25,7 @@
#include <string.h>
#include <ctype.h>
#include "apptypes.h"
#include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
......@@ -69,7 +70,8 @@ static void paint_line_pixmap_mask(GImage *dest,
int x,
int y,
int bytes,
int width);
int width,
int mode);
static void
gimp_brush_pixmap_destroy (GtkObject *object)
......@@ -585,7 +587,8 @@ void
color_area_with_pixmap (PaintCore *paint_core,
GImage *dest,
GimpDrawable *drawable,
TempBuf *area)
TempBuf *area,
int mode)
{
PixelRegion destPR;
......@@ -624,7 +627,7 @@ color_area_with_pixmap (PaintCore *paint_core,
{
paint_line_pixmap_mask (dest, drawable, pixmap,
d, offsetx, y + offsety,
destPR.bytes, destPR.w);
destPR.bytes, destPR.w, mode);
d += destPR.rowstride;
}
}
......@@ -638,7 +641,8 @@ paint_line_pixmap_mask (GImage *dest,
int x,
int y,
int bytes,
int width)
int width,
int mode)
{
guchar *b, *p;
int x_index;
......@@ -661,24 +665,45 @@ paint_line_pixmap_mask (GImage *dest,
/* ditto, except for the brush mask, so we can pre-multiply the alpha value */
mask = temp_buf_data((brush->gbrush).mask) +
(y % brush->pixmap_mask->height) * brush->pixmap_mask->width;
for (i = 0; i < width; i++)
if(mode == SOFT)
{
for (i = 0; i < width; i++)
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = mask[x_index];
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
if(alpha = d[bytes-1] * factor)
{
d[0] *= alpha;
d[1] *= alpha;
d[2] *= alpha;
}
/* printf("i: %i d->r: %i d->g: %i d->b: %i d->a: %i\n",i,(int)d[0], (int)d[1], (int)d[2], (int)d[3]); */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
}
}
else
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = mask[x_index];
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
alpha = d[bytes-1] * factor;
d[0] *= alpha;
d[1] *= alpha;
d[2] *= alpha;
/* printf("i: %i d->r: %i d->g: %i d->b: %i d->a: %i\n",i,(int)d[0], (int)d[1], (int)d[2], (int)d[3]); */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
for (i = 0; i < width; i++)
{
/* attempt to avoid doing this calc twice in the loop */
x_index = ((i + x) % brush->pixmap_mask->width);
p = b + x_index * brush->pixmap_mask->bytes;
d[bytes-1] = 255;
/* multiply alpha into the pixmap data */
/* maybe we could do this at tool creation or brush switch time? */
/* and compute it for the whole brush at once and cache it? */
gimage_transform_color (dest, drawable, p, d, RGB);
d += bytes;
}
}
}
......@@ -47,6 +47,7 @@ TempBuf *gimp_brush_pixmap_pixmap (GimpBrushPixmap *);
void color_area_with_pixmap (PaintCore *paint_core,
GImage *dest,
GimpDrawable *drawable,
TempBuf *area);
TempBuf *area,
int mode);
#endif /* __GIMPBRUSHPIPE_H__ */
......@@ -297,8 +297,8 @@ airbrush_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
color_area_with_pixmap (paint_core, gimage, drawable, area);
mode = INCREMENTAL;
color_area_with_pixmap (paint_core, gimage, drawable, area, SOFT);
}
else
{
......
......@@ -182,7 +182,8 @@ pencil_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
/* if its a pixmap, do pixmap stuff */
color_area_with_pixmap (paint_core, gimage, drawable, area);
color_area_with_pixmap (paint_core, gimage, drawable, area,HARD );
paint_appl_mode = INCREMENTAL;
}
else
......
......@@ -352,6 +352,7 @@ tools_new_paintbrush ()
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}
......@@ -441,7 +442,7 @@ paintbrush_motion (PaintCore *paint_core,
pixmap image into the are instead of the color */
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush) && !gradient_length)
{
color_area_with_pixmap (paint_core, gimage, drawable, area);
color_area_with_pixmap (paint_core, gimage, drawable, area, SOFT);
paint_appl_mode = INCREMENTAL;
}
else
......
......@@ -182,7 +182,8 @@ pencil_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
/* if its a pixmap, do pixmap stuff */
color_area_with_pixmap (paint_core, gimage, drawable, area);
color_area_with_pixmap (paint_core, gimage, drawable, area,HARD );
paint_appl_mode = INCREMENTAL;
}
else
......
......@@ -297,8 +297,8 @@ airbrush_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
color_area_with_pixmap (paint_core, gimage, drawable, area);
mode = INCREMENTAL;
color_area_with_pixmap (paint_core, gimage, drawable, area, SOFT);
}
else
{
......
......@@ -297,8 +297,8 @@ airbrush_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
color_area_with_pixmap (paint_core, gimage, drawable, area);
mode = INCREMENTAL;
color_area_with_pixmap (paint_core, gimage, drawable, area, SOFT);
}
else
{
......
......@@ -182,7 +182,8 @@ pencil_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
/* if its a pixmap, do pixmap stuff */
color_area_with_pixmap (paint_core, gimage, drawable, area);
color_area_with_pixmap (paint_core, gimage, drawable, area,HARD );
paint_appl_mode = INCREMENTAL;
}
else
......
......@@ -352,6 +352,7 @@ tools_new_paintbrush ()
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}
......@@ -441,7 +442,7 @@ paintbrush_motion (PaintCore *paint_core,
pixmap image into the are instead of the color */
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush) && !gradient_length)
{
color_area_with_pixmap (paint_core, gimage, drawable, area);
color_area_with_pixmap (paint_core, gimage, drawable, area, SOFT);
paint_appl_mode = INCREMENTAL;
}
else
......
......@@ -182,7 +182,8 @@ pencil_motion (PaintCore *paint_core,
if (GIMP_IS_BRUSH_PIXMAP (paint_core->brush))
{
/* if its a pixmap, do pixmap stuff */
color_area_with_pixmap (paint_core, gimage, drawable, area);
color_area_with_pixmap (paint_core, gimage, drawable, area,HARD );
paint_appl_mode = INCREMENTAL;
}
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment