bitmap and finger move

derez

Expert
Licensed User
Longtime User
I can't upload it since it is larger than what is permitted, and It is blocked by my mail.
I'll write a demo application for the problem (and may be then it will disappear...)
 

derez

Expert
Licensed User
Longtime User
Check this
 

Attachments

  • mapcheck.zip
    10.6 KB · Views: 232
Last edited:

derez

Expert
Licensed User
Longtime User
But it is defined in the visual designer, why don't we have to add buttons ?
I deleted it from the layout and added it by code, it runs without errors. thanks.
 
Last edited:

derez

Expert
Licensed User
Longtime User
Erel
I'm sorry for troubling you so much, I hope it is part of the beta activity, otherwise just tell me to wait for better times.

The trick with the intermediate (clipboard bitmap is not working or I don't understand what is going on.
The photo shows the activity painted in the color of the blank picture I use to clear the clipboard. The map on the right is the imageview which should be seen but I made it visible to see what happens.

The imageview gets the part of the map that is copied from the big map by
B4X:
board.DrawBitmap(bmp,srect,trect)
but the next line should copy this to the activity, and it copies the blank background instead.
B4X:
cnvs.DrawBitmaprotated(board.Bitmap,trect,drect,angle)

:confused:
 

Attachments

  • mapcheck.jpg
    mapcheck.jpg
    54.6 KB · Views: 232
Last edited:

derez

Expert
Licensed User
Longtime User
Agraham
For moving map based on tiles, with rotation capability, there is need for a clipboard bitmap, on which pieces of maps from various tiles are pasted and then the complet bitmap is copied to the form/activity for display.
I couldn't find a way to do it, because the canvas can draw only on a view, and if I use a view then I cannot copy the view's bitmap (rect to rect with rotation) to the activity, because the view has no bitmap (at least as it defined now).
In c# I would say - Graphics to draw on a bitmap.
If you do see a way - please show it.
thanks.
 

agraham

Expert
Licensed User
Longtime User
The ImageView Background property seems to get and set a Bitmap (Drawable) reference.

You could try creating the Bitmap, Initialising a Canvas on it and making the the Bitmap the ImageView Background.

You could also try creating the Bitmap, making the the Bitmap the ImageView Background and Initialising a Canvas on the ImageView.
 

derez

Expert
Licensed User
Longtime User
Solved by re-initializing the canvas that draws on the imageview, after the map is drawn.

It seems as if the canvas gets the bitmap of the view that it is initialized on, only at the initialization. Drawing on the view does not change it.
 

agraham

Expert
Licensed User
Longtime User
When a canvas is initialised on a view it copies any existing Backgoround drawable to a new Bitmap then sets the Backround to that new Bitmap. The previous Background is no longer visible. It you previously took a reference to the old Background or initialised a Canvas on it any changes you make to that old Background will not be visible.

As I said in a previous post the ImageView Background property gets and sets a Bitmap (Drawable) reference. You can obtain a reference to the new Bitmap after initialising the Canvas on the View.
 
Top