Difference between revisions of "TSCARBitmap.TranspColor"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== Member of TSCARBitmap, read/write, default -1.<source lang="scar" lines="false"> property TSCARBitmap.TransColor: Integer; </source> ==Availability== SCAR ...")
(No difference)

Revision as of 11:35, 26 October 2012

Definition

Member of TSCARBitmap, read/write, default -1.
property TSCARBitmap.TransColor: Integer;

Availability

SCAR Divi 3.35 > Current

Description

Sets the transparent color of the bitmap to the given value. When this field is not -1, bitmap searches will ignore the pixels with the transparent color on the bitmap during the search. If AlphaBlend is set to true, the function will clear the alpha channel and when the assigned value is not -1, it will alpha-blend the pixels on the bitmap with the given color at full transparency.

Example

var
  Bmp, Bmp2: TSCARBitmap;
   
begin
  Bmp := TSCARBitmap.Create('deNoTYBBg+M/wnwCKjwchgsrgip/e+X/5D' +
    'DFausEApHjfjv/LF+HXAlIJBiAGUPGEHjzq4YofPXp04sQJEBe34pPNCv+/3Aa' +
    'qgSiGWoFX8f83h/8/XAaxhUjF/693/D+XR5JikAjdFUPVE60Y6CNTU1MiFcPVA' +
    'wFQJUHFQARUCU0nRKZAEhEAWNcFGw==');      
  Bmp2 := TSCARBitmap.Create('');
  try                 
    Bmp.Resize(100, 100);  
    DebugBitmap(Bmp);  
    Wait(2000);              
    Bmp2.SetSize(100, 100);     
    Bmp2.Clear(clAquamarine);
    Bmp.AlphaBlend := True;
    Bmp.TranspColor := clFuchsia;  
    Bmp.DrawTo(Bmp2, 0, 0);
    DebugBitmap(Bmp2);  
  finally
    Bmp.Free;
    Bmp2.Free;
  end;
end.

See Also