mirror of https://github.com/GNOME/gimp.git
libimp: merge public gimppixbuf functions into gimplayer and gimpdrawable
and remove gimppuxbuf.h from the public API. Keep the files privately for _gimp_pixbuf_from_data().
This commit is contained in:
parent
c08186e6fe
commit
b2582e80f6
|
@ -117,6 +117,8 @@ libgimp_private_sources = \
|
|||
gimpdb-private.h \
|
||||
gimppdbprocedure.c \
|
||||
gimppdbprocedure.h \
|
||||
gimppixbuf.c \
|
||||
gimppixbuf.h \
|
||||
gimpplugin-private.c \
|
||||
gimpplugin-private.h \
|
||||
gimp-debug.c \
|
||||
|
@ -189,7 +191,6 @@ gimpinclude_HEADERS = \
|
|||
gimpitemcombobox.h \
|
||||
gimppaletteselectbutton.h \
|
||||
gimppatternselectbutton.h \
|
||||
gimppixbuf.h \
|
||||
gimpprocbrowserdialog.h \
|
||||
gimpprocview.h \
|
||||
gimpprogressbar.h \
|
||||
|
|
|
@ -136,8 +136,6 @@ libgimp_introspectable = \
|
|||
$(top_srcdir)/libgimp/gimppatternselect.h \
|
||||
$(top_srcdir)/libgimp/gimppdb.c \
|
||||
$(top_srcdir)/libgimp/gimppdb.h \
|
||||
$(top_srcdir)/libgimp/gimppixbuf.c \
|
||||
$(top_srcdir)/libgimp/gimppixbuf.h \
|
||||
$(top_srcdir)/libgimp/gimpplugin.c \
|
||||
$(top_srcdir)/libgimp/gimpplugin.h \
|
||||
$(top_srcdir)/libgimp/gimpprocedure.c \
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include <libgimp/gimpparamspecs.h>
|
||||
#include <libgimp/gimppatternselect.h>
|
||||
#include <libgimp/gimppdb.h>
|
||||
#include <libgimp/gimppixbuf.h>
|
||||
#include <libgimp/gimpplugin.h>
|
||||
#include <libgimp/gimpprocedure.h>
|
||||
#include <libgimp/gimpprogress.h>
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#define GIMP_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gimp.h"
|
||||
|
||||
#include "gimppixbuf.h"
|
||||
#include "gimptilebackendplugin.h"
|
||||
|
||||
|
||||
|
@ -53,6 +52,48 @@ gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
|
|||
return image_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_get_thumbnail:
|
||||
* @drawable_ID: the drawable ID
|
||||
* @width: the requested thumbnail width (<= 1024 pixels)
|
||||
* @height: the requested thumbnail height (<= 1024 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the drawable identified by
|
||||
* @drawable_ID. The thumbnail will be not larger than the requested
|
||||
* size.
|
||||
*
|
||||
* Returns: (transfer full): a new #GdkPixbuf
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gimp_drawable_get_thumbnail (gint32 drawable_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
gint thumb_width = width;
|
||||
gint thumb_height = height;
|
||||
gint thumb_bpp;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (width > 0 && width <= 1024, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 1024, NULL);
|
||||
|
||||
data = gimp_drawable_get_thumbnail_data (drawable_ID,
|
||||
&thumb_width,
|
||||
&thumb_height,
|
||||
&thumb_bpp);
|
||||
|
||||
if (data)
|
||||
return _gimp_pixbuf_from_data (data,
|
||||
thumb_width, thumb_height, thumb_bpp,
|
||||
alpha);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
guchar *
|
||||
gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
|
@ -85,6 +126,62 @@ gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID,
|
|||
return image_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_get_sub_thumbnail:
|
||||
* @drawable_ID: the drawable ID
|
||||
* @src_x: the x coordinate of the area
|
||||
* @src_y: the y coordinate of the area
|
||||
* @src_width: the width of the area
|
||||
* @src_height: the height of the area
|
||||
* @dest_width: the requested thumbnail width (<= 1024 pixels)
|
||||
* @dest_height: the requested thumbnail height (<= 1024 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the drawable identified by
|
||||
* @drawable_ID. The thumbnail will be not larger than the requested
|
||||
* size.
|
||||
*
|
||||
* Returns: (transfer full): a new #GdkPixbuf
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gimp_drawable_get_sub_thumbnail (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_width,
|
||||
gint dest_height,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
gint thumb_width = dest_width;
|
||||
gint thumb_height = dest_height;
|
||||
gint thumb_bpp;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (src_x >= 0, NULL);
|
||||
g_return_val_if_fail (src_y >= 0, NULL);
|
||||
g_return_val_if_fail (src_width > 0, NULL);
|
||||
g_return_val_if_fail (src_height > 0, NULL);
|
||||
g_return_val_if_fail (dest_width > 0 && dest_width <= 1024, NULL);
|
||||
g_return_val_if_fail (dest_height > 0 && dest_height <= 1024, NULL);
|
||||
|
||||
data = gimp_drawable_get_sub_thumbnail_data (drawable_ID,
|
||||
src_x, src_y,
|
||||
src_width, src_height,
|
||||
&thumb_width,
|
||||
&thumb_height,
|
||||
&thumb_bpp);
|
||||
|
||||
if (data)
|
||||
return _gimp_pixbuf_from_data (data,
|
||||
thumb_width, thumb_height, thumb_bpp,
|
||||
alpha);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_get_buffer:
|
||||
* @drawable_ID: the ID of the #GimpDrawable to get the buffer for.
|
||||
|
|
|
@ -30,24 +30,37 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
GeglBuffer * gimp_drawable_get_buffer (gint32 drawable_ID);
|
||||
GeglBuffer * gimp_drawable_get_shadow_buffer (gint32 drawable_ID);
|
||||
GeglBuffer * gimp_drawable_get_buffer (gint32 drawable_ID);
|
||||
GeglBuffer * gimp_drawable_get_shadow_buffer (gint32 drawable_ID);
|
||||
|
||||
const Babl * gimp_drawable_get_format (gint32 drawable_ID);
|
||||
const Babl * gimp_drawable_get_thumbnail_format (gint32 drawable_ID);
|
||||
const Babl * gimp_drawable_get_format (gint32 drawable_ID);
|
||||
const Babl * gimp_drawable_get_thumbnail_format (gint32 drawable_ID);
|
||||
|
||||
guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *bpp);
|
||||
guchar * gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint *dest_width,
|
||||
gint *dest_height,
|
||||
gint *bpp);
|
||||
guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *bpp);
|
||||
GdkPixbuf * gimp_drawable_get_thumbnail (gint32 drawable_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha);
|
||||
|
||||
guchar * gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint *dest_width,
|
||||
gint *dest_height,
|
||||
gint *bpp);
|
||||
GdkPixbuf * gimp_drawable_get_sub_thumbnail (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_width,
|
||||
gint dest_height,
|
||||
GimpPixbufTransparency alpha);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
|
||||
#include "gimppixbuf.h"
|
||||
|
||||
|
||||
/**
|
||||
* gimp_image_get_colormap:
|
||||
|
@ -74,6 +76,22 @@ gimp_image_set_colormap (gint32 image_ID,
|
|||
return _gimp_image_set_colormap (image_ID, num_colors * 3, colormap);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_get_thumbnail_data:
|
||||
* @image_ID: The image.
|
||||
* @width: (inout): The requested thumbnail width.
|
||||
* @height: (inout): The requested thumbnail height.
|
||||
* @bpp: (out): The previews bpp.
|
||||
*
|
||||
* Get a thumbnail of an image.
|
||||
*
|
||||
* This function gets data from which a thumbnail of an image preview
|
||||
* can be created. Maximum x or y dimension is 1024 pixels. The pixels
|
||||
* are returned in RGB[A] or GRAY[A] format. The bpp return value
|
||||
* gives the number of bytes per pixel in the image.
|
||||
*
|
||||
* Returns: (transfer full): the thumbnail data.
|
||||
**/
|
||||
guchar *
|
||||
gimp_image_get_thumbnail_data (gint32 image_ID,
|
||||
gint *width,
|
||||
|
@ -100,6 +118,46 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
|
|||
return image_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_get_thumbnail:
|
||||
* @image_ID: the image ID
|
||||
* @width: the requested thumbnail width (<= 1024 pixels)
|
||||
* @height: the requested thumbnail height (<= 1024 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the image identified by @image_ID.
|
||||
* The thumbnail will be not larger than the requested size.
|
||||
*
|
||||
* Returns: (transfer full): a new #GdkPixbuf
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gimp_image_get_thumbnail (gint32 image_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
gint thumb_width = width;
|
||||
gint thumb_height = height;
|
||||
gint thumb_bpp;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (width > 0 && width <= 1024, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 1024, NULL);
|
||||
|
||||
data = gimp_image_get_thumbnail_data (image_ID,
|
||||
&thumb_width,
|
||||
&thumb_height,
|
||||
&thumb_bpp);
|
||||
if (data)
|
||||
return _gimp_pixbuf_from_data (data,
|
||||
thumb_width, thumb_height, thumb_bpp,
|
||||
alpha);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_get_metadata:
|
||||
* @image_ID: The image.
|
||||
|
|
|
@ -40,6 +40,10 @@ guchar * gimp_image_get_thumbnail_data (gint32 image_ID,
|
|||
gint *width,
|
||||
gint *height,
|
||||
gint *bpp);
|
||||
GdkPixbuf * gimp_image_get_thumbnail (gint32 image_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha);
|
||||
|
||||
GimpMetadata * gimp_image_get_metadata (gint32 image_ID);
|
||||
gboolean gimp_image_set_metadata (gint32 image_ID,
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#define GIMP_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gimp.h"
|
||||
|
||||
|
||||
|
|
|
@ -26,171 +26,16 @@
|
|||
#include "gimppixbuf.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION: gimppixbuf
|
||||
* @title: gimppixbuf
|
||||
* @short_description: Get a thumbnail pixbuf for a drawable or image.
|
||||
*
|
||||
* Get a thumbnail pixbuf for a drawable or image.
|
||||
**/
|
||||
|
||||
|
||||
static GdkPixbuf * gimp_pixbuf_from_data (guchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
GimpPixbufTransparency alpha);
|
||||
|
||||
|
||||
/**
|
||||
* gimp_image_get_thumbnail:
|
||||
* @image_ID: the image ID
|
||||
* @width: the requested thumbnail width (<= 1024 pixels)
|
||||
* @height: the requested thumbnail height (<= 1024 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the image identified by @image_ID.
|
||||
* The thumbnail will be not larger than the requested size.
|
||||
*
|
||||
* Returns: (transfer full): a new #GdkPixbuf
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gimp_image_get_thumbnail (gint32 image_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
gint thumb_width = width;
|
||||
gint thumb_height = height;
|
||||
gint thumb_bpp;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (width > 0 && width <= 1024, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 1024, NULL);
|
||||
|
||||
data = gimp_image_get_thumbnail_data (image_ID,
|
||||
&thumb_width,
|
||||
&thumb_height,
|
||||
&thumb_bpp);
|
||||
if (data)
|
||||
return gimp_pixbuf_from_data (data,
|
||||
thumb_width, thumb_height, thumb_bpp,
|
||||
alpha);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_get_thumbnail:
|
||||
* @drawable_ID: the drawable ID
|
||||
* @width: the requested thumbnail width (<= 1024 pixels)
|
||||
* @height: the requested thumbnail height (<= 1024 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the drawable identified by
|
||||
* @drawable_ID. The thumbnail will be not larger than the requested
|
||||
* size.
|
||||
*
|
||||
* Returns: (transfer full): a new #GdkPixbuf
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gimp_drawable_get_thumbnail (gint32 drawable_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
gint thumb_width = width;
|
||||
gint thumb_height = height;
|
||||
gint thumb_bpp;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (width > 0 && width <= 1024, NULL);
|
||||
g_return_val_if_fail (height > 0 && height <= 1024, NULL);
|
||||
|
||||
data = gimp_drawable_get_thumbnail_data (drawable_ID,
|
||||
&thumb_width,
|
||||
&thumb_height,
|
||||
&thumb_bpp);
|
||||
|
||||
if (data)
|
||||
return gimp_pixbuf_from_data (data,
|
||||
thumb_width, thumb_height, thumb_bpp,
|
||||
alpha);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_get_sub_thumbnail:
|
||||
* @drawable_ID: the drawable ID
|
||||
* @src_x: the x coordinate of the area
|
||||
* @src_y: the y coordinate of the area
|
||||
* @src_width: the width of the area
|
||||
* @src_height: the height of the area
|
||||
* @dest_width: the requested thumbnail width (<= 1024 pixels)
|
||||
* @dest_height: the requested thumbnail height (<= 1024 pixels)
|
||||
* @alpha: how to handle an alpha channel
|
||||
*
|
||||
* Retrieves a thumbnail pixbuf for the drawable identified by
|
||||
* @drawable_ID. The thumbnail will be not larger than the requested
|
||||
* size.
|
||||
*
|
||||
* Returns: (transfer full): a new #GdkPixbuf
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gimp_drawable_get_sub_thumbnail (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_width,
|
||||
gint dest_height,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
gint thumb_width = dest_width;
|
||||
gint thumb_height = dest_height;
|
||||
gint thumb_bpp;
|
||||
guchar *data;
|
||||
|
||||
g_return_val_if_fail (src_x >= 0, NULL);
|
||||
g_return_val_if_fail (src_y >= 0, NULL);
|
||||
g_return_val_if_fail (src_width > 0, NULL);
|
||||
g_return_val_if_fail (src_height > 0, NULL);
|
||||
g_return_val_if_fail (dest_width > 0 && dest_width <= 1024, NULL);
|
||||
g_return_val_if_fail (dest_height > 0 && dest_height <= 1024, NULL);
|
||||
|
||||
data = gimp_drawable_get_sub_thumbnail_data (drawable_ID,
|
||||
src_x, src_y,
|
||||
src_width, src_height,
|
||||
&thumb_width,
|
||||
&thumb_height,
|
||||
&thumb_bpp);
|
||||
|
||||
if (data)
|
||||
return gimp_pixbuf_from_data (data,
|
||||
thumb_width, thumb_height, thumb_bpp,
|
||||
alpha);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The data that is passed to this function is either freed here or
|
||||
* owned by the returned pixbuf.
|
||||
*/
|
||||
static GdkPixbuf *
|
||||
gimp_pixbuf_from_data (guchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
GimpPixbufTransparency alpha)
|
||||
GdkPixbuf *
|
||||
_gimp_pixbuf_from_data (guchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
GimpPixbufTransparency alpha)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
|
|
|
@ -31,40 +31,13 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
/**
|
||||
* GimpPixbufTransparency:
|
||||
* @GIMP_PIXBUF_KEEP_ALPHA: Create a pixbuf with alpha
|
||||
* @GIMP_PIXBUF_SMALL_CHECKS: Show transparency as small checks
|
||||
* @GIMP_PIXBUF_LARGE_CHECKS: Show transparency as large checks
|
||||
*
|
||||
* How to deal with transparency when creating thubnail pixbufs from
|
||||
* images and drawables.
|
||||
**/
|
||||
typedef enum
|
||||
{
|
||||
GIMP_PIXBUF_KEEP_ALPHA,
|
||||
GIMP_PIXBUF_SMALL_CHECKS,
|
||||
GIMP_PIXBUF_LARGE_CHECKS
|
||||
} GimpPixbufTransparency;
|
||||
GdkPixbuf * _gimp_pixbuf_from_data (guchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
GimpPixbufTransparency alpha);
|
||||
|
||||
|
||||
GdkPixbuf * gimp_image_get_thumbnail (gint32 image_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha);
|
||||
GdkPixbuf * gimp_drawable_get_thumbnail (gint32 drawable_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpPixbufTransparency alpha);
|
||||
GdkPixbuf * gimp_drawable_get_sub_thumbnail (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_width,
|
||||
gint dest_height,
|
||||
GimpPixbufTransparency alpha);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __LIBGIMP_GIMP_PIXBUF_H__ */
|
||||
|
|
|
@ -38,6 +38,25 @@ typedef union _GimpParamData GimpParamData;
|
|||
typedef struct _GimpParam GimpParam;
|
||||
|
||||
|
||||
/* FIXME move somewhere else */
|
||||
|
||||
/**
|
||||
* GimpPixbufTransparency:
|
||||
* @GIMP_PIXBUF_KEEP_ALPHA: Create a pixbuf with alpha
|
||||
* @GIMP_PIXBUF_SMALL_CHECKS: Show transparency as small checks
|
||||
* @GIMP_PIXBUF_LARGE_CHECKS: Show transparency as large checks
|
||||
*
|
||||
* How to deal with transparency when creating thubnail pixbufs from
|
||||
* images and drawables.
|
||||
**/
|
||||
typedef enum
|
||||
{
|
||||
GIMP_PIXBUF_KEEP_ALPHA,
|
||||
GIMP_PIXBUF_SMALL_CHECKS,
|
||||
GIMP_PIXBUF_LARGE_CHECKS
|
||||
} GimpPixbufTransparency;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_TYPES_H__ */
|
||||
|
|
Loading…
Reference in New Issue