I have found an error in the code it will be fixed, if you leave defaults no problem, I did not test all scenarios it will be fixed.
This C code will create a Usplash using a image of your choice. You can utilize my source & modify it to your hearts desire GUI Version (point , click & done) is in the works read below
Current Changelog:
- Code: Select all
#ChangeLog:
# 1.03
# attempted to fix the update subroutine (downloads and checks properly until a new version is detected does not replace with the new version) - fixed
# 1.02 Started Changelog
# added pallete generated progress bars (throbbers) - thanks redteam_316
# added resolution selection
# makefile generation based on resolutions the user selects.
# 1.00 Initial release
# THE FUTURE
# ==========
# Progress bar positioning (only good with single resoultion selection)
Those that are using an older version then 1.03 will have to enter the following in a terminal, it will automatically update here on forward. all because of a ~ not being there.
Far from complete. To install the new USplash Maker (TUM - TheeMahn's Usplash Maker) enter the following in a terminal:
- Code: Select all
sudo apt-get install -y --force-yes libusplash-dev
cd ~/.gnome2/nautilus-scripts/
rm MakeUsplash #<<in case you have the older one installed
wget http://ubuntusoftware.info/scripts/MakeUsplash
sudo chmod +x MakeUsplash
Right click your image of choice I suggest an image of at least 1280 X 1024 and click MakeUsplash, it will convert the image to all resolutions up to 1280 X 1024 in indexed mode, compile a usplash & put it in your current directory naming it what ever the jpg, png etc. was named .so. If it does not show up on your menu you may have to restart nautilus, I suggest a
Enjoy, as always my source is open and freely modifiable. Please be informed it does not support spaces in the filename or path and I am not gonna spend another day or 2 to make it do so. call it aaa.jpg let it take care of business and name it what you like. Sorry don't have time currently.sudo killall nautilus
Bash script source:
- Code: Select all
#!/bin/sh
# USplash Maker Via TheeMahn
# Copyright (c) 2007 Ubuntusoftware Team <http://ubuntusoftware.info>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ChangeLog:
# 1.03
# attempted to fix the update subroutine (downloads and checks properly until a new version is detected does not replace with the new version) - fixed
# 1.02 Started Changelog
# added pallete generated progress bars (throbbers) - thanks redteam_316
# added resolution selection
# makefile generation based on resolutions the user selects.
# 1.00 Initial release
# THE FUTURE
# ==========
# Progress bar positioning (only good with single resoultion selection
SCRIPT_VERSION=1.03
FNAME="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
file=$@
# everything after last '/'
basename=${file%.*}
ext=".so"
OUTFILE=${basename}${ext}
##Check for zenity
if [ ! -e "/usr/bin/zenity" ]; then
gksudo apt-get install -y --force-yes zenity
fi
update() {
wget -O /tmp/MakeUsplash http://ubuntusoftware.info/scripts/MakeUsplash >/dev/null 2>&1
#Verify it did download it
RESULTS_SIZE=`stat -c %s /tmp/MakeUsplash`
if [ "$RESULTS_SIZE" = 0 ]
then
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='It is suggested to re-run the script, the server may be under a heavy load. If the message persists, please verify you have an internet connection, the server is online & try again. Please refer to UbuntuSoftware Forum for further info.' --title="TUM - TheeMahns USplash Maker";
exit 0
fi
#Version check script
REMOTE_VERSION=`grep SCRIPT_VERSION /tmp/MakeUsplash |head -n1 |sed 's/.*=//'`
if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
if [[ -n $DIALOG ]]
then
dialog --yesno "Newer version of TUM - TheeMahns USplash Maker script has been found\n\nDo you wish to install it?" 0 0
DIALOG_EXIT_CODE=$?
if [[ $DIALOG_EXIT_CODE = 0 ]]
then
cp /tmp/MakeUsplash ~/.gnome2/nautilus-scripts/
echo "USplash Maker script has been updated to v $REMOTE_VERSION"
echo "Please re-run the script"
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'. It has been upgraded please re-run script.' --title="TUM - TheeMahns USplash Maker";
exit
fi
else
cp /tmp/MakeUsplash ~/.gnome2/nautilus-scripts/
echo "Newer version detected: $REMOTE_VERSION"
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'. It has been upgraded please re-run script.' --title="TUM - TheeMahns USplash Maker";
exit
fi
fi
cp /tmp/MakeUsplash ~/.gnome2/nautilus-scripts/
rm /tmp/MakeUsplash 2>/dev/null
}
update
PROGRESS=0
#FNAME=$@
#Resolution Subroutines
Res1(){
#cd $
convert -colors 256 $FNAME -resize "640X400!" -quality 100 -strip WorkInProgress/usplash_640_400.png | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Processing @ 640 X 400..."
# Palleting of progressbar - Thanks red_team316
convert WorkInProgress/usplash_640_400.png WorkInProgress/throbber_back_640_400.png WorkInProgress/throbber_fore_640_400.png -append WorkInProgress/append.png
convert WorkInProgress/append.png +dither -colors 256 WorkInProgress/paletted.png
convert WorkInProgress/paletted.png -crop 640x400+0+0! WorkInProgress/usplash_640_400.png
convert WorkInProgress/paletted.png -crop 216x8+0+400! WorkInProgress/throbber_back_640_400.png
convert WorkInProgress/paletted.png -crop 216x8+0+408! WorkInProgress/throbber_fore_640_400.png
}
Res2(){
#640X480
#cd $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
convert -colors 256 $FNAME -resize "640X480!" -quality 100 -strip WorkInProgress/usplash_640_480.png | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Processing @ 640 X 480..."
convert WorkInProgress/usplash_640_480.png WorkInProgress/throbber_back_640_480.png WorkInProgress/throbber_fore_640_480.png -append WorkInProgress/append.png
convert WorkInProgress/append.png +dither -colors 256 WorkInProgress/paletted.png
convert WorkInProgress/paletted.png -crop 640x480+0+0! WorkInProgress/usplash_640_480.png
convert WorkInProgress/paletted.png -crop 216x8+0+480! WorkInProgress/throbber_back_640_480.png
convert WorkInProgress/paletted.png -crop 216x8+0+488! WorkInProgress/throbber_fore_640_480.png
}
Res3(){
#800X600
#cd $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
convert -colors 256 $FNAME -resize "800X600!" -quality 100 -strip WorkInProgress/usplash_800_600.png | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Processing @ 800 X 600..."
convert WorkInProgress/usplash_800_600.png WorkInProgress/throbber_back_800_600.png WorkInProgress/throbber_fore_800_600.png -append WorkInProgress/append.png
convert WorkInProgress/append.png +dither -colors 256 WorkInProgress/paletted.png
convert WorkInProgress/paletted.png -crop 800x600+0+0! WorkInProgress/usplash_800_600.png
convert WorkInProgress/paletted.png -crop 216x8+0+600! WorkInProgress/throbber_back_800_600.png
convert WorkInProgress/paletted.png -crop 216x8+0+608! WorkInProgress/throbber_fore_800_600.png
}
Res4(){
#1024 X 768
convert -colors 256 $FNAME -resize "1024X768!" -quality 100 -strip WorkInProgress/usplash_1024_768.png | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Processing @ 1024 X 768..."
convert WorkInProgress/usplash_1024_768.png WorkInProgress/throbber_back_1024_768.png WorkInProgress/throbber_fore_1024_768.png -append WorkInProgress/append.png
convert WorkInProgress/append.png +dither -colors 256 WorkInProgress/paletted.png
convert WorkInProgress/paletted.png -crop 1024x768+0+0! WorkInProgress/usplash_1024_768.png
convert WorkInProgress/paletted.png -crop 216x8+0+768! WorkInProgress/throbber_back_1024_768.png
convert WorkInProgress/paletted.png -crop 216x8+0+776! WorkInProgress/throbber_fore_1024_768.png
}
Res5(){
#1280X1024
convert -colors 256 $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS -resize "1280X1024!" -quality 100 -strip WorkInProgress/usplash_1280_1024.png | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Processing @ 1280 X 1024..."
convert WorkInProgress/usplash_1280_1024.png WorkInProgress/throbber_back_1280_1024.png WorkInProgress/throbber_fore_1280_1024.png -append WorkInProgress/append.png
convert WorkInProgress/append.png +dither -colors 256 WorkInProgress/paletted.png
convert WorkInProgress/paletted.png -crop 1280x1024+0+0! WorkInProgress/usplash_1280_1024.png
convert WorkInProgress/paletted.png -crop 216x8+0+1024! WorkInProgress/throbber_back_1280_1024.png
convert WorkInProgress/paletted.png -crop 216x8+0+1032! WorkInProgress/throbber_fore_1280_1024.png
}
#C Code Subroutines
Header(){
#Grab Throbbers, fonts & C code
cd WorkInProgress
wget http://ubuntusoftware.info/scripts/USplash/USplash.tar.gz
tar xfv USplash.tar.gz
#modify Makefile
echo 'CC=gcc
CFLAGS=-g -Wall -fPIC
LDFLAGS=
INCLUDES=
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS)
INSTALL = /usr/bin/install -c
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROGRAM = $(INSTALL) -m 755
' > Makefile
printf 'usplash-theme-ubuntu.so: ' >> Makefile
#Throbber Back
#600X400 Selected?
if echo "$SIZE" | grep "600X400" ; then
printf 'throbber_back_640_400.png.c.o ' >> Makefile
fi
#600X480 Selected?
if echo "$SIZE" | grep "640X480" ; then
printf 'throbber_back_640_480.png.c.o ' >> Makefile
fi
#800X600 Selected?
if echo "$SIZE" | grep "800X600" ; then
printf 'throbber_back_800_600.png.c.o ' >> Makefile
fi
echo ' \' >> Makefile
printf ' ' >> Makefile
#1024X768 Selected?
if echo "$SIZE" | grep "1024X768" ; then
printf 'throbber_back_1024_768.png.c.o ' >> Makefile
fi
#1280X1024 Selected?
if echo "$SIZE" | grep "1280X1024" ; then
printf 'throbber_back_1280_1024.png.c.o ' >> Makefile
fi
echo ' \' >> Makefile
printf ' ' >> Makefile
#Throbber Fore
#600X400 Selected?
if echo "$SIZE" | grep "600X400" ; then
printf 'throbber_fore_640_400.png.c.o ' >> Makefile
fi
#600X480 Selected?
if echo "$SIZE" | grep "640X480" ; then
printf 'throbber_fore_640_480.png.c.o ' >> Makefile
fi
#800X600 Selected?
if echo "$SIZE" | grep "800X600" ; then
printf 'throbber_fore_800_600.png.c.o ' >> Makefile
fi
echo ' \' >> Makefile
printf ' ' >> Makefile
#1024X768 Selected?
if echo "$SIZE" | grep "1024X768" ; then
printf 'throbber_fore_1024_768.png.c.o ' >> Makefile
fi
#1024X768 Selected?
if echo "$SIZE" | grep "1280X1024" ; then
printf 'throbber_fore_1280_1024.png.c.o ' >> Makefile
fi
echo ' \' >> Makefile
printf ' ' >> Makefile
#MAIN
#600X400 Selected?
if echo "$SIZE" | grep "600X400" ; then
printf 'usplash_640_400.png.c.o ' >> Makefile
il=1
fi
#600X480 Selected?
if echo "$SIZE" | grep "640X480" ; then
printf 'usplash_640_480.png.c.o ' >> Makefile
il=1
fi
#800X600 Selected?
if echo "$SIZE" | grep "800X600" ; then
printf 'usplash_800_600.png.c.o ' >> Makefile
il=1
fi
#check if any
if echo "$il" | grep "1" ; then
echo ' \' >> Makefile
printf ' ' >> Makefile
fi
#1024X768 Selected?
if echo "$SIZE" | grep "1024X768" ; then
printf 'usplash_1024_768.png.c.o ' >> Makefile
fi
#1024X768 Selected?
if echo "$SIZE" | grep "1280X1024" ; then
printf 'usplash_1280_1024.png.c.o ' >> Makefile
fi
echo ' \' >> Makefile
printf ' ' >> Makefile
echo 'usplash-theme-ubuntu.c.o' >> Makefile
#ENDING
echo ' $(COMPILE) -shared -o $@ $^
%.png.c: %.png
pngtousplash $< > $@
%.bdf.c: %.bdf
bdftousplash $< > $@
%.c.o: %.c
$(COMPILE) -o $@ -c $<
install:
$(INSTALL) -d $(DESTDIR)/usr/lib/usplash
$(INSTALL_PROGRAM) usplash-theme-ubuntu.so $(DESTDIR)/usr/lib/usplash/usplash-theme-ubuntu.so
clean:
rm -f *.png.c *.bdf.c *.c.o' >> Makefile
cd ..
}
# Dialog box to choose USplash's size(s)
# Begin interaction with end user
`zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text="This will complie a USplash in current folder called $OUTFILE you can then load this file into Startup Manager (SUM). Enjoy, TheeMahn" --title="TUM - TheeMahns USplash Maker"`;
SIZE="";
SIZE="$(zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=500 --height=280 --title "TUM - TheeMahns USplash Maker" --text "Choose the Usplash resolutions to be compiled." --list --checklist --column "Select" --column "Resolution" true '600X400' true '640X480' true '800X600' true '1024X768' true '1280X1024')";
echo $SIZE
if [ "${SIZE}" == "" ]; then
zenity --error --text="Resolution not defined by user. Please choose a size to use. "
exit 0
fi
n=0
if echo "$SIZE" | grep "600X400" ; then
n=$(($n + 1))
echo -n "$n "
fi
if echo "$SIZE" | grep "640X480" ; then
n=$(($n + 1))
echo -n "$n "
fi
if echo "$SIZE" | grep "800X600" ; then
n=$(($n + 1))
echo -n "$n "
fi
if echo "$SIZE" | grep "1024X768" ; then
n=$(($n + 1))
echo -n "$n "
fi
if echo "$SIZE" | grep "1280X1024" ; then
n=$(($n + 1))
echo -n "$n "
fi
How many files to make the progress bar
PROGRESS=0
TOTAL=$((100 / $n))
echo $TOTAL
mkdir -p WorkInProgress
Header
if echo "$SIZE" | grep "600X400" ; then
Res1
fi
if echo "$SIZE" | grep "640X480" ; then
Res2
fi
if echo "$SIZE" | grep "800X600" ; then
Res3
fi
if echo "$SIZE" | grep "1024X768" ; then
Res4
fi
if echo "$SIZE" | grep "1280X1024" ; then
Res5
fi
if
cd WorkInProgress
make | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Compiling USplash"
mv usplash-theme-ubuntu.so ../$OUTFILE
cd ..
#Clean up
rm -R WorkInProgress
exit 0
C Source:
- Code: Select all
/* Ultimate Usplash Maker
*
# Copyright (c) 2007 Ubuntusoftware Team <http://ubuntusoftware.info>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# alonCleaning upg with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <usplash-theme.h>
/* Needed for the custom drawing functions */
#include <usplash_backend.h>
extern struct usplash_pixmap pixmap_usplash_640_400, pixmap_usplash_640_480;
extern struct usplash_pixmap pixmap_usplash_800_600, pixmap_usplash_1024_768, pixmap_usplash_1280_1024;
extern struct usplash_pixmap pixmap_throbber_back_640_400;
extern struct usplash_pixmap pixmap_throbber_back_640_480;
extern struct usplash_pixmap pixmap_throbber_back_800_600;
extern struct usplash_pixmap pixmap_throbber_back_1024_768;
extern struct usplash_pixmap pixmap_throbber_back_1280_1024;
extern struct usplash_pixmap pixmap_throbber_fore_640_400;
extern struct usplash_pixmap pixmap_throbber_fore_640_480;
extern struct usplash_pixmap pixmap_throbber_fore_800_600;
extern struct usplash_pixmap pixmap_throbber_fore_1024_768;
extern struct usplash_pixmap pixmap_throbber_fore_1280_1024;
extern struct usplash_font font_helvB10;
void t_init(struct usplash_theme* theme);
void t_clear_progressbar_640_400(struct usplash_theme* theme);
void t_clear_progressbar_640_480(struct usplash_theme* theme);
void t_clear_progressbar_800_600(struct usplash_theme* theme);
void t_clear_progressbar_1024_768(struct usplash_theme* theme);
void t_clear_progressbar_1280_1024(struct usplash_theme* theme);
void t_draw_progressbar_640_400(struct usplash_theme* theme, int percentage);
void t_draw_progressbar_640_480(struct usplash_theme* theme, int percentage);
void t_draw_progressbar_800_600(struct usplash_theme* theme, int percentage);
void t_draw_progressbar_1024_768(struct usplash_theme* theme, int percentage);
void t_draw_progressbar_1280_1024(struct usplash_theme* theme, int percentage);
void t_animate_step_640_400(struct usplash_theme* theme, int pulsating);
void t_animate_step_640_480(struct usplash_theme* theme, int pulsating);
void t_animate_step_800_600(struct usplash_theme* theme, int pulsating);
void t_animate_step_1024_768(struct usplash_theme* theme, int pulsating);
void t_animate_step_1280_1024(struct usplash_theme* theme, int pulsating);
struct usplash_theme usplash_theme_640_480;
struct usplash_theme usplash_theme_800_600;
struct usplash_theme usplash_theme_1024_768;
struct usplash_theme usplash_theme_1280_1024;
struct usplash_theme usplash_theme = {
.version = THEME_VERSION, /* ALWAYS set this to THEME_VERSION,
it's a compatibility check */
.next = &usplash_theme_640_480,
.ratio = USPLASH_4_3,
/* Background and font */
.pixmap = &pixmap_usplash_640_400,
.font = &font_helvB10,
/* Palette indexes */
.background = 0x0,
.progressbar_background = 0x7,
.progressbar_foreground = 0x156,
.text_background = 0x15,
.text_foreground = 0x31,
.text_success = 0x171,
.text_failure = 0x156,
/* Progress bar position and size in pixels */
.progressbar_x = 212, /* 640/2-216/2 */
.progressbar_y = 321,
.progressbar_width = 216,
.progressbar_height = 8,
/* Text box position and size in pixels */
.text_x = 120,
.text_y = 307,
.text_width = 360,
.text_height = 100,
/* Text details */
.line_height = 15,
.line_length = 32,
.status_width = 35,
/* Functions */
.init = t_init,
.clear_progressbar = t_clear_progressbar_640_400,
.draw_progressbar = t_draw_progressbar_640_400,
.animate_step = t_animate_step_640_400,
};
struct usplash_theme usplash_theme_640_480 = {
.version = THEME_VERSION, /* ALWAYS set this to THEME_VERSION,
it's a compatibility check */
.next = &usplash_theme_800_600,
.ratio = USPLASH_4_3,
/* Background and font */
.pixmap = &pixmap_usplash_640_480,
.font = &font_helvB10,
/* Palette indexes */Screenshots coming currently busy uploading Ultimate Gamers Edition 1.6
.background = 0x0,
.progressbar_background = 0x7,
.progressbar_foreground = 0x156,
.text_background = 0x15,
.text_foreground = 0x31,
.text_success = 0x171,
.text_failure = 0x156,
/* Progress bar position and size in pixels */
.progressbar_x = 212, /* 640/2-216/2 */
.progressbar_y = 291,
.progressbar_width = 216,
.progressbar_height = 8,
/* Text box position and size in pixels */
.text_x = 160,
.text_y = 312,
.text_width = 320,
.text_height = 100,
/* Text details */
.line_height = 15,
.line_length = 32,
.status_width = 35,
/* Functions */
.init = t_init,
.clear_progressbar = t_clear_progressbar_640_480,
.draw_progressbar = t_draw_progressbar_640_480,
.animate_step = t_animate_step_640_480,
};
struct usplash_theme usplash_theme_800_600 = {
.version = THEME_VERSION, /* ALWAYS set this to THEME_VERSION,
it's a compatibility check */
.next = &usplash_theme_1024_768,
.ratio = USPLASH_4_3,
/* Background and font */
.pixmap = &pixmap_usplash_800_600,
.font = &font_helvB10,
/* Palette indexes */
.background = 0x0,
.progressbar_background = 0x7,
.progressbar_foreground = 0x156,
.text_background = 0x15,
.text_foreground = 0x31,
.text_success = 0x171,
.text_failure = 0x156,
/* Progress bar position and size in pixels */
.progressbar_x = 292, /* 800/2-216/2 */
.progressbar_y = 370,
.progressbar_width = 216,
.progressbar_height = 8,
/* Text box position and size in pixels */
.text_x = 225,
.text_y = 407,
.text_width = 360,
.text_height = 100,
/* Text details */
.line_height = 15,
.line_length = 32,
.status_width = 35,
/* Functions */
.init = t_init,
.clear_progressbar = t_clear_progressbar_800_600,
.draw_progressbar = t_draw_progressbar_800_600,
.animate_step = t_animate_step_800_600,
};
struct usplash_theme usplash_theme_1024_768 = {
.version = THEME_VERSION,
.next = &usplash_theme_1280_1024,
.ratio = USPLASH_4_3,
/* Background and font */
.pixmap = &pixmap_usplash_1024_768,
.font = &font_helvB10,
/* Palette indexes */
.background = 0x0,
.progressbar_background = 0x7,
.progressbar_foreground = 0x156,
.text_background = 0x15,
.text_foreground = 0x31,
.text_success = 0x171,
.text_failure = 0x156,
/* Progress bar position and size in pixels */
.progressbar_x = 404, /* 1024/2 - 216/2 */
.progressbar_y = 475,
.progressbar_width = 216,
.progressbar_height = 8,
/* Text box position and size in pixels */
.text_x = 322,
.text_y = 525,
.text_width = 380,
.text_height = 100,
/* Text details */
.line_height = 15,
.line_length = 32,
.status_width = 35,
/* Functions */
.init = t_init,
.clear_progressbar = t_clear_progressbar_1024_768,
.draw_progressbar = t_draw_progressbar_1024_768,
.animate_step = t_animate_step_1024_768,
};
/* Added 1280 X 1024 support*/
struct usplash_theme usplash_theme_1280_1024 = {
.version = THEME_VERSION,
.next = NULL,
.ratio = USPLASH_4_3,
/* Background and font */
.pixmap = &pixmap_usplash_1280_1024,
.font = &font_helvB10,
/* Palette indexes */
.background = 0x0,
.progressbar_background = 0x7,
.progressbar_foreground = 0x156,
.text_background = 0x15,
.text_foreground = 0x252, /*was 31*/
.text_success = 0x171,
.text_failure = 0x156,
/* Progress bar position and size in pixels */
.progressbar_x = 532, /* 1280/2 - 512/2 */
.progressbar_y = 595,
.progressbar_width = 525,
.progressbar_height = 8,
/* Text box position and size in pixels */
.text_x = 377,
.text_y = 640,
.text_width = 525,
.text_height = 100,
/* Text details */
.line_height = 15,
.line_length = 32,
.status_width = 35,
/* Functions */
.init = t_init,
.clear_progressbar = t_clear_progressbar_1280_1024,
.draw_progressbar = t_draw_progressbar_1280_1024,
.animate_step = t_animate_step_1280_1024,
};
void t_init(struct usplash_theme *theme) {
int x, y;
usplash_getdimensions(&x, &y);
theme->progressbar_x = (x - theme->pixmap->width)/2 + theme->progressbar_x;
theme->progressbar_y = (y - theme->pixmap->height)/2 + theme->progressbar_y;
}
void t_clear_progressbar_640_400(struct usplash_theme *theme) {
t_draw_progressbar_640_400(theme, 0);
}
void t_clear_progressbar_640_480(struct usplash_theme *theme) {
t_draw_progressbar_640_480(theme, 0);
}
void t_clear_progressbar_800_600(struct usplash_theme *theme) {
t_draw_progressbar_800_600(theme, 0);
}
void t_clear_progressbar_1024_768(struct usplash_theme *theme) {
t_draw_progressbar_1024_768(theme, 0);
}
void t_clear_progressbar_1280_1024(struct usplash_theme *theme) {
t_draw_progressbar_1280_1024(theme, 0);
}
void t_draw_progressbar_640_400(struct usplash_theme *theme, int percentage) {
int w = (pixmap_throbber_back_640_400.width * percentage / 100);
usplash_put(theme->progressbar_x, theme->progressbar_y, &pixmap_throbber_back_640_400);
if(percentage == 0)
return;
if(percentage < 0)
usplash_put_part(theme->progressbar_x - w, theme->progressbar_y, pixmap_throbber_back_640_400.width + w,
pixmap_throbber_back_640_400.height, &pixmap_throbber_fore_640_400, -w, 0);
else
usplash_put_part(theme->progressbar_x, theme->progressbar_y, w, pixmap_throbber_back_640_400.height,
&pixmap_throbber_fore_640_400, 0, 0);
}
void t_draw_progressbar_640_480(struct usplash_theme *theme, int percentage) {
int w = (pixmap_throbber_back_640_480.width * percentage / 100);
usplash_put(theme->progressbar_x, theme->progressbar_y, &pixmap_throbber_back_640_480);
if(percentage == 0)
return;
if(percentage < 0)
usplash_put_part(theme->progressbar_x - w, theme->progressbar_y, pixmap_throbber_back_640_480.width + w,
pixmap_throbber_back_640_480.height, &pixmap_throbber_fore_640_480, -w, 0);
else
usplash_put_part(theme->progressbar_x, theme->progressbar_y, w, pixmap_throbber_back_640_480.height,
&pixmap_throbber_fore_640_480, 0, 0);
}
void t_draw_progressbar_800_600(struct usplash_theme *theme, int percentage) {
int w = (pixmap_throbber_back_800_600.width * percentage / 100);
usplash_put(theme->progressbar_x, theme->progressbar_y, &pixmap_throbber_back_800_600);
if(percentage == 0)
return;
if(percentage < 0)
usplash_put_part(theme->progressbar_x - w, theme->progressbar_y, pixmap_throbber_back_800_600.width + w,
pixmap_throbber_back_800_600.height, &pixmap_throbber_fore_800_600, -w, 0);
else
usplash_put_part(theme->progressbar_x, theme->progressbar_y, w, pixmap_throbber_back_800_600.height,
&pixmap_throbber_fore_800_600, 0, 0);
}
void t_draw_progressbar_1024_768(struct usplash_theme *theme, int percentage) {
int w = (pixmap_throbber_back_1024_768.width * percentage / 100);
usplash_put(theme->progressbar_x, theme->progressbar_y, &pixmap_throbber_back_1024_768);
if(percentage == 0)
return;
if(percentage < 0)
usplash_put_part(theme->progressbar_x - w, theme->progressbar_y, pixmap_throbber_back_1024_768.width + w,
pixmap_throbber_back_1024_768.height, &pixmap_throbber_fore_1024_768, -w, 0);
else
usplash_put_part(theme->progressbar_x, theme->progressbar_y, w, pixmap_throbber_back_1024_768.height,
&pixmap_throbber_fore_1024_768, 0, 0);
}
void t_draw_progressbar_1280_1024(struct usplash_theme *theme, int percentage) {
int w = (pixmap_throbber_back_1280_1024.width * percentage / 100);
usplash_put(theme->progressbar_x, theme->progressbar_y, &pixmap_throbber_back_1280_1024);
if(percentage == 0)
return;
if(percentage < 0)
usplash_put_part(theme->progressbar_x - w, theme->progressbar_y, pixmap_throbber_back_1280_1024.width + w,
pixmap_throbber_back_1280_1024.height, &pixmap_throbber_fore_1280_1024, -w, 0);
else
usplash_put_part(theme->progressbar_x, theme->progressbar_y, w, pixmap_throbber_back_1280_1024.height,
&pixmap_throbber_fore_1024_768, 0, 0);
}
void t_animate_step_640_400(struct usplash_theme* theme, int pulsating) {
static int pulsate_step = 0;
static int pulse_width = 56;
static int step_width = 2;
static int num_steps = 0;
int x1;
num_steps = (pixmap_throbber_fore_640_400.width - pulse_width)/2;
if (pulsating) {
t_draw_progressbar_640_400(theme, 0);
if(pulsate_step < num_steps/2+1)
x1 = 2 * step_width * pulsate_step;
else
x1 = pixmap_throbber_fore_640_400.width - pulse_width - 2 * step_width * (pulsate_step - num_steps/2+1);
usplash_put_part(theme->progressbar_x + x1, theme->progressbar_y, pulse_width,
pixmap_throbber_fore_640_400.height, &pixmap_throbber_fore_640_400, x1, 0);
pulsate_step = (pulsate_step + 1) % num_steps;
}
}
void t_animate_step_640_480(struct usplash_theme* theme, int pulsating) {
static int pulsate_step = 0;
static int pulse_width = 56;
static int step_width = 2;
static int num_steps = 0;
int x1;
num_steps = (pixmap_throbber_fore_640_480.width - pulse_width)/2;
if (pulsating) {
t_draw_progressbar_640_480(theme, 0);
if(pulsate_step < num_steps/2+1)
x1 = 2 * step_width * pulsate_step;
else
x1 = pixmap_throbber_fore_640_480.width - pulse_width - 2 * step_width * (pulsate_step - num_steps/2+1);
usplash_put_part(theme->progressbar_x + x1, theme->progressbar_y, pulse_width,
pixmap_throbber_fore_640_480.height, &pixmap_throbber_fore_640_480, x1, 0);
pulsate_step = (pulsate_step + 1) % num_steps;
}
}
void t_animate_step_800_600(struct usplash_theme* theme, int pulsating) {
static int pulsate_step = 0;
static int pulse_width = 56;
static int step_width = 2;
static int num_steps = 0;
int x1;
num_steps = (pixmap_throbber_fore_800_600.width - pulse_width)/2;
if (pulsating) {
t_draw_progressbar_800_600(theme, 0);
if(pulsate_step < num_steps/2+1)
x1 = 2 * step_width * pulsate_step;
else
x1 = pixmap_throbber_fore_800_600.width - pulse_width - 2 * step_width * (pulsate_step - num_steps/2+1);
usplash_put_part(theme->progressbar_x + x1, theme->progressbar_y, pulse_width,
pixmap_throbber_fore_800_600.height, &pixmap_throbber_fore_800_600, x1, 0);
pulsate_step = (pulsate_step + 1) % num_steps;
}
}
void t_animate_step_1024_768(struct usplash_theme* theme, int pulsating) {
static int pulsate_step = 0;
static int pulse_width = 56;
static int step_width = 2;
static int num_steps = 0;
int x1;
num_steps = (pixmap_throbber_fore_1024_768.width - pulse_width)/2;
if (pulsating) {
t_draw_progressbar_1024_768(theme, 0);
if(pulsate_step < num_steps/2+1)
x1 = 2 * step_width * pulsate_step;
else
x1 = pixmap_throbber_fore_1024_768.width - pulse_width - 2 * step_width * (pulsate_step - num_steps/2+1);
usplash_put_part(theme->progressbar_x + x1, theme->progressbar_y, pulse_width,
pixmap_throbber_fore_1024_768.height, &pixmap_throbber_fore_1024_768, x1, 0);
pulsate_step = (pulsate_step + 1) % num_steps;
}
}
void t_animate_step_1280_1024(struct usplash_theme* theme, int pulsating) {
static int pulsate_step = 0;
static int pulse_width = 56;
static int step_width = 2;
static int num_steps = 0;
int x1;
num_steps = (pixmap_throbber_fore_1280_1024.width - pulse_width)/2;
if (pulsating) {
t_draw_progressbar_1280_1024(theme, 0);
if(pulsate_step < num_steps/2+1)
x1 = 2 * step_width * pulsate_step;
else
x1 = pixmap_throbber_fore_1280_1024.width - pulse_width - 2 * step_width * (pulsate_step - num_steps/2+1);
usplash_put_part(theme->progressbar_x + x1, theme->progressbar_y, pulse_width,
pixmap_throbber_fore_1280_1024.height, &pixmap_throbber_fore_1280_1024, x1, 0);
pulsate_step = (pulsate_step + 1) % num_steps;
}
}
Makefile:
- Code: Select all
CC=gcc
CFLAGS=-g -Wall -fPIC
LDFLAGS=
INCLUDES=
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS)
INSTALL = /usr/bin/install -c
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROGRAM = $(INSTALL) -m 755
usplash-theme-ubuntu.so: throbber_back_640_400.png.c.o throbber_back_640_480.png.c.o throbber_back_800_600.png.c.o \
throbber_back_1024_768.png.c.o throbber_back_1280_1024.png.c.o \
throbber_fore_640_400.png.c.o throbber_fore_640_480.png.c.o throbber_fore_800_600.png.c.o \
throbber_fore_1024_768.png.c.o throbber_fore_1280_1024.png.c.o \
usplash_640_400.png.c.o usplash_640_480.png.c.o usplash_800_600.png.c.o \
usplash_1024_768.png.c.o usplash_1280_1024.png.c.o \
usplash-theme-ubuntu.c.o
$(COMPILE) -shared -o $@ $^
%.png.c: %.png
pngtousplash $< > $@
%.bdf.c: %.bdf
bdftousplash $< > $@
%.c.o: %.c
$(COMPILE) -o $@ -c $<
install:
$(INSTALL) -d $(DESTDIR)/usr/lib/usplash
$(INSTALL_PROGRAM) usplash-theme-ubuntu.so $(DESTDIR)/usr/lib/usplash/usplash-theme-ubuntu.so
clean:
rm -f *.png.c *.bdf.c *.c.o
All the info below is now unnecessary as the bash script now does this all for you. It is left for reference only.
Download Source:
Full Source including png images.
Replace Images:
After you have replaced the pngs making sure they are the same resolution, name & indexed... Gimp >> Image >> mode >> indexed.
Building your Usplash:
Open a terminal in that folder and enter the following:
- Code: Select all
make
this will generate a file called usplash-theme-ubuntu.so select this file with sum (start-up manager) System Tools >> Administration >> Start-up manager, under appearance tab usplash themes, manage usplash themes... browse to where you created it and select it. You can also set resolution & colors for boot up (boot options tab).
Cleaning up:
- Code: Select all
make clean
GUI Version Under Construction:
The concept? I have done alot of searching about the web to find a app that converts image files to .so Usplash Themes, does not exist to the best of my knowledge besides the code used above. Enter motivation; one thing a programmer hates to do is re-create the wheel.
I am taking the time to make this as user friendly as possible with no knowledge in *nix required point, click, select options and have it, I am writing it in 3 languages, so not simple to interpret, but will get r done when completed. Languages being utilized: Bash, Zenity if you wanna call it a language and C, full source will be posted here as well. Once fully tested will be included in each Ultimate Edition. It will probably take me a few days depending on how much I am bothered as I write it.
Start-up Manager:
Spoiler of Work in progress:
I do not currently have time to make it compile resolution independent, when I get time I may come back and write in in solid C to allow for progress bar change and position, just don't have time right now sorry.
Final results: