1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| procedure TfrmGen.Button2Click(Sender: TObject);
const ColMatrix: TGPColorMatrix =
((1.0, 0.0, 0.0, 0.0, 0.0),
(0.0, 1.0, 0.0, 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0, 0.0),
(0.0, 0.0, 0.0, 0.5, 0.0), //<- 0.5 pour la semi-transparence
(0.0, 0.0, 0.0, 0.0, 1.0));
var
graph: IGpGraphics;
imgTexture: IGPImage;
OpaqueBrush, SemiTransBrush: IGPTextureBrush;
IAttr: IGPImageAttributes;
begin
graph := TGPGraphics.Create(imageFond.Picture.Bitmap.Canvas);
imgTexture:=TGPImage.Create('E:\D_Fi_img\Texture_Bleue.bmp');
// Affichage Ellipse avec Texture Opaque : OK : marche
OpaqueBrush := TGPTextureBrush.Create(imgTexture);
graph.FillEllipse(OpaqueBrush, 35, 45, 65, 30);
imageFond.repaint;
// Affichage Ellipse avec Texture Semi-Transparente : NOK : ne marche pas !!!
IAttr := TGPImageAttributes.Create;
IAttr.SetColorMatrix(ColMatrix);
SemiTransBrush := TGPTextureBrush.Create(imgTexture, MakeRect(0, 0, 30, 30), IAttr);
Graph.FillEllipse(SemiTransBrush, 86, 45, 45, 30);
imageFond.repaint;
end; |
Partager