mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 14:23:33 +00:00
libgimpwidgets/gimppreviewarea.c added two functions:
* libgimpwidgets/gimppreviewarea.c * libgimpwidgets/gimppreviewarea.h: added two functions: gimp_preview_area_blend() to draw the blending of two buffers with an opacity parameter, and gimp_preview_area_mask() to draw the blending of two buffers, with a mask buffer. The code still needs some polish, though. * libgimp/gimpdrawablepreview.c * libgimp/gimpdrawablepreview.h: use gimp_preview_area_mask() in gimp_drawable_preview_draw(), so the previews are now much more accurate (respecting the selection, if any). Also made the buf parameter of gimp_drawable_preview_draw() a pointer to constants.
This commit is contained in:
parent
567385a150
commit
e733ca0930
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2004-09-07 DindinX <david@dindinx.org>
|
||||
|
||||
* libgimpwidgets/gimppreviewarea.c
|
||||
* libgimpwidgets/gimppreviewarea.h: added two functions:
|
||||
gimp_preview_area_blend() to draw the blending of two buffers with
|
||||
an opacity parameter, and gimp_preview_area_mask() to draw the
|
||||
blending of two buffers, with a mask buffer. The code still needs some
|
||||
polish, though.
|
||||
|
||||
* libgimp/gimpdrawablepreview.c
|
||||
* libgimp/gimpdrawablepreview.h: use gimp_preview_area_mask() in
|
||||
gimp_drawable_preview_draw(), so the previews are now much more
|
||||
accurate (respecting the selection, if any).
|
||||
|
||||
Also made the buf parameter of gimp_drawable_preview_draw() a pointer
|
||||
to constants.
|
||||
|
||||
2004-09-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-draw.c
|
||||
|
|
|
@ -245,10 +245,17 @@ gimp_drawable_preview_new (GimpDrawable *drawable,
|
|||
**/
|
||||
void
|
||||
gimp_drawable_preview_draw (GimpDrawablePreview *preview,
|
||||
guchar *buf)
|
||||
const guchar *buf)
|
||||
{
|
||||
GimpPreview *gimp_preview;
|
||||
GimpDrawable *drawable;
|
||||
GimpDrawable *drawable, *selection;
|
||||
gint32 image_id, selection_id;
|
||||
GimpPixelRgn selection_rgn, drawable_rgn;
|
||||
guchar *sel, *s;
|
||||
guchar *src, *saved_sel;
|
||||
gint x1, y1;
|
||||
gint width, height;
|
||||
gint bytes;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview));
|
||||
g_return_if_fail (preview->drawable != NULL);
|
||||
|
@ -256,10 +263,50 @@ gimp_drawable_preview_draw (GimpDrawablePreview *preview,
|
|||
|
||||
gimp_preview = GIMP_PREVIEW (preview);
|
||||
drawable = preview->drawable;
|
||||
x1 = gimp_preview->xoff + gimp_preview->xmin;
|
||||
y1 = gimp_preview->yoff + gimp_preview->ymin;
|
||||
width = gimp_preview->width;
|
||||
height = gimp_preview->height;
|
||||
bytes = drawable->bpp;
|
||||
|
||||
gimp_preview_area_draw (GIMP_PREVIEW_AREA (gimp_preview->area),
|
||||
0, 0, gimp_preview->width, gimp_preview->height,
|
||||
gimp_drawable_type (drawable->drawable_id),
|
||||
buf,
|
||||
gimp_preview->width * drawable->bpp);
|
||||
image_id = gimp_drawable_get_image (drawable->drawable_id);
|
||||
|
||||
if (gimp_selection_is_empty (image_id))
|
||||
{
|
||||
gimp_preview_area_draw (GIMP_PREVIEW_AREA (gimp_preview->area),
|
||||
0, 0, width, height,
|
||||
gimp_drawable_type (drawable->drawable_id),
|
||||
buf,
|
||||
width * bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_id = gimp_image_get_selection (image_id);
|
||||
selection = gimp_drawable_get (selection_id);
|
||||
|
||||
gimp_pixel_rgn_init (&drawable_rgn, drawable,
|
||||
x1, y1, width, height,
|
||||
FALSE, FALSE);
|
||||
gimp_pixel_rgn_init (&selection_rgn, selection,
|
||||
x1, y1, width, height,
|
||||
FALSE, FALSE);
|
||||
|
||||
saved_sel = sel = g_new (guchar, width * height);
|
||||
src = s = g_new (guchar, width * height * bytes);
|
||||
|
||||
gimp_pixel_rgn_get_rect (&drawable_rgn, src,
|
||||
x1, y1, width, height);
|
||||
gimp_pixel_rgn_get_rect (&selection_rgn, sel,
|
||||
x1, y1, width, height);
|
||||
|
||||
gimp_preview_area_mask (GIMP_PREVIEW_AREA (gimp_preview->area),
|
||||
0, 0, width, height,
|
||||
gimp_drawable_type (drawable->drawable_id),
|
||||
src, width * bytes,
|
||||
buf, width * bytes,
|
||||
sel, width);
|
||||
|
||||
g_free (saved_sel);
|
||||
g_free (src);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ GtkWidget * gimp_drawable_preview_new (GimpDrawable *drawable,
|
|||
gboolean *toggle);
|
||||
|
||||
void gimp_drawable_preview_draw (GimpDrawablePreview *preview,
|
||||
guchar *buf);
|
||||
const guchar *buf);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -66,6 +66,30 @@ void gimp_preview_area_draw (GimpPreviewArea *area,
|
|||
GimpImageType type,
|
||||
const guchar *buf,
|
||||
gint rowstride);
|
||||
void gimp_preview_area_blend (GimpPreviewArea *area,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpImageType type,
|
||||
const guchar *buf1,
|
||||
gint rowstride1,
|
||||
const guchar *buf2,
|
||||
gint rowstride2,
|
||||
guchar opacity);
|
||||
void gimp_preview_area_mask (GimpPreviewArea *area,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpImageType type,
|
||||
const guchar *buf1,
|
||||
gint rowstride1,
|
||||
const guchar *buf2,
|
||||
gint rowstride2,
|
||||
guchar *mask,
|
||||
gint rowstride_mask);
|
||||
|
||||
void gimp_preview_area_fill (GimpPreviewArea *area,
|
||||
gint x,
|
||||
gint y,
|
||||
|
|
Loading…
Reference in a new issue