Recent

Author Topic: EraseLineAntialias Procedure  (Read 6049 times)

Rails

  • Guest
EraseLineAntialias Procedure
« on: March 18, 2012, 01:59:21 am »
Can anyone give a quick description (or better yet, a tutorial) on how to use BGRABitMap's EraseLineAntialias procedure? 

I've Googled for examples and or discussions and found absolutely nothing, other than references to BGRABitMapTypes.pas, which doesn't help. I don't have enough Pascal expertise to figure out how it is supposed to be used just from studying that file.

Thanks.

« Last Edit: March 18, 2012, 02:20:36 am by Rails »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: EraseLineAntialias Procedure
« Reply #1 on: March 18, 2012, 04:16:33 pm »
This procedure makes the line transparent, which means it changes the alpha channel. You can see the result by using a bitmap which contains something (you can just fill it with some color), then erase a line with EraseLineAntialias, and then draw this bitmap using transparency (PutImage, Draw with Opaque=false).

What do you want to do with this procedure ?
Conscience is the debugger of the mind

Rails

  • Guest
Re: EraseLineAntialias Procedure
« Reply #2 on: March 18, 2012, 04:58:50 pm »
I was hoping to erase a line that crossed one more other lines without leaving any trace on the other lines. In other words, I wondered if it would be helpful for rubber banding in a drawing application.

Edit:

I've been poking around a bit. It seems like using layers (the main drawing on one layer and the element being pulled by the cursor on another) might work. That way the main drawing would not have to be redrawn so often.

« Last Edit: March 19, 2012, 12:00:28 am by Rails »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: EraseLineAntialias Procedure
« Reply #3 on: March 19, 2012, 05:53:23 pm »
That's right. You can use BGRALayers for this, or simply have a collection of bitmaps.

If you draw on the same bitmap, the information behind the line is lost, so you cannot undo it with EraseLineAntialias. There is no way to know what was behind in this case.

Alternatively you can draw with Xor mode, but then you don't have antialiasing support, and the result is not always beautiful.
« Last Edit: March 19, 2012, 05:55:33 pm by circular »
Conscience is the debugger of the mind

Rails

  • Guest
Re: EraseLineAntialias Procedure
« Reply #4 on: March 19, 2012, 06:31:03 pm »
Thanks, Circular, layers it will be.


circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: EraseLineAntialias Procedure
« Reply #5 on: March 20, 2012, 11:26:49 pm »
Good luck I wish you.  :D
Conscience is the debugger of the mind

lainz

  • Guest
Re: EraseLineAntialias Procedure
« Reply #6 on: March 21, 2012, 12:21:55 am »
Nice, the 2nd public user of Layers, the first was Dibo  ::)

Rails

  • Guest
Re: EraseLineAntialias Procedure
« Reply #7 on: March 21, 2012, 02:19:36 am »
Now all I have to do is figure out how they work.   :o

I may have to ask <a lot> more questions.   :D

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: EraseLineAntialias Procedure
« Reply #8 on: March 22, 2012, 02:18:40 am »
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018