Archive: AdvSplash + gif, jpeg and others


AdvSplash + gif, jpeg and others
  Jpeg compression is a wellknown quality/size decision, may be usefull for a big splash images.
I only replaced LoadImage() with OleLoadPicturePath() call (and renamed project files :) )

Tested on Win2K

This might be done already, but I not found "IPicture" word using forum search or in my "Contrib" folder.

For any use, of course..


Going to test it :)


Thanks, this is something I've been looking for lately. I thought it was weird that the NSIS installer wouldn't allow the use of a .jpg image as the splash image.

I've tried your file on WinXP Pro SP2, and the .jpg showed up just fine, with no errors. I'm going to try a .gif with transparency tomorrow. :)


Thanks, John.
Please note, that I used gif with white (0x000000) transparency color in Example.nsi

"KeyColor - color used for transparency, could be any RGB value
(for ex. R=255 G=100 B=16 -> KeyColor=0xFF6410),
use KeyColor=-1 if there is no transparent color at your image."


It works for .gif with and without transparency, and for .jpg. :)

I've tried .png with transparency too though, but that doesn't seem to work. Any simple way I can make .png work using this plugin?


The same problem with tiff. OleLoadPicturePath returns NULL instead of interface pointer :(
IE also supports all image formats, and code samples are available in Inet, but this is another story..
New "play" plug-in entry (see included sample), now sound works and on my Win98 too. 2 images included to make test more easily.
Transparency extraction from GIF adds 2 kB to dll, so it is not included again.


Are you going to try to make it work for .tiff and .png images as well, or should I go for .gif instead?

.gif is OK, but a 24bit .png with transparency looks much better than a transparent .gif with it's 256 colour cap. (.gif gets "pixellated")

But either way, thanks for the work you put into it as it is. :)


Right now my tasks list is too long for this, may be later :(
But if anybody wants to add png support - IImgCtx is a keyword. It is a part of IE, but Win95 Gold was last MS OS without IE embedded, so I guess this is safe way.
One link (russian, but code presents) http://www.rsdn*****article/qna/gdi/drawimg.xml


png ok, but what's the point in tiff support?


PhotoShop asks me about tiff compression every time (none/lzw/zip), plain files looks really compressed. So why not?


Transparency extraction from GIF adds 2 kB to dll, so it is not included again.
Maybe adding an extra option for this would be excellent. I don't think you should care about size at first. You should expand the plugin to the most you can, then you can make optimizations. Except for that, I'm liking it! :)

OK, color extraction added, code based on the Andy Key GBM lib, +0.5 kB only :) I also made another minor changes.
I am not sure how RGB - BGR color goes from gif to bmp, but on my tests with black and white transparent colors it worked fine. PhotoEditor sets transparent color to white only :( Might be good to test with red transp. color. Tested on Win98 and XP. Some considerations about indexed colors in ipicsplash.txt file - see attachment.


Any coders out there willing to continue Takhir's work?

I think a lot of people would appreciate .png support, since a 24bit .png with transparency looks so much better than a .gif with transparency.


my first idea was to use jpeg - it can lose a bit of image quality, but at the same time gives (or must give :) ) image file size, which cannot be reached in image formats without quality loses (gif, bmp, png). If lzma compressor used in package creation, it might be good to compare compressed particular package sizes with 24 bit bmp and png - what compression is better. BTW when I write random data to tape with hardware compression enabled, it takes 11% (average) place more, then without compression. It's about (png compression + nsis lzma compression) - package size may increase.
But any case it would be fine to have all formats (and without taxes :)


I added mp3 support to "play" function and renamed plug-in back to AdvSplash (because only 5% of code is mine :) )


On Win2K in some situations after splash window installer appeared in the background, fixed. 2 KichiK - this was caused by TOPMOST splash window style.
Current plug-in name is NewAdvSplash - use folder name under nsis/contrib/NewAdvSplash


