Live Wallpaper; Background

trebun

Member
Licensed User
Longtime User
Hi,

I need help to scale the background images for my live wallpaper.

I take a random flyer from my site with the url:

>> http://.../electronic/fcDownload.php (only some test flyer available)

In the attachments, I uploaded my project (construction area - haha! - not all will work correctly. If all things are done, I will upload and share the code in "Basic4android Share Your Creations"! Promise!)

In the WallpaperService I need to scale the backgroundimage with the right ratio. I need this dynamicly, because not all flyer have the same scaling.

B4X:
Sub LWM_OffsetChanged (Engine As LWEngine)
      
   If Flyer.IsInitialized  Then
      
      Engine.Rect.Left = -Engine.CurrentOffsetX 
      Engine.Rect.Top = -Engine.CurrentOffsetY 
      Engine.Rect.Right = -Engine.CurrentOffsetX + Engine.FullWallpaperWidth 
      Engine.Rect.Bottom = -Engine.CurrentOffsetY + Engine.FullWallpaperHeight
      
      Engine.Canvas.DrawBitmap(Flyer, Null, Engine.Rect)

   Else
      Engine.Canvas.DrawColor(Colors.Black)
      Engine.Canvas.DrawText(AResMap.Get("other_placeholder_on_screen"), 120dip, 120dip, Typeface.DEFAULT_BOLD, 30, Colors.White, "LEFT")
   End If
   
   Engine.RefreshAll
End Sub

This works good, but all images on my GNex or N7 are clinched. I think it is a problem with "FullWallpaperHeight" (=1280). But on both devices, I have software buttons they must be subtracted from the "FullWallpaperHeight".

I test it with
B4X:
pScreenHeight=GetDeviceLayoutValues.Height
pScreenWidth=GetDeviceLayoutValues.Width

But I have no Idea with the nice offset x/y. So, please :sign0085:

Regards,
trebun
 

Attachments

  • stretch_wallpaper.jpg
    stretch_wallpaper.jpg
    92.3 KB · Views: 679
Last edited:

trebun

Member
Licensed User
Longtime User
Sure, I am working with your test project :).

But as I aready said it needs its time. I've never worked with LiveWallpapers berfore.
In general I post back only when I have a solution and not inbetween.
And afters some hours of trying to understand why things don't work as you expect them to work need breaks and I leave it besides and continue afterwards.

Best regards.

Thats true - I have no time pressure and I make a break on this project. If you need more information, let me know...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I have 'played' quite a lot with the project trying to find a solution.
Unfortunately it doesn't work yet as I want it to work.
Next week i'll be absent and no time to investigate further.
When I'm back I will look at it again.

Best regards.
 
Upvote 0

trebun

Member
Licensed User
Longtime User
I have 'played' quite a lot with the project trying to find a solution.
Unfortunately it doesn't work yet as I want it to work.
Next week i'll be absent and no time to investigate further.
When I'm back I will look at it again.

Best regards.

Thanks for the information! :)
 
Upvote 0

trebun

Member
Licensed User
Longtime User
I have 'played' quite a lot with the project trying to find a solution.
Unfortunately it doesn't work yet as I want it to work.
Next week i'll be absent and no time to investigate further.
When I'm back I will look at it again.

Best regards.

Klaus, do you find some time to help me? :)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, I forgot this one.
I was busy that time and when I came back I missed it.
Will have a look it, I've put it on the todo list.
No garantie before Easter.

Best regards.
 
Upvote 0
Top