Loading interlace-frames.py +53 −26 Original line number Diff line number Diff line Loading @@ -12,20 +12,31 @@ # See the License for the specific language governing permissions and # limitations under the License. """Script to take a set of frames (PNG files) for a recovery animation and turn it into a single output image which contains the input frames interlaced by row. Run with the names of all the input frames on the command line, in order, followed by the name of the output file.""" """ Script to take a set of frames (PNG files) for a recovery animation and turn it into a single output image which contains the input frames interlaced by row. Run with the names of all the input frames on the command line. Specify the name of the output file with -o (or --output), and optionally specify the number of frames per second (FPS) with --fps (default: 20). e.g. interlace-frames.py --fps 20 --output output.png frame0.png frame1.png frame3.png """ from __future__ import print_function import argparse import sys try: import Image import PngImagePlugin except ImportError: print "This script requires the Python Imaging Library to be installed." print("This script requires the Python Imaging Library to be installed.") sys.exit(1) frames = [Image.open(fn).convert("RGB") for fn in sys.argv[1:-1]] def interlace(output, fps, inputs): frames = [Image.open(fn).convert("RGB") for fn in inputs] assert len(frames) > 0, "Must have at least one input frame." sizes = set() for fr in frames: Loading @@ -49,5 +60,21 @@ for j in range(h): meta = PngImagePlugin.PngInfo() meta.add_text("Frames", str(N)) meta.add_text("FPS", str(fps)) out.save(output, pnginfo=meta) def main(argv): parser = argparse.ArgumentParser() parser.add_argument('--fps', default=20) parser.add_argument('--output', '-o', required=True) parser.add_argument('input', nargs='+') args = parser.parse_args(argv) interlace(args.output, args.fps, args.input) if __name__ == '__main__': main(sys.argv[1:]) out.save(sys.argv[-1], pnginfo=meta) minui/minui.h +2 −2 Original line number Diff line number Diff line Loading @@ -101,8 +101,8 @@ int res_create_display_surface(const char* name, GRSurface** pSurface); // should have a 'Frames' text chunk whose value is the number of // frames this image represents. The pixel data itself is interlaced // by row. int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** pSurface); int res_create_multi_display_surface(const char* name, int* frames, int* fps, GRSurface*** pSurface); // Load a single alpha surface from a grayscale PNG image. int res_create_alpha_surface(const char* name, GRSurface** pSurface); Loading minui/resources.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -237,14 +237,14 @@ int res_create_display_surface(const char* name, GRSurface** pSurface) { return result; } int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** pSurface) { int res_create_multi_display_surface(const char* name, int* frames, int* fps, GRSurface*** pSurface) { GRSurface** surface = NULL; int result = 0; png_structp png_ptr = NULL; png_infop info_ptr = NULL; png_uint_32 width, height; png_byte channels; int i; png_textp text; int num_text; unsigned char* p_row; Loading @@ -257,14 +257,23 @@ int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** if (result < 0) return result; *frames = 1; *fps = 20; if (png_get_text(png_ptr, info_ptr, &text, &num_text)) { for (i = 0; i < num_text; ++i) { for (int i = 0; i < num_text; ++i) { if (text[i].key && strcmp(text[i].key, "Frames") == 0 && text[i].text) { *frames = atoi(text[i].text); break; } else if (text[i].key && strcmp(text[i].key, "FPS") == 0 && text[i].text) { *fps = atoi(text[i].text); } } printf(" found frames = %d\n", *frames); printf(" found fps = %d\n", *fps); } if (frames <= 0 || fps <= 0) { printf("bad number of frames (%d) and/or FPS (%d)\n", *frames, *fps); result = -10; goto exit; } if (height % *frames != 0) { Loading @@ -278,7 +287,7 @@ int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** result = -8; goto exit; } for (i = 0; i < *frames; ++i) { for (int i = 0; i < *frames; ++i) { surface[i] = init_display_surface(width, height / *frames); if (surface[i] == NULL) { result = -8; Loading Loading @@ -307,7 +316,7 @@ exit: if (result < 0) { if (surface) { for (i = 0; i < *frames; ++i) { for (int i = 0; i < *frames; ++i) { if (surface[i]) free(surface[i]); } free(surface); Loading res-hdpi/images/icon_installing.png +11.1 KiB (127 KiB) Loading image diff... res-mdpi/images/icon_installing.png +11.1 KiB (127 KiB) Loading image diff... Loading
interlace-frames.py +53 −26 Original line number Diff line number Diff line Loading @@ -12,20 +12,31 @@ # See the License for the specific language governing permissions and # limitations under the License. """Script to take a set of frames (PNG files) for a recovery animation and turn it into a single output image which contains the input frames interlaced by row. Run with the names of all the input frames on the command line, in order, followed by the name of the output file.""" """ Script to take a set of frames (PNG files) for a recovery animation and turn it into a single output image which contains the input frames interlaced by row. Run with the names of all the input frames on the command line. Specify the name of the output file with -o (or --output), and optionally specify the number of frames per second (FPS) with --fps (default: 20). e.g. interlace-frames.py --fps 20 --output output.png frame0.png frame1.png frame3.png """ from __future__ import print_function import argparse import sys try: import Image import PngImagePlugin except ImportError: print "This script requires the Python Imaging Library to be installed." print("This script requires the Python Imaging Library to be installed.") sys.exit(1) frames = [Image.open(fn).convert("RGB") for fn in sys.argv[1:-1]] def interlace(output, fps, inputs): frames = [Image.open(fn).convert("RGB") for fn in inputs] assert len(frames) > 0, "Must have at least one input frame." sizes = set() for fr in frames: Loading @@ -49,5 +60,21 @@ for j in range(h): meta = PngImagePlugin.PngInfo() meta.add_text("Frames", str(N)) meta.add_text("FPS", str(fps)) out.save(output, pnginfo=meta) def main(argv): parser = argparse.ArgumentParser() parser.add_argument('--fps', default=20) parser.add_argument('--output', '-o', required=True) parser.add_argument('input', nargs='+') args = parser.parse_args(argv) interlace(args.output, args.fps, args.input) if __name__ == '__main__': main(sys.argv[1:]) out.save(sys.argv[-1], pnginfo=meta)
minui/minui.h +2 −2 Original line number Diff line number Diff line Loading @@ -101,8 +101,8 @@ int res_create_display_surface(const char* name, GRSurface** pSurface); // should have a 'Frames' text chunk whose value is the number of // frames this image represents. The pixel data itself is interlaced // by row. int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** pSurface); int res_create_multi_display_surface(const char* name, int* frames, int* fps, GRSurface*** pSurface); // Load a single alpha surface from a grayscale PNG image. int res_create_alpha_surface(const char* name, GRSurface** pSurface); Loading
minui/resources.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -237,14 +237,14 @@ int res_create_display_surface(const char* name, GRSurface** pSurface) { return result; } int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** pSurface) { int res_create_multi_display_surface(const char* name, int* frames, int* fps, GRSurface*** pSurface) { GRSurface** surface = NULL; int result = 0; png_structp png_ptr = NULL; png_infop info_ptr = NULL; png_uint_32 width, height; png_byte channels; int i; png_textp text; int num_text; unsigned char* p_row; Loading @@ -257,14 +257,23 @@ int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** if (result < 0) return result; *frames = 1; *fps = 20; if (png_get_text(png_ptr, info_ptr, &text, &num_text)) { for (i = 0; i < num_text; ++i) { for (int i = 0; i < num_text; ++i) { if (text[i].key && strcmp(text[i].key, "Frames") == 0 && text[i].text) { *frames = atoi(text[i].text); break; } else if (text[i].key && strcmp(text[i].key, "FPS") == 0 && text[i].text) { *fps = atoi(text[i].text); } } printf(" found frames = %d\n", *frames); printf(" found fps = %d\n", *fps); } if (frames <= 0 || fps <= 0) { printf("bad number of frames (%d) and/or FPS (%d)\n", *frames, *fps); result = -10; goto exit; } if (height % *frames != 0) { Loading @@ -278,7 +287,7 @@ int res_create_multi_display_surface(const char* name, int* frames, GRSurface*** result = -8; goto exit; } for (i = 0; i < *frames; ++i) { for (int i = 0; i < *frames; ++i) { surface[i] = init_display_surface(width, height / *frames); if (surface[i] == NULL) { result = -8; Loading Loading @@ -307,7 +316,7 @@ exit: if (result < 0) { if (surface) { for (i = 0; i < *frames; ++i) { for (int i = 0; i < *frames; ++i) { if (surface[i]) free(surface[i]); } free(surface); Loading