Help developing a program with images

raistlin74

Member
Licensed User
Longtime User
Hi all,
I'd like to develop an application that work with images.

The behaviour should be this :
the screen shows an images with only the borders of the image.
when you draw with a freehand movement on the image, it should show on the path that has been designed, the colors of the the second image behind the first (that is the same image but with colors), like a magic pen.

How can I do this?

Thanks in advance for any help.

Fabio
 

raistlin74

Member
Licensed User
Longtime User
do you think I can load 2 identical images, the first without colors, the second with the colors.
hide the image with colors and show only the white image.
and using the bitmapextended library fills the missing colors with the functions :

image1.erasecolor(imageWhite, image2.getPixel(imageColor, x, y))

?
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I think a better way will be to use two panels overlaid on each other.
Draw the image in the back panel.
Draw a black/white rectangle on the front panel.
When the user draws on the front panel color it with colors.transparent
In that way the back image will be revealed.

Sent from my GT-I9000 using Tapatalk
 
Upvote 0

raistlin74

Member
Licensed User
Longtime User
thanks for the reply.
I'm trying to implement it, but panel.color sets the color for all the panel.

What I'd like to achieve is to color transparent a single point, not all background, so when I draw on the screen, the colored image seems to be drawed on the white one.

thanks
Fabio
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Yes, I know. You need to use a canvas for this.
Basic4android - Drawing (Core)

Do something like:
B4X:
Dim c as Canvas
c.Initialize(panel)
Dim Rect1 As Rect
Rect1.Initialize(100dip, 100dip, panel.width-100dip, panel.height-100dip)
Canvas1.DrawRect(Rect1, Colors.Gray, True, 5dip)
panel.Invalidate

And then on touch you can draw a circle:
B4X:
c.DrawCircle(x, y, 20dip, Colors.Transparent, True, 1dip)
panel.Invalidate
 
Upvote 0

raistlin74

Member
Licensed User
Longtime User
Thanks again,
while you were answering me, I found the solution looking at Eerel SignatureCapture example ;) ;)

Thanks again.

Fabio
 
Upvote 0
Top