gimpressionist.h 4.75 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* GIMP - The GNU Image Manipulation Program
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
18

19 20 21 22 23 24
#ifndef __GIMPRESSIONIST_H
#define __GIMPRESSIONIST_H

/* Includes necessary for the correct processing of this file. */
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
25 26

#include "ppmtool.h"
27 28
/* Defines */

29
#define PLUG_IN_NAME    "plug-in-gimpressionist"
30
#define PLUG_IN_VERSION "v1.0, November 2003"
Manish Singh's avatar
Manish Singh committed
31

32 33 34
#define PREVIEWSIZE     150
#define MAXORIENTVECT   50
#define MAXSIZEVECT     50
Manish Singh's avatar
Manish Singh committed
35 36 37

/* Type declaration and definitions */

38 39
typedef struct vector
{
Manish Singh's avatar
Manish Singh committed
40 41 42 43
  double x, y;
  double dir;
  double dx, dy;
  double str;
44
  int    type;
45
} vector_t;
Manish Singh's avatar
Manish Singh committed
46

47 48
typedef struct smvector
{
Manish Singh's avatar
Manish Singh committed
49 50 51
  double x, y;
  double siz;
  double str;
52
} smvector_t;
Manish Singh's avatar
Manish Singh committed
53

54 55
typedef struct
{
56 57 58 59 60 61 62
  int        orient_num;
  double     orient_first;
  double     orient_last;
  int        orient_type;
  double     brush_relief;
  double     brush_scale;
  double     brush_density;
63
  double     brushgamma;
64 65 66 67
  int        general_background_type;
  double     general_dark_edge;
  double     paper_relief;
  double     paper_scale;
68
  int        paper_invert;
69
  int        run;
70 71
  char       selected_brush[200];
  char       selected_paper[200];
72
  GimpRGB    color;
73
  int        general_paint_edges;
74 75 76
  int        place_type;
  vector_t   orient_vectors[MAXORIENTVECT];
  int        num_orient_vectors;
77
  int        placement_center;
78 79 80
  double     brush_aspect;
  double     orient_angle_offset;
  double     orient_strength_exponent;
81
  int        general_tileable;
82
  int        paper_overlay;
83
  int        orient_voronoi;
84
  int        color_brushes;
85
  int        general_drop_shadow;
86 87 88 89 90
  double     general_shadow_darkness;
  int        size_num;
  double     size_first;
  double     size_last;
  int        size_type;
91
  double     devthresh;
Manish Singh's avatar
Manish Singh committed
92

93 94 95 96
  smvector_t size_vectors[MAXSIZEVECT];
  int        num_size_vectors;
  double     size_strength_exponent;
  int        size_voronoi;
Manish Singh's avatar
Manish Singh committed
97

98 99
  int        general_shadow_depth;
  int        general_shadow_blur;
100

101 102
  int        color_type;
  double     color_noise;
Manish Singh's avatar
Manish Singh committed
103 104
} gimpressionist_vals_t;

105 106 107 108 109 110 111 112 113 114
/* Enumerations */

enum GENERAL_BG_TYPE_ENUM
{
    BG_TYPE_SOLID = 0,
    BG_TYPE_KEEP_ORIGINAL = 1,
    BG_TYPE_FROM_PAPER = 2,
    BG_TYPE_TRANSPARENT = 3,
};

115 116 117 118 119 120
enum PRESETS_LIST_COLUMN_ENUM
{
  PRESETS_LIST_COLUMN_FILENAME = 0,
  PRESETS_LIST_COLUMN_OBJECT_NAME = 1,
};

Manish Singh's avatar
Manish Singh committed
121 122 123
/* Globals */

extern gimpressionist_vals_t pcvals;
124

Manish Singh's avatar
Manish Singh committed
125 126 127

/* Prototypes */

128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
GList *parsepath (void);
void free_parsepath_cache (void);

void grabarea (void);
void store_values (void);
void restore_values (void);
gchar *findfile (const gchar *);

void unselectall (GtkWidget *list);
void reselect (GtkWidget *list, char *fname);
void readdirintolist (char *subdir, GtkWidget *view, char *selected);
void readdirintolist_extended (char *subdir, GtkWidget *view, char *selected,
                               gboolean with_filename_column,
                               gchar *(*get_object_name_cb)
                               (gchar *dir, gchar *filename, void *context),
                               void * context);

GtkWidget *create_one_column_list (GtkWidget *parent,
			           void (*changed_cb)
147
			           (GtkTreeSelection *selection,
148 149 150 151
                                    gpointer data));

void brush_reload (const gchar *fn, struct ppm *p);

152
double get_direction (double x, double y, int from);
153

154
void create_sizemap_dialog (GtkWidget *parent);
155 156 157 158 159 160 161
double getsiz_proto (double x, double y, int n, smvector_t *vec,
                     double smstrexp, int voronoi);


void set_colorbrushes (const gchar *fn);
int  create_gimpressionist (void);

162
double dist (double x, double y, double dx, double dy);
163

164
void restore_default_values (void);
165

166
GtkWidget *create_radio_button (GtkWidget *box, int orient_type,
167 168
                                void (*callback)(GtkWidget *wg, void *d),
                                gchar *label, gchar *help_string,
169
                                GSList **radio_group,
170 171 172
                                GtkWidget **buttons_array
                               );

173 174
#define CLAMP_UP_TO(x, max) (CLAMP((x),(0),(max-1)))

175 176
#endif /* #ifndef __GIMPRESSIONIST_H */

177