예제 #1
0
TileManager *
gimp_projection_get_tiles_at_level (GimpProjection *proj,
                                    gint            level,
                                    gboolean       *is_premult)
{
  g_return_val_if_fail (GIMP_IS_PROJECTION (proj), NULL);

  if (! proj->pyramid)
    {
      const Babl *format;
      gint        bytes;
      gint        width;
      gint        height;

      format = gimp_projection_get_format (GIMP_PICKABLE (proj));

      bytes = babl_format_get_bytes_per_pixel (format);
      gimp_projectable_get_size (proj->projectable, &width, &height);

      proj->pyramid = tile_pyramid_new (bytes, width, height);

      tile_pyramid_set_validate_proc (proj->pyramid,
                                      (TileValidateProc) gimp_projection_validate_tile,
                                      proj);
    }

  return tile_pyramid_get_tiles (proj->pyramid, level, is_premult);
}
예제 #2
0
static GeglBuffer *
gimp_projection_get_buffer (GimpPickable *pickable)
{
  GimpProjection *proj = GIMP_PROJECTION (pickable);

  if (! proj->buffer)
    {
      TileManager *tiles  = gimp_projection_get_tiles_at_level (proj, 0, NULL);
      const Babl  *format = gimp_projection_get_format (pickable);

      proj->buffer = gimp_tile_manager_create_buffer (tiles, format);

      if (proj->sink_node)
        {
          gegl_node_set (proj->sink_node,
                         "buffer", proj->buffer,
                         NULL);
        }
    }

  return proj->buffer;
}
예제 #3
0
static GeglBuffer *
gimp_projection_get_buffer (GimpPickable *pickable)
{
  GimpProjection *proj = GIMP_PROJECTION (pickable);

  if (! proj->buffer)
    {
      GeglNode   *graph;
      const Babl *format;
      gint        width;
      gint        height;

      graph = gimp_projectable_get_graph (proj->projectable);
      format = gimp_projection_get_format (GIMP_PICKABLE (proj));
      gimp_projectable_get_size (proj->projectable, &width, &height);

      proj->buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
                                      format);

      proj->validate_handler = gimp_tile_handler_projection_new (graph);
      gegl_buffer_add_handler (proj->buffer, proj->validate_handler);

      /*  This used to call gimp_tile_handler_projection_invalidate()
       *  which forced the entire projection to be constructed in one
       *  go for new images, causing a potentially huge delay. Now we
       *  initially validate stuff the normal way, which makes the
       *  image appear incrementally, but it keeps everything
       *  responsive.
       */
      gimp_projection_add_update_area (proj, 0, 0, width, height);
      proj->invalidate_preview = TRUE;
      gimp_projection_flush (proj);
    }

  return proj->buffer;
}