示例#1
0
        /// <summary>
        /// Save a new custom puzzle
        /// </summary>
                #if IOS
        public PuzzleData AddPuzzle(string filename, string owner, MonoTouch.UIKit.UIImage image)
        {
            string completeFilePath = System.IO.Path.Combine(mCustomPuzzlePath, filename);

            Logger.I("Adding a new " + owner + " puzzle " + filename);

            // Save the new image
            MonoTouch.Foundation.NSError error;
            image.AsPNG().Save(completeFilePath, true, out error);

            if (error == null)
            {
                Logger.I("Adding puzzle OK");
            }
            else
            {
                Logger.E("Adding puzzle KO: " + error);
            }

            PuzzleData newPuzzle = new PuzzleData()
            {
                Filename = completeFilePath,
                IsCustom = true,
                IsNew    = true,
                OwnerId  = owner
            };

            Savedgame.Puzzles.Add(newPuzzle);
            Save();

            return(newPuzzle);
        }
 /// <summary>
 /// 表示用画像を用意する。
 /// </summary>
 private void InitializeImageList()
 {
     _defaultImage = MonoTouch.UIKit.UIImage.FromFile("default.png");
     _imageList = new System.Collections.Generic.List<MonoTouch.UIKit.UIImage>(30);
     int i = 0;
     while (_imageList.Count < _imageList.Capacity)
     {
         MonoTouch.UIKit.UIImage img = MonoTouch.UIKit.UIImage.FromFile("images/" + i + ".jpg");
         _imageList.Add(img);
         ++i;
     }
 }
示例#3
0
 private static byte[] DoImgConvert(byte[] data, ref TXlsImgType imgType)
 {
     using (MemoryStream DataStream = new MemoryStream(data))
     {
         using (MemoryStream Result = new MemoryStream())
         {
             using (Image Img = ImageExtender.FromStream(DataStream))
             {
                 Img.Save(Result, ImageFormat.Png);
                 imgType = TXlsImgType.Png;
                 return(Result.ToArray());
             }
         }
     }
 }
示例#4
0
 public static Image GetImage(Stream aStream)
 {
     if (MissingFrameworkImageFromStream)
     {
         return(null);
     }
     try
     {
         Image Result = DoGetImage(aStream);
         return(Result);
     }
     catch (MissingMethodException)
     {
         MissingFrameworkImageFromStream = true;
         //Nothing.
     }
     catch (ArgumentException)
     {
         FlxMessages.ThrowException(FlxErr.ErrInvalidImage);
     }
     return(null);
 }
 public CoverImage(MonoTouch.UIKit.UIImage image)
 {
     _height = image.Size.Height;
     _image = ImageUtils.AddImageReflection(image, kReflectionFraction);
 }
示例#6
0
 internal static Image FromStream(Stream St)
 {
     return(Image.FromStream(St));
 }
示例#7
0
 internal static int Width(this Image Img)
 {
     return(Img.Width);
 }
示例#8
0
 internal static int Height(this Image Img)
 {
     return(Img.Height);
 }