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.
This commit is contained in:
Michael Natterer 2004-02-19 13:18:24 +00:00 committed by Michael Natterer
parent 513f5eac36
commit bb7a9d9bcc
9 changed files with 44 additions and 30 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -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),

View File

@ -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),

View File

@ -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)
{

View File

@ -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__ */

View File

@ -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)
{

View File

@ -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__ */

View File

@ -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);
}

View File

@ -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),