Pinch Zoom Transformations - Android Software Development

Hey everyone!
I have been trying to get pinch zoom working in a SurfaceView, and I can get it to detect if a pinch is happening and all, but here is my dilemma.
I am using canvas to draw a grid to the background. The grid is a 2d array of Rect objects, so as I pinch, I change the size of the Rects. My problem is getting it to zoom into the correct area of the grid.
So, my question is how to do the correct transformation on something like this? Is there a way to put an ImageView into the canvas and draw to that? I will post the relevant code when I get home from work later today, but I figured I would post this just to see if anyone had done something similar.
Thanks in advance!

Related

landscape wallpaper

sorry if its a stupid ? but Is it at all possible to have a separate landscape pic than the portrait one if anyone could help me out it would be greatly appreciated thanks
No, I don't think so!
Yes it's possible, there are available today themes floating around.. that when you slide out the keyboard and switches the screen to landscape, it would display a diff background image on the screen diff from the portrait background. I think i saw that first on the Wizard forum..try to search for it...

[Q] Pictures to fit HD2 screen...HELP!

Hey guys I'm new here i have tried looking on the web to solve my problem but no luck...is there a way to fit pictures you transferred from your computer to fit the HD2 screen.
You could use an editing program such as Photoshop or Gimp to resize your pics to the right resolution. Photbucket can resize as well.
480x800 for portrait, or 800x480 for landscape
If what you're trying to do is get the image to also cover the taskbar and softkey bar (top and bottom of the screen), you'll need a tool such as CHT to work that magic for you.
I just used Paint.
Use the wallpaper.hellaphone. com/phone/HTC_HD2 to resize your images. Cheer
Thanks ill try them out and get back to you guys
Best free image editing program EVER is paint.net. Nuff said.
Thanks they all worked but I went with paint.

[Q] Live Wallpaper Backgroud

I am pretty new into android development and have a couple questions I'm sure you guys can answer pretty quickly but have so far not been able to figure out. How do I have a set background in a live wallpaper besides just creating something from canvas, I have it already loaded in the hdpi I just need to figure out how to call it. Also, is it possible to have something appear enlarge a little bit in the center of the screen then fall off the screen? I'm trying to create a time lapse of a tree where it goes through all the weather changes. Any sites you could link me too or answers you would have would be greatly appreciated. Thanks for anything you guys are able to do.
Can you be more specific? When you say background are you talking about an image file you've added as a drawable?
If you use the drawBitmap method you can draw images anywhere on a canvas.
This is roughly how I do it on my Live Wallpapers.
Code:
Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.background);
c.drawBitmap(background, 0, 0, null);
That will draw the bitmap at the upper left most position on your canvas.
If you want your live wallpaper to slide left and right as you swipe between home screens you need to adjust the x position based on the offset. Look at the cube live wallpaper source code for more information on how to get the offset value.
What I have is a picture loaded in the hdpi file that I want to use as my background, the thing with the cube is it shows you how to draw a picture but not add one into it. I want to load in the photo and then have objects enlarge and drop down around the center of this picture. The design I'm going for is a time lapse of a tree. I was told surfaceView can set your background but I'm not sure if that's the case or not. Thanks for the reply though I appreciate it.
bearcatext said:
the thing with the cube is it shows you how to draw a picture but not add one into it.
Click to expand...
Click to collapse
It works exactly the same but instead of using c.drawLine() you use c.drawBitmap()
That makes a lot of sense thanks, and for the leaves falling would you just set the coordinates to somewhere in the middle then? Also, is there a way to have an image change color mid-screen so it looks like fall is hitting? Thanks for all your help again though.

[Q] Custom View question

Apparently XDA thinks my code is a link to an outside website ??? so it's attached in a .txt
Here's my problem. I finally figured out how to get my custom view
working, but discovered that "canvas.drawCircle(..)" draws based on
the screens dimensions and not the bitmap drawn to the canvas (I may be
misusing some terms/concepts here, still a little iffy on the whole
custom view).
Basically, I have a bitmap of a map image (decoded from a .jpg resource), and I want to be able to draw relative to the bitmap's pixel dimensions, and to the bitmap if possible, so that when it's panned/zoomed, it stays in its respective
place. Here is the code for my custom view. I x'd out my latitude and
longitude. The touch handling is code adapted from a Hello, Android
(3e) excerpt.
I'm currently working with "MAP" mode, but it will also come into
play for NAV. But I basically need to draw relative to the bitmap, which is
scaled and manipulated through the canvas(?) so that the current
location dot will stay in the same spot when the bitmap is panned or
zoomed, instead of staying in a static location based on the screen's
dimensions. Any advice?
-Mike

[Q] Wallpaper from a Screenshot?

Hi all,
Trying to create a new wallpaper from a screenshot. So far can only create a small portion of the whole picture as wallpaper. Is there any earthly way to make those cropping thingies include the whole screenshot pic? So far I can only fit Kate Upton's face onto the wallpaper, but would like to get face AND boobs. Kate's pic without boobs is just not right. Seriously, any help much appreciated.
jamere said:
Hi all,
Trying to create a new wallpaper from a screenshot. So far can only create a small portion of the whole picture as wallpaper. Is there any earthly way to make those cropping thingies include the whole screenshot pic? So far I can only fit Kate Upton's face onto the wallpaper, but would like to get face AND boobs. Kate's pic without boobs is just not right. Seriously, any help much appreciated.
Click to expand...
Click to collapse
bump for more boobage
Try to crop out the clock/widgets/icons then try Google image search to see if the actual picture is on the interweb somewhere.
Thanks for the reply Stronger. Think I may have stumbled onto a solution. With the image in Gallery, I zoomed out making the image smaller. About the size of the cropping rectangles in setting the image as wallpaper. Hope this makes sense. I think the key is making a smaller image that will fit in rectangles.

Categories

Resources