AlynxZhou / alynx-live-wallpaper

An android app that allows you choose a video as wallpaper.
https://livewallpaper.alynx.xyz/
Apache License 2.0
94 stars 37 forks source link

Question: how to set different scale-types? #10

Closed AndroidDeveloperLB closed 4 years ago

AndroidDeveloperLB commented 4 years ago

Like what we have for ImageView, of scale-crop, and to fit in the center?

Currently it seems zoomed if I choose a wide video (which is most videos)...

AlynxZhou commented 4 years ago

You need to edit the OpenGL code to set different crop mode for video, but I personally not interested in other mode, center crop is the best way for background, which does not change the video ratio or add black bars. If you have an video that main part is not in center, I suggest you to crop it on computer first, because it will make the app more complex to support custom cropping.

AndroidDeveloperLB commented 4 years ago

Can you please tell in which part of the code to change it?

AlynxZhou commented 4 years ago

Can you please tell in which part of the code to change it?

https://github.com/AlynxZhou/alynx-live-wallpaper/blob/master/app/src/main/java/xyz/alynx/livewallpaper/GLES30WallpaperRenderer.java#L333-L373

Just use different matrix here.

AndroidDeveloperLB commented 4 years ago

I see. I hope I can get it right.

Currently, what is the behavior? It seems to fit to width or to height based on whether the video aspect ratio is larger than of the video?