diff --git a/ChangeLog b/ChangeLog index 82e47ee4dc..ced53d48a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2007-12-12 Sven Neumann + + * app/widgets/Makefile.am + * app/widgets/gimpcairo-utils.[ch]: removed here... + + * libgimpwidgets/Makefile.am + * libgimpwidgets/gimpcairo-utils.[ch]: and added here after some + cleanup. + + * libgimpwidgets/gimpwidgets.h: include gimpcairo-utils.h. + + * app/widgets/gimpviewrenderer.c + * app/widgets/gimpviewrenderergradient.c + * app/widgets/gimpviewrendererpalette.c: changed accordingly. + + * libgimpwidgets/gimpwidgets.def: updated for Cairo utils. + + * libgimp/gimp.def: added gimp_image_get_vectors_by_tattoo. + 2007-12-12 Michael Natterer * app/core/gimpitem.[ch]: added GError to GimpItem::rename(). diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am index 429cf08971..0e94402858 100644 --- a/app/widgets/Makefile.am +++ b/app/widgets/Makefile.am @@ -36,8 +36,6 @@ libappwidgets_a_sources = \ gimpbrushselect.h \ gimpbufferview.c \ gimpbufferview.h \ - gimpcairo-utils.c \ - gimpcairo-utils.h \ gimpcellrendererdashes.c \ gimpcellrendererdashes.h \ gimpcellrendererviewable.c \ diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c index 392237e9ed..0002e6a2e5 100644 --- a/app/widgets/gimpviewrenderer.c +++ b/app/widgets/gimpviewrenderer.c @@ -39,7 +39,6 @@ #include "core/gimpmarshal.h" #include "core/gimpviewable.h" -#include "gimpcairo-utils.h" #include "gimprender.h" #include "gimpviewrenderer.h" #include "gimpviewrenderer-utils.h" diff --git a/app/widgets/gimpviewrenderergradient.c b/app/widgets/gimpviewrenderergradient.c index 494ab14c44..c31b04ae0f 100644 --- a/app/widgets/gimpviewrenderergradient.c +++ b/app/widgets/gimpviewrenderergradient.c @@ -27,12 +27,12 @@ #include "libgimpcolor/gimpcolor.h" #include "libgimpmath/gimpmath.h" +#include "libgimpwidgets/gimpwidgets.h" #include "widgets-types.h" #include "core/gimpgradient.h" -#include "gimpcairo-utils.h" #include "gimprender.h" #include "gimpviewrenderergradient.h" diff --git a/app/widgets/gimpviewrendererpalette.c b/app/widgets/gimpviewrendererpalette.c index ff501d82ef..9c9eb8b59f 100644 --- a/app/widgets/gimpviewrendererpalette.c +++ b/app/widgets/gimpviewrendererpalette.c @@ -27,12 +27,12 @@ #include "libgimpcolor/gimpcolor.h" #include "libgimpmath/gimpmath.h" +#include "libgimpwidgets/gimpwidgets.h" #include "widgets-types.h" #include "core/gimppalette.h" -#include "gimpcairo-utils.h" #include "gimpviewrendererpalette.h" diff --git a/libgimp/gimp.def b/libgimp/gimp.def index 1723e44dfe..9c2a1eabeb 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -336,6 +336,7 @@ EXPORTS gimp_image_get_thumbnail_data gimp_image_get_unit gimp_image_get_vectors + gimp_image_get_vectors_by_tattoo gimp_image_get_vectors_position gimp_image_grid_get_background_color gimp_image_grid_get_foreground_color diff --git a/libgimpwidgets/Makefile.am b/libgimpwidgets/Makefile.am index 5c3e6c77f6..4e56a12ca9 100644 --- a/libgimpwidgets/Makefile.am +++ b/libgimpwidgets/Makefile.am @@ -67,6 +67,8 @@ libgimpwidgets_2_0_la_sources = \ gimpbrowser.h \ gimpbutton.c \ gimpbutton.h \ + gimpcairo-utils.c \ + gimpcairo-utils.h \ gimpcellrenderercolor.c \ gimpcellrenderercolor.h \ gimpcellrenderertoggle.c \ @@ -181,6 +183,7 @@ libgimpwidgetsinclude_HEADERS = \ gimpwidgetstypes.h \ gimpbrowser.h \ gimpbutton.h \ + gimpcairo-utils.h \ gimpcellrenderercolor.h \ gimpcellrenderertoggle.h \ gimpchainbutton.h \ diff --git a/app/widgets/gimpcairo-utils.c b/libgimpwidgets/gimpcairo-utils.c similarity index 80% rename from app/widgets/gimpcairo-utils.c rename to libgimpwidgets/gimpcairo-utils.c index dc6baaa833..4f556100b0 100644 --- a/app/widgets/gimpcairo-utils.c +++ b/libgimpwidgets/gimpcairo-utils.c @@ -1,22 +1,23 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpcairo-utils.c * Copyright (C) 2007 Sven Neumann * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ #include "config.h" @@ -37,6 +38,8 @@ * Sets the source pattern within @cr to the color described by @color. * * This function calls cairo_set_source_rgba() for you. + * + * Since: GIMP 2.6 **/ void gimp_cairo_set_source_color (cairo_t *cr, @@ -53,6 +56,8 @@ gimp_cairo_set_source_color (cairo_t *cr, * * You should avoid calling this function as there are probably more * efficient ways of achieving the result you are looking for. + * + * Since: GIMP 2.6 **/ cairo_surface_t * gimp_cairo_create_surface_from_pixbuf (GdkPixbuf *pixbuf) diff --git a/app/widgets/gimpcairo-utils.h b/libgimpwidgets/gimpcairo-utils.h similarity index 57% rename from app/widgets/gimpcairo-utils.h rename to libgimpwidgets/gimpcairo-utils.h index db3116ff83..9df8518fe7 100644 --- a/app/widgets/gimpcairo-utils.h +++ b/libgimpwidgets/gimpcairo-utils.h @@ -1,22 +1,23 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpcairo-utils.h * Copyright (C) 2007 Sven Neumann * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ #ifndef __GIMP_CAIRO_UTILS_H__ @@ -28,9 +29,6 @@ void gimp_cairo_set_source_color (cairo_t *cr, cairo_surface_t * gimp_cairo_create_surface_from_pixbuf (GdkPixbuf *pixbuf); -#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8)) - - /* some useful macros for writing directly to a Cairo surface */ /** @@ -41,6 +39,8 @@ cairo_surface_t * gimp_cairo_create_surface_from_pixbuf (GdkPixbuf *pixbuf); * @b: blue component * * Sets a single pixel in an Cairo image surface in %CAIRO_FORMAT_RGB24. + * + * Since: GIMP 2.6 **/ #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define GIMP_CAIRO_RGB24_SET_PIXEL(d, r, g, b) \ @@ -60,24 +60,31 @@ cairo_surface_t * gimp_cairo_create_surface_from_pixbuf (GdkPixbuf *pixbuf); * @a: alpha component * * Sets a single pixel in an Cairo image surface in %CAIRO_FORMAT_ARGB32. + * + * Since: GIMP 2.6 **/ + #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define GIMP_CAIRO_ARGB32_SET_PIXEL(d, r, g, b, a) \ G_STMT_START { \ - guint t1, t2, t3; \ - d[0] = INT_MULT ((b), (a), t1); \ - d[1] = INT_MULT ((g), (a), t2); \ - d[2] = INT_MULT ((r), (a), t3); \ + guint tr = (a) * (r) + 0x80; \ + guint tg = (a) * (g) + 0x80; \ + guint tb = (a) * (b) + 0x80; \ + d[0] = (((tb) >> 8) + (tb)) >> 8; \ + d[1] = (((tg) >> 8) + (tg)) >> 8; \ + d[2] = (((tr) >> 8) + (tr)) >> 8; \ d[3] = (a); \ } G_STMT_END #else #define GIMP_CAIRO_ARGB32_SET_PIXEL(d, r, g, b, a) \ G_STMT_START { \ - guint t1, t2, t3; \ + guint tr = (a) * (r) + 0x80; \ + guint tg = (a) * (g) + 0x80; \ + guint tb = (a) * (b) + 0x80; \ d[0] = (a); \ - d[1] = INT_MULT ((r), (a), t1); \ - d[2] = INT_MULT ((g), (a), t2); \ - d[3] = INT_MULT ((b), (a), t3); \ + d[1] = (((tr) >> 8) + (tr)) >> 8; \ + d[2] = (((tg) >> 8) + (tg)) >> 8; \ + d[3] = (((tb) >> 8) + (tb)) >> 8; \ } G_STMT_END #endif diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def index 32d5956b50..60336c9ca7 100644 --- a/libgimpwidgets/gimpwidgets.def +++ b/libgimpwidgets/gimpwidgets.def @@ -8,6 +8,8 @@ EXPORTS gimp_button_extended_clicked gimp_button_get_type gimp_button_new + gimp_cairo_create_surface_from_pixbuf + gimp_cairo_set_source_color gimp_cell_renderer_color_get_type gimp_cell_renderer_color_new gimp_cell_renderer_toggle_clicked diff --git a/libgimpwidgets/gimpwidgets.h b/libgimpwidgets/gimpwidgets.h index 83bc97f798..f7f0e84aee 100644 --- a/libgimpwidgets/gimpwidgets.h +++ b/libgimpwidgets/gimpwidgets.h @@ -28,6 +28,7 @@ #include #include +#include #include #include #include