Question about my first Live wallpaper

  • Replies:1
Stephen Kong
  • Forum posts: 17

Dec 10, 2011, 3:26:45 AM via Website

1. I am trying to load a bitmap in the WallpaperService.Engine.onCreate() but the bitmap is too small to cover the entire screen. How do I stretch the bitmap to cover the entire screen?

2. How difficult to implement water ripple effect in response to touch event? Is there any Java library out there that could do that?

Reply
Jeremiah
  • Forum posts: 775

Dec 13, 2011, 6:16:06 AM via Website

Stephen Kong
1. I am trying to load a bitmap in the WallpaperService.Engine.onCreate() but the bitmap is too small to cover the entire screen. How do I stretch the bitmap to cover the entire screen?

2. How difficult to implement water ripple effect in response to touch event? Is there any Java library out there that could do that?

In response to your first question, you can scale the bitmap with Bitmap.createScaledBitmap: http://developer.android.com/reference/android/graphics/Bitmap.html#createScaledBitmap(android.graphics.Bitmap, int, int, boolean)

Something like this:

mLogo = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.logo);
logoWidth=mCanvasWidth;
logoHeight=mCanvasHeight;
mLogo = Bitmap.createScaledBitmap(mLogo, logoWidth, logoHeight,true);

2. There's lots of examples of doing this in java on the net. Here's one that might help: http://neilwallis.com/projects/java/water/index.php

Reply