~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to libgimp/gimppalettes_pdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * gimppalettes_pdb.c
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
/* NOTE: This file is autogenerated by pdbgen.pl */
 
23
 
 
24
#include "config.h"
 
25
 
 
26
#include "gimp.h"
 
27
 
 
28
/**
 
29
 * gimp_palettes_refresh:
 
30
 *
 
31
 * Refreshes current palettes. This function always succeeds.
 
32
 *
 
33
 * This procedure retrieves all palettes currently in the user's
 
34
 * palette path and updates the palette dialogs accordingly.
 
35
 *
 
36
 * Returns: TRUE on success.
 
37
 */
 
38
gboolean
 
39
gimp_palettes_refresh (void)
 
40
{
 
41
  GimpParam *return_vals;
 
42
  gint nreturn_vals;
 
43
  gboolean success = TRUE;
 
44
 
 
45
  return_vals = gimp_run_procedure ("gimp_palettes_refresh",
 
46
                                    &nreturn_vals,
 
47
                                    GIMP_PDB_END);
 
48
 
 
49
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
50
 
 
51
  gimp_destroy_params (return_vals, nreturn_vals);
 
52
 
 
53
  return success;
 
54
}
 
55
 
 
56
/**
 
57
 * gimp_palettes_get_list:
 
58
 * @filter: An optional regular expression used to filter the list.
 
59
 * @num_palettes: The number of palettes in the list.
 
60
 *
 
61
 * Retrieves a list of all of the available palettes
 
62
 *
 
63
 * This procedure returns a complete listing of available palettes.
 
64
 * Each name returned can be used as input to the command
 
65
 * 'gimp_context_set_palette'.
 
66
 *
 
67
 * Returns: The list of palette names.
 
68
 */
 
69
gchar **
 
70
gimp_palettes_get_list (const gchar *filter,
 
71
                        gint        *num_palettes)
 
72
{
 
73
  GimpParam *return_vals;
 
74
  gint nreturn_vals;
 
75
  gchar **palette_list = NULL;
 
76
  gint i;
 
77
 
 
78
  return_vals = gimp_run_procedure ("gimp_palettes_get_list",
 
79
                                    &nreturn_vals,
 
80
                                    GIMP_PDB_STRING, filter,
 
81
                                    GIMP_PDB_END);
 
82
 
 
83
  *num_palettes = 0;
 
84
 
 
85
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
86
    {
 
87
      *num_palettes = return_vals[1].data.d_int32;
 
88
      palette_list = g_new (gchar *, *num_palettes);
 
89
      for (i = 0; i < *num_palettes; i++)
 
90
        palette_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
 
91
    }
 
92
 
 
93
  gimp_destroy_params (return_vals, nreturn_vals);
 
94
 
 
95
  return palette_list;
 
96
}
 
97
 
 
98
/**
 
99
 * gimp_palettes_get_palette:
 
100
 * @num_colors: The palette num_colors.
 
101
 *
 
102
 * This procedure is deprecated! Use gimp_context_get_palette()
 
103
 * instead.
 
104
 *
 
105
 * Returns: The palette name.
 
106
 */
 
107
gchar *
 
108
gimp_palettes_get_palette (gint *num_colors)
 
109
{
 
110
  GimpParam *return_vals;
 
111
  gint nreturn_vals;
 
112
  gchar *name = NULL;
 
113
 
 
114
  return_vals = gimp_run_procedure ("gimp_palettes_get_palette",
 
115
                                    &nreturn_vals,
 
116
                                    GIMP_PDB_END);
 
117
 
 
118
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
119
    {
 
120
      name = g_strdup (return_vals[1].data.d_string);
 
121
      *num_colors = return_vals[2].data.d_int32;
 
122
    }
 
123
 
 
124
  gimp_destroy_params (return_vals, nreturn_vals);
 
125
 
 
126
  return name;
 
127
}
 
128
 
 
129
/**
 
130
 * gimp_palettes_get_palette_entry:
 
131
 * @name: The palette name (\"\" means currently active palette).
 
132
 * @entry_num: The entry to retrieve.
 
133
 * @num_colors: The palette num_colors.
 
134
 * @color: The color requested.
 
135
 *
 
136
 * This procedure is deprecated! Use gimp_palette_entry_get_color()
 
137
 * instead.
 
138
 *
 
139
 * Returns: The palette name.
 
140
 */
 
141
gchar *
 
142
gimp_palettes_get_palette_entry (const gchar *name,
 
143
                                 gint         entry_num,
 
144
                                 gint        *num_colors,
 
145
                                 GimpRGB     *color)
 
146
{
 
147
  GimpParam *return_vals;
 
148
  gint nreturn_vals;
 
149
  gchar *ret_name = NULL;
 
150
 
 
151
  return_vals = gimp_run_procedure ("gimp_palettes_get_palette_entry",
 
152
                                    &nreturn_vals,
 
153
                                    GIMP_PDB_STRING, name,
 
154
                                    GIMP_PDB_INT32, entry_num,
 
155
                                    GIMP_PDB_END);
 
156
 
 
157
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
158
    {
 
159
      ret_name = g_strdup (return_vals[1].data.d_string);
 
160
      *num_colors = return_vals[2].data.d_int32;
 
161
      *color = return_vals[3].data.d_color;
 
162
    }
 
163
 
 
164
  gimp_destroy_params (return_vals, nreturn_vals);
 
165
 
 
166
  return ret_name;
 
167
}