gimpviewrenderer-utils.c 2.72 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2 3
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
4
 * gimpviewrenderer-utils.c
5
 * Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 3 of the License, or
10 11 12 13 14 15 16 17
 * (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
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 20 21 22
 */

#include "config.h"

23
#include <gegl.h>
24 25 26 27 28
#include <gtk/gtk.h>

#include "widgets-types.h"

#include "core/gimpbrush.h"
29
#include "core/gimpbuffer.h"
30
#include "core/gimpgradient.h"
31
#include "core/gimpimage.h"
32
#include "core/gimpimagefile.h"
33 34
#include "core/gimplayer.h"
#include "core/gimppalette.h"
35

36
#include "vectors/gimpvectors.h"
37

38
#include "gimpviewrenderer-utils.h"
39
#include "gimpviewrendererbrush.h"
40
#include "gimpviewrendererbuffer.h"
41 42 43 44
#include "gimpviewrendererlayer.h"
#include "gimpviewrenderergradient.h"
#include "gimpviewrendererimage.h"
#include "gimpviewrendererimagefile.h"
45
#include "gimpviewrendererpalette.h"
46
#include "gimpviewrenderervectors.h"
47 48 49


GType
50
gimp_view_renderer_type_from_viewable_type (GType viewable_type)
51
{
52
  GType type = GIMP_TYPE_VIEW_RENDERER;
53

54 55
  g_return_val_if_fail (g_type_is_a (viewable_type, GIMP_TYPE_VIEWABLE),
                        G_TYPE_NONE);
56

57
  if (g_type_is_a (viewable_type, GIMP_TYPE_BRUSH))
58
    {
59
      type = GIMP_TYPE_VIEW_RENDERER_BRUSH;
60
    }
61 62 63 64
  else if (g_type_is_a (viewable_type, GIMP_TYPE_BUFFER))
    {
      type = GIMP_TYPE_VIEW_RENDERER_BUFFER;
    }
65
  else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGE))
66
    {
67
      type = GIMP_TYPE_VIEW_RENDERER_IMAGE;
68
    }
Michael Natterer's avatar
Michael Natterer committed
69
  else if (g_type_is_a (viewable_type, GIMP_TYPE_LAYER))
70
    {
71
      type = GIMP_TYPE_VIEW_RENDERER_LAYER;
72
    }
73
  else if (g_type_is_a (viewable_type, GIMP_TYPE_DRAWABLE))
74
    {
75
      type = GIMP_TYPE_VIEW_RENDERER_DRAWABLE;
76
    }
77 78
  else if (g_type_is_a (viewable_type, GIMP_TYPE_GRADIENT))
    {
79
      type = GIMP_TYPE_VIEW_RENDERER_GRADIENT;
80
    }
81 82
  else if (g_type_is_a (viewable_type, GIMP_TYPE_VECTORS))
    {
83
      type = GIMP_TYPE_VIEW_RENDERER_VECTORS;
84
    }
85 86
  else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGEFILE))
    {
87
      type = GIMP_TYPE_VIEW_RENDERER_IMAGEFILE;
88
    }
89 90 91 92
  else if (g_type_is_a (viewable_type, GIMP_TYPE_PALETTE))
    {
      type = GIMP_TYPE_VIEW_RENDERER_PALETTE;
    }
93 94 95

  return type;
}