mirror of https://github.com/GNOME/gimp.git
made gimp_image_get_active_components() a static function and changed its
2003-03-11 Sven Neumann <sven@gimp.org> * app/core/gimpimage.[ch]: made gimp_image_get_active_components() a static function and changed its behaviour so that the image's active components are only used for layers, not for channels. Fixes bug #108083.
This commit is contained in:
parent
a87da0ea1c
commit
c65a2dd1af
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2003-03-11 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpimage.[ch]: made gimp_image_get_active_components()
|
||||||
|
a static function and changed its behaviour so that the image's
|
||||||
|
active components are only used for layers, not for channels.
|
||||||
|
Fixes bug #108083.
|
||||||
|
|
||||||
|
2003-03-11 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/gui/session.c (session_info_deserialize): improved error
|
||||||
|
handling.
|
||||||
|
|
||||||
2003-03-11 Sven Neumann <sven@gimp.org>
|
2003-03-11 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/display/gimpdisplayshell-callbacks.c
|
* app/display/gimpdisplayshell-callbacks.c
|
||||||
|
|
|
@ -128,6 +128,10 @@ static TempBuf *gimp_image_get_new_preview (GimpViewable *viewable,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
|
||||||
|
static void gimp_image_get_active_components (const GimpImage *gimage,
|
||||||
|
const GimpDrawable *drawable,
|
||||||
|
gboolean *active);
|
||||||
|
|
||||||
static void gimp_image_real_colormap_changed (GimpImage *gimage,
|
static void gimp_image_real_colormap_changed (GimpImage *gimage,
|
||||||
gint ncol);
|
gint ncol);
|
||||||
|
|
||||||
|
@ -995,6 +999,36 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_image_get_active_components (const GimpImage *gimage,
|
||||||
|
const GimpDrawable *drawable,
|
||||||
|
gboolean *active)
|
||||||
|
{
|
||||||
|
/* If the drawable is a channel make sure that the alpha channel is
|
||||||
|
* not valid.
|
||||||
|
*/
|
||||||
|
if (GIMP_IS_CHANNEL (drawable))
|
||||||
|
{
|
||||||
|
active[GRAY_PIX] = TRUE;
|
||||||
|
active[ALPHA_G_PIX] = FALSE;
|
||||||
|
}
|
||||||
|
/* otherwise, check whether preserve transparency is
|
||||||
|
* enabled in the layer and if the layer has alpha
|
||||||
|
*/
|
||||||
|
else if (GIMP_IS_LAYER (drawable))
|
||||||
|
{
|
||||||
|
GimpLayer *layer = GIMP_LAYER (drawable);
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
/* first copy the gimage active channels */
|
||||||
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
|
active[i] = gimage->active[i];
|
||||||
|
|
||||||
|
if (gimp_drawable_has_alpha (drawable) && layer->preserve_trans)
|
||||||
|
active[gimp_drawable_bytes (drawable) - 1] = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_image_real_colormap_changed (GimpImage *gimage,
|
gimp_image_real_colormap_changed (GimpImage *gimage,
|
||||||
gint ncol)
|
gint ncol)
|
||||||
|
@ -1453,41 +1487,6 @@ gimp_image_get_component_active (const GimpImage *gimage,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gimp_image_get_active_components (const GimpImage *gimage,
|
|
||||||
const GimpDrawable *drawable,
|
|
||||||
gint *active)
|
|
||||||
{
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
/* first, blindly copy the gimage active channels */
|
|
||||||
for (i = 0; i < MAX_CHANNELS; i++)
|
|
||||||
active[i] = gimage->active[i];
|
|
||||||
|
|
||||||
/* If the drawable is a channel (a saved selection, etc.)
|
|
||||||
* make sure that the alpha channel is not valid
|
|
||||||
*/
|
|
||||||
if (GIMP_IS_CHANNEL (drawable))
|
|
||||||
{
|
|
||||||
active[ALPHA_G_PIX] = 0; /* no alpha values in channels */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* otherwise, check whether preserve transparency is
|
|
||||||
* enabled in the layer and if the layer has alpha
|
|
||||||
*/
|
|
||||||
if (GIMP_IS_LAYER (drawable))
|
|
||||||
{
|
|
||||||
GimpLayer *layer;
|
|
||||||
|
|
||||||
layer = GIMP_LAYER (drawable);
|
|
||||||
|
|
||||||
if (gimp_drawable_has_alpha (drawable) && layer->preserve_trans)
|
|
||||||
active[gimp_drawable_bytes (drawable) - 1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_set_component_visible (GimpImage *gimage,
|
gimp_image_set_component_visible (GimpImage *gimage,
|
||||||
GimpChannelType type,
|
GimpChannelType type,
|
||||||
|
@ -1998,10 +1997,10 @@ gimp_image_apply_image (GimpImage *gimage,
|
||||||
* we need to add the layer offset to transform coords
|
* we need to add the layer offset to transform coords
|
||||||
* into the mask coordinate system
|
* into the mask coordinate system
|
||||||
*/
|
*/
|
||||||
x1 = CLAMP (x1, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
x1 = CLAMP (x1, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y1 = CLAMP (y1, -offset_y, gimp_drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
y1 = CLAMP (y1, -offset_y, gimp_drawable_height (GIMP_DRAWABLE (mask))-offset_y);
|
||||||
x2 = CLAMP (x2, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
x2 = CLAMP (x2, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x);
|
||||||
y2 = CLAMP (y2, -offset_y, gimp_drawable_height(GIMP_DRAWABLE (mask))-offset_y);
|
y2 = CLAMP (y2, -offset_y, gimp_drawable_height (GIMP_DRAWABLE (mask))-offset_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the calling procedure specified an undo step... */
|
/* If the calling procedure specified an undo step... */
|
||||||
|
|
|
@ -267,9 +267,6 @@ void gimp_image_set_component_active (GimpImage *gimage,
|
||||||
gboolean active);
|
gboolean active);
|
||||||
gboolean gimp_image_get_component_active (const GimpImage *gimage,
|
gboolean gimp_image_get_component_active (const GimpImage *gimage,
|
||||||
GimpChannelType type);
|
GimpChannelType type);
|
||||||
void gimp_image_get_active_components (const GimpImage *gimage,
|
|
||||||
const GimpDrawable *drawable,
|
|
||||||
gint *active);
|
|
||||||
|
|
||||||
void gimp_image_set_component_visible (GimpImage *gimage,
|
void gimp_image_set_component_visible (GimpImage *gimage,
|
||||||
GimpChannelType type,
|
GimpChannelType type,
|
||||||
|
|
Loading…
Reference in New Issue