Gtk2

 view release on metacpan or  search on metacpan

xs/GdkColor.xs  view on Meta::CPAN

*/

MODULE = Gtk2::Gdk::Color	PACKAGE = Gtk2::Gdk::Colormap	PREFIX = gdk_colormap_

=for position DESCRIPTION

=head1 DESCRIPTION

Colormaps are used to store the mappings between the RGB values you ask for
and the actual, hardware-dependent values used to display those colors.
The C<< $colormap->alloc_color >> and C<< $colormap->alloc_colors >> methods
do the necessary work to allocate a color within the visual; this actually
has nothing to do with memory management, so it is important that you call
C<< $colormap->free_colors >> to release those spots in the colormap
allocated by C<alloc_color> and C<alloc_colors>.

=cut

 ## GdkColormap* gdk_colormap_new (GdkVisual *visual, gboolean allocate)
GdkColormap_noinc*
gdk_colormap_new (class, visual, allocate)
	GdkVisual *visual
	gboolean allocate
    C_ARGS:
	visual, allocate

 ## deprecated
 ## GdkColormap* gdk_colormap_ref (GdkColormap *cmap)
 ## deprecated
 ## void gdk_colormap_unref (GdkColormap *cmap)

 ## GdkColormap* gdk_colormap_get_system (void)
GdkColormap*
gdk_colormap_get_system (class)
    C_ARGS:
	/* void */


 ## deprecated
 ## gint gdk_colormap_get_system_size (void)

 ## gint gdk_colormap_alloc_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writeable, gboolean best_match, gboolean *success)
## success becomes an array of TRUE or FALSE corresponding to each input
## color, telling whether each one was successfully allocated.  the return
## value is the number that were NOT allocated.
=for apidoc
=for arg ... of Gtk2::Gdk::Color's to be allocated
Returns a list of boolean values, telling whether the color at the
corresponding spot in I<...> could be allocated.
=cut
void
gdk_colormap_alloc_colors (colormap, writeable, best_match, ...)
	GdkColormap *colormap
	gboolean writeable
	gboolean best_match
    PREINIT:
	gint ncolors, i;
	GdkColor *colors = NULL;
	GdkColor **argcolors = NULL; /* so we can modify the ones passed in */
	gboolean *success = NULL;
    PPCODE:
#define first 3
	ncolors = items - first;
	if (ncolors < 1)
		XSRETURN_EMPTY;
	colors = g_new0 (GdkColor, ncolors);
	argcolors = g_new0 (GdkColor*, ncolors);
	success = g_new0 (gboolean, ncolors);
	for (i = 0 ; i < ncolors ; i++) {
		argcolors[i] = SvGdkColor (ST (first + i));
		colors[i] = *(argcolors[i]);
	}
	gdk_colormap_alloc_colors (colormap, colors, ncolors, writeable,
	                           best_match, success);
	EXTEND (SP, ncolors);
	for (i = 0 ; i < ncolors ; i++) {
		*(argcolors[i]) = colors[i];
		PUSHs (sv_2mortal (newSViv (success[i])));
	}
	g_free (argcolors);
	g_free (colors);
	g_free (success);
#undef first

 ## gboolean gdk_colormap_alloc_color (GdkColormap *colormap, GdkColor *color, gboolean writeable, gboolean best_match)
gboolean
gdk_colormap_alloc_color (colormap, color, writeable, best_match)
	GdkColormap *colormap
	GdkColor *color
	gboolean writeable
	gboolean best_match

 # this deallocates colors in the colormap, as allocated by alloc_color(s)
 # above; it has nothing to do with memory management.  we do need this.
 ## void gdk_colormap_free_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors)
=for apidoc
=for arg ... of Gtk2::Gdk::Color's to be freed
=cut
void
gdk_colormap_free_colors (colormap, ...)
	GdkColormap *colormap
    PREINIT:
	GdkColor *colors;
	gint ncolors, i;
    CODE:
#define first 1
	ncolors = items - first;
	if (ncolors < 1)
		XSRETURN_EMPTY;
	colors = g_new (GdkColor, ncolors);
	for (i = 0; i < ncolors ; i++) {
		GdkColor * c = (GdkColor*) SvGdkColor (ST (i + first));
		colors[i] = *c;
	}
	gdk_colormap_free_colors (colormap, colors, ncolors);
	g_free (colors);
#undef first

 ## void gdk_colormap_query_color (GdkColormap *colormap, gulong pixel, GdkColor *result)
GdkColor_copy *
gdk_colormap_query_color (colormap, pixel)



( run in 0.710 second using v1.01-cache-2.11-cpan-5511b514fd6 )