2006-12-09 13:33:38 -08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2002-03-22 07:47:59 -08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2004-08-26 07:20:30 -07:00
|
|
|
* gimpviewrenderer-utils.c
|
2003-02-28 19:53:41 -08:00
|
|
|
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
2002-03-22 07:47:59 -08:00
|
|
|
*
|
2009-01-17 14:28:01 -08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2002-03-22 07:47:59 -08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-03-22 07:47:59 -08:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 14:47:19 -07:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2002-03-22 07:47:59 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2008-10-09 13:24:04 -07:00
|
|
|
#include <gegl.h>
|
2002-03-22 07:47:59 -08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
|
#include "widgets-types.h"
|
|
|
|
|
|
|
|
|
|
#include "core/gimpbrush.h"
|
2004-09-14 05:06:28 -07:00
|
|
|
#include "core/gimpbuffer.h"
|
2003-03-10 06:07:22 -08:00
|
|
|
#include "core/gimpgradient.h"
|
2002-03-22 07:47:59 -08:00
|
|
|
#include "core/gimpimage.h"
|
2004-03-03 04:39:19 -08:00
|
|
|
#include "core/gimpimagefile.h"
|
2005-07-13 13:11:24 -07:00
|
|
|
#include "core/gimplayer.h"
|
|
|
|
|
#include "core/gimppalette.h"
|
2006-10-30 02:13:06 -08:00
|
|
|
|
2003-09-27 21:00:50 -07:00
|
|
|
#include "vectors/gimpvectors.h"
|
2002-03-22 07:47:59 -08:00
|
|
|
|
2006-10-30 02:13:06 -08:00
|
|
|
#include "gimpviewrenderer-utils.h"
|
2004-08-26 07:20:30 -07:00
|
|
|
#include "gimpviewrendererbrush.h"
|
2004-09-14 05:06:28 -07:00
|
|
|
#include "gimpviewrendererbuffer.h"
|
2004-08-26 07:20:30 -07:00
|
|
|
#include "gimpviewrendererlayer.h"
|
|
|
|
|
#include "gimpviewrenderergradient.h"
|
|
|
|
|
#include "gimpviewrendererimage.h"
|
|
|
|
|
#include "gimpviewrendererimagefile.h"
|
2005-07-13 13:11:24 -07:00
|
|
|
#include "gimpviewrendererpalette.h"
|
2004-08-26 07:20:30 -07:00
|
|
|
#include "gimpviewrenderervectors.h"
|
2002-03-22 07:47:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
GType
|
2004-08-26 07:20:30 -07:00
|
|
|
gimp_view_renderer_type_from_viewable_type (GType viewable_type)
|
2002-03-22 07:47:59 -08:00
|
|
|
{
|
2004-08-25 15:31:44 -07:00
|
|
|
GType type = GIMP_TYPE_VIEW_RENDERER;
|
2002-03-22 07:47:59 -08:00
|
|
|
|
2002-08-22 05:49:01 -07:00
|
|
|
g_return_val_if_fail (g_type_is_a (viewable_type, GIMP_TYPE_VIEWABLE),
|
|
|
|
|
G_TYPE_NONE);
|
2002-03-22 07:47:59 -08:00
|
|
|
|
2002-08-22 05:49:01 -07:00
|
|
|
if (g_type_is_a (viewable_type, GIMP_TYPE_BRUSH))
|
2002-03-22 07:47:59 -08:00
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_BRUSH;
|
2002-03-22 07:47:59 -08:00
|
|
|
}
|
2004-09-14 05:06:28 -07:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_BUFFER))
|
|
|
|
|
{
|
|
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_BUFFER;
|
|
|
|
|
}
|
2002-08-22 05:49:01 -07:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGE))
|
2002-03-22 07:47:59 -08:00
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_IMAGE;
|
2002-03-22 07:47:59 -08:00
|
|
|
}
|
2003-09-06 15:02:12 -07:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_LAYER))
|
2003-03-03 09:19:30 -08:00
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_LAYER;
|
2003-03-03 09:19:30 -08:00
|
|
|
}
|
2003-02-28 19:53:41 -08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_DRAWABLE))
|
2002-03-22 07:47:59 -08:00
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_DRAWABLE;
|
2002-03-22 07:47:59 -08:00
|
|
|
}
|
2003-03-10 06:07:22 -08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_GRADIENT))
|
|
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_GRADIENT;
|
2003-03-10 06:07:22 -08:00
|
|
|
}
|
2003-09-27 21:00:50 -07:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_VECTORS))
|
|
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_VECTORS;
|
2003-09-27 21:00:50 -07:00
|
|
|
}
|
2004-03-03 04:39:19 -08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGEFILE))
|
|
|
|
|
{
|
2004-08-26 07:20:30 -07:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_IMAGEFILE;
|
2004-03-03 04:39:19 -08:00
|
|
|
}
|
2005-07-13 13:11:24 -07:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_PALETTE))
|
|
|
|
|
{
|
|
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_PALETTE;
|
|
|
|
|
}
|
2002-03-22 07:47:59 -08:00
|
|
|
|
|
|
|
|
return type;
|
|
|
|
|
}
|