cryptozeny / sugarchain-v0.16.3

OUTDATED! This repo is moved to:
https://github.com/sugarchain-project/sugarchain
MIT License
0 stars 1 forks source link

Change Windows Icons #72

Closed cryptozeny closed 5 years ago

cryptozeny commented 5 years ago
cryptozeny commented 5 years ago

for size in 16 24 256; do

for (( size=16; size<=256; size+=8 )); do convert bitcoin.png -resize ${size}x${size} bitcoin-${size}.png done

convert -background transparent bitcoin-*.png -compress zip bitcoin.ico

convert 16.png 32.png 48.png 128.png 256.png -colors 256 icon.ico

convert -background transparent "bitcoin.png" -define icon:auto-resize=16,24,32,48,64,72,96,128,256 "bitcoin.ico"

16,32,48,256

convert -background transparent "bitcoin.png" -define icon:auto-resize=16,24,32,40,48,56,64,128,256 "bitcoin.ico"

cryptozeny commented 5 years ago

image

image

cryptozeny commented 5 years ago
static const struct {
    const char *networkId;
    const char *appName;
    const int iconColorHueShift;
    const int iconColorSaturationReduction;
    const char *titleAddText;
} network_styles[] = {
    {"main", QAPP_APP_NAME_DEFAULT, 0, 0, ""},
    {"test", QAPP_APP_NAME_TESTNET, 70, 30, QT_TRANSLATE_NOOP("SplashScreen", "[testnet]")},
    {"regtest", QAPP_APP_NAME_TESTNET, 160, 30, "[regtest]"}
};
static const unsigned network_styles_count = sizeof(network_styles)/sizeof(*network_styles);

