2000-06-02 01:34:56 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpchannel.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-06-02 01:34:56 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2000-06-02 01:34:56 +08:00
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2000-06-02 01:34:56 +08:00
|
|
|
*/
|
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-06-02 01:34:56 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
|
|
|
|
2019-08-14 03:36:03 +08:00
|
|
|
G_DEFINE_TYPE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE)
|
|
|
|
|
|
|
|
#define parent_class gimp_drawable_parent_class
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_channel_class_init (GimpChannelClass *klass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_channel_init (GimpChannel *channel)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Public API. */
|
|
|
|
|
|
|
|
|
2000-08-25 08:37:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_channel_new:
|
2019-08-11 23:12:20 +08:00
|
|
|
* @image: The image to which to add the channel.
|
|
|
|
* @name: The channel name.
|
|
|
|
* @width: The channel width.
|
|
|
|
* @height: The channel height.
|
2000-08-25 08:37:35 +08:00
|
|
|
* @opacity: The channel opacity.
|
2019-08-11 23:12:20 +08:00
|
|
|
* @color: The channel compositing color.
|
2000-08-25 08:37:35 +08:00
|
|
|
*
|
|
|
|
* Create a new channel.
|
|
|
|
*
|
|
|
|
* This procedure creates a new channel with the specified width and
|
|
|
|
* height. Name, opacity, and color are also supplied parameters. The
|
|
|
|
* new channel still needs to be added to the image, as this is not
|
2010-09-06 06:03:29 +08:00
|
|
|
* automatic. Add the new channel with the gimp_image_insert_channel()
|
|
|
|
* command. Other attributes such as channel show masked, should be
|
|
|
|
* set with explicit procedure calls. The channel's contents are
|
|
|
|
* undefined initially.
|
2000-08-25 08:37:35 +08:00
|
|
|
*
|
|
|
|
* Returns: The newly created channel.
|
|
|
|
*/
|
2019-08-14 04:54:37 +08:00
|
|
|
GimpChannel *
|
2019-08-11 23:12:20 +08:00
|
|
|
gimp_channel_new (GimpImage *image,
|
2006-04-12 18:53:28 +08:00
|
|
|
const gchar *name,
|
|
|
|
guint width,
|
|
|
|
guint height,
|
|
|
|
gdouble opacity,
|
|
|
|
const GimpRGB *color)
|
2000-06-02 01:34:56 +08:00
|
|
|
{
|
2019-08-11 23:12:20 +08:00
|
|
|
return _gimp_channel_new (image,
|
2006-04-12 18:53:28 +08:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
name,
|
|
|
|
opacity,
|
|
|
|
color);
|
2000-06-02 01:34:56 +08:00
|
|
|
}
|
2019-08-13 06:42:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Deprecated API. */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_channel_new_deprecated: (skip)
|
|
|
|
* @image_ID: The image to which to add the channel.
|
|
|
|
* @name: The channel name.
|
|
|
|
* @width: The channel width.
|
|
|
|
* @height: The channel height.
|
|
|
|
* @opacity: The channel opacity.
|
|
|
|
* @color: The channel compositing color.
|
|
|
|
*
|
|
|
|
* Create a new channel.
|
|
|
|
*
|
|
|
|
* This procedure creates a new channel with the specified width and
|
|
|
|
* height. Name, opacity, and color are also supplied parameters. The
|
|
|
|
* new channel still needs to be added to the image, as this is not
|
|
|
|
* automatic. Add the new channel with the gimp_image_insert_channel()
|
|
|
|
* command. Other attributes such as channel show masked, should be
|
|
|
|
* set with explicit procedure calls. The channel's contents are
|
|
|
|
* undefined initially.
|
|
|
|
*
|
|
|
|
* Returns: The newly created channel.
|
|
|
|
*/
|
|
|
|
gint32
|
|
|
|
gimp_channel_new_deprecated (gint32 image_id,
|
|
|
|
const gchar *name,
|
|
|
|
guint width,
|
|
|
|
guint height,
|
|
|
|
gdouble opacity,
|
|
|
|
const GimpRGB *color)
|
|
|
|
{
|
2019-08-14 04:54:37 +08:00
|
|
|
GimpImage *image = gimp_image_new_by_id (image_id);
|
|
|
|
GimpChannel *channel;
|
|
|
|
gint32 channel_id;
|
2019-08-13 06:42:10 +08:00
|
|
|
|
2019-08-14 04:54:37 +08:00
|
|
|
channel = gimp_channel_new (image, name, width, height,
|
|
|
|
opacity, color);
|
|
|
|
channel_id = gimp_item_get_id (GIMP_ITEM (channel));
|
2019-08-13 06:42:10 +08:00
|
|
|
|
|
|
|
g_object_unref (image);
|
2019-08-14 04:54:37 +08:00
|
|
|
g_object_unref (channel);
|
2019-08-13 06:42:10 +08:00
|
|
|
|
|
|
|
return channel_id;
|
|
|
|
}
|