Are you a spammer

Please note, that the first 3 posts you make, will need to be approved by a forum Administrator or Moderator before they are publicly viewable.
Each application to join this forum is checked at the Stop Forum Spam website. If the email or IP address appears there when checked, you will not be allowed to join this forum.
If you get past this check and post spam on this forum, your posts will be immediately deleted and your account inactivated.You will then be banned and your IP will be submitted to your ISP, notifying them of your spamming. So your spam links will only be seen for an hour or two at most. In other words, don't waste your time and ours.

This forum is for the use and enjoyment of the members and visitors looking to learn about and share information regarding the topics listed. It is not a free-for-all advertising venue. Your time would be better spent pursuing legitimate avenues of promoting your websites.

Usplash Maker 1.03

Source code I have written openly published for your viewing pleasure.

Did you find this source useful / informative?

Yes
16
94%
No
1
6%
 
Total votes : 17



Usplash Maker 1.03

Postby TheeMahn » Fri Oct 19, 2007 10:14 am

I made this initially for the users of Ultimate Edition, some code I scratched together & to help me expedite the creation of the next distro. This code will now be elaborated upon for all user to enjoy. I have seen people pour in because it does not exist elsewhere. I want to make things better for everyone not just users of Ultimate Edition.

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 :P 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
sudo killall nautilus
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.

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 &amp; 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:
sum.png
Usplash resolution

sum1.png
Setting Usplash


Spoiler of Work in progress:
usplash3.png
Nautilus integration

usplash4.png
Selecting available resolutions to be compiled into the .so file


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:
snapshot4.png
Nautilus integration

Screenshot.png
Sorry no options w/o work that I don't have time for currently

Screenshot-1.png
Compiling

Screenshot-2.png
Results
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: Dual 4K 43" LG, 4K Samsung 28"
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4201
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 53
Operating System: Ultimate Edition Developer



Re: Usplash Maker

Postby cowboy » Mon Jan 07, 2008 10:55 am

USplash Maker works superbly..you might want to consider calling it TUM..TheeMahn-USplash-Maker..besides this Distro one of the finest piece of work anyone can use..thumbs up on this ;)
"Back up your Data"
"May I never lose the view of a nubie"
"Give a man a fish, he will eat for a day, teach a man how to fish , he will eat a lifetime"
Asus P8Z68-V PRO/GEN3
i5 2500k
3x4G-Skill Ripjaws
MSI GTX 560Ti Hawk..
Seagate 1TB Barracuda
NZXT 850w PS
CM Storm Sniper Case
Evga Superclock CPU Cooler
Mushkin SSD coming soon
http://acowboydave.blogspot.com/
User avatar
cowboy
U.E. God
U.E. God
 
Posts: 2625
Joined: Mon Oct 15, 2007 2:38 pm
Location: Scottsdale Az
Age: 71
Operating System: Ultimate Edition 3.2 64 BIT



Re: Usplash Maker

Postby TheeMahn » Mon Jan 07, 2008 12:42 pm

cowboy wrote:USplash Maker works superbly..you might want to consider calling it TUM..TheeMahn-USplash-Maker..besides this Distro one of the finest piece of work anyone can use..thumbs up on this ;)



I just finished the GDM Maker 1 days work (modified the Usplash maker to make it happen) once again works flawlessly. ;) Will be updating the post in a few...
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: Dual 4K 43" LG, 4K Samsung 28"
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4201
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 53
Operating System: Ultimate Edition Developer



Re: Usplash Maker

Postby drama » Mon Jan 07, 2008 1:05 pm

im gonna have to give this a try. have some really wicked images ive always wanted to use as a usplash just never knew how.
ULTIMATE EDITION 2.5 X64/ARCHLINUX X64 DUAL BOOT
Antec 900two case
3 antec 120mm tri cool blue led fans (1 rear exaust 2 front intake)
1 antec 220mm "bigboy" tri cool blue led fan (top exaust)
Amd Phenom II X4 955 Black Edition Am3 Cpu OC'D @ 4.2 Rev C3
MSI NF980-G65 Am3 Socket DDR3 Tri-sli ATX Mainboard
Nvidia 980A Sli Chipset
Corsair 2GB Dual Channel ram (1GBx2) DDR3 @ 1600 MHZ
EVGA Nvidia GTS-250 1GB PCI Express Graphics Card
Lite-On Dual Layer Sata Dvd Burner
3x 1TB Seagate Sata Hdd's 32Mb cache
ASUS VH235 23 Inch Lcd Wide Screen Monitor
OCZ ModXStream Pro 700Watt Psu
Rosewill 3.5" Internal USB 2.0 Card Reader w/ Floppy Drive
User avatar
drama
U.E. Master
U.E. Master
 
