예제 #1
0
def _generate(d, image_xcassets, image_fn, options, icon=False):
    for c, in_fn, out_fn in options:
        args = []
        if in_fn is not None:
            filename = join(image_xcassets, d, in_fn)
        else:
            filename = image_fn

        if icon:
            args += [filename, "-Z", c]
            args += ["--out", join(image_xcassets, d, out_fn)]
            print("sips", " ".join(args))
            sh.sips(*args)
        else:
            size = [int(x) for x in c.split()]
            _buildimage(filename, join(image_xcassets, d, out_fn), size)
예제 #2
0
파일: xcassets.py 프로젝트: rammie/kivy-ios
def _generate(d, image_xcassets, image_fn, options, icon=False):
    for c, in_fn, out_fn in options:
        args = []
        if icon:
            args += ["-Z", c]
        else:
            # ensure one side will not be bigger than the other (ie, the image will
            # fit to the screen)
            args += ["-Z", str(min(map(int, c.split())))]
            # if there is any left pixel, cover in black.
            args += ["-p"] + c.split()
            # and crop the image in necessary.
            args += ["-c"] + c.split()[::-1]
        if in_fn is not None:
            args += [join(image_xcassets, d, in_fn)]
        else:
            args += [image_fn]
        args += ["--out", join(image_xcassets, d, out_fn)]
        print "sips", " ".join(args)
        sh.sips(*args)
예제 #3
0
def _generate(d, image_xcassets, image_fn, options, icon=False):
    for c, in_fn, out_fn in options:
        args = []
        if icon:
            args += ["-Z", c]
        else:
            # ensure one side will not be bigger than the other (ie, the image will
            # fit to the screen)
            args += ["-Z", str(min(map(int, c.split())))]
            # if there is any left pixel, cover in black.
            args += ["-p"] + c.split()
            # and crop the image in necessary.
            args += ["-c"] + c.split()[::-1]
        if in_fn is not None:
            args += [join(image_xcassets, d, in_fn)]
        else:
            args += [image_fn]
        args += ["--out", join(image_xcassets, d, out_fn)]
        print "sips", " ".join(args)
        sh.sips(*args)