2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2002-03-22 23:47:59 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2004-08-26 22:20:30 +08:00
|
|
|
* gimpviewrenderer-utils.c
|
2003-03-01 11:53:41 +08:00
|
|
|
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
2002-03-22 23:47:59 +08:00
|
|
|
*
|
|
|
|
* 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 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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2002-03-22 23:47:59 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "widgets-types.h"
|
|
|
|
|
|
|
|
#include "core/gimpbrush.h"
|
2004-09-14 20:06:28 +08:00
|
|
|
#include "core/gimpbuffer.h"
|
2003-03-10 22:07:22 +08:00
|
|
|
#include "core/gimpgradient.h"
|
2002-03-22 23:47:59 +08:00
|
|
|
#include "core/gimpimage.h"
|
2004-03-03 20:39:19 +08:00
|
|
|
#include "core/gimpimagefile.h"
|
2005-07-14 04:11:24 +08:00
|
|
|
#include "core/gimplayer.h"
|
|
|
|
#include "core/gimppalette.h"
|
2006-10-30 18:13:06 +08:00
|
|
|
|
2003-09-28 12:00:50 +08:00
|
|
|
#include "vectors/gimpvectors.h"
|
2002-03-22 23:47:59 +08:00
|
|
|
|
2006-10-30 18:13:06 +08:00
|
|
|
#include "gimpviewrenderer-utils.h"
|
2004-08-26 22:20:30 +08:00
|
|
|
#include "gimpviewrendererbrush.h"
|
2004-09-14 20:06:28 +08:00
|
|
|
#include "gimpviewrendererbuffer.h"
|
2004-08-26 22:20:30 +08:00
|
|
|
#include "gimpviewrendererlayer.h"
|
|
|
|
#include "gimpviewrenderergradient.h"
|
|
|
|
#include "gimpviewrendererimage.h"
|
|
|
|
#include "gimpviewrendererimagefile.h"
|
2005-07-14 04:11:24 +08:00
|
|
|
#include "gimpviewrendererpalette.h"
|
2004-08-26 22:20:30 +08:00
|
|
|
#include "gimpviewrenderervectors.h"
|
2002-03-22 23:47:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
GType
|
2004-08-26 22:20:30 +08:00
|
|
|
gimp_view_renderer_type_from_viewable_type (GType viewable_type)
|
2002-03-22 23:47:59 +08:00
|
|
|
{
|
2004-08-26 06:31:44 +08:00
|
|
|
GType type = GIMP_TYPE_VIEW_RENDERER;
|
2002-03-22 23:47:59 +08:00
|
|
|
|
2002-08-22 20:49:01 +08:00
|
|
|
g_return_val_if_fail (g_type_is_a (viewable_type, GIMP_TYPE_VIEWABLE),
|
|
|
|
G_TYPE_NONE);
|
2002-03-22 23:47:59 +08:00
|
|
|
|
2002-08-22 20:49:01 +08:00
|
|
|
if (g_type_is_a (viewable_type, GIMP_TYPE_BRUSH))
|
2002-03-22 23:47:59 +08:00
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_BRUSH;
|
2002-03-22 23:47:59 +08:00
|
|
|
}
|
2004-09-14 20:06:28 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_BUFFER))
|
|
|
|
{
|
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_BUFFER;
|
|
|
|
}
|
2002-08-22 20:49:01 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGE))
|
2002-03-22 23:47:59 +08:00
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_IMAGE;
|
2002-03-22 23:47:59 +08:00
|
|
|
}
|
2003-09-07 06:02:12 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_LAYER))
|
2003-03-04 01:19:30 +08:00
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_LAYER;
|
2003-03-04 01:19:30 +08:00
|
|
|
}
|
2003-03-01 11:53:41 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_DRAWABLE))
|
2002-03-22 23:47:59 +08:00
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_DRAWABLE;
|
2002-03-22 23:47:59 +08:00
|
|
|
}
|
2003-03-10 22:07:22 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_GRADIENT))
|
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_GRADIENT;
|
2003-03-10 22:07:22 +08:00
|
|
|
}
|
2003-09-28 12:00:50 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_VECTORS))
|
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_VECTORS;
|
2003-09-28 12:00:50 +08:00
|
|
|
}
|
2004-03-03 20:39:19 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGEFILE))
|
|
|
|
{
|
2004-08-26 22:20:30 +08:00
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_IMAGEFILE;
|
2004-03-03 20:39:19 +08:00
|
|
|
}
|
2005-07-14 04:11:24 +08:00
|
|
|
else if (g_type_is_a (viewable_type, GIMP_TYPE_PALETTE))
|
|
|
|
{
|
|
|
|
type = GIMP_TYPE_VIEW_RENDERER_PALETTE;
|
|
|
|
}
|
2002-03-22 23:47:59 +08:00
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|