Code sample Home

Scale raster image
  HANDLE hImgRef;
  double W, H, ScaleX, ScaleY;

  ScaleX = 0.7;
  ScaleY = 1.2;
  // our image ref. entity is marked with key = 911
  hImgRef = lcDrwGetEntByKey( m_hLcDrw, 911 );
  if (hImgRef){
    // get image width & height on a drawing
    W = lcPropGetFloat( hImgRef, LC_PROP_IMGREF_W );
    H = lcPropGetFloat( hImgRef, LC_PROP_IMGREF_H );
    // allow non-square pixels of the image
    lcPropPutBool( hImgRef, LC_PROP_IMGREF_SQPIX, false );
    // change image width & height on a drawing according ScaleX, ScaleY
    W = W * ScaleX;
    H = H * ScaleY;
    lcPropPutFloat( hImgRef, LC_PROP_IMGREF_W, W );
    lcPropPutFloat( hImgRef, LC_PROP_IMGREF_H, H );
    // update view
    lcEntUpdate( hImgRef );
    lcWndRedraw( m_hLcWnd );
  }
Image before and after the scaling



See Also:

Resample raster image
Create raster image (from a file)
Create raster image (set pixels)