Posts: 580
Joined: Wed Oct 17, 2007 11:26 am
Location: eastern iowa, united states
Age: 42
Operating System: Ultimate Edition 3.2 32 BIT



Re: Usplash Maker

Postby TheeMahn » Mon Jan 07, 2008 1:21 pm

drama1981 wrote:im gonna have to give this a try. have some really wicked images ive always wanted to use as a usplash just never knew how.



Well you can now generate them in USplash as well as GDM ;) I suggest an image of at least 1280 X 1024 or greater for either.
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: Dual 4K 43" LG, 4K Samsung 28"
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4201
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 53
Operating System: Ultimate Edition Developer



Re: Usplash Maker

Postby red_team316 » Mon Jan 28, 2008 11:21 pm

Hey theemahn, I toyed around with imagemagick a bit more. Here is the solution to pre-paletting the images. Obviously, the code needs to be expanded a bit for other resolutions, but a similar implementation of this should work with your code well. I'll leave the rest up to you as I'm not to fond of bash and prefer real progging languages :P

Oh, btw, I dont have a blog. You're thinking of Mr. Reese. My self portrait is strikingly similar to his actual photo lol.

'til we meet again!...


Usage: /bin/bash usplashmagick.sh eft_800_600.png throbber_back.png throbber_fore.png

Code: Select all
#!/bin/sh
#
# UsplashMagick
#   Copyright (c) 2007  red_team316
#
# 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.

IMAGE1="$1"
IMAGE2="$2"
IMAGE3="$3"
echo $IMAGE1 # eft_800_600.png
echo $IMAGE2 # throbber_back.png
echo $IMAGE3 # throbber_fore.png

# get the size information from the source images
identify -verbose $IMAGE1 | grep Geometry:
identify -verbose $IMAGE2 | grep Geometry:
identify -verbose $IMAGE3 | grep Geometry:
# it will return something similar to this depending on the sizes
# Geometry: 800x600
# Geometry: 216x8
# Geometry: 216x8

# append all images vertically into 1 image
convert $IMAGE1 $IMAGE2 $IMAGE3 -append append.png

# convert the appended image to 8bpp (256 colors)
convert append.png +dither -colors 256 paletted.png

# crop the original images back out so they are all palleted the same :)
convert paletted.png -crop 800x600+0+0! crop1.png
convert paletted.png -crop 216x8+0+600! crop2.png
convert paletted.png -crop 216x8+0+608! crop3.png

# remove temporary images
rm append.png
rm paletted.png
Core i7 920(working on a decent OC), x58 ASUS P6T Deluxe V2, 6GB DDR3 1600, EVGA 8800GTS512, Silencer 750W PSU, CoolerMaster V8, Red Antec900
Image
User avatar
red_team316
U.E. College Professor
U.E. College Professor
 
Posts: 288
Joined: Mon Jan 07, 2008 12:37 am
Age: 39
Operating System: Ultimate Edition 3.2 64 BIT



Re: Usplash Maker

Postby TheeMahn » Wed Jan 30, 2008 10:03 am

red_team316 wrote:Hey theemahn, I toyed around with imagemagick a bit more. Here is the solution to pre-paletting the images. Obviously, the code needs to be expanded a bit for other resolutions, but a similar implementation of this should work with your code well. I'll leave the rest up to you as I'm not to fond of bash and prefer real progging languages :P

Oh, btw, I dont have a blog. You're thinking of Mr. Reese. My self portrait is strikingly similar to his actual photo lol.

'til we meet again!...


Usage: /bin/bash usplashmagick.sh eft_800_600.png throbber_back.png throbber_fore.png

Code: Select all
#!/bin/sh
#
# UsplashMagick
#   Copyright (c) 2007  red_team316
#
# 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.

IMAGE1="$1"
IMAGE2="$2"
IMAGE3="$3"
echo $IMAGE1 # eft_800_600.png
echo $IMAGE2 # throbber_back.png
echo $IMAGE3 # throbber_fore.png

# get the size information from the source images
identify -verbose $IMAGE1 | grep Geometry:
identify -verbose $IMAGE2 | grep Geometry:
identify -verbose $IMAGE3 | grep Geometry:
# it will return something similar to this depending on the sizes
# Geometry: 800x600
# Geometry: 216x8
# Geometry: 216x8

