示例#1
0
        internal static void SaveWP7Image(CBImageFile image, int width, int height)
        {
            Bitmap newImage = CBImageManager.ResizeImage(image.SourceImage, width, height);
            string fileName = string.Format("{0}\\WP7\\{1}", image.DirectoryName, image.FileName);

            newImage.Save(fileName, ImageFormat.Png);
        }
示例#2
0
        public static void SaveIcon(CBImageFile image, CBImageInfo info)
        {
            Bitmap newImage = CBImageManager.ResizeImage(image.SourceImage, info.Width, info.Height);
            string fileName = GetIconName(image, info);

            newImage.Save(fileName, ImageFormat.Png);
        }
 public CBImageFile(string directory, string fileName)
 {
     m_DirectoryName = directory;
     m_FileName      = fileName;
     m_FullName      = directory + fileName;
     m_SourceImage   = CBImageManager.LoadImage(m_FullName);
 }
        public CBImageFile(string fullName)
        {
            FileInfo file = new FileInfo(fullName);

            m_FileName      = file.Name;
            m_DirectoryName = file.DirectoryName + "\\";
            m_FullName      = fullName;
            m_SourceImage   = CBImageManager.LoadImage(m_FullName);
        }
示例#5
0
        public static void GenerateImage(string fileName, int width, int height)
        {
            CBImageFile     image         = new CBImageFile(fileName);
            CBDeviceManager deviceManager = new CBDeviceManager();

            deviceManager.CreateAllDeviceDirectory(image.DirectoryName);

            CBImageManager.SaveiOSImage(image, width, height);
            CBImageManager.SaveAndroidImage(image, width, height);
            CBImageManager.SaveWP7Image(image, width, height);
        }
示例#6
0
        internal static void SaveiOSImage(CBImageFile image, int width, int height)
        {
            // normal image
            Bitmap newImage = CBImageManager.ResizeImage(image.SourceImage, width / 2, height / 2);
            string fileName = string.Format("{0}\\iOS\\{1}", image.DirectoryName, image.FileName);

            newImage.Save(fileName, ImageFormat.Png);
            // retina image
            newImage = CBImageManager.ResizeImage(image.SourceImage, width, height);
            fileName = string.Format("{0}\\iOS\\{1}", image.DirectoryName, image.FileName.Replace(".png", "@2x.png"));
            newImage.Save(fileName, ImageFormat.Png);
        }
示例#7
0
        public static void GenerateIcons(string directory, string fileName)
        {
            CBDeviceManager deviceManager = new CBDeviceManager();

            deviceManager.CreateAllDeviceDirectory(directory);
            CBImageFile image = new CBImageFile(directory, fileName);
            CBIconInfo  icons = CBIconInfo.GenerateDefault();

            foreach (CBImageInfo info in icons.IconDefines)
            {
                CBImageManager.SaveIcon(image, info);
            }
        }
示例#8
0
        public static void GenerateImages(string rootImageDirectory, int width, int height)
        {
            CBDeviceManager deviceManager = new CBDeviceManager();

            deviceManager.CreateAllDeviceDirectory(rootImageDirectory);

            string[] files = Directory.GetFiles(rootImageDirectory, "*.png");

            foreach (string fullName in files)
            {
                Debug.WriteLine(fullName);
                CBImageFile image = new CBImageFile(fullName);
                CBImageManager.SaveiOSImage(image, width, height);
                CBImageManager.SaveAndroidImage(image, width, height);
                CBImageManager.SaveWP7Image(image, width, height);
            }
        }
示例#9
0
        public static void GenerateImages(string rootImageDirectory)
        {
            CBDeviceManager deviceManager = new CBDeviceManager();

            deviceManager.CreateAllDeviceDirectory(rootImageDirectory);

            string[] files = Directory.GetFiles(rootImageDirectory, "*.png");

            foreach (string fullName in files)
            {
                CBImageFile image = new CBImageFile(fullName);
                // v1.2 fix width and height to even
                int width  = image.SourceImage.Width - (image.SourceImage.Width % 2);
                int height = image.SourceImage.Height - (image.SourceImage.Height % 2);
                CBImageManager.SaveiOSImage(image, width, height);
                CBImageManager.SaveAndroidImage(image, width, height);
                CBImageManager.SaveWP7Image(image, width, height);
            }
        }