mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 09:09:08 +00:00
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
This commit is contained in:
parent
6a71208875
commit
5e64804c4b
|
@ -1,3 +1,11 @@
|
|||
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++)
|
||||
{
|
||||
/* 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;
|
||||
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
|
||||
{
|
||||
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++)
|
||||
{
|
||||
/* 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;
|
||||
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
|
||||
{
|
||||
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++)
|
||||
{
|
||||
/* 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;
|
||||
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
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue