android - Dynamically creating a tile for a TileProvider -


i want create heat map on android , trying generate tile return gettile, can't find dynamically generating large image smaller 1 copied bunch of times. there tutorials or code snippets this?

also, if isn't way go let me know well. since i'm dynamically generating tile can't use urlprovider, can't find single example of generating tiles dynamically.

if want create bitmap bitmap cropping, resizing, etc, you're gonna want use canvas:

canvas canvas = new canvas(resultbitmap); //result bitmap end drawing. canvas.drawbitmap(otherbitmap, areafromotherbitmaptocopyrect, areainresultbitmaptodrawrect, paint); 

the 2nd , 3rd parameters there rects inside the source bitmap (from you're copying part or whole image), , result bitmap (to you're drawing image).

however, if you're drawing heat-map, might find easier draw small rectangles of colors instead of copying other bitmaps (which computationally harder). create canvas in same way, instead of calling drawbitmap, call drawrect:

paint redpaint = new paint(); redpaint.setcolor(0xffff0000); //this red. 1st ff alpha. canvas.drawrect(someareaintheresultrect, redpaint); 

all that's left play colors according value of area in heat map, play positions (by generating rects properly, , you're done :)

hope helps!


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -