Jump to content

Recommended Posts

Posted

  cArea.Brush.Opacity:= 0.10;
  cArea.LoadFromFile('images\FemaleAbdomen.png');
  cArea.Brush.Opacity:= 1;

PNG Image has a Masked out area and it is ignored (painted black) ?

I need to load a PNG Image at a particular Left/Top position overlaying other Canvas Objects with an Opacity of 10% - please advise how - thanks

Posted
On 5/5/2020 at 3:28 AM, andyhill said:

PNG Image has a Masked out area and it is ignored (painted black) ?

Hello,

One of the possible solutions:

procedure TMainForm.UniButton11Click(Sender: TObject);
begin
  UniCanvas1.JSInterface.JSCode('var context='#1'._cc_; var image=new Image();'+
                                'image.onload=function(){'+
                                '    context.drawImage(image, 0, 0, image.width, image.height);'+
                                '}; image.src="yourPNGFile.png";'
  );
end;

 

Posted

Thank You for PNG rendering above, We also need Opacity settings ?

Also, We should be able to have FloodFill as part of any closed drawn object (ClosedPolygon, Circle, Rectangle) so that we do not have to readdress that object with a new Fill command that has anti-aliasing issues.

eg.

canvas.Circle(X, Y, 2, FloodFill=True, Colour);

Drawing circle first, then re-locating center X,Y then FloodFilling is not advantageous for irregular polygon shapes.

Please provide work around for:-

canvas.Polygon(PointArray, FloodFill=True, Colour);

 

 

Posted
10 hours ago, andyhill said:

We also need Opacity settings ?

procedure TMainForm.UniButton13Click(Sender: TObject);
begin
  UniCanvas1.JSInterface.JSCode('var context='#1'._cc_; var image=new Image();'+
                                'image.onload=function(){'+
                                '    context.globalAlpha = 0.5;'+ //<----- custom opacity
                                '    context.drawImage(image, 0, 0, image.width, image.height);'+
                                '    context.globalAlpha = 1;'+   //<----- opacity = 1
                                '}; image.src="yourPNGFile.png";'
  );
end;

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...