# append all images vertically into 1 image
convert $IMAGE1 $IMAGE2 $IMAGE3 -append append.png

# convert the appended image to 8bpp (256 colors)
convert append.png +dither -colors 256 paletted.png

# crop the original images back out so they are all palleted the same :)
convert paletted.png -crop 800x600+0+0! crop1.png
convert paletted.png -crop 216x8+0+600! crop2.png
convert paletted.png -crop 216x8+0+608! crop3.png

# remove temporary images
rm append.png
rm paletted.png


Great to see you on my forum brother, sorry for the misidentification, If you don't mind I will try implementing the code directly into the USplash maker and see what the end results are, Thanks, I did not have time on my time off enough to look into it. Ultimate Edition 1.7 was priority #1 and in the end was my only accomplishment, a lot goes into a release believe that. I will give you credit for your work if I can get it working. I may spuce the code up a bit as well such as progress bar placement well see.

Thanks again,

TheeMahn

EDIT: Your code quickly patched in no scripting needed right click and done... Not fully implemented, just patched in going to do much better now that I have a minute or 2:
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.
SCRIPT_VERSION=1.01
FNAME="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
file=$@
# everything after last '/'
basename=${file%.*}
ext=".so"
OUTFILE=${basename}${ext}

`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.  Enjoy, TheeMahn" --title="USplash Maker"`;
##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 &amp; try again.  Please refer to UbuntuSoftware Forum for further info.' --title="UbuntuSoftware USplashMaker";
    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 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="USplash Maker script";
    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="USplash Maker script";
   exit
  fi
 fi
 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
cd ..
}

# Dialog box to choose USplash's size(s)
#SIZE="";
#SIZE="$(zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png  --width=500 --height=280 --title "Ubuntu Softwares 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
Res1
Res2
Res3
Res4
Res5
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


I will follow through with resolution selection and progress bar positioning. May actually take the time to make it support long file names ;)

Thanks, worked well with my hammertime.jpg a sledgehammer hitting a CPU ;)
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: Dual 4K 43" LG, 4K Samsung 28"
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4201
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 53
Operating System: Ultimate Edition Developer



Re: Usplash Maker

Postby Peng » Thu Feb 14, 2008 2:05 am

I love Usplash Maker. I used it to work on a Usplash for the Mac4Lin project. I am noting, however, that is some odd orange marks showing up in my my progress bar (throbber) in the finished product. It's especially odd since the color scheme is a mostly black design on a gray (#bfbfbf) background, as you can see from the attachment. Any ideas why this may be happening?
Attachments
usplash_640_480_SAMPLE.png
usplash_640_480_SAMPLE.png (3.34 KiB) Viewed 40319 times
Peng
U.E. Newbie
U.E. Newbie
 
Posts: 4
Joined: Thu Feb 14, 2008 1:27 am
Operating System: Ultimate Edition 2.7 32 BIT



Re: Usplash Maker

Postby komputes » Fri Feb 22, 2008 1:01 pm

I have on many occasions tried to make a custom usplash and I fell that you are the closest at making that happen. I can't get the script to produce a myimage.so file by running it through a script. I do see the resolutions I can pick, it goes through each one, but doesn't produce an output file .so for me. Is there something I'm doing wrong?

I've also tried using an older version of TUM through the command line with the images provided and got the following output. Any ideas what might be causing this?

http://pastebin.com/m5f1c692b
komputes
U.E. Newbie
U.E. Newbie
 
Posts: 5
Joined: Tue Feb 19, 2008 3:38 pm
Operating System: Ultimate Edition 2.7 32 BIT



Re: Usplash Maker

Postby TheeMahn » Sun Feb 24, 2008 5:33 pm

komputes wrote:I have on many occasions tried to make a custom usplash and I fell that you are the closest at making that happen. I can't get the script to produce a myimage.so file by running it through a script. I do see the resolutions I can pick, it goes through each one, but doesn't produce an output file .so for me. Is there something I'm doing wrong?

I've also tried using an older version of TUM through the command line with the images provided and got the following output. Any ideas what might be causing this?

http://pastebin.com/m5f1c692b

/usr/include/usplash-theme.h:24:23: error: sys/types.h: No such file or directory


Did you do the following?

Code: Select all
sudo apt-get install -y --force-yes libusplash-dev
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: Dual 4K 43" LG, 4K Samsung 28"
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4201
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 53
Operating System: Ultimate Edition Developer

Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests