PIKApp/app/widgets/pikaviewrenderer-utils.c

103 lines
3.1 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* pikaviewrenderer-utils.c
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "widgets-types.h"
#include "core/pikabrush.h"
#include "core/pikabuffer.h"
#include "core/pikagradient.h"
#include "core/pikaimage.h"
#include "core/pikaimagefile.h"
#include "core/pikaimageproxy.h"
#include "core/pikalayer.h"
#include "core/pikapalette.h"
#include "vectors/pikavectors.h"
#include "pikaviewrenderer-utils.h"
#include "pikaviewrendererbrush.h"
#include "pikaviewrendererbuffer.h"
#include "pikaviewrendererlayer.h"
#include "pikaviewrenderergradient.h"
#include "pikaviewrendererimage.h"
#include "pikaviewrendererimagefile.h"
#include "pikaviewrendererpalette.h"
#include "pikaviewrenderervectors.h"
GType
pika_view_renderer_type_from_viewable_type (GType viewable_type)
{
GType type = PIKA_TYPE_VIEW_RENDERER;
g_return_val_if_fail (g_type_is_a (viewable_type, PIKA_TYPE_VIEWABLE),
G_TYPE_NONE);
if (g_type_is_a (viewable_type, PIKA_TYPE_BRUSH))
{
type = PIKA_TYPE_VIEW_RENDERER_BRUSH;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_BUFFER))
{
type = PIKA_TYPE_VIEW_RENDERER_BUFFER;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_IMAGE) ||
g_type_is_a (viewable_type, PIKA_TYPE_IMAGE_PROXY))
{
type = PIKA_TYPE_VIEW_RENDERER_IMAGE;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_LAYER))
{
type = PIKA_TYPE_VIEW_RENDERER_LAYER;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_DRAWABLE))
{
type = PIKA_TYPE_VIEW_RENDERER_DRAWABLE;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_GRADIENT))
{
type = PIKA_TYPE_VIEW_RENDERER_GRADIENT;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_VECTORS))
{
type = PIKA_TYPE_VIEW_RENDERER_VECTORS;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_IMAGEFILE))
{
type = PIKA_TYPE_VIEW_RENDERER_IMAGEFILE;
}
else if (g_type_is_a (viewable_type, PIKA_TYPE_PALETTE))
{
type = PIKA_TYPE_VIEW_RENDERER_PALETTE;
}
return type;
}