Android live wallpaper rescaling?

Well, um, all I can say is "Welcome to the real world. " You get your screen dimensions passed to you via onSurfaceChanged, and yes, it is your job to figure out how to scale everything based on this data. That's why they pay us the big bucks.

:-) You will want to make sure your resources are large enough to fit the biggest display you intend to support, so you will always be shrinking things (which distorts much less than expanding things) Suggest starting with "best practices for screen independence" here: developer.android.com/guide/practices/sc... Additional comments in re your request for more help You cannot (necessarily) scale your artwork just using the width, because you need to support multiple aspect ratios. If the screen proportions do not match your artwork, you must decide if you want to distort your artwork, leave blank spaces, etc I'm not sure how to interpret your trouble passing around the screen dimensions. Most of us put all of our active code within a single engine class, so our methods can share data via private variables.

For example, in the Cube wallpaper in the SDK, onSurfaceChanged() sets mCenterX for later use in drawCube(). I suggest beginning with a similar, simple approach Handling scrolling takes some "intelligence" and a careful assessment of the data you receive via onOffsetsChanged(). XStep indicates how many screens your launcher supports.

Normally xStep will be 0.25, indicating 5 screens (i.e. XOffset = 0, 0.25, 0.5, 0.75, or 1) but it can be any value from 0 to 1; 0.5 would indicate 3 screens. XPixels gives you an indication of how much the launcher "wants" you to shift your imagery based on the screen you're on; normally you should respect this.

On my phone, the launcher "desires" a virtual wallpaper with twice the pixels of the physical screen, so each scroll is supposed to shift things only one quarter of one screen's pixels. All this, and more, is documented in http://developer.android.com/reference/android/app/WallpaperManager.html This is not "easy" coding--apps are easier than wallpaper. :-) Good luck...George P.S.I'll throw in one more thing: somewhere along the line you might want to retrieve the "desired minimum width" of the wallpaper desired by the launcher, so you can explicitly understand the virtualization implicit in xPixels.

For example, in my engine constructor, I have mContext = getApplicationContext(); mWM = WallpaperManager. GetInstance(mContext); mDW = mWM. GetDesiredMinimumWidth() My device has 320 pixel width; I get mDW = 640; as I scroll from screen to screen, xPixels changes by 80 each time...because four scrolls (across five screens) is supposed to double the amount of revealed artwork (this effect is called "parallax scrolling").

The rightmost section has xPixels equals 0; the center (of five) sections has xPixels = -160, etc.

Well, um, all I can say is "Welcome to the real world. " You get your screen dimensions passed to you via onSurfaceChanged, and yes, it is your job to figure out how to scale everything based on this data. That's why they pay us the big bucks.

:-) You will want to make sure your resources are large enough to fit the biggest display you intend to support, so you will always be shrinking things (which distorts much less than expanding things). Suggest starting with "best practices for screen independence" here: developer.android.com/guide/practices/sc... Additional comments in re your request for more help... You cannot (necessarily) scale your artwork just using the width, because you need to support multiple aspect ratios. If the screen proportions do not match your artwork, you must decide if you want to distort your artwork, leave blank spaces, etc.I'm not sure how to interpret your trouble passing around the screen dimensions.

Most of us put all of our active code within a single engine class, so our methods can share data via private variables. For example, in the Cube wallpaper in the SDK, onSurfaceChanged() sets mCenterX for later use in drawCube(). I suggest beginning with a similar, simple approach.

Handling scrolling takes some "intelligence" and a careful assessment of the data you receive via onOffsetsChanged(). XStep indicates how many screens your launcher supports. Normally xStep will be 0.25, indicating 5 screens (i.e.

XOffset = 0, 0.25, 0.5, 0.75, or 1) but it can be any value from 0 to 1; 0.5 would indicate 3 screens. XPixels gives you an indication of how much the launcher "wants" you to shift your imagery based on the screen you're on; normally you should respect this. On my phone, the launcher "desires" a virtual wallpaper with twice the pixels of the physical screen, so each scroll is supposed to shift things only one quarter of one screen's pixels.

All this, and more, is documented in http://developer.android.com/reference/android/app/WallpaperManager.html This is not "easy" coding--apps are easier than wallpaper. :-) Good luck...George P.S.I'll throw in one more thing: somewhere along the line you might want to retrieve the "desired minimum width" of the wallpaper desired by the launcher, so you can explicitly understand the virtualization implicit in xPixels. For example, in my engine constructor, I have mContext = getApplicationContext(); mWM = WallpaperManager.

GetInstance(mContext); mDW = mWM. GetDesiredMinimumWidth(); My device has 320 pixel width; I get mDW = 640; as I scroll from screen to screen, xPixels changes by 80 each time...because four scrolls (across five screens) is supposed to double the amount of revealed artwork (this effect is called "parallax scrolling"). The rightmost section has xPixels equals 0; the center (of five) sections has xPixels = -160, etc.

Thanks Goerge and I registered Bill thanks also, I'm new to this place so forgive me I do accept it it helped I read through all that the link you gave but what I'm trying to do is scale through one number and since Im so new to java I'm still trying to figure out how to get that number over to the other files, I check out cube and I have quite a few more plus books, and have tried a few things but to no avail as of yet. Maybe adding the code would help eh? In the main file I have this for onSurfaceChanged where I divide the surface width into the background image measurement to give me my measurement for scaling all images and positions, now my problem (since I'm so new to this), is how to get that number into other class files where the images and positions are to be scaled.

I tried what some files have done with success but for me it is not working as of yet, after 4 hours and sore eyeballs and fingers I gave it a rest and will read more. I've scaled images but not with this number so its just getting it into the other files. Hopefully once I get this all figured out and it works nicely I'll make up a tutorial as I'm sure theres quite a few others running into this issue as well.

I also looked into the lunar sample, the cube and the lunar sample both don't show how to initiate this into other class files (wish it did I'd be done by now) @Override public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) { super. OnSurfaceChanged(holder, format, width, height); int samsScaler = width / 1024; } anyhow if you know where I can go to find out more how to do this what seems to be basic java I'd appreciate it,aslo I'll look how to vote and do more on this site. Thanks again George.

I am learning how to make live wallpapers, but I have a dilemma I'm sure all who start off have as well. There is so many resolution screen sizes, how can I just make one set of artwork to be rescaled in code for all versions? I know it's been done as I seen the images in the apk's on a lot of them and they get rescaled.

If it was just one image that did not need any positioning that would be easy, but my problem is I have to get the background image rescaled to fit all devices, I also have animations that fit in a certain x and y position on that background image to fit in place so it looks like the whole background is being animated but only parts of it is (my way of staying away from 300 images of frame by frame live wallpapers). So the background image needs to be rescaled and the animations need to be rescaled as well to the exact percentage as the background image and they need to sit in a specific x and y position. Any help would be appreciated so I can get this going.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions