0

I have a png image of a floor plan and I want to overlay certain regions of it with different transparencies of the color red.

Some Complexities:

  • The regions do not follow the lines on the floor plan strictly. Some regions cover 2-3 rooms, some cover aisles.
  • The regions are not rectangular. Some are made of curved lines.

Questions

  • Can I create these regions on a png image? Which file format is going to be the easiest to work with?
  • How can I create these regions or mark these boundaries? Will I have to do it pixel by pixel?
  • Once I have the boundaries, how do I add color? Can I use the flood fill algorithm based on these boundaries?

Thanks!

nknj
  • 2,436
  • 5
  • 31
  • 45

2 Answers2

1

see my LayeredImageView How to maintain multi layers of ImageViews and keep their aspect ratio based on the largest one?

it's a ImageView that lets you add some Drawables as layers, so you can create your custom Drawable that draws your red regions by overriding draw() method

Community
  • 1
  • 1
pskink
  • 23,874
  • 6
  • 66
  • 77
  • Thanks for this. You code looks really robust. But if I am just going to be overlaying images, I can just use the [LayerList](http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList) drawable right? – nknj Jun 04 '13 at 04:09
  • when using standard ImageView you could use LayerList with setImageDrawable but you will need to scale your drawing code to adjust to ImageView bounds, with my class all you need is to extend Drawable and override its draw method - no scaling needed - drawing is done in pixels units – pskink Jun 04 '13 at 07:12
  • seems i was wrong, yes in your case you can use LayerList and it will be scaled automatically :) – pskink Jun 04 '13 at 07:57
  • Yes I just tried it out and it scaled well. Thanks anyways. :) – nknj Jun 04 '13 at 08:12
0

Since I did not need my layers to have the robustness mentioned by @pskink, I ended up using the layerlist drawable to overlay images to "shade" certain parts.

nknj
  • 2,436
  • 5
  • 31
  • 45