Improved screen redraw after image was destroyed for "no fading" modes - old (included to NSIS distribution AdvSplash) plug-in on Win98 lefts image scraps on the screen.
BTW, BMP RLE compression (PhotoEditor can do) with subsequent palette cutting (I have program for this) and NSIS package compression may give less file size then gif encoding (for plain images with limited colors number).


GlobalFree() bad pointer bug fixed (from original AdvSplash code).


New mode with /BANNER key - due to few lines of code from the nxs plug-in it not stops installer execution while displaying image banner. This makes possible to perform some background initalization (like Banner plug-in does, but with image instead of text).
/BANNER key requires /NOUNLOAD in the command line and 'ShowWindow $HWNDPARENT 2' string in the .onGUIInit function (see incuded Example.nsi).
Finally:


newadvsplash::show [/NOUNLOAD] show in out color [/BANNER] [/NOCANCEL] filename

Two new dll entry points for this mode: wait and stop. First - waits for the end of 'show' and returns control to installer, stop - terminates it (see included Example.nsi).

New /NOCANCEL key - disables 'exit on user click' default behaviour.

newadvsplash::play /NOUNLOAD "sndfile.mp3" ; plays sound
newadvsplash::play /NOUNLOAD "" ; stops sound.

I have a problem trying to use these files after I installed NSIS 2.08

I have an "old" installer script that I haven't touched for a long time, but today I needed to compile it again, because I had changed something in the README that comes with the installer. I have NOT changed the script at all.

Now, when I try to compile this old script, I get an "Invalid command: ipicsplash::show" error.

I get the same error when trying to use the latest newadvsplash.dll posted above instead of the older ipicsplash.dll.

ipicsplash.dll worked just fine on NSIS 2.05 or so (maybe it was an even earlier release).

The "good old" vanilla AdvSplash.dll works, but I'd like to have .gif support. I have managed to create transparency using a .bmp and AdvSplash as well now, but I'd like to use .gif.

Any fix for this, so I can use the transparent .gif again?
Or will I have to revert back to an earlier NSIS build to compile?


I retested June 26 version with NSIS 2.08 on XP Pro without any problems. So please make following:
1. Download latest version from previous post zip.
2. Put included newadvsplash.dll to your Program files\NSIS\plugins folder.
3. Replace file name in the following code and test it in your script:


newadvsplash::show 2000 1000 500 -2 "$PLUGINSDIR\catch.gif"

"Invalid command "Invalid command: ipicsplash::show"" meand that new NSIS version has removed ipicsplash.dll from your plugins (and a lot of other usefull things you had under NSIS folder). Next time do not uninstall previous NSIS version when installing new one (NSIS installer' default) - NSIS uninstaller script was written by "left hand", they removed source code from installer and also deleted all usefull stuff we had under NSIS folder :(
I will be offline 10 days beginning Thursday - test code now :)

Yes, I'm very sorry. I came back here now to say that it wasn't the latest NSIS build that was at fault, because I have now tried build 2.00 and had the same problem.

It was, as you say, only a matter of the missing .dll file in the plugins folder.

I haven't used that script for so long that I had forgotten about having to put the .dll into the plugins folder. So I feel a little stupid now.

Thanks for your help. :)


PS: this forum is so slow to load now that it's hard to come back to post updates; it takes ages.


