[DEV] add icon on IOs
This commit is contained in:
parent
2e79c973af
commit
a9ea020823
29
lutinImage.py
Normal file
29
lutinImage.py
Normal file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
import lutinDebug as debug
|
||||
import platform
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
import CoreGraphics
|
||||
else:
|
||||
import image
|
||||
|
||||
def resize(srcFile, destFile, x, y):
|
||||
if platform.system() == "Darwin":
|
||||
source_image = CoreGraphics.CGImageImport(CoreGraphics.CGDataProviderCreateWithFilename(srcFile))
|
||||
source_width = source_image.getWidth()
|
||||
source_height = source_image.getHeight()
|
||||
source_image_rect = CoreGraphics.CGRectMake(0, 0, source_width, source_height)
|
||||
new_image = source_image.createWithImageInRect(source_image_rect)
|
||||
colors_space = CoreGraphics.CGColorSpaceCreateDeviceRGB()
|
||||
colors = CoreGraphics.CGFloatArray(5)
|
||||
context = CoreGraphics.CGBitmapContextCreateWithColor(x, y, colors_space, colors)
|
||||
context.setInterpolationQuality(CoreGraphics.kCGInterpolationHigh)
|
||||
new_image_rect = CoreGraphics.CGRectMake(0, 0, x, y)
|
||||
context.drawImage(new_image_rect, new_image)
|
||||
context.writeToFile(destFile, CoreGraphics.kCGImageFormatPNG)
|
||||
else:
|
||||
# open an image file (.bmp,.jpg,.png,.gif) you have in the working folder
|
||||
im1 = image.open(srcFile)
|
||||
# use one of these filter options to resize the image
|
||||
tmpImage = im1.resize((x, y), Image.ANTIALIAS)
|
||||
tmpImage.save(destFile)
|
@ -2,6 +2,7 @@
|
||||
import lutinDebug as debug
|
||||
import lutinTarget
|
||||
import lutinTools
|
||||
import lutinImage
|
||||
import os
|
||||
import stat
|
||||
import lutinExtProjectGeneratorXCode
|
||||
@ -72,7 +73,27 @@ class Target(lutinTarget.Target):
|
||||
|
||||
if "ICON" in pkgProperties.keys() \
|
||||
and pkgProperties["ICON"] != "":
|
||||
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", True)
|
||||
# Resize all icon needed for Ios ...
|
||||
# TODO : Do not regenerate if source resource is not availlable
|
||||
# TODO : Add a colored background ...
|
||||
debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork.png", 512, 512)
|
||||
debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024)
|
||||
debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-60@2x.png", 120, 120)
|
||||
debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76.png", 76, 76)
|
||||
debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76@2x.png", 152, 152)
|
||||
debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40.png", 40, 40)
|
||||
debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40@2x.png", 80, 80)
|
||||
debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small.png", 29, 29)
|
||||
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small@2x.png", 58, 58)
|
||||
|
||||
debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
|
||||
infoFile = self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
@ -96,10 +117,20 @@ class Target(lutinTarget.Target):
|
||||
dataFile += " <string>" + pkgName + "</string>\n"
|
||||
dataFile += " <key>CFBundleIdentifier</key>\n"
|
||||
dataFile += " <string>com." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n"
|
||||
"""
|
||||
dataFile += " <key>CFBundleIconFile</key>\n"
|
||||
dataFile += " <string>icon.icns</string>\n"
|
||||
"""
|
||||
|
||||
dataFile += " <key>CFBundleIconFiles</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>Icon-60@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-76.png</string>\n"
|
||||
dataFile += " <string>Icon-76@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-Small-40.png</string>\n"
|
||||
dataFile += " <string>Icon-Small-40@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-Small.png</string>\n"
|
||||
dataFile += " <string>Icon-Small@2x.png</string>\n"
|
||||
dataFile += " <string>iTunesArtwork.png</string>\n"
|
||||
dataFile += " <string>iTunesArtwork@2x.png</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
|
||||
dataFile += " <key>CFBundleInfoDictionaryVersion</key>\n"
|
||||
dataFile += " <string>6.0</string>\n"
|
||||
dataFile += " <key>CFBundleName</key>\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user