What I want is might be separated into several or one methods, whatever is best.
I have four values that are set (as fields):
- Width of image the whole image (canvas so to speak)
- Height of the whole image (height of the canvas)
- Padding (how many pixels I want to have as padding)
- How many images in i want in the width and height separately (can be separate values)
What I want is to have a whole image, that I'm putting small images inside (these are the bitmap sizes I want to get from the method).
I basically want to have the size of the images inside, both the width and height. And coordinates in of the small images in the whole image view.
A small example might be:
- The width of the image is 200 and I want a padding of 4, and I want to have 3 images on one row of the image.
The calculation would might look like this:
(200 - (4*(3+1))) / 3 = 61,33;
The 3+1 is only because I want to have padding on either side of the small images.
But this is only for width, i would like to have a universal solution that applies to height as well.
And calculate the height and width of every image that is inside the canvas-image.
And just to put some sugar on top. I would like to have the x and y coordinates of every image that is inside.
How can this be done? And how do I get every value? The bitmaps (I'm developing android) is stored in an ArrayList.
Basically I want this, a basic grid layout: http://developer.android.com/images/ui/gridview.png The values I have based on this image:
- I have the size of the light-blue area,
- including the space between the dark-blue images (padding)
- and how many dark blue spots I want in every row and column.
What I want is the size (width and height of the dark-blue spots), and the coordinates of those images (where they should be placed in the light-blue area, x and y coordinates).
Anybody have a good solution for this?
UPDATED THE TEXT FOR CLARITY