コード例 #1
0
 public Size?GetSize(bool decompressIfNecessary, bool ifDecompressingOccuredLeaveDecompressed = false)
 {
     lock (this._lock)
     {
         if (this._size != null)
         {
             return(this._size);
         }
         else if (this._pngBytes != null)
         {
             Image t = null;
             if (decompressIfNecessary)
             {
                 t          = CompressibleImage.UncompressFromPng(this._pngBytes);
                 this._size = t.Size;
             }
             if (t != null && ifDecompressingOccuredLeaveDecompressed)
             {
                 this._image = t;
             }
             return(this._size);
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #2
0
 public void Decompress()
 {
     lock (this._lock)
     {
         if (this._image == null && this._pngBytes != null)
         {
             this._image = CompressibleImage.UncompressFromPng(this._pngBytes);
             this._size  = this._image.Size;
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// IMPORTANT: You must see GetAsAutoDisposableImage() comment first.
 /// </summary>
 /// <returns></returns>
 public Image GetAsImage()
 {
     lock (this._lock)
     {
         if (this._image != null)
         {
             return(this._image);
         }
         else
         {
             if (this._pngBytes != null)
             {
                 Image r = CompressibleImage.UncompressFromPng(this._pngBytes);
                 this._size = r.Size;
                 return(r);
             }
             else
             {
                 return(null);
             }
         }
     }
 }