Jump to content

Canvas DrawLine "xor" RemoveLine


andyhill

Recommended Posts

I am trying to draw a rectangle polyline over a canvas containing a color image, then (via way of a mouse drag move event) remove that rectangle polyline with it's original points and redraw as a new rectangle polyline using the new x,y co-ordinates. Code below paints with or without "xor", my problem is it will not erase when using the same points, happy for any help - Thanks - Andy

    UniSession.AddJS('var context=fMain.cArea._cc_; '+
                     'var polyln = ['+s+']; '+
                     'var shape = polyln.slice(0); '+
                     '{ '+
                     '  context.globalAlpha = 1; '+
                     '  context.globalCompositeOperation = ''xor''; '+
                     '  context.lineWidth = 1; '+
                     '  context.strokeStyle = "'+LineColourStr+'"; '+
                     '  context.moveTo(shape.shift(), shape.shift()); '+
                     '  while(shape.length) '+
                     '  { '+
                     '    context.lineTo(shape.shift(), shape.shift()); '+
                     '  } '+
                     '  context.stroke(); '+
                     '  context.globalCompositeOperation = ''source-over''; '+
                     '  context.globalAlpha = 1; '+
                     '}; '
                    );

 

Link to comment
Share on other sites

10 hours ago, andyhill said:

I am trying to draw a rectangle polyline over a canvas containing a color image, then (via way of a mouse drag move event) remove that rectangle polyline with it's original points and redraw as a new rectangle polyline using the new x,y co-ordinates. Code below paints with or without "xor", my problem is it will not erase when using the same points, happy for any help - Thanks - Andy

Hello,

Do you have a simple testcase to test?

Link to comment
Share on other sites

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...