gimp-utils.h 3.85 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2 3
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7 8 9 10 11 12 13 14
 * (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
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17 18 19 20 21
 */

#ifndef __APP_GIMP_UTILS_H__
#define __APP_GIMP_UTILS_H__


22 23 24 25
#define GIMP_TIMER_START() \
  { GTimer *_timer = g_timer_new ();

#define GIMP_TIMER_END(message) \
26
  g_printerr ("%s: %s took %0.4f seconds\n", \
27
              G_STRFUNC, message, g_timer_elapsed (_timer, NULL)); \
28 29 30
  g_timer_destroy (_timer); }


31 32 33 34
#define MIN4(a,b,c,d) MIN (MIN ((a), (b)), MIN ((c), (d)))
#define MAX4(a,b,c,d) MAX (MAX ((a), (b)), MAX ((c), (d)))


35 36 37
gint         gimp_get_pid                          (void);
guint64      gimp_get_physical_memory_size         (void);
gchar      * gimp_get_backtrace                    (void);
38 39 40 41 42 43 44 45 46 47 48 49 50 51
gchar      * gimp_get_default_language             (const gchar     *category);
GimpUnit     gimp_get_default_unit                 (void);

GParameter * gimp_parameters_append                (GType            object_type,
                                                    GParameter      *params,
                                                    gint            *n_params,
                                                    ...) G_GNUC_NULL_TERMINATED;
GParameter * gimp_parameters_append_valist         (GType            object_type,
                                                    GParameter      *params,
                                                    gint            *n_params,
                                                    va_list          args);
void         gimp_parameters_free                  (GParameter      *params,
                                                    gint             n_params);

52 53
gchar      * gimp_markup_extract_text              (const gchar     *markup);

54 55
const gchar* gimp_enum_get_value_name              (GType            enum_type,
                                                    gint             value);
56

57 58 59 60 61 62
gboolean     gimp_get_fill_params                  (GimpContext      *context,
                                                    GimpFillType      fill_type,
                                                    GimpRGB          *color,
                                                    GimpPattern     **pattern,
                                                    GError          **error);

63 64 65 66 67 68 69 70 71 72 73 74 75
/* Common values for the n_snap_lines parameter of
 * gimp_constrain_line.
 */
#define GIMP_CONSTRAIN_LINE_90_DEGREES 2
#define GIMP_CONSTRAIN_LINE_45_DEGREES 4
#define GIMP_CONSTRAIN_LINE_15_DEGREES 12

void         gimp_constrain_line                   (gdouble          start_x,
                                                    gdouble          start_y,
                                                    gdouble         *end_x,
                                                    gdouble         *end_y,
                                                    gint             n_snap_lines);

76 77
gint         gimp_file_compare                     (GFile           *file1,
                                                    GFile           *file2);
78
gboolean     gimp_file_is_executable               (GFile           *file);
79

80 81 82
void         gimp_create_image_from_buffer         (Gimp            *gimp,
                                                    GeglBuffer      *buffer);

83 84

#endif /* __APP_GIMP_UTILS_H__ */