Hi,
I want to draw a transparent alpha blended rectangles.
I've searched this forum and found an example which only fills a rectangle with opac colors.
sgImage1.Canvas.Brush.Color := clRed;
Could you modify this example to draw semi transparent transculent rectangles
Here it goes the example.
Thanks
Aby
...DXFImage, DXFConv, SGImage, sgConsts;
TForm1 = <b>class</b>(TForm)
...
FImg: TsgDXFImage;
...
TForm1.Open1Click(Sender: TObject);
begin
if not OpenDialog1.Execute then Exit;
sgImage1.LoadFromFile(OpenDialog1.FileName);
if sgImage1.Picture.Graphic is TsgDXFImage then
FImg := TsgDXFImage(sgImage1.Picture.Graphic)
else
FImg := nil;
sgImage1.Align := alClient;
end;
procedure TForm1.btnSelectAllClick(Sender: TObject);
var
I: Integer;
vPolyLine: TsgDXFPolyline;
vTRect: TRect;
vColor: TColor;
begin
if FImg = nil then Exit;
vColor := sgImage1.Canvas.Brush.Color;
sgImage1.Canvas.Brush.Color := clRed;
for I := 0 to FImg.Converter.Sections[csEntities].Count - 1 do
begin
if FImg.Converter.Sections[csEntities].Entities[I] <b> TsgDXFPolyline then
begin
vPolyLine := TsgDXFPolyline(FImg.Converter.Sections[csEntities].Entities[I]);
if (vPolyLine.Count = 4) and (vPolyLine.Closed = True) and (vPolyLine.Layer.Name = 'WWW') then
begin
vTRect.TopLeft := FImg.GetPoint(vPolyLine.Points[2]);
vTRect.BottomRight := FImg.GetPoint(vPolyLine.Points[0]);
vTRect.BottomRight.X := vTRect.BottomRight.X + 1;
vTRect.TopLeft.Y := vTRect.TopLeft.Y + 1;
sgImage1.Canvas.FillRect(vTRect);
end;
end;
end;
sgImage1.Canvas.Brush.Color := vColor;
end
end.
