动画GIF导致闪屏是空
我知道这可能是接近这个线程的副本: GIF动画闪屏中
I know this is probably close to a duplicate of this thread: Animated GIF in Splashscreen
但是,因为它似乎没有答案,我无法在其上或任何对不起发表评论我要重新发布这一点,但它会真棒,如果有人能够给我一个答案。
But since it seems unanswered and I can't comment on it or anything I'm sorry to repost this but it would be awesome if someone could give me an answer.
我想提出一个游戏,这个游戏需要相当多的时间来启动。因此,我想给在载入画面时用户的反馈,所以他知道该应用程序还没有崩溃。这就是为什么我用的是闪屏API从Java 7。
I am making a game and this game takes quite a lot of time to start. Therefore I want to give the user feedback during the loading screen so he knows the application hasn't crashed. That's why I use the SplashScreen API from java 7.
在Eclipse中,当我使用VM参数以下配置运行我的应用程序, SplashScreen.getSplashScreen()
收益空
。
In eclipse, when I run my application using the following configuration in VM Arguments, SplashScreen.getSplashScreen()
returns null
.
-splash:SRC / aapplication / Splash.gif
但是当我使用这个配置,它工作正常(我必须在同一个包文件,一个是 Splash.png
和其他 Splash.gif
)
But when I use this configuration, it works fine (I have to files in the same package, one is Splash.png
and the other Splash.gif
):
-splash:SRC / aapplication / Splash.png
在一个jar文件( MANIFEST.MF
),这不起作用:
In a jar file (in MANIFEST.MF
), this doesn't work:
闪屏,图像:aapplication / Splash.gif
虽然这确实
闪屏,图像:aapplication / Splash.png
我的GIF约1MB大小的,而PNG是50KB。
My GIF is about 1Mb in size while the PNG is 50kb.
任何人都可以向我解释为何GIF甚至不能同时PNG确实装(我知道这是不是因为路径它们具有相同的)?
Can anyone explain to me why does the GIF can't even be loaded while the PNG does (I know it's not the path since they have the same)?
我到处看了看,它说,这应该只是为PNG格式的罚款。
Everywhere I looked, it said it should work just as fine as for PNGs.
感谢您的帮助!
我想你会发现,这个问题归结为两件事情...
I think you'll find that the problem comes down to two things...
- 使用命令行参数(-splash),Java的期望图像出现在文件系统上的文件,而清单文件希望它是一个嵌入式的资源。
- 的Java似乎并没有能够播放GIF格式的优化,这是GIF格式的帧重新present最后和当前帧之间的差异,而不是一个完整的图像(至于闪屏变)。
我试图用
和
第一个图像失败,但第二个工作,所不同的,尽可能接近我可以告诉大家,是第一个被优化,二是不要...
The first image failed, but the second worked, the difference, as near as I can tell, is the first is optimised and the second is not...