// titleAddText needs to be const char* for tr()
NetworkStyle::NetworkStyle(const QString &_appName, const int iconColorHueShift, const int iconColorSaturationReduction, const char *_titleAddText):
    appName(_appName),
    titleAddText(qApp->translate("SplashScreen", _titleAddText))
{

set iconColorHueShift to 70 iconColorSaturationReduction to 30

cryptozeny commented 5 years ago
    if(iconColorHueShift != 0 && iconColorSaturationReduction != 0)
    {
        // generate QImage from QPixmap
        QImage img = pixmap.toImage();

        int h,s,l,a;

        // traverse though lines
        for(int y=0;y<img.height();y++)
        {
            QRgb *scL = reinterpret_cast< QRgb *>( img.scanLine( y ) );

            // loop through pixels
            for(int x=0;x<img.width();x++)
            {
                // preserve alpha because QColor::getHsl doesn't return the alpha value
                a = qAlpha(scL[x]);
                QColor col(scL[x]);

                // get hue value
                col.getHsl(&h,&s,&l);

                // rotate color on RGB color circle
                // 70° should end up with the typical "testnet" green
                h+=iconColorHueShift;

                // change saturation value
                if(s>iconColorSaturationReduction)
                {
                    s -= iconColorSaturationReduction;
                }
                col.setHsl(h,s,l,a);

                // set the pixel
                scL[x] = col.rgba();
            }
        }

        //convert back to QPixmap
#if QT_VERSION >= 0x040700
        pixmap.convertFromImage(img);
#else
        pixmap = QPixmap::fromImage(img);
#endif
    }
cryptozeny commented 5 years ago

image

cryptozeny commented 5 years ago

TESTNET ICON

$ convert ../bitcoin.png -modulate 100,170,130 ./bitcoin_testnet.png

$ convert -background transparent bitcoin_testnet.png -define icon:auto-resize=16,24,32,40,48,56,64,128,256 bitcoin_testnet.ico
cryptozeny commented 5 years ago

PNG and XPM

for size in 16 24 32 40 48 56 64 128 256; do
    convert bitcoin.png -resize ${size}x${size} bitcoin${size}.png
    convert bitcoin${size}.png bitcoin${size}.xpm
done
cryptozeny commented 5 years ago

ICO

convert -background transparent "bitcoin.png" -define icon:auto-resize=16,24,32,40,48,56,64,128,256 "bitcoin.ico"
cryptozeny commented 5 years ago
- static char *bitcoin___[] = {
+ static char *bitcoin256[] = {
cryptozeny commented 5 years ago
$ git grep "*bitcoin"
share/pixmaps/bitcoin128.xpm:static char *bitcoin128[] = {
share/pixmaps/bitcoin16.xpm:static char *bitcoin16[] = {
share/pixmaps/bitcoin24.xpm:static char *bitcoin24[] = {
share/pixmaps/bitcoin256.xpm:static char *bitcoin256[] = {
share/pixmaps/bitcoin32.xpm:static char *bitcoin32[] = {
share/pixmaps/bitcoin40.xpm:static char *bitcoin40[] = {
share/pixmaps/bitcoin48.xpm:static char *bitcoin48[] = {
share/pixmaps/bitcoin56.xpm:static char *bitcoin56[] = {
share/pixmaps/bitcoin64.xpm:static char *bitcoin64[] = {
share/qt/extract_strings_qt.py:f.write('static const char UNUSED *bitcoin_strings[] = {\n')
src/qt/bitcoinstrings.cpp:static const char UNUSED *bitcoin_strings[] = {

fix *bitcoinXX[] to *bitcoin__[]

cryptozeny commented 5 years ago

original was

$ git grep "*bitcoin"
share/pixmaps/bitcoin128.xpm:static char *bitcoin___[] = {
share/pixmaps/bitcoin16.xpm:static char *bitcoin__[] = {
share/pixmaps/bitcoin256.xpm:static char *bitcoin___[] = {
share/pixmaps/bitcoin32.xpm:static char *bitcoin__[] = {
share/pixmaps/bitcoin64.xpm:static char *bitcoin__[] = {
share/qt/extract_strings_qt.py:f.write('static const char UNUSED *bitcoin_strings[] = {\n')
src/qt/bitcoinstrings.cpp:static const char UNUSED *bitcoin_strings[] = {
cryptozeny commented 5 years ago

https://stackoverflow.com/questions/4354617/how-to-make-get-a-multi-size-ico-file

cryptozeny commented 5 years ago

BTC Windows ICO Identify

bitcoin_BTC.ico[9] ICO 16x16 16x16+0+0 32-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[5] ICO 16x16 16x16+0+0 8-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[8] ICO 32x32 32x32+0+0 32-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[4] ICO 32x32 32x32+0+0 8-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[7] ICO 48x48 48x48+0+0 32-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[3] ICO 48x48 48x48+0+0 8-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[0] ICO 48x48 48x48+0+0 4-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[6] PNG 256x256 256x256+0+0 8-bit sRGB 58KB 0.000u 0:00.000
cryptozeny commented 5 years ago

PNG: | Default. Save image using economical format.
-- | --
PNG8: | The PNG equivalent to GIF, including Boolean transparency and a 256 color table.
PNG24: | 8 bit RGB channels without an alpha channel. Special case can include boolean transparency (see below)
PNG32: | Force a full RGBA image format with full semi-transparency.
PNG48: | 16 bit RGB channels without alpha channel
PNG64: | 16 bit RGBA image (including semi-transparency)
PNG00: | Inherit PNG color and bit depth from input image.
cryptozeny commented 5 years ago
bitcoin_BTC.ico[9] ICO 16x16 16x16+0+0 32-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[5] ICO 16x16 16x16+0+0 8-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[8] ICO 32x32 32x32+0+0 32-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[4] ICO 32x32 32x32+0+0 8-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[7] ICO 48x48 48x48+0+0 32-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[3] ICO 48x48 48x48+0+0 8-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[0] ICO 48x48 48x48+0+0 4-bit sRGB 58KB 0.000u 0:00.000
bitcoin_BTC.ico[6] PNG 256x256 256x256+0+0 8-bit sRGB 58KB 0.000u 0:00.000

for size in 16 32 48 256; do
    convert bitcoin.png -resize ${size}x${size} bitcoin-${size}.png
  convert bitcoin-${size}.png bitcoin-${size}.PNG32
  convert bitcoin-${size}.png bitcoin-${size}.PNG24
  convert bitcoin-${size}.png bitcoin-${size}.PNG8
done

rm bitcoin-256-32.png && \
rm bitcoin-256-8.png && \
convert -background transparent bitcoin-*-*.png bitcoin.ico 

for (( size=16; size<=256; size+=4 )); do
convert bitcoin.png -resize ${size}x${size} bitcoin-${size}.png
done

# ico
convert \
-background transparent \
bitcoin.png \
-define icon:auto-resize=16,20,24,32,40,48,64,72,96,128,256 \
bitcoin.ico

# testnet (not exactly same hue)
convert bitcoin.png -modulate 100,100,134 bitcoin_testnet.png

# ico - testnet
convert \
-background transparent \
bitcoin_testnet.png \
-define icon:auto-resize=16,20,24,32,40,48,64,72,96,128,256 \
bitcoin_testnet.ico

$ identify bitcoin_BTC-pixmap.ico 
bitcoin_BTC-pixmap.ico[6] ICO 16x16 16x16+0+0 32-bit sRGB 68.8KB 0.000u 0:00.009
bitcoin_BTC-pixmap.ico[5] ICO 20x20 20x20+0+0 32-bit sRGB 68.8KB 0.000u 0:00.009
bitcoin_BTC-pixmap.ico[4] ICO 32x32 32x32+0+0 32-bit sRGB 68.8KB 0.000u 0:00.009
bitcoin_BTC-pixmap.ico[0] ICO 32x32 32x32+0+0 8-bit sRGB 68.8KB 0.000u 0:00.009
bitcoin_BTC-pixmap.ico[3] ICO 48x48 48x48+0+0 32-bit sRGB 68.8KB 0.000u 0:00.009
bitcoin_BTC-pixmap.ico[2] ICO 64x64 64x64+0+0 32-bit sRGB 68.8KB 0.000u 0:00.009
bitcoin_BTC-pixmap.ico[1] PNG 256x256 256x256+0+0 8-bit sRGB 68.8KB 0.000u 0:00.009

# pixmaps - PNG && XPM
for size in 16 32 64 128 256; do
    convert bitcoin.png -resize ${size}x${size} bitcoin${size}.png
  convert bitcoin${size}.png bitcoin${size}.xpm
done
cryptozeny commented 5 years ago

test on win10

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

cryptozeny commented 5 years ago

NSIS

image

image

image

image

image

cryptozeny commented 5 years ago

image

image

cryptozeny commented 5 years ago

fixed https://github.com/cryptozeny/sugarchain-v0.16.3/pull/77