added utility function gimp_rgb_get_gdk_color(), documented
2003-06-10 Sven Neumann <sven@gimp.org> * app/widgets/gimpwidgets-utils.[ch]: added utility function gimp_rgb_get_gdk_color(), documented gimp_get_screen_resolution(). * app/widgets/gimppreviewrenderer.c (gimp_preview_renderer_set_border_color) * app/display/gimpdisplayshell-appearance.c (gimp_display_shell_set_padding): use the new function.
This commit is contained in:
committed by
Sven Neumann
parent
55eea34f1c
commit
addba61b08
@ -26,6 +26,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
@ -407,6 +408,7 @@ gimp_get_mod_name_alt (void)
|
||||
|
||||
return (const gchar *) mod_name_alt;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gimp_get_mod_separator (void)
|
||||
{
|
||||
@ -424,6 +426,15 @@ gimp_get_mod_separator (void)
|
||||
return (const gchar *) mod_separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_get_screen_resolution:
|
||||
* @screen: a #GdkScreen or %NULL
|
||||
* @xres: returns the horizontal screen resolution (in dpi)
|
||||
* @yres: returns the vertical screen resolution (in dpi)
|
||||
*
|
||||
* Retrieves the screen resolution from GDK. If @screen is %NULL, the
|
||||
* default screen is used.
|
||||
**/
|
||||
void
|
||||
gimp_get_screen_resolution (GdkScreen *screen,
|
||||
gdouble *xres,
|
||||
@ -477,3 +488,29 @@ gimp_get_screen_resolution (GdkScreen *screen,
|
||||
*xres = ROUND (x);
|
||||
*yres = ROUND (y);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_rgb_get_gdk_color:
|
||||
* @color: the source color as #GimpRGB
|
||||
* @gdk_color: pointer to a #GdkColor
|
||||
*
|
||||
* Initializes @gdk_color from a #GimpRGB. This function does not
|
||||
* allocate the color for you. Depending on how you want to use it,
|
||||
* you may have to call gdk_colormap_alloc_color().
|
||||
**/
|
||||
void
|
||||
gimp_rgb_get_gdk_color (const GimpRGB *color,
|
||||
GdkColor *gdk_color)
|
||||
{
|
||||
guchar r, g, b;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (gdk_color != NULL);
|
||||
|
||||
gimp_rgb_get_uchar (color, &r, &g, &b);
|
||||
|
||||
gdk_color->red = (r << 8) | r;
|
||||
gdk_color->green = (g << 8) | g;
|
||||
gdk_color->blue = (b << 8) | b;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user