[gthumb] pixbuf-utils: removed unused functions
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] pixbuf-utils: removed unused functions
- Date: Sun, 19 Aug 2012 08:38:16 +0000 (UTC)
commit 274dde121ba806abfdcea45f53ef6d5ea4a62a77
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Aug 18 23:58:32 2012 +0200
pixbuf-utils: removed unused functions
gthumb/pixbuf-utils.c | 435 -------------------------------------------------
gthumb/pixbuf-utils.h | 20 ---
2 files changed, 0 insertions(+), 455 deletions(-)
---
diff --git a/gthumb/pixbuf-utils.c b/gthumb/pixbuf-utils.c
index f4f60fe..7ed7975 100644
--- a/gthumb/pixbuf-utils.c
+++ b/gthumb/pixbuf-utils.c
@@ -28,37 +28,6 @@
#include "pixbuf-utils.h"
-GdkPixbuf*
-_gdk_pixbuf_new_void (int width,
- int height)
-{
- GdkPixbuf *p;
-
- p = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- width,
- height);
- gdk_pixbuf_fill (p, 0xFFFFFF00);
-
- return p;
-}
-
-
-GdkPixbuf *
-_gdk_pixbuf_new_compatible (GdkPixbuf *src)
-{
- if (src == NULL)
- return NULL;
-
- return gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
- gdk_pixbuf_get_has_alpha (src),
- gdk_pixbuf_get_bits_per_sample (src),
- gdk_pixbuf_get_width (src),
- gdk_pixbuf_get_height (src));
-}
-
-
GdkPixbuf *
_gdk_pixbuf_new_from_cairo_context (cairo_t *cr)
{
@@ -197,49 +166,6 @@ _gdk_pixbuf_scale_composite (const GdkPixbuf *src,
}
-GdkPixbuf *
-_gdk_pixbuf_scale_squared (GdkPixbuf *p,
- int size,
- GdkInterpType interp_type)
-{
- int w, h, tw, th;
- GdkPixbuf *p1;
- int x, y;
- GdkPixbuf *p2;
-
- w = gdk_pixbuf_get_width (p);
- h = gdk_pixbuf_get_height (p);
-
- if ((w < size) && (h < size))
- return gdk_pixbuf_copy (p);
-
- if (w > h) {
- th = size;
- tw = (int) (((double) w / h) * th);
- }
- else {
- tw = size;
- th = (int) (((double) h / w) * tw);
- }
-
- if ((tw != w) || (th != h))
- p1 = _gdk_pixbuf_scale_composite (p, tw, th, interp_type);
- else
- p1 = g_object_ref (p);
-
- if ((tw == size) && (th == size))
- return p1;
-
- x = (tw - size) / 2;
- y = (th - size) / 2;
- p2 = gdk_pixbuf_new_subpixbuf (p1, x, y, size, size);
-
- g_object_unref (p1);
-
- return p2;
-}
-
-
/*
* Returns a transformed image.
*/
@@ -335,341 +261,6 @@ _gdk_pixbuf_colorshift (GdkPixbuf *dest,
}
-/* From gtkcellrendererpixbuf.c
- * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb redhat com>
- *
- * modified for gthumb */
-GdkPixbuf *
-_gdk_pixbuf_colorize (GdkPixbuf *src,
- GdkRGBA *new_color)
-{
- gint i, j;
- gint width, height, has_alpha, src_row_stride, dst_row_stride;
- gint red_value, green_value, blue_value;
- guchar *target_pixels;
- guchar *original_pixels;
- guchar *pixsrc;
- guchar *pixdest;
- GdkPixbuf *dest;
-
- red_value = new_color->red / 255.0;
- green_value = new_color->green / 255.0;
- blue_value = new_color->blue / 255.0;
-
- dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
- TRUE /*gdk_pixbuf_get_has_alpha (src)*/,
- gdk_pixbuf_get_bits_per_sample (src),
- gdk_pixbuf_get_width (src),
- gdk_pixbuf_get_height (src));
-
- has_alpha = gdk_pixbuf_get_has_alpha (src);
- width = gdk_pixbuf_get_width (src);
- height = gdk_pixbuf_get_height (src);
- src_row_stride = gdk_pixbuf_get_rowstride (src);
- dst_row_stride = gdk_pixbuf_get_rowstride (dest);
- target_pixels = gdk_pixbuf_get_pixels (dest);
- original_pixels = gdk_pixbuf_get_pixels (src);
-
- for (i = 0; i < height; i++) {
- pixdest = target_pixels + i*dst_row_stride;
- pixsrc = original_pixels + i*src_row_stride;
- for (j = 0; j < width; j++) {
- *pixdest++ = (*pixsrc++ * red_value) >> 8;
- *pixdest++ = (*pixsrc++ * green_value) >> 8;
- *pixdest++ = (*pixsrc++ * blue_value) >> 8;
- if (has_alpha)
- *pixdest++ = (*pixsrc++ * new_color->alpha);
- else
- *pixdest++ = (255 * new_color->alpha);
- }
- }
-
- return dest;
-}
-
-
-void
-_gdk_pixbuf_vertical_gradient (GdkPixbuf *pixbuf,
- guint32 color1,
- guint32 color2)
-{
- guchar *pixels;
- guint32 r1, g1, b1, a1;
- guint32 r2, g2, b2, a2;
- double r, g, b, a;
- double rd, gd, bd, ad;
- guint32 ri, gi, bi, ai;
- guchar *p;
- guint width, height;
- guint w, h;
- int n_channels, rowstride;
-
- g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- if (width == 0 || height == 0)
- return;
-
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- r1 = (color1 & 0xff000000) >> 24;
- g1 = (color1 & 0x00ff0000) >> 16;
- b1 = (color1 & 0x0000ff00) >> 8;
- a1 = (color1 & 0x000000ff);
-
- r2 = (color2 & 0xff000000) >> 24;
- g2 = (color2 & 0x00ff0000) >> 16;
- b2 = (color2 & 0x0000ff00) >> 8;
- a2 = (color2 & 0x000000ff);
-
- rd = ((double) (r2) - r1) / height;
- gd = ((double) (g2) - g1) / height;
- bd = ((double) (b2) - b1) / height;
- ad = ((double) (a2) - a1) / height;
-
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
- r = r1;
- g = g1;
- b = b1;
- a = a1;
-
- for (h = height; h > 0; h--) {
- w = width;
- p = pixels;
-
- ri = (int) r;
- gi = (int) g;
- bi = (int) b;
- ai = (int) a;
-
- switch (n_channels) {
- case 3:
- while (w--) {
- p[0] = ri;
- p[1] = gi;
- p[2] = bi;
- p += 3;
- }
- break;
- case 4:
- while (w--) {
- p[0] = ri;
- p[1] = gi;
- p[2] = bi;
- p[3] = ai;
- p += 4;
- }
- break;
- default:
- break;
- }
-
- r += rd;
- g += gd;
- b += bd;
- a += ad;
-
- pixels += rowstride;
- }
-}
-
-
-void
-_gdk_pixbuf_horizontal_gradient (GdkPixbuf *pixbuf,
- guint32 color1,
- guint32 color2)
-{
- guchar *pixels;
- guint32 r1, g1, b1, a1;
- guint32 r2, g2, b2, a2;
- double r, g, b, a;
- double rd, gd, bd, ad;
- guint32 ri, gi, bi, ai;
- guchar *p;
- guint width, height;
- guint w, h;
- int n_channels, rowstride;
-
- g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- if (width == 0 || height == 0)
- return;
-
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- r1 = (color1 & 0xff000000) >> 24;
- g1 = (color1 & 0x00ff0000) >> 16;
- b1 = (color1 & 0x0000ff00) >> 8;
- a1 = (color1 & 0x000000ff);
-
- r2 = (color2 & 0xff000000) >> 24;
- g2 = (color2 & 0x00ff0000) >> 16;
- b2 = (color2 & 0x0000ff00) >> 8;
- a2 = (color2 & 0x000000ff);
-
- rd = ((double) (r2) - r1) / width;
- gd = ((double) (g2) - g1) / width;
- bd = ((double) (b2) - b1) / width;
- ad = ((double) (a2) - a1) / width;
-
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
- r = r1;
- g = g1;
- b = b1;
- a = a1;
-
- for (w = 0; w < width; w++) {
- h = height;
- p = pixels;
-
- ri = (int) rint (r);
- gi = (int) rint (g);
- bi = (int) rint (b);
- ai = (int) rint (a);
-
- switch (n_channels) {
- case 3:
- while (h--) {
- p[0] = ri;
- p[1] = gi;
- p[2] = bi;
- p += rowstride;
- }
- break;
- case 4:
- while (h--) {
- p[0] = ri;
- p[1] = gi;
- p[2] = bi;
- p[3] = ai;
- p += rowstride;
- }
- break;
- default:
- break;
- }
-
- r += rd;
- g += gd;
- b += bd;
- a += ad;
-
- pixels += n_channels;
- }
-}
-
-
-void
-_gdk_pixbuf_hv_gradient (GdkPixbuf *pixbuf,
- guint32 hcolor1,
- guint32 hcolor2,
- guint32 vcolor1,
- guint32 vcolor2)
-{
- guchar *pixels;
- guint32 hr1, hg1, hb1, ha1;
- guint32 hr2, hg2, hb2, ha2;
- guint32 vr1, vg1, vb1, va1;
- guint32 vr2, vg2, vb2, va2;
- double r, g, b, a;
- guint32 ri, gi, bi, ai;
- guchar *p;
- guint width, height;
- guint w, h;
- int n_channels, rowstride;
- double x, y;
-
- g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- if (width == 0 || height == 0)
- return;
-
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- hr1 = (hcolor1 & 0xff000000) >> 24;
- hg1 = (hcolor1 & 0x00ff0000) >> 16;
- hb1 = (hcolor1 & 0x0000ff00) >> 8;
- ha1 = (hcolor1 & 0x000000ff);
-
- hr2 = (hcolor2 & 0xff000000) >> 24;
- hg2 = (hcolor2 & 0x00ff0000) >> 16;
- hb2 = (hcolor2 & 0x0000ff00) >> 8;
- ha2 = (hcolor2 & 0x000000ff);
-
- vr1 = (vcolor1 & 0xff000000) >> 24;
- vg1 = (vcolor1 & 0x00ff0000) >> 16;
- vb1 = (vcolor1 & 0x0000ff00) >> 8;
- va1 = (vcolor1 & 0x000000ff);
-
- vr2 = (vcolor2 & 0xff000000) >> 24;
- vg2 = (vcolor2 & 0x00ff0000) >> 16;
- vb2 = (vcolor2 & 0x0000ff00) >> 8;
- va2 = (vcolor2 & 0x000000ff);
-
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
- for (h = 0; h < height; h++) {
- p = pixels;
-
- x = (((double) height) - h) / height;
-
- for (w = 0; w < width; w++) {
- double x_y, x_1_y, y_1_x, _1_x_1_y;
-
- y = (((double) width) - w) / width;;
-
- x_y = x * y;
- x_1_y = x * (1.0 - y);
- y_1_x = y * (1.0 - x);
- _1_x_1_y = (1.0 - x) * (1.0 - y);
-
- r = hr1 * x_y + hr2 * x_1_y + vr1 * y_1_x + vr2 * _1_x_1_y;
- g = hg1 * x_y + hg2 * x_1_y + vg1 * y_1_x + vg2 * _1_x_1_y;
- b = hb1 * x_y + hb2 * x_1_y + vb1 * y_1_x + vb2 * _1_x_1_y;
- a = ha1 * x_y + ha2 * x_1_y + va1 * y_1_x + va2 * _1_x_1_y;
-
- ri = (int) r;
- gi = (int) g;
- bi = (int) b;
- ai = (int) a;
-
- switch (n_channels) {
- case 3:
- p[0] = ri;
- p[1] = gi;
- p[2] = bi;
- p += 3;
- break;
- case 4:
- p[0] = ri;
- p[1] = gi;
- p[2] = bi;
- p[3] = ai;
- p += 4;
- break;
- default:
- break;
- }
- }
-
- pixels += rowstride;
- }
-}
-
-
gboolean
scale_keeping_ratio_min (int *width,
int *height,
@@ -723,29 +314,3 @@ scale_keeping_ratio (int *width,
max_height,
allow_upscaling);
}
-
-
-gboolean
-_g_mime_type_is_writable (const char *mime_type)
-{
- GSList *list;
- GSList *scan;
-
- list = gdk_pixbuf_get_formats ();
- for (scan = list; scan; scan = scan->next) {
- GdkPixbufFormat *format = scan->data;
- char **mime_types;
- int i;
-
- mime_types = gdk_pixbuf_format_get_mime_types (format);
- for (i = 0; mime_types[i] != NULL; i++)
- if (strcmp (mime_type, mime_types[i]) == 0)
- return ! gdk_pixbuf_format_is_disabled (format) && gdk_pixbuf_format_is_writable (format);
-
- g_strfreev (mime_types);
- }
-
- g_slist_free (list);
-
- return FALSE;
-}
diff --git a/gthumb/pixbuf-utils.h b/gthumb/pixbuf-utils.h
index d481ff7..4241b8c 100644
--- a/gthumb/pixbuf-utils.h
+++ b/gthumb/pixbuf-utils.h
@@ -30,9 +30,6 @@
G_BEGIN_DECLS
-GdkPixbuf * _gdk_pixbuf_new_void (int width,
- int height);
-GdkPixbuf * _gdk_pixbuf_new_compatible (GdkPixbuf *src);
GdkPixbuf * _gdk_pixbuf_new_from_cairo_context (cairo_t *cr);
GdkPixbuf * _gdk_pixbuf_new_from_cairo_surface (cairo_surface_t *surface);
GdkPixbuf * _gdk_pixbuf_scale_simple_safe (const GdkPixbuf *src,
@@ -43,27 +40,11 @@ GdkPixbuf * _gdk_pixbuf_scale_composite (const GdkPixbuf *src,
int dest_width,
int dest_height,
GdkInterpType interp_type);
-GdkPixbuf * _gdk_pixbuf_scale_squared (GdkPixbuf *src,
- int size,
- GdkInterpType interp_type);
GdkPixbuf * _gdk_pixbuf_transform (GdkPixbuf *src,
GthTransform transform);
void _gdk_pixbuf_colorshift (GdkPixbuf *dest,
GdkPixbuf *src,
int shift);
-GdkPixbuf * _gdk_pixbuf_colorize (GdkPixbuf *src,
- GdkRGBA *new_color);
-void _gdk_pixbuf_vertical_gradient (GdkPixbuf *pixbuf,
- guint32 color1,
- guint32 color2);
-void _gdk_pixbuf_horizontal_gradient (GdkPixbuf *pixbuf,
- guint32 color1,
- guint32 color2);
-void _gdk_pixbuf_hv_gradient (GdkPixbuf *pixbuf,
- guint32 hcolor1,
- guint32 hcolor2,
- guint32 vcolor1,
- guint32 vcolor2);
gboolean scale_keeping_ratio_min (int *width,
int *height,
int min_width,
@@ -76,7 +57,6 @@ gboolean scale_keeping_ratio (int *width,
int max_width,
int max_height,
gboolean allow_upscaling);
-gboolean _g_mime_type_is_writable (const char *mime_type);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]