A
A
Alexey Menkov2013-04-13 09:27:35
Java
Alexey Menkov, 2013-04-13 09:27:35

Displaying a high resolution image?

Good day!
I am developing an application designed to monitor the status of an aircraft's onboard system. The application displays some layout of elements + a set of sensors (View set) on the screen. The scheme has a fixed size (4096x4096), the format is PNG.
What you need:
1. Display the scheme on the screen in real size with the possibility of scrolling;
2. Make the scheme scalable.
Scrolling is implemented using the standard ScrollView component based on FrameLayout.
Problems begin when you try to display the circuit on the screen. To display the schema, I wanted to make an ImageView and set an image for it. But OpenGL in Android has a limitation on the texture size - no more than 2048x2048 pixels, so it was not possible to put the whole image into one component. I had to make 9 ImageViews, line them up with tiles, and slice the original image using BitmapRegionDecoder.
Now we still need to scale all these elements, and this implementation looks like a crutch. I see there is an easier way.
Has anyone experienced similar issues and can offer some advice?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
serso, 2013-04-13
@alekseymenkov

On stackoverflow, they suggest using WebView: link (but the tiles still have to be cut)

A
Alexey Menkov, 2013-04-16
@alekseymenkov

Thanks for the great idea!
Implemented the required functionality through WebView + FrameLayout.
In WebView, I created a child FrameLayout, and already in FrameLayout I added all my View. It turned out well: scrolling works in all directions (it makes no sense to use ScrollView), scaling (Pinch Zoom) works - and all without any special brakes. The only negative is that I can’t track the WebView scaling factor in any way in order to proportionally increase my own View.
The image is cut into tiles. For 4096x4096 on a real device, slicing takes about 10 seconds. In principle, it can be moved to a separate thread, reloading the WebView as it is sliced.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question