ImageEn, unit imageenview

TImageEnView.LayersFixSizes

TImageEnView.LayersFixSizes


Declaration

procedure LayersFixSizes(LayerIndex: Integer = LYR_ALL_LAYERS);


Description

Resamples the bitmap of layers to match their displayed size. This will improve the quality of the layer.
This should be called after all layer sizing is finished to avoid quality loss.
The index of a specific layer can be specified, or LYR_ALL_LAYERS (-3) to process all layers, or LYR_SELECTED_LAYERS (-2) to process selected layers.

Note: LayersMergeFilter will specify the quality of image layers, if they do not have a custom UseResampleFilter


Example

// Resample top-most layer
ImageEnView1.LayersFixSizes( ImageEnView1.LayersCount - 1 );

// Resample all layers
ImageEnView1.LayersFixSizes( LYR_ALL_LAYERS );

// Resample selected layers
ImageEnView1.LayersFixSizes( LYR_SELECTED_LAYERS );

// Make all selected layers 1/3 size
ImageEnView1.LockUpdate();
for i := 0 to ImageEnView1.LayersCount - 1 do
  if ImageEnView1Layers[ I ].Selected then
  begin
    ImageEnView1Layers[ I ].Width  := ImageEnView1Layers[ I ].Width div 3;
    ImageEnView1Layers[ I ].Height := ImageEnView1Layers[ I ].Height div 3;
  end;
ImageEnView1.LayersFixSizes( LYR_SELECTED_LAYERS );
ImageEnView1.UnlockUpdate();