]> code.delx.au - refind/commitdiff
Added raw images directory for those who might want to change &
authorsrs5694 <srs5694@users.sourceforge.net>
Mon, 3 Dec 2012 01:24:02 +0000 (20:24 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Mon, 3 Dec 2012 01:24:02 +0000 (20:24 -0500)
recompile

13 files changed:
images/back-normal-big.png [new file with mode: 0644]
images/back-normal-small.png [new file with mode: 0644]
images/back-selected-big.png [new file with mode: 0644]
images/back-selected-small.png [new file with mode: 0644]
images/font.png [new file with mode: 0644]
images/imgprepare.py [new file with mode: 0755]
images/linux-bootlogo.png [new file with mode: 0644]
images/mkeei.py [new file with mode: 0755]
images/mkegemb.py [new file with mode: 0755]
images/refind_banner.bmp [new file with mode: 0644]
images/refind_banner.odt [new file with mode: 0644]
images/txt.pl [new file with mode: 0755]
images/windows-bootlogo.png [new file with mode: 0644]

diff --git a/images/back-normal-big.png b/images/back-normal-big.png
new file mode 100644 (file)
index 0000000..3484611
Binary files /dev/null and b/images/back-normal-big.png differ
diff --git a/images/back-normal-small.png b/images/back-normal-small.png
new file mode 100644 (file)
index 0000000..8109815
Binary files /dev/null and b/images/back-normal-small.png differ
diff --git a/images/back-selected-big.png b/images/back-selected-big.png
new file mode 100644 (file)
index 0000000..752d2d2
Binary files /dev/null and b/images/back-selected-big.png differ
diff --git a/images/back-selected-small.png b/images/back-selected-small.png
new file mode 100644 (file)
index 0000000..8d473da
Binary files /dev/null and b/images/back-selected-small.png differ
diff --git a/images/font.png b/images/font.png
new file mode 100644 (file)
index 0000000..49ba0a8
Binary files /dev/null and b/images/font.png differ
diff --git a/images/imgprepare.py b/images/imgprepare.py
new file mode 100755 (executable)
index 0000000..306f3cc
--- /dev/null
@@ -0,0 +1,114 @@
+#!/usr/bin/python
+
+import sys
+import Image
+
+def enc_backbuffer(backbuffer):
+    compdata = []
+    if len(backbuffer) == 0:
+        return compdata
+    while len(backbuffer) > 128:
+        compdata.append(127)
+        compdata.extend(backbuffer[0:128])
+        backbuffer = backbuffer[128:]
+    compdata.append(len(backbuffer)-1)
+    compdata.extend(backbuffer)
+    return compdata
+
+def packbits(rawdata):
+    compdata = []
+    backbuffer = []
+
+    while len(rawdata) >= 3:
+        c = rawdata[0]
+        if rawdata[1] == c and rawdata[2] == c:
+            runlength = 3
+            while runlength < 130 and len(rawdata) > runlength:
+                if rawdata[runlength] == c:
+                    runlength = runlength + 1
+                else:
+                    break
+            compdata.extend(enc_backbuffer(backbuffer))
+            backbuffer = []
+            compdata.append(runlength + 125)
+            compdata.append(c)
+            rawdata = rawdata[runlength:]
+
+        else:
+            backbuffer.append(c)
+            rawdata = rawdata[1:]
+
+    backbuffer.extend(rawdata)
+    compdata.extend(enc_backbuffer(backbuffer))
+
+    return compdata
+
+
+for filename in sys.argv[1:]:
+
+    origimage = Image.open(filename)
+
+    (width, height) = origimage.size
+    mode = origimage.mode
+    data = origimage.getdata()
+
+    print "%s: %d x %d %s" % (filename, width, height, mode)
+
+    basename = filename[:-4]
+    identname = basename.replace("-", "_")
+
+    planecount = 1
+    imgmode = 0
+    rawdata = []
+
+    if mode == "RGB" or mode == "RGBA":
+        planes = [ [], [], [] ]
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata[2])
+            planes[1].append(pixeldata[1])
+            planes[2].append(pixeldata[0])
+
+        if planes[0] == planes[1] and planes[0] == planes[2]:
+            print " encoding as greyscale"
+            planecount = 1
+            rawdata.extend(planes[0])
+
+            if basename[0:4] == "font":
+                print " font detected, using alpha-only mode"
+                imgmode = 1
+                # invert all values
+                rawdata = map(lambda x: 255-x, rawdata)
+
+        else:
+            print " encoding as true color"
+            planecount = 3
+            rawdata.extend(planes[0])
+            rawdata.extend(planes[1])
+            rawdata.extend(planes[2])
+
+    else:
+        print " Mode not supported!"
+        continue
+
+    rawlen = len(rawdata)
+    compdata = packbits(rawdata)
+    complen = len(compdata)
+    print " compressed %d to %d" % (rawlen, complen)
+
+    output = """static UINT8 image_%s_compdata[] = {
+""" % identname
+    for i in range(0, len(compdata)):
+        output = output + " 0x%02x," % compdata[i]
+        if (i % 12) == 11:
+            output = output + "\n"
+    output = output + """
+};
+static BUILTIN_IMAGE image_%s = { NULL, %d, %d, %d, %d, image_%s_compdata, %d };
+""" % (identname, width, height, imgmode, planecount, identname, len(compdata))
+
+    f = file("image_%s.h" % identname, "w")
+    f.write(output)
+    f.close()
+
+print "Done!"
diff --git a/images/linux-bootlogo.png b/images/linux-bootlogo.png
new file mode 100644 (file)
index 0000000..203c5dc
Binary files /dev/null and b/images/linux-bootlogo.png differ
diff --git a/images/mkeei.py b/images/mkeei.py
new file mode 100755 (executable)
index 0000000..3aa1737
--- /dev/null
@@ -0,0 +1,179 @@
+#!/usr/bin/python
+
+import sys
+import Image
+
+def enc_backbuffer(backbuffer):
+    """Helper function for RLE compression, encodes a string of uncompressable data."""
+    compdata = []
+    if len(backbuffer) == 0:
+        return compdata
+    while len(backbuffer) > 128:
+        compdata.append(127)
+        compdata.extend(backbuffer[0:128])
+        backbuffer = backbuffer[128:]
+    compdata.append(len(backbuffer)-1)
+    compdata.extend(backbuffer)
+    return compdata
+
+def compress_rle(rawdata):
+    """Compresses the string using a RLE scheme."""
+    compdata = []
+    backbuffer = []
+
+    while len(rawdata) >= 3:
+        c = rawdata[0]
+        if rawdata[1] == c and rawdata[2] == c:
+            runlength = 3
+            while runlength < 130 and len(rawdata) > runlength:
+                if rawdata[runlength] == c:
+                    runlength = runlength + 1
+                else:
+                    break
+            compdata.extend(enc_backbuffer(backbuffer))
+            backbuffer = []
+            compdata.append(runlength + 125)
+            compdata.append(c)
+            rawdata = rawdata[runlength:]
+
+        else:
+            backbuffer.append(c)
+            rawdata = rawdata[1:]
+
+    backbuffer.extend(rawdata)
+    compdata.extend(enc_backbuffer(backbuffer))
+
+    return compdata
+
+def encode_plane(rawdata, identname, planename):
+    """Encodes the data of a single plane."""
+
+    rawlen = len(rawdata)
+    compdata = compress_rle(rawdata)
+    complen = len(compdata)
+    print "  plane %s: compressed %d to %d (%.1f%%)" % (planename, rawlen, complen, float(complen) / float(rawlen) * 100.0)
+
+    output = """static const UINT8 eei_%s_planedata_%s[%d] = {
+""" % (identname, planename, complen)
+    for i in range(0, len(compdata)):
+        output = output + " 0x%02x," % compdata[i]
+        if (i % 12) == 11:
+            output = output + "\n"
+    output = output + """
+};
+"""
+    return (output, "eei_%s_planedata_%s, %d" % (identname, planename, complen))
+
+
+### main loop
+
+print "mkeei 0.1, Copyright (c) 2006 Christoph Pfisterer"
+
+planenames = ( "blue", "green", "red", "alpha", "grey" )
+
+for filename in sys.argv[1:]:
+
+    origimage = Image.open(filename)
+
+    (width, height) = origimage.size
+    mode = origimage.mode
+    data = origimage.getdata()
+
+    print "%s: %d x %d %s" % (filename, width, height, mode)
+
+    basename = filename[:-4]   # TODO!!!!!!
+    identname = basename.replace("-", "_")
+
+    planes = [ [], [], [], [] ]
+
+    if mode == "RGB":
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata[2])
+            planes[1].append(pixeldata[1])
+            planes[2].append(pixeldata[0])
+
+    elif mode == "RGBA":
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata[2])
+            planes[1].append(pixeldata[1])
+            planes[2].append(pixeldata[0])
+            planes[3].append(pixeldata[3])
+
+    elif mode == "L":
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata)
+            planes[1].append(pixeldata)
+            planes[2].append(pixeldata)
+
+    else:
+        print " Error: Mode not supported!"
+        continue
+
+    # special treatment for fonts
+
+    if basename[0:4] == "font":
+        if planes[0] != planes[1] or planes[0] != planes[2]:
+            print " Error: Font detected, but it is not greyscale!"
+            continue
+        print " font detected, encoding as alpha-only"
+        # invert greyscale values for use as alpha
+        planes[3] = map(lambda x: 255-x, planes[0])
+        planes[0] = []
+        planes[1] = []
+        planes[2] = []
+
+    # generate optimal output
+
+    output = ""
+    planeinfo = [ "NULL, 0", "NULL, 0", "NULL, 0", "NULL, 0" ]
+
+    if len(planes[0]) > 0 and planes[0] == planes[1] and planes[0] == planes[2]:
+        print " encoding as greyscale"
+        (output_part, planeinfo[0]) = encode_plane(planes[0], identname, planenames[4])
+        output = output + output_part
+        planeinfo[1] = planeinfo[0]
+        planeinfo[2] = planeinfo[0]
+
+    elif len(planes[0]) > 0:
+        print " encoding as true color"
+
+        (output_part, planeinfo[0]) = encode_plane(planes[0], identname, planenames[0])
+        output = output + output_part
+
+        if planes[1] == planes[0]:
+            print " encoding plane 1 is a copy of plane 0"
+            planeinfo[1] = planeinfo[0]
+        else:
+            (output_part, planeinfo[1]) = encode_plane(planes[1], identname, planenames[1])
+            output = output + output_part
+
+        if planes[2] == planes[0]:
+            print " encoding plane 2 is a copy of plane 0"
+            planeinfo[2] = planeinfo[0]
+        elif planes[2] == planes[1]:
+            print " encoding plane 2 is a copy of plane 1"
+            planeinfo[2] = planeinfo[1]
+        else:
+            (output_part, planeinfo[2]) = encode_plane(planes[2], identname, planenames[2])
+            output = output + output_part
+
+    if len(planes[3]) > 0:
+        if reduce(lambda x,y: x+y, planes[3]) == 0:
+            print " skipping alpha plane because it is empty"
+        else:
+            (output_part, planeinfo[3]) = encode_plane(planes[3], identname, planenames[3])
+            output = output + output_part
+
+    output = output + "static EEI_IMAGE eei_%s = { %d, %d, NULL, {\n" % (identname, width, height)
+    for i in range(0,4):
+        output = output + "    { %s },\n" % planeinfo[i]
+    output = output + "} };\n"
+
+    f = file("eei_%s.h" % identname, "w")
+    f.write(output)
+    f.close()
+
+print "Done!"
diff --git a/images/mkegemb.py b/images/mkegemb.py
new file mode 100755 (executable)
index 0000000..6a7c63d
--- /dev/null
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+
+import sys, os.path
+import Image
+
+def enc_backbuffer(backbuffer):
+    """Helper function for RLE compression, encodes a string of uncompressable data."""
+    compdata = []
+    if len(backbuffer) == 0:
+        return compdata
+    while len(backbuffer) > 128:
+        compdata.append(127)
+        compdata.extend(backbuffer[0:128])
+        backbuffer = backbuffer[128:]
+    compdata.append(len(backbuffer)-1)
+    compdata.extend(backbuffer)
+    return compdata
+
+def compress_rle(rawdata):
+    """Compresses the string using a RLE scheme."""
+    compdata = []
+    backbuffer = []
+    
+    while len(rawdata) >= 3:
+        c = rawdata[0]
+        if rawdata[1] == c and rawdata[2] == c:
+            runlength = 3
+            while runlength < 130 and len(rawdata) > runlength:
+                if rawdata[runlength] == c:
+                    runlength = runlength + 1
+                else:
+                    break
+            compdata.extend(enc_backbuffer(backbuffer))
+            backbuffer = []
+            compdata.append(runlength + 125)
+            compdata.append(c)
+            rawdata = rawdata[runlength:]
+        
+        else:
+            backbuffer.append(c)
+            rawdata = rawdata[1:]
+    
+    backbuffer.extend(rawdata)
+    compdata.extend(enc_backbuffer(backbuffer))
+    
+    return compdata
+
+def encode_plane(rawdata, planename):
+    """Encodes the data of a single plane."""
+    
+    rawlen = len(rawdata)
+    compdata = compress_rle(rawdata)
+    complen = len(compdata)
+    print "  plane %s: compressed %d to %d (%.1f%%)" % (planename, rawlen, complen, float(complen) / float(rawlen) * 100.0)
+    
+    return compdata
+
+
+### main loop
+
+print "mkegemb 0.1, Copyright (c) 2006 Christoph Pfisterer"
+
+planenames = ( "blue", "green", "red", "alpha", "grey" )
+
+for filename in sys.argv[1:]:
+    
+    origimage = Image.open(filename)
+    
+    (width, height) = origimage.size
+    mode = origimage.mode
+    data = origimage.getdata()
+    
+    print "%s: %d x %d %s" % (filename, width, height, mode)
+    
+    (basename, extension) = os.path.splitext(filename)
+    identname = basename.replace("-", "_")
+    
+    # extract image data from PIL object
+    
+    planes = [ [], [], [], [] ]
+    
+    if mode == "RGB":
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata[0])
+            planes[1].append(pixeldata[1])
+            planes[2].append(pixeldata[2])
+    
+    elif mode == "RGBA":
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata[0])
+            planes[1].append(pixeldata[1])
+            planes[2].append(pixeldata[2])
+            planes[3].append(pixeldata[3])
+    
+    elif mode == "L":
+        for pixcount in range(0, width*height):
+            pixeldata = data[pixcount]
+            planes[0].append(pixeldata)
+            planes[1].append(pixeldata)
+            planes[2].append(pixeldata)
+    
+    else:
+        print " Error: Mode not supported!"
+        continue
+    
+    # special treatment for fonts
+    
+    if basename[0:4] == "font":
+        if planes[0] != planes[1] or planes[0] != planes[2]:
+            print " Error: Font detected, but it is not greyscale!"
+            continue
+        print " font detected, encoding as alpha-only"
+        # invert greyscale values for use as alpha
+        planes[3] = map(lambda x: 255-x, planes[0])
+        planes[0] = []
+        planes[1] = []
+        planes[2] = []
+    
+    # encode planes
+    
+    imagedata = []
+    pixelformat = "EG_EIPIXELMODE"
+    
+    if len(planes[0]) > 0 and planes[0] == planes[1] and planes[0] == planes[2]:
+        print " encoding as greyscale"
+        imagedata.extend(encode_plane(planes[0], planenames[4]))
+        pixelformat = pixelformat + "_GRAY"
+    
+    elif len(planes[0]) > 0:
+        print " encoding as true color"
+        imagedata.extend(encode_plane(planes[0], planenames[0]))
+        imagedata.extend(encode_plane(planes[1], planenames[1]))
+        imagedata.extend(encode_plane(planes[2], planenames[2]))
+        pixelformat = pixelformat + "_COLOR"
+    
+    if len(planes[3]) > 0:
+        if reduce(lambda x,y: x+y, planes[3]) == 0:
+            print " skipping alpha plane because it is empty"
+        else:
+            imagedata.extend(encode_plane(planes[3], planenames[3]))
+            pixelformat = pixelformat + "_ALPHA"
+    
+    # generate compilable header file
+    
+    output = "static const UINT8 egemb_%s_data[%d] = {\n" % (identname, len(imagedata))
+    for i in range(0, len(imagedata)):
+        output = output + " 0x%02x," % imagedata[i]
+        if (i % 12) == 11:
+            output = output + "\n"
+    output = output + "\n};\n"
+    output = output + "static EG_EMBEDDED_IMAGE egemb_%s = { %d, %d, %s, EG_EICOMPMODE_RLE, egemb_%s_data, %d };\n" % (identname, width, height, pixelformat, identname, len(imagedata))
+    
+    f = file("egemb_%s.h" % identname, "w")
+    f.write(output)
+    f.close()
+
+print "Done!"
diff --git a/images/refind_banner.bmp b/images/refind_banner.bmp
new file mode 100644 (file)
index 0000000..de8150a
Binary files /dev/null and b/images/refind_banner.bmp differ
diff --git a/images/refind_banner.odt b/images/refind_banner.odt
new file mode 100644 (file)
index 0000000..35704ad
Binary files /dev/null and b/images/refind_banner.odt differ
diff --git a/images/txt.pl b/images/txt.pl
new file mode 100755 (executable)
index 0000000..b504fc2
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+
+foreach $i (32..126) {
+  print chr($i);
+}
+print "?\n";
+exit 0;
diff --git a/images/windows-bootlogo.png b/images/windows-bootlogo.png
new file mode 100644 (file)
index 0000000..2ff1dd9
Binary files /dev/null and b/images/windows-bootlogo.png differ