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

app/gimpbrushhose.c removed. app/gimpbrushpipe.c New files to replace the

Mon Aug 23 00:56:59 EDT 1999 Adrian Likins <alikins@redhat.com>

        * app/gimpbrushhose.c
        * app/gimpbrushhose.h:
                removed.
        * app/gimpbrushpipe.c
        * app/gimpbrushpipe.h:
                New files to replace the above
        * app/gimpbrushlist.c
        * app/paintbrush.c
        * app/pixmapbrush.c
        * app/Makefile.am:
                s/hose/pipe. Seems someone else uses that name,
        so change it to pipe.

        * app/gimpbrush.c
        * app/gimpbrush.h
        * app/gimpbrushpixmap.c
        * app/patterns.c
        * app/patterns.h
        * app/pixmapbrush.c:
                Added functions to do the actual loading of
        brush/pattern data. Use them where approriate instead
        of cut&pasting the same code all over the place.

        * app/pixmapbrush.c: Fix the bug where masks and brush
        data werent aligned. I didnt quite notice that
        paint_core_get_paint_area returns an area with a 1 pixel
        border larger than the brush. Ooops.

        * TODO: just update a few things while I'm at it
        (pixmap/pipe stuff in particular)
parent 3f00c01b
Mon Aug 23 00:56:59 EDT 1999 Adrian Likins <alikins@redhat.com>
* app/gimpbrushhose.c
* app/gimpbrushhose.h:
removed.
* app/gimpbrushpipe.c
* app/gimpbrushpipe.h:
New files to replace the above
* app/gimpbrushlist.c
* app/paintbrush.c
* app/pixmapbrush.c
* app/Makefile.am:
s/hose/pipe. Seems someone else uses that name,
so change it to pipe.
* app/gimpbrush.c
* app/gimpbrush.h
* app/gimpbrushpixmap.c
* app/patterns.c
* app/patterns.h
* app/pixmapbrush.c:
Added functions to do the actual loading of
brush/pattern dialog. Use them where approriate instead
of c&p the same code all over the place.
* app/pixmapbrush.c: Fix the bug where masks and brush
data werent aligned. I didnt quite notice that
paint_core_get_paint_area returns an area with a 1 pixel
border larger than the brush. Ooops.
* TODO: just update a few things while I'm at it
(pixmap/pipe stuff in particular)
Sun Aug 22 15:49:10 PDT 1999 Manish Singh <yosh@gimp.org>
* configure.in: add check for zlib for building psp plugin
......
......@@ -8,6 +8,20 @@ Add Unsharp Mask to the distribution. The filter is just way too basic
to leave out.
For the pixmap/hose stuff:
a loader/saver plugin for the hose types
(tml has a gpb saver, and a .tub loader...getting close)
add a "pipe edit" option to the brush dialog so we can
call up a hose editor (to reorder images, scale them, etc)
"selection to brush" and as part of that, some general
TileManager->TempBuf functions.
Load pipes as xcf maybe? would need above functiosn first
A few GUI things suggestions...
1) Crop tool could have an optional shader for the outside area
......@@ -181,6 +195,8 @@ drag & drop for layers:
raise by one, and lower by one. It would be much nicer to be
able to click & drag a layer to its new spot in the stack.
Done, by Michael Natterer 8/22/99
Handle Out of Space Better!
Also should handle out-of-space on swap device better.
......@@ -242,7 +258,7 @@ active brushes:
Maybe really want to define new tool types, rather than new brush
types.
pixmap brushes:
*pixmap brushes:
Should be simple. maybe need a new format that would include
data/mask (probabaly just use a xcf). Once its loaded in as a
......@@ -250,12 +266,16 @@ pixmap brushes:
it. Should it be a new tool? jsut a new brush type for old
paint to ls?
Quickmask/paintable selections:
Just about done: Adrian Likins 8/23/99
*Quickmask/paintable selections:
Any ideas on the best way to do the ui? The fundamentals of
beng able to do this are already there. Just need a good way to
present it.
Done: Seth Burgess
let pdb stuff register under the layers_dialog menu:
Lots of potential in scripts to do layer/channel manip. Might
......@@ -405,3 +425,11 @@ Grid
intersection.
(this was suggested to me by email -- Sven)
"font" brush?
a brush that could use chars rendered from fonts as the brush
bitmap. limited utility for char's, but a couple of nice sets
of winding fonts could make it interestings. And you could
use words or strings.
......@@ -185,8 +185,8 @@ gimp_SOURCES = \
gimpbrush.h \
gimpbrushgenerated.c \
gimpbrushgenerated.h \
gimpbrushhose.c \
gimpbrushhose.h \
gimpbrushpipe.c \
gimpbrushpipe.h \
gimpbrushpixmap.c \
gimpbrushpixmap.h \
gimpbrushlist.c \
......
......@@ -165,11 +165,6 @@ void
gimp_brush_load(GimpBrush *brush, char *filename)
{
FILE * fp;
int bn_size;
unsigned char buf [sz_BrushHeader];
BrushHeader header;
unsigned int * hp;
int i;
brush->filename = g_strdup (filename);
......@@ -180,12 +175,32 @@ gimp_brush_load(GimpBrush *brush, char *filename)
return;
}
gimp_brush_load_brush(brush,fp,filename);
/* Clean up */
fclose (fp);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
temp_buf_swap (brush->mask);
}
int
gimp_brush_load_brush(GimpBrush *brush, FILE* fp, char* filename)
{
int bn_size;
unsigned char buf [sz_BrushHeader];
BrushHeader header;
unsigned int * hp;
int i;
/* Read in the header size */
if ((fread (buf, 1, sz_BrushHeader, fp)) < sz_BrushHeader)
{
fclose (fp);
gimp_object_destroy (brush);
return;
return 0;
}
/* rearrange the bytes in each unsigned int */
......@@ -197,25 +212,26 @@ gimp_brush_load(GimpBrush *brush, char *filename)
/* 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;
return 0;
}
}
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;
}
{
/* 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 */
/* Read in the brush name */
if ((bn_size = (header.header_size - sz_BrushHeader)))
{
brush->name = (char *) g_malloc (sizeof (char) * bn_size);
......@@ -224,7 +240,7 @@ gimp_brush_load(GimpBrush *brush, char *filename)
g_message (_("Error in GIMP brush file...aborting."));
fclose (fp);
gimp_object_destroy (brush);
return;
return 0;
}
}
else
......@@ -253,20 +269,8 @@ gimp_brush_load(GimpBrush *brush, char *filename)
header.version, filename);
fclose (fp);
gimp_object_destroy (brush);
return;
return 0;
}
/* Clean up */
fclose (fp);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
temp_buf_swap (brush->mask);
/* Check if the current brush is the default one */
/* lets see if it works with out this for now */
/* if (strcmp(default_brush, g_basename(filename)) == 0) {
active_brush = brush;
have_default_brush = 1;
}*/ /* if */
return 1;
}
......@@ -165,11 +165,6 @@ void
gimp_brush_load(GimpBrush *brush, char *filename)
{
FILE * fp;
int bn_size;
unsigned char buf [sz_BrushHeader];
BrushHeader header;
unsigned int * hp;
int i;
brush->filename = g_strdup (filename);
......@@ -180,12 +175,32 @@ gimp_brush_load(GimpBrush *brush, char *filename)
return;
}
gimp_brush_load_brush(brush,fp,filename);
/* Clean up */
fclose (fp);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
temp_buf_swap (brush->mask);
}
int
gimp_brush_load_brush(GimpBrush *brush, FILE* fp, char* filename)
{
int bn_size;
unsigned char buf [sz_BrushHeader];
BrushHeader header;
unsigned int * hp;
int i;
/* Read in the header size */
if ((fread (buf, 1, sz_BrushHeader, fp)) < sz_BrushHeader)
{
fclose (fp);
gimp_object_destroy (brush);
return;
return 0;
}
/* rearrange the bytes in each unsigned int */
......@@ -197,25 +212,26 @@ gimp_brush_load(GimpBrush *brush, char *filename)
/* 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;
return 0;
}
}
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;
}
{
/* 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 */
/* Read in the brush name */
if ((bn_size = (header.header_size - sz_BrushHeader)))
{
brush->name = (char *) g_malloc (sizeof (char) * bn_size);
......@@ -224,7 +240,7 @@ gimp_brush_load(GimpBrush *brush, char *filename)
g_message (_("Error in GIMP brush file...aborting."));
fclose (fp);
gimp_object_destroy (brush);
return;
return 0;
}
}
else
......@@ -253,20 +269,8 @@ gimp_brush_load(GimpBrush *brush, char *filename)
header.version, filename);
fclose (fp);
gimp_object_destroy (brush);
return;
return 0;
}
/* Clean up */
fclose (fp);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
temp_buf_swap (brush->mask);
/* Check if the current brush is the default one */
/* lets see if it works with out this for now */
/* if (strcmp(default_brush, g_basename(filename)) == 0) {
active_brush = brush;
have_default_brush = 1;
}*/ /* if */
return 1;
}
......@@ -19,6 +19,7 @@
#ifndef __GIMPBRUSH_H__
#define __GIMPBRUSH_H__
#include <stdio.h>
#include "gimpobjectP.h"
#include "temp_buf.h"
#include "vector2d.h"
......@@ -51,6 +52,7 @@ typedef struct _GimpBrushClass GimpBrushClass;
GimpBrush * gimp_brush_new (char *filename);
void gimp_brush_load (GimpBrush *brush, char *filename);
int gimp_brush_load_brush (GimpBrush *brush, FILE* fp, char* filename);
GtkType gimp_brush_get_type (void);
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
char * gimp_brush_get_name (GimpBrush *brush);
......
#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 "patterns.h"
#include "gimpbrush.h"
#include "gimpbrushpixmap.h"
#include "gimpbrushlist.h"
#include "paint_core.h"
#include "gimprc.h"
#include "gimpbrushpipe.h"
#include "libgimp/gimpintl.h"
static void
gimp_brush_pipe_generate(GimpBrushPipe *brush);
static GimpObjectClass* parent_class;
static void
gimp_brush_pipe_destroy(GtkObject *object)
{
GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (GIMP_TYPE_BRUSH_PIXMAP);
object_class->destroy = gimp_brush_pipe_destroy;
}
void
gimp_brush_pipe_init(GimpBrushPipe *brush)
{
brush->name = NULL;
brush->filename = NULL;
brush->brush_list = gimp_brush_list_new();
}
GtkType gimp_brush_pipe_get_type(void)
{
static GtkType type=0;
if(!type){
GtkTypeInfo info={
"GimpBrushPipe",
sizeof(GimpBrushPipe),
sizeof(GimpBrushPipeClass),
(GtkClassInitFunc)gimp_brush_pipe_class_init,
(GtkObjectInitFunc)gimp_brush_pipe_init,
/* reserved_1 */ NULL,
/* reserver_2 */ NULL,
(GtkClassInitFunc) NULL};
type=gtk_type_unique(GIMP_TYPE_BRUSH_PIXMAP, &info);
}
return type;
}
GimpBrushPipe *
gimp_brush_pipe_load (char *file_name)
{
GimpBrushPipe *pipe;
GimpBrushPixmap *brush;
GimpBrushList *list;
GPatternP pattern;
FILE *fp;
gchar buf2[1024];
int num_of_brushes;
int brush_count=0;
pipe = GIMP_BRUSH_PIPE(gimp_type_new(gimp_brush_pipe_get_type()));
GIMP_BRUSH_PIPE(pipe)->filename = g_strdup(file_name);
pattern = (GPatternP) g_malloc (sizeof (GPattern));
pattern->filename = g_strdup (file_name);
pattern->name = NULL;
pattern->mask = NULL;
brush = GIMP_BRUSH_PIXMAP (pipe);
list = gimp_brush_list_new();
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';
pipe->name = g_strdup(buf2);
/* get the number of brushes */
if(fgets (buf2, 1024, fp) == NULL)
return NULL;
num_of_brushes = strtol(buf2,NULL,10);
while(brush_count < num_of_brushes)
{
if (brush_count > 0)
brush = GIMP_BRUSH_PIXMAP(gimp_type_new(gimp_brush_pixmap_get_type()));
GIMP_BRUSH(brush)->filename = g_strdup(file_name);
/* load the brush */
if(!gimp_brush_load_brush(GIMP_BRUSH(brush),fp,file_name))
{
g_message (_("failed to load a brush mask in the pipe"));
return NULL;
}
/* load the pattern data*/
if(!load_pattern_pattern(pattern, fp, file_name))
{
g_message (_("failed to load a section of pixmap mask in the pipe"));
return NULL;
}
brush->pixmap_mask = pattern->mask;
gimp_brush_list_add(list,GIMP_BRUSH(brush));
brush_count++;
}
fclose (fp);
if (!GIMP_IS_BRUSH_PIPE(pipe))
g_print ("Is not BRUSH_PIPE???\n");
pipe->brush_list = list;
return pipe;
}
#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 "patterns.h"
#include "gimpbrush.h"
#include "gimpbrushpixmap.h"
#include "gimpbrushlist.h"
#include "paint_core.h"
#include "gimprc.h"
#include "gimpbrushpipe.h"
#include "libgimp/gimpintl.h"
static void
gimp_brush_pipe_generate(GimpBrushPipe *brush);
static GimpObjectClass* parent_class;
static void
gimp_brush_pipe_destroy(GtkObject *object)
{
GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class (GIMP_TYPE_BRUSH_PIXMAP);
object_class->destroy = gimp_brush_pipe_destroy;
}
void
gimp_brush_pipe_init(GimpBrushPipe *brush)
{
brush->name = NULL;
brush->filename = NULL;
brush->brush_list = gimp_brush_list_new();
}
GtkType gimp_brush_pipe_get_type(void)
{
static GtkType type=0;
if(!type){
GtkTypeInfo info={
"GimpBrushPipe",
sizeof(GimpBrushPipe),
sizeof(GimpBrushPipeClass),
(GtkClassInitFunc)gimp_brush_pipe_class_init,
(GtkObjectInitFunc)gimp_brush_pipe_init,
/* reserved_1 */ NULL,
/* reserver_2 */ NULL,
(GtkClassInitFunc) NULL};
type=gtk_type_unique(GIMP_TYPE_BRUSH_PIXMAP, &info);
}
return type;
}
GimpBrushPipe *
gimp_brush_pipe_load (char *file_name)
{
GimpBrushPipe *pipe;
GimpBrushPixmap *brush;
GimpBrushList *list;
GPatternP pattern;
FILE *fp;
gchar buf2[1024];
int num_of_brushes;
int brush_count=0;
pipe = GIMP_BRUSH_PIPE(gimp_type_new(gimp_brush_pipe_get_type()));
GIMP_BRUSH_PIPE(pipe)->filename = g_strdup(file_name);
pattern = (GPatternP) g_malloc (sizeof (GPattern));
pattern->filename = g_strdup (file_name);
pattern->name = NULL;
pattern->mask = NULL;
brush = GIMP_BRUSH_PIXMAP (pipe);
list = gimp_brush_list_new();
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';
pipe->name = g_strdup(buf2);
/* get the number of brushes */
if(fgets (buf2, 1024, fp) == NULL)
return NULL;
num_of_brushes = strtol(buf2,NULL,10);
while(brush_count < num_of_brushes)
{