mirror of https://github.com/GNOME/gimp.git
app/gimpbrushhose.c new files to implement a GimpBrushHose type. The idea
Mon Aug 16 20:48:33 1999 Adrian Likins <alikins@redhat.com> * app/gimpbrushhose.c * app/gimpbrushhose.h: new files to implement a GimpBrushHose type. The idea being its derived from gimpbrushes, so we can make regular tools use it if need be, and fold it into the brushes dialog nice and easy. * app/gimpbrush.c * app/gimpbrushgenerated.c * app/gimpbrushpixmap.c: * app/gimpbrushpixmap.h: Modified the *_get_type() functions to behave more correctly. As suggested by Tim Janik <tim@gtk.org> * app/pixmapbrush.c: Since pixmapbrush tool wasnt doing anything useful anyway, start using it as a testbed for "image hoses". Right now it doesnt really work correctly. I'll try to upload a sample hose to http://adrian.gimp.org/pixmap-brushes/ shortly, and maybe some docs about the lame format. -adrian
This commit is contained in:
parent
97346fb110
commit
e87ae53aba
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Mon Aug 16 20:48:33 1999 Adrian Likins <alikins@redhat.com>
|
||||
|
||||
* app/gimpbrushhose.c
|
||||
* app/gimpbrushhose.h: new files to implement a GimpBrushHose
|
||||
type. The idea being its derived from gimpbrushes, so we can
|
||||
make regular tools use it if need be, and fold it into the brushes
|
||||
dialog nice and easy.
|
||||
|
||||
* app/gimpbrush.c
|
||||
* app/gimpbrushgenerated.c
|
||||
* app/gimpbrushpixmap.c:
|
||||
* app/gimpbrushpixmap.h: Modified the *_get_type() functions
|
||||
to behave more correctly. As suggested by Tim Janik <tim@gtk.org>
|
||||
|
||||
* app/pixmapbrush.c: Since pixmapbrush tool wasnt doing anything
|
||||
useful anyway, start using it as a testbed for "image hoses".
|
||||
Right now it doesnt really work correctly.
|
||||
|
||||
1999-08-16 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* app/transform_core.c: Use RINT instead of rint.
|
||||
|
|
|
@ -86,19 +86,24 @@ gimp_brush_init(GimpBrush *brush)
|
|||
brush->y_axis.y = 15.0;
|
||||
}
|
||||
|
||||
GtkType gimp_brush_get_type(void)
|
||||
|
||||
GtkType
|
||||
gimp_brush_get_type (void)
|
||||
{
|
||||
static GtkType type;
|
||||
if(!type){
|
||||
GtkTypeInfo info={
|
||||
"GimpBrush",
|
||||
sizeof(GimpBrush),
|
||||
sizeof(GimpBrushClass),
|
||||
(GtkClassInitFunc)gimp_brush_class_init,
|
||||
(GtkObjectInitFunc)gimp_brush_init,
|
||||
NULL,
|
||||
NULL };
|
||||
type=gtk_type_unique(gimp_object_get_type(), &info);
|
||||
static GtkType type = 0;
|
||||
if(!type)
|
||||
{
|
||||
static const GtkTypeInfo info = {
|
||||
"GimpBrush",
|
||||
sizeof (GimpBrush),
|
||||
sizeof (GimpBrushClass),
|
||||
(GtkClassInitFunc) gimp_brush_class_init,
|
||||
(GtkObjectInitFunc) gimp_brush_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
type = gtk_type_unique (gimp_object_get_type (), &info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -86,19 +86,24 @@ gimp_brush_init(GimpBrush *brush)
|
|||
brush->y_axis.y = 15.0;
|
||||
}
|
||||
|
||||
GtkType gimp_brush_get_type(void)
|
||||
|
||||
GtkType
|
||||
gimp_brush_get_type (void)
|
||||
{
|
||||
static GtkType type;
|
||||
if(!type){
|
||||
GtkTypeInfo info={
|
||||
"GimpBrush",
|
||||
sizeof(GimpBrush),
|
||||
sizeof(GimpBrushClass),
|
||||
(GtkClassInitFunc)gimp_brush_class_init,
|
||||
(GtkObjectInitFunc)gimp_brush_init,
|
||||
NULL,
|
||||
NULL };
|
||||
type=gtk_type_unique(gimp_object_get_type(), &info);
|
||||
static GtkType type = 0;
|
||||
if(!type)
|
||||
{
|
||||
static const GtkTypeInfo info = {
|
||||
"GimpBrush",
|
||||
sizeof (GimpBrush),
|
||||
sizeof (GimpBrushClass),
|
||||
(GtkClassInitFunc) gimp_brush_class_init,
|
||||
(GtkObjectInitFunc) gimp_brush_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
type = gtk_type_unique (gimp_object_get_type (), &info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -86,19 +86,24 @@ gimp_brush_init(GimpBrush *brush)
|
|||
brush->y_axis.y = 15.0;
|
||||
}
|
||||
|
||||
GtkType gimp_brush_get_type(void)
|
||||
|
||||
GtkType
|
||||
gimp_brush_get_type (void)
|
||||
{
|
||||
static GtkType type;
|
||||
if(!type){
|
||||
GtkTypeInfo info={
|
||||
"GimpBrush",
|
||||
sizeof(GimpBrush),
|
||||
sizeof(GimpBrushClass),
|
||||
(GtkClassInitFunc)gimp_brush_class_init,
|
||||
(GtkObjectInitFunc)gimp_brush_init,
|
||||
NULL,
|
||||
NULL };
|
||||
type=gtk_type_unique(gimp_object_get_type(), &info);
|
||||
static GtkType type = 0;
|
||||
if(!type)
|
||||
{
|
||||
static const GtkTypeInfo info = {
|
||||
"GimpBrush",
|
||||
sizeof (GimpBrush),
|
||||
sizeof (GimpBrushClass),
|
||||
(GtkClassInitFunc) gimp_brush_class_init,
|
||||
(GtkObjectInitFunc) gimp_brush_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
type = gtk_type_unique (gimp_object_get_type (), &info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,280 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "appenv.h"
|
||||
#include "brush_header.h"
|
||||
#include "pattern_header.h"
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbrushpixmap.h"
|
||||
#include "gimpbrushlist.h"
|
||||
|
||||
#include "paint_core.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpbrushhose.h"
|
||||
|
||||
static void
|
||||
gimp_brush_hose_generate(GimpBrushHose *brush);
|
||||
|
||||
static GimpObjectClass* parent_class;
|
||||
|
||||
static void
|
||||
gimp_brush_hose_destroy(GtkObject *object)
|
||||
{
|
||||
GTK_OBJECT_CLASS(parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_brush_hose_class_init (GimpBrushHoseClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS(klass);
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_BRUSH_PIXMAP);
|
||||
object_class->destroy = gimp_brush_hose_destroy;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_hose_init(GimpBrushHose *brush)
|
||||
{
|
||||
brush->name = NULL;
|
||||
brush->filename = NULL;
|
||||
brush->brush_list = gimp_brush_list_new();
|
||||
}
|
||||
|
||||
GtkType gimp_brush_hose_get_type(void)
|
||||
{
|
||||
static GtkType type=0;
|
||||
if(!type){
|
||||
GtkTypeInfo info={
|
||||
"GimpBrushHose",
|
||||
sizeof(GimpBrushHose),
|
||||
sizeof(GimpBrushHoseClass),
|
||||
(GtkClassInitFunc)gimp_brush_hose_class_init,
|
||||
(GtkObjectInitFunc)gimp_brush_hose_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserver_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL};
|
||||
type=gtk_type_unique(GIMP_TYPE_BRUSH_PIXMAP, &info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GimpBrushHose *
|
||||
gimp_brush_hose_load (char *file_name)
|
||||
{
|
||||
GimpBrushHose *hose;
|
||||
GimpBrushPixmap *brush;
|
||||
GimpBrushList *list;
|
||||
FILE *fp;
|
||||
unsigned char buf[sz_BrushHeader];
|
||||
gchar buf2[1024];
|
||||
BrushHeader header;
|
||||
int bn_size;
|
||||
unsigned int *hp;
|
||||
char *nothing;
|
||||
int i;
|
||||
int num_of_brushes;
|
||||
int brush_count=0;
|
||||
|
||||
hose = GIMP_BRUSH_HOSE(gimp_type_new(gimp_brush_hose_get_type()));
|
||||
GIMP_BRUSH_HOSE(hose)->filename = g_strdup(file_name);
|
||||
// hose = gimp_brush_hose_new
|
||||
|
||||
brush = GIMP_BRUSH_PIXMAP(gimp_type_new(gimp_brush_pixmap_get_type()));
|
||||
GIMP_BRUSH(brush)->filename = g_strdup(file_name);
|
||||
|
||||
list = gimp_brush_list_new();
|
||||
|
||||
printf("filename: %s\n list->num_brushes: %i", file_name, list->num_brushes);
|
||||
|
||||
if ((fp =fopen(file_name, "rb")) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* the file format starts with a painfully simple text header
|
||||
and we use a painfully simple way to read it */
|
||||
if(fgets (buf2, 1024, fp) == NULL)
|
||||
return NULL;
|
||||
buf2[strlen(buf2) - 1] = '\0';
|
||||
hose->name = g_strdup(buf2);
|
||||
|
||||
if(fgets (buf2, 1024, fp) == NULL)
|
||||
return NULL;
|
||||
//buf2[strlen(buf2) - 1] = '\0';
|
||||
num_of_brushes = strtol(buf2,NULL,10);
|
||||
|
||||
/* get the number of brushes */
|
||||
|
||||
printf("filename: %s \n name: %s number: %i \n",hose->filename, hose->name, num_of_brushes);
|
||||
|
||||
|
||||
/* FIXME
|
||||
|
||||
Think i need to flesh out all the bits if this thing is
|
||||
going to stop segfaulting
|
||||
|
||||
*/
|
||||
|
||||
while(brush_count < num_of_brushes)
|
||||
{
|
||||
|
||||
/* we read in the brush mask first */
|
||||
|
||||
/* Read in the header size */
|
||||
if ((fread (buf, 1, sz_BrushHeader, fp)) < sz_BrushHeader)
|
||||
{
|
||||
fclose (fp);
|
||||
gimp_object_destroy (brush);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* rearrange the bytes in each unsigned int */
|
||||
hp = (unsigned int *) &header;
|
||||
for (i = 0; i < (sz_BrushHeader / 4); i++)
|
||||
hp [i] = (buf [i * 4] << 24) + (buf [i * 4 + 1] << 16) +
|
||||
(buf [i * 4 + 2] << 8) + (buf [i * 4 + 3]);
|
||||
|
||||
|
||||
/* Check for correct file format */
|
||||
if (header.magic_number != GBRUSH_MAGIC)
|
||||
{
|
||||
/* One thing that can save this error is if the brush is version 1 */
|
||||
if (header.version != 1)
|
||||
{
|
||||
fclose (fp);
|
||||
gimp_object_destroy (brush);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (header.version == 1)
|
||||
{
|
||||
/* If this is a version 1 brush, set the fp back 8 bytes */
|
||||
fseek (fp, -8, SEEK_CUR);
|
||||
header.header_size += 8;
|
||||
/* spacing is not defined in version 1 */
|
||||
header.spacing = 25;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Read in the brush name */
|
||||
if ((bn_size = (header.header_size - sz_BrushHeader)))
|
||||
{
|
||||
GIMP_BRUSH(brush)->name = (char *) g_malloc (sizeof (char) * bn_size);
|
||||
if ((fread (GIMP_BRUSH(brush)->name, 1, bn_size, fp)) < bn_size)
|
||||
{
|
||||
g_message ("Error in GIMP brush file...aborting.");
|
||||
fclose (fp);
|
||||
gimp_object_destroy (brush);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch(header.version)
|
||||
{
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
/* Get a new brush mask */
|
||||
GIMP_BRUSH(brush)->mask = temp_buf_new (header.width,
|
||||
header.height,
|
||||
header.bytes,
|
||||
0, 0, NULL);
|
||||
/* Read the brush mask data */
|
||||
|
||||
if ((fread (temp_buf_data (GIMP_BRUSH(brush)->mask),
|
||||
1,header.width * header.height,
|
||||
fp)) < header.width * header.height)
|
||||
g_message ("GIMP brush file appears to be truncated.");
|
||||
|
||||
break;
|
||||
default:
|
||||
g_message ("Unknown brush format version #%d in \"%s\"\n",
|
||||
header.version, file_name);
|
||||
|
||||
fclose (fp);
|
||||
gimp_object_destroy (brush);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* PATTERN STUFF HERE */
|
||||
/* Read in the header size */
|
||||
if ((fread (buf, 1, sz_PatternHeader, fp)) < sz_PatternHeader)
|
||||
{
|
||||
fclose (fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
hp = (unsigned int *) &header;
|
||||
for (i = 0; i < (sz_PatternHeader / 4); i++)
|
||||
hp [i] = (buf [i * 4] << 24) + (buf [i * 4 + 1] << 16) +
|
||||
(buf [i * 4 + 2] << 8) + (buf [i * 4 + 3]);
|
||||
|
||||
|
||||
brush->pixmap_mask = temp_buf_new (header.width,
|
||||
header.height,
|
||||
header.bytes,
|
||||
0, 0, NULL);
|
||||
|
||||
|
||||
/* Read in the pattern name */
|
||||
if ((bn_size = (header.header_size - sz_PatternHeader)))
|
||||
{
|
||||
|
||||
nothing = (char *) g_malloc (sizeof (char) * bn_size);
|
||||
if ((fread (nothing, 1, bn_size, fp)) < bn_size)
|
||||
{
|
||||
g_message ("Error in GIMP pattern file...aborting.");
|
||||
fclose (fp);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
nothing = g_strdup ("Unnamed");
|
||||
}
|
||||
|
||||
|
||||
if ((fread (temp_buf_data (brush->pixmap_mask), 1,
|
||||
header.width * header.height * header.bytes, fp))
|
||||
< header.width * header.height * header.bytes)
|
||||
g_message ("GIMP pattern file appears to be truncated.");
|
||||
|
||||
|
||||
if(brush != NULL)
|
||||
gimp_brush_list_add(list,GIMP_BRUSH(brush));
|
||||
|
||||
printf("got here brush_count: %i\n", brush_count);
|
||||
printf("brush_list_count: %i \n", gimp_brush_list_length(list));
|
||||
|
||||
|
||||
brush_count++;
|
||||
printf("brush index is: %i \n", gimp_brush_list_get_brush_index(list, GIMP_BRUSH(brush)));
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
brush =GIMP_BRUSH_PIXMAP((gimp_brush_list_get_brush_by_index(list,0)));
|
||||
hose->pixmap_brush = *brush;
|
||||
hose->brush_list = list;
|
||||
/* random test code */
|
||||
|
||||
printf("got here, return hose;\n");
|
||||
return hose;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef __GIMP_BRUSH_HOSE_H__
|
||||
#define __GIMP_BRUSH_HOSE_H__
|
||||
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbrushpixmap.h"
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimpbrushlistP.h"
|
||||
|
||||
typedef struct _GimpBrushHose
|
||||
{
|
||||
GimpBrushPixmap pixmap_brush;
|
||||
GimpBrushList *brush_list;
|
||||
char * name;
|
||||
char * filename;
|
||||
} GimpBrushHose;
|
||||
|
||||
typedef struct _GimpBrushHoseClass
|
||||
{
|
||||
GimpBrushPixmapClass parent_class;
|
||||
void (* generate) (GimpBrushHose *brush);
|
||||
} GimpBrushHoseClass;
|
||||
|
||||
/* object stuff */
|
||||
#define GIMP_TYPE_BRUSH_HOSE (gimp_brush_hose_get_type ())
|
||||
#define GIMP_BRUSH_HOSE(obj) (GIMP_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_HOSE, GimpBrushHose))
|
||||
#define GIMP_IS_BRUSH_HOSE(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_HOSE))
|
||||
|
||||
GtkType gimp_brush_hose_get_type (void);
|
||||
|
||||
GimpBrushHose * gimp_brush_hose_new (char *file_name);
|
||||
GimpBrushHose * gimp_brush_hose_load (char *file_name);
|
||||
|
||||
#endif /* __GIMPBRUSHHOSE_H__ */
|
||||
|
||||
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
#include "appenv.h"
|
||||
#include "gimpbrushpixmap.h"
|
||||
#include "gimpbrushgenerated.h"
|
||||
#include "gimpbrushhose.h"
|
||||
#include "brush_header.h"
|
||||
#include "brush_select.h"
|
||||
#include "colormaps.h"
|
||||
|
@ -105,7 +106,7 @@ gimp_brush_list_init(GimpBrushList *list)
|
|||
|
||||
GtkType gimp_brush_list_get_type(void)
|
||||
{
|
||||
static GtkType type;
|
||||
static GtkType type=0;
|
||||
if(!type)
|
||||
{
|
||||
GtkTypeInfo info={
|
||||
|
@ -114,8 +115,9 @@ GtkType gimp_brush_list_get_type(void)
|
|||
sizeof(GimpBrushListClass),
|
||||
(GtkClassInitFunc)gimp_brush_list_class_init,
|
||||
(GtkObjectInitFunc)gimp_brush_list_init,
|
||||
NULL,
|
||||
NULL };
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */NULL,
|
||||
(GtkClassInitFunc) NULL};
|
||||
type=gtk_type_unique(gimp_list_get_type(), &info);
|
||||
}
|
||||
return type;
|
||||
|
@ -178,6 +180,15 @@ brush_load(char *filename)
|
|||
else
|
||||
g_message("Warning: failed to load brush \"%s\"", filename);
|
||||
}
|
||||
else if (strcmp(&filename[strlen(filename) - 4], ".gih") == 0)
|
||||
{
|
||||
GimpBrushHose *brush;
|
||||
brush = gimp_brush_hose_load(filename);
|
||||
if (brush != NULL)
|
||||
gimp_brush_list_add(brush_list, GIMP_BRUSH(brush));
|
||||
else
|
||||
g_message("Warning: failed to load brush \"%s\"", filename);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "appenv.h"
|
||||
#include "brush_header.h"
|
||||
#include "pattern_header.h"
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbrushpixmap.h"
|
||||
#include "paint_core.h"
|
||||
#include "gimprc.h"
|
||||
|
@ -30,7 +31,7 @@ gimp_brush_pixmap_class_init (GimpBrushPixmapClass *klass)
|
|||
|
||||
object_class = GTK_OBJECT_CLASS(klass);
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_BRUSH);
|
||||
parent_class = gtk_type_class (gimp_brush_get_type());
|
||||
object_class->destroy = gimp_brush_pixmap_destroy;
|
||||
}
|
||||
|
||||
|
@ -40,9 +41,9 @@ gimp_brush_pixmap_init(GimpBrushPixmap *brush)
|
|||
brush->pixmap_mask = NULL;
|
||||
}
|
||||
|
||||
guint gimp_brush_pixmap_get_type(void)
|
||||
GtkType gimp_brush_pixmap_get_type(void)
|
||||
{
|
||||
static GtkType type;
|
||||
static GtkType type=0;
|
||||
if(!type){
|
||||
GtkTypeInfo info={
|
||||
"GimpBrushPixmap",
|
||||
|
@ -50,8 +51,9 @@ guint gimp_brush_pixmap_get_type(void)
|
|||
sizeof(GimpBrushPixmapClass),
|
||||
(GtkClassInitFunc)gimp_brush_pixmap_class_init,
|
||||
(GtkObjectInitFunc)gimp_brush_pixmap_init,
|
||||
NULL,
|
||||
NULL };
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserver_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL};
|
||||
type=gtk_type_unique(GIMP_TYPE_BRUSH, &info);
|
||||
}
|
||||
return type;
|
||||
|
|
|
@ -13,7 +13,7 @@ typedef struct _GimpBrushPixmapClass
|
|||
{
|
||||
GimpBrushClass parent_class;
|
||||
|
||||
void (* generate) (GimpBrushPixmap *brush);
|
||||
void (* generate) (GimpBrushPixmap *brush);
|
||||
} GimpBrushPixmapClass;
|
||||
|
||||
/* object stuff */
|
||||
|
@ -21,7 +21,7 @@ typedef struct _GimpBrushPixmapClass
|
|||
#define GIMP_BRUSH_PIXMAP(obj) (GIMP_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIXMAP, GimpBrushPixmap))
|
||||
#define GIMP_IS_BRUSH_PIXMAP(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIXMAP))
|
||||
|
||||
guint gimp_brush_pixmap_get_type (void);
|
||||
GtkType gimp_brush_pixmap_get_type (void);
|
||||
|
||||
GimpBrushPixmap * gimp_brush_pixmap_new (char *filename);
|
||||
GimpBrushPixmap * gimp_brush_pixmap_load (char *filename);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "appenv.h"
|
||||
#include "gimpbrushpixmap.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimpbrushhose.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -124,8 +125,8 @@ pixmapbrush_options_new (void)
|
|||
|
||||
void *
|
||||
pixmap_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
int state)
|
||||
GimpDrawable *drawable,
|
||||
int state)
|
||||
{
|
||||
#if TIMED_BRUSH
|
||||
static GTimer *timer;
|
||||
|
@ -203,16 +204,23 @@ pixmapbrush_motion (PaintCore *paint_core,
|
|||
/* unsigned char col[MAX_CHANNELS]; */
|
||||
void * pr;
|
||||
int opacity;
|
||||
GimpBrushHose *brush;
|
||||
|
||||
pr = NULL;
|
||||
|
||||
if(GIMP_IS_BRUSH_PIXMAP(paint_core->brush)){
|
||||
printf("looks like were a pixmap\n");
|
||||
}
|
||||
|
||||
/* ttemp hack just for kicks. remove */
|
||||
/* paint_core->brush = gimp_brush_list_get_brush_by_index(brush_list,
|
||||
(rand()% gimp_brush_list_length(brush_list))); */
|
||||
|
||||
if(! (GIMP_IS_BRUSH_PIXMAP(paint_core->brush)))
|
||||
return;
|
||||
if(!( GIMP_IS_BRUSH_HOSE(paint_core->brush))){
|
||||
printf("not gimpbrushhose apparently...but why not i have no idea\n");
|
||||
}
|
||||
|
||||
// brush = GIMP_BRUSH_HOSE(paint_core->brush);
|
||||
|
||||
|
||||
//paint_core->brush = gimp_brush_list_get_brush_by_index(&(GIMP_BRUSH_HOSE(brush))->brush_list, 0);
|
||||
|
||||
/* We always need a destination image */
|
||||
if (! (gimage = drawable_gimage (drawable)))
|
||||
return;
|
||||
|
@ -267,8 +275,8 @@ color_area_with_pixmap (GImage *dest,
|
|||
|
||||
|
||||
pr = NULL;
|
||||
pixmapbrush = brush;;
|
||||
pixmap_data = gimp_brush_pixmap_get_pixmap(brush);
|
||||
pixmapbrush = GIMP_BRUSH_PIXMAP(brush);
|
||||
pixmap_data = gimp_brush_pixmap_get_pixmap(GIMP_BRUSH_PIXMAP(brush));
|
||||
position = 0.0;
|
||||
/* stolen from clone.c */
|
||||
/* this should be a similar thing to want to do, right? */
|
||||
|
|
Loading…
Reference in New Issue