Registriert seit: 17. Mai 2007
482 Beiträge
Delphi XE6 Professional
|
Re: [GR32] How to blend two TBitmap32s
19. Sep 2010, 19:08
@NamenLozer, this is black blured border on white background. I mean white color in multiply mode is neutral (not visible)
Here is test code:
Delphi-Quellcode:
function ColorAlgebra(F, B, M: TColor32): TColor32;
begin
// BlendMode.Multiply(F, B, M);
// Result := BlendRegEx(F, B, M);
// 1. multiply
Result := ColorModulate(F, B);
// 2. blend
Result := BlendRegEx(Result, B, M);
end;
procedure TForm18.Image321Click(Sender: TObject);
var
ImageMap, ShapeMap, Blended: TBitmap32;
begin
ImageMap := TBitmap32.Create;
ShapeMap := TBitmap32.Create;
Blended := TBitmap32.Create;
try
// Bitmap.SetSize(240, 180);
// Bitmap.Clear(clWhite32);
ImageMap.Assign(Image321.Bitmap);
ShapeMap.SetSize(ImageMap.Width, ImageMap.Height);
Blended.SetSize(ImageMap.Width, ImageMap.Height);
// vignette is generated, can use existing img too
[vignette code here, working on ShapeMap]
Blended.MasterAlpha := 0;
ImageMap.MasterAlpha := 0;
ShapeMap.MasterAlpha := 0;
// BlendTransfer(Blended, 0, 0, Blended.BoundsRect, ImageMap, ImageMap.BoundsRect,
// ShapeMap, ShapeMap.BoundsRect, ColorAlgebra, 0
// );
// Image321.Bitmap.Assign(Blended);
ImageMap.DrawMode := dmBlend;
ImageMap.OnPixelCombine := BlendMode.Multiply;
ImageMap.MasterAlpha := 0;
ImageMap.DrawTo(ShapeMap, 0, 0);
Image321.Bitmap.Assign(ShapeMap);
finally
ImageMap.Free;
ShapeMap.Free;
Blended.Free;
end;
end;
Whats wrong with this?
Multiply() method supports alpha. In this way I realized blending and opacity in my layers (5).
Geändert von WojTec (19. Sep 2010 um 19:12 Uhr)
|
|
Zitat
|