Erasing line on bitmap

ddahan

Member
Licensed User
Longtime User
I can not find a way to erase a line drew on a BitmapEx.
No effective results on forum search.
Line end points coordinate are known

thanks,
David.
 

klaus

Expert
Licensed User
Longtime User
What do you mean with 'erase a line' on a BitmapEx object?
If you mean remove a drawn line and get back the previous colors the pixels of the line had before, this is not possible.
You can only draw a line with a given color.
But you can 'play' with the transparent color of the form's Forelayer.

What exactly do you want to do ?

Best regards.
 

HARRY

Active Member
Licensed User
Longtime User
Hi ddahan,

I had a similar problem and solved it by drawing the line on the ForeLayer and erased that when I wanted to remove the line. Search for the thread "Frame object" to see the whole discussion. Success

Harry
 

ddahan

Member
Licensed User
Longtime User
Hi ddahan,

I had a similar problem and solved it by drawing the line on the ForeLayer and erased that when I wanted to remove the line. Search for the thread "Frame object" to see the whole discussion. Success

Harry

What do you mean with 'erase a line' on a BitmapEx object?
If you mean remove a drawn line and get back the previous colors the pixels of the line had before, this is not possible.
You can only draw a line with a given color.
But you can 'play' with the transparent color of the form's Forelayer.

What exactly do you want to do ?

Best regards.


Hi Harry and Klaus,
Thanks for responding.

I would like to draw a line from a starting point (mouse/finger down) to the current finger location. this has to be done dynamically - continuously displaying a single line that follows the finger position.
All this is done over an image control that is related to a panel. the image control image is a bitmap.
I was thinking about a solution that is based on erasing line to previous finger location and drawing a new line to current location.

thanks,
David.
 

klaus

Expert
Licensed User
Longtime User
I wouln't use an Image control on a Panel, but draw the image directly onto the form and use the form's forelayer.

You could have a look at the http://www.b4x.com/forum/tutorials/5191-graphics-tutorial.html
Chapter 'Basic graphics/Drawing on bitmap', Rubberbanding in the middle of the page.

Attached the sample program from the tutorial.

Best regards.
 

ddahan

Member
Licensed User
Longtime User
I wouln't use an Image control on a Panel, but draw the image directly onto the form and use the form's forelayer.

You could have a look at the http://www.b4x.com/forum/tutorials/5191-graphics-tutorial.html
Chapter 'Basic graphics/Drawing on bitmap', Rubberbanding in the middle of the page.

Attached the sample program from the tutorial.

Best regards.

Hi Klaus,
I'm aware about the forelayer solution on top of a form, unfortunately have to use a panel as a best approach for my application.

thanks,
David.
 

klaus

Expert
Licensed User
Longtime User
Could you explain what the reasons are why you need a Panel.

I had also begun with an Image on a Panel to show an image bigger than the screen. But as there is no mean to draw 'transparent' other than on a form's forelayer, I use now a BitmapEx object for drawing the image and copy the desired part of the image onto the desired area of the form's background and use the form's forelayer for rubberbanding or temporary drawings.

Best regards.
 

ddahan

Member
Licensed User
Longtime User
Hi Klaus,

Good points to think about, I may have to consider again forms vs. panels. this may solve some issues I'm encountering this days.
I'm deeply in a big project, this may cost a lot of efforts and time...

Thanks for your help.

Regards,
David.
 
Top