ImageEn, unit imageenview

TImageEnView.SelectCustom

TImageEnView.SelectCustom


Declaration

procedure SelectCustom();


Description

Call SelectCustom after you have specified a pixmap of selected pixels of the image.
To select a pixmap use SelectionMask methods like SetPixel.

Note: You can use IsPointInsideSelection to determine whether specific pixels are selected.


Examples

// only pixels at 10,10 and 15,15 are selected (SelectionMaskDepth=1)
ImageEnView1.SelectionMask.SetPixel(10, 10, 1);
ImageEnView1.SelectionMask.SetPixel(15, 15, 1);
ImageEnView1.SelectCustom();


// Make a gradient selection (increasing from unselected to fully selected along height of image)
// Then convert selection to gray scale
ImageEnView1.Deselect();
ImageEnView1.SelectionMaskDepth := 8;
for Y := 0 to ImageEnView1.IEBitmap.Height - 1 do
  for X := 0 to ImageEnView1.IEBitmap.Width - 1 do
  begin
    selIntensity := Round( Y / ImageEnView1.IEBitmap.Height * 255 );
    ImageEnView1.SelectionMask.SetPixel( X, Y, selIntensity );
  end;
ImageEnView1.SelectCustom;
ImageEnView1.Proc.ConvertToGray();
ImageEnView1.Deselect();




// Select all pixels that are blue or green (SelectionMaskDepth=1)
for y := 0 to ImageEnView1.IEBitmap.Height - 1 do
  for x := 0 to ImageEnView1.IEBitmap.Width - 1 do
  begin
    color := ImageEnView1.IEBitmap.Pixels[x, y];
    if ( color = clBlue ) or ( color = clGreen ) then
    begin
      ImageEnView.SelectionMask.SetPixel(X, Y, 1);
      ImageEnView.SelectCustom();
    end;
  end;


See Also

- SelectionMask