Generating the multi-size image

Carver object creation
Carver activation

Carver object creation

The LqrCarver objects are initialized from a plain buffer of unsigned chars representing an image, in which each colour channel takes a value between 0 and 255, through this function:

LqrCarver * lqr_carver_new( guchar *  buffer,
  gint  width,
  gint  height,
  gint  bpp);

Here, buffer is the array representing an image of size width by height width bpp colour channels per pixels. Thus, the overall buffer size has to be of widht * height * bpp unsigned characters, and ordered such that the k-th colour of the pixel at row y and column x is found at:

buffer[(y * width + x) * bpp + k]

(this assumes that x, y and k all start from 0 and reach the maximum values widht-1, height-1 and bpp-1, respectively)

The function returns a pointer to the newly allocated LqrCarver upon success, or NULL in case of insufficient memory.

Important

The buffer will be incorporated into the LqrCarver object and must not be accessed directly any more.

Carver activation

The newly created LqrCarver consists only of the image buffer plus an uninitialized visibility map. If one had a previously computed visibility map, it could be imported into the LqrCarver and that would be enough (see the Importing a visibility map in a carver section). If the visibility map has to be computed, the LqrCarver needs to be initialized through this function:

LqrRetVal lqr_carver_init( LqrCarver *  carver,
  gint  delta_x,
  gfloat  rigidity);

Here, delta_x is the maximum allowed transversal step of the seams (0 means straight seams, the standard value is 1), while the rigidity parameter can be used to introduce a bias for non-straight seams (the standard value is 0).

Important

It is currently an error to initalize a carver object if a visibility map has been imported already.