コード例 #1
0
 /// <summary>Gets or sets the individual images</summary>
 /// <param name="index">Array index</param>
 /// <returns><see cref="PixelFormat.Format8bppIndexed"/> Bitmap of the indicated image</returns>
 /// <exception cref="IndexOutOfRangeException">Invalid <i>index</i> value</exception>
 /// <exception cref="Idmr.Common.BoundaryException">Image exceeds allowable dimensions</exception>
 /// <exception cref="NullReferenceException">Images have not been initialized</exception>
 /// <remarks>If the resource was created from an LFD file, <i>index</i> is ignored.<br/>
 /// Image is converted to <see cref="PixelFormat.Format8bppIndexed"/>, must be <b>640x480</b> or smaller.</remarks>
 public override Bitmap this[int index]
 {
     get
     {
         if (!_parent._isPnl)
         {
             index = 0;
         }
         return(_items[index]);
     }
     set
     {
         if (!_parent._isPnl)
         {
             index = 0;
         }
         if (value.Width > Panl.MaximumWidth)
         {
             throw new BoundaryException("image.Width", Panl.MaximumWidth + "px max");
         }
         if (value.Height > Panl.MaximumHeight)
         {
             throw new BoundaryException("image.Height", Panl.MaximumHeight + "px max");
         }
         Bitmap temp = _items[index];
         try { _items[index] = GraphicsFunctions.ConvertTo8bpp(value, _parent._palette); }
         catch (Exception x) { _items[index] = temp; throw x; }
     }
 }
コード例 #2
0
ファイル: Delt.cs プロジェクト: gtraines/LfdReader
 /// <summary>Converts the provided image to 256-colors using the given palette before converting to compressed DELT data</summary>
 /// <param name="image">Bitmap to be encoded</param>
 /// <param name="left"><see cref="Delt.Left">Delt.Left</see> or <see cref="Anim.Frame.Left">Anim.Frame.Left</see></param>
 /// <param name="top"><see cref="Delt.Top">Delt.Top</see> or <see cref="Anim.Frame.Top">Anim.Frame.Top</see></param>
 /// <param name="palette">ColorPalette to be used</param>
 /// <returns>Encoded byte array of raw data ready to be written to file</returns>
 public static byte[] EncodeImage(Bitmap image, short left, short top, ColorPalette palette)
 {
     return(EncodeImage(GraphicsFunctions.ConvertTo8bpp(image, palette), left, top));
 }