any chance of supporting animated gifs in newadvsplash ?
Wanted to have a splash gif with a text box that animates:
initializing
initializing.
initializing..
initializing...
;
at the first go, it does not seem to work :(
g


Current version not supports animation, this is improved AdvSplash only (more image and sound formats, /BANNER mode). Windows animation control works with AVI (MSDN declares this), but not with GIF. For AVI it is possible to use existing control as splash window, but animated GIFs require some code I guess (for example http://www.codeguru.com/Cpp/G-M/bitm...cle.php/c4879/ )
This increases plug-in size and creates problems with transparency.


understood
BTW, having code execute while the splash showing is really really cool ! This is a great feature.
g


New plug-in entry point 'hwnd' - gets splash window handle, may be usefull for additional window drawing (in the /banner mode). wiki page


Sorry, but I am having color problems with NewAdvSplash... In jpeg and bmp images, -1 is setting white to be transparent :(


Can you give detailed description of problem? I re-tested last version (from wiki) and it worked fine with jpeg and bmp both with -1 (no transparency) and some hex value as transp. color. Included to package Example.nsi shows bmp image with transparency "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp". White value is 0xffffff
Possible jpeg problem - transparent areas are not in 8-pixel jpeg grid, this case borders may have distortions. With other truecolor images please check hex color value you want to make transparent in graphic editor (like Photoshop).


Here is the screenshot with code highlighted in the back:

http://imagehost.bizhat.com/img_page...screenshot.jpg

The white color is transparent despite -1 command... changing -1 to 0x008000 (for example) makes it nontransparent.

This is a bmp file edited with windows xp paint. I can't put it here to be downloaded, because my registration request with username zeeh3 has never recieved the activation code by mail :(


Originally posted by meganoob
... because my registration request with username zeeh3 has never recieved the activation code by mail :(
I've resent it. Let me know if it doesn't arrive in a couple of hours.

Thanks you, meganoob, I could reproduce and fix the bug. New file uploaded to wiki


You are welcome, Takhir :) and thanks a lot kichik, from now on meganoob no more, the activation arrived at last!


I am havng a problem with the newadvsplash plugin. I grabbed the one from Takhir's wiki page, and when I run it, the sound and transparent gif show/play ok, but when it's unloading the installer crashes. I'm not sure what I'm doing wrong.

Here is the code I used:

Function .onInit

InitPluginsDir
File /oname=$PLUGINSDIR\splash.gif "F:\Projects\Test\Install\Images\splash.gif"
#optional
File /oname=$PLUGINSDIR\splash.mp3 "F:\Projects\Test\Install\Extras\splash.mp3"
newadvsplash::play $PLUGINSDIR\splash.mp3
newadvsplash::show 7000 600 400 -2 $PLUGINSDIR\splash.gif

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.

Delete $PLUGINSDIR\splash.gif
Delete $PLUGINSDIR\splash.mp3

FunctionEnd

Any help is appreciated


You need the /NOUNLOAD flag after newadvsplash::show:


newadvsplash::show /NOUNLOAD 7000 600 400 -2 $PLUGINSDIRsplash.gif 

>
-Dan

Yes, /nounload required, but in the first call ('play' this case). For 'modal' banner


newadvsplash::play /nounload "$PLUGINSDIR\splash.mp3"
newadvsplash::show 7000 600 400 -2 "$PLUGINSDIR\splash.gif"

Works beautifully now, Thanks!


Small change to prevent grabbing focus...
  FWIW, I have slightly modified my copy of NewAdvSplash.dll (thanks for the sources!) to add the SWP_NOACTIVATE flag to the SetWindowPos call in the WndProc function. For my purposes, it was annoying that the splash grabbed focus when it displayed. This was on or about line 105 in advsplash.cpp.

If others feel this is a useful improvement, perhaps this change could be integrated into the main source?

Nathan Probst


As a quick follow up, I also found it necessary to remove the call to SetForegroundWindow() in the function sf(). Without this change, there is an annoying momentary window activation as the display is ending.

I'd appreciate it if someone (Takhir?) could sanity-check my changes...not sure if I've broken anything!


Thanks, Nathan!
Default 'activate' behavior came with old AdvSplash code. I tested your variant and don't see big differences, but if we'll have more then one reqest I can add this as option. Please note 2 another places in the code: sf() function - attempts to set window foreground on splash creation and removing; TOPMOST splash window style - in some situations this also may be a bit annoying.


New version available:
1. /PASSIVE key - not forces splash window to foreground (last request);
2. /BANNER mode MUI sample fix.
3. Animated sample (thanks zeeh3), requires AnimGif plug-in.