Exemplo n.º 1
0
static GimpTempBuf *
gimp_undo_get_new_preview (GimpViewable *viewable,
                           GimpContext  *context,
                           gint          width,
                           gint          height)
{
  GimpUndo *undo = GIMP_UNDO (viewable);

  if (undo->preview)
    {
      gint preview_width;
      gint preview_height;

      gimp_viewable_calc_preview_size (gimp_temp_buf_get_width  (undo->preview),
                                       gimp_temp_buf_get_height (undo->preview),
                                       width,
                                       height,
                                       TRUE, 1.0, 1.0,
                                       &preview_width,
                                       &preview_height,
                                       NULL);

      if (preview_width  < gimp_temp_buf_get_width  (undo->preview) &&
          preview_height < gimp_temp_buf_get_height (undo->preview))
        {
          return gimp_temp_buf_scale (undo->preview,
                                      preview_width, preview_height);
        }

      return gimp_temp_buf_copy (undo->preview);
    }

  return NULL;
}
Exemplo n.º 2
0
static GimpData *
gimp_pattern_duplicate (GimpData *data)
{
  GimpPattern *pattern = g_object_new (GIMP_TYPE_PATTERN, NULL);

  pattern->mask = gimp_temp_buf_copy (GIMP_PATTERN (data)->mask);

  return GIMP_DATA (pattern);
}