Commit bb7a9d9b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

new function which returns the image's QMask.

2004-02-19  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage-qmask.c (gimp_image_get_qmask): new function
	which returns the image's QMask.

	* app/core/gimpimage.c (gimp_image_channel_name_changed)
	* app/gui/qmask-commands.c (qmask_query_response): use it.
parent 513f5eac
2004-02-19 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-qmask.c (gimp_image_get_qmask): new function
which returns the image's QMask.
* app/core/gimpimage.c (gimp_image_channel_name_changed)
* app/gui/qmask-commands.c (qmask_query_response): use it.
2004-02-19 Michael Natterer <mitch@gimp.org>
 
* app/core/gimp.[ch]: added new signal "buffer_changed" and new
......@@ -213,12 +213,9 @@ qmask_query_response (GtkWidget *widget,
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *channel;
GimpChannel *channel = gimp_image_get_qmask (options->gimage);
GimpRGB color;
channel = gimp_image_get_channel_by_name (options->gimage,
GIMP_IMAGE_QMASK_NAME);
if (options->gimage && channel)
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
......
......@@ -213,12 +213,9 @@ qmask_query_response (GtkWidget *widget,
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *channel;
GimpChannel *channel = gimp_image_get_qmask (options->gimage);
GimpRGB color;
channel = gimp_image_get_channel_by_name (options->gimage,
GIMP_IMAGE_QMASK_NAME);
if (options->gimage && channel)
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
......
......@@ -56,7 +56,7 @@ gimp_image_set_qmask_state (GimpImage *gimage,
gimage->qmask_state = qmask_state ? TRUE : FALSE;
selection = gimp_image_get_mask (gimage);
mask = gimp_image_get_channel_by_name (gimage, GIMP_IMAGE_QMASK_NAME);
mask = gimp_image_get_qmask (gimage);
if (qmask_state)
{
......@@ -134,6 +134,14 @@ gimp_image_get_qmask_state (const GimpImage *gimage)
return gimage->qmask_state;
}
GimpChannel *
gimp_image_get_qmask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimp_image_get_channel_by_name (gimage, GIMP_IMAGE_QMASK_NAME);
}
void
gimp_image_qmask_invert (GimpImage *gimage)
{
......@@ -141,9 +149,7 @@ gimp_image_qmask_invert (GimpImage *gimage)
if (gimage->qmask_state)
{
GimpChannel *qmask;
qmask = gimp_image_get_channel_by_name (gimage, GIMP_IMAGE_QMASK_NAME);
GimpChannel *qmask = gimp_image_get_qmask (gimage);
if (qmask)
{
......
......@@ -23,11 +23,13 @@
#define GIMP_IMAGE_QMASK_NAME "Qmask"
void gimp_image_set_qmask_state (GimpImage *gimage,
gboolean qmask_state);
gboolean gimp_image_get_qmask_state (const GimpImage *gimage);
void gimp_image_set_qmask_state (GimpImage *gimage,
gboolean qmask_state);
gboolean gimp_image_get_qmask_state (const GimpImage *gimage);
void gimp_image_qmask_invert (GimpImage *gimage);
GimpChannel * gimp_image_get_qmask (const GimpImage *gimage);
void gimp_image_qmask_invert (GimpImage *gimage);
#endif /* __GIMP_IMAGE_QMASK_H__ */
......@@ -56,7 +56,7 @@ gimp_image_set_qmask_state (GimpImage *gimage,
gimage->qmask_state = qmask_state ? TRUE : FALSE;
selection = gimp_image_get_mask (gimage);
mask = gimp_image_get_channel_by_name (gimage, GIMP_IMAGE_QMASK_NAME);
mask = gimp_image_get_qmask (gimage);
if (qmask_state)
{
......@@ -134,6 +134,14 @@ gimp_image_get_qmask_state (const GimpImage *gimage)
return gimage->qmask_state;
}
GimpChannel *
gimp_image_get_qmask (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimp_image_get_channel_by_name (gimage, GIMP_IMAGE_QMASK_NAME);
}
void
gimp_image_qmask_invert (GimpImage *gimage)
{
......@@ -141,9 +149,7 @@ gimp_image_qmask_invert (GimpImage *gimage)
if (gimage->qmask_state)
{
GimpChannel *qmask;
qmask = gimp_image_get_channel_by_name (gimage, GIMP_IMAGE_QMASK_NAME);
GimpChannel *qmask = gimp_image_get_qmask (gimage);
if (qmask)
{
......
......@@ -23,11 +23,13 @@
#define GIMP_IMAGE_QMASK_NAME "Qmask"
void gimp_image_set_qmask_state (GimpImage *gimage,
gboolean qmask_state);
gboolean gimp_image_get_qmask_state (const GimpImage *gimage);
void gimp_image_set_qmask_state (GimpImage *gimage,
gboolean qmask_state);
gboolean gimp_image_get_qmask_state (const GimpImage *gimage);
void gimp_image_qmask_invert (GimpImage *gimage);
GimpChannel * gimp_image_get_qmask (const GimpImage *gimage);
void gimp_image_qmask_invert (GimpImage *gimage);
#endif /* __GIMP_IMAGE_QMASK_H__ */
......@@ -981,8 +981,7 @@ gimp_image_channel_name_changed (GimpChannel *channel,
gimp_image_set_qmask_state (gimage, TRUE);
}
else if (gimp_image_get_qmask_state (gimage) &&
! gimp_container_get_child_by_name (gimage->channels,
GIMP_IMAGE_QMASK_NAME))
! gimp_image_get_qmask (gimage))
{
gimp_image_set_qmask_state (gimage, FALSE);
}
......
......@@ -213,12 +213,9 @@ qmask_query_response (GtkWidget *widget,
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *channel;
GimpChannel *channel = gimp_image_get_qmask (options->gimage);
GimpRGB color;
channel = gimp_image_get_channel_by_name (options->gimage,
GIMP_IMAGE_QMASK_NAME);
if (options->gimage && channel)
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment