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