Beispiel #1
0
 /// <summary>
 /// Initializes a new instance based on the specified FreeImage bitmap.
 /// </summary>
 /// <param name="dib">Handle to a FreeImage bitmap.</param>
 /// <param name="scanline">Index of the zero based scanline.</param>
 public Scanline(FIBITMAP dib, int scanline)
     : this(dib, scanline, (int)(typeof(T) == typeof(FI1BIT) ?
                                 FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) :
                                 typeof(T) == typeof(FI4BIT) ?
                                 FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) / 4 :
                                 (FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib)) / (Marshal.SizeOf(typeof(T)) * 8)))
 {
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance for the given FreeImage bitmap.
 /// </summary>
 /// <param name="dib">Handle to a FreeImage bitmap.</param>
 /// <exception cref="ArgumentNullException"><paramref name="dib"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="dib"/> is not
 /// <see cref="FREE_IMAGE_TYPE.FIT_BITMAP"/><para/>-or-<para/>
 /// <paramref name="dib"/> has more than 8bpp.</exception>
 public Palette(FIBITMAP dib)
     : base(FreeImage.GetPalette(dib), (int)FreeImage.GetColorsUsed(dib))
 {
     if (dib.IsNull)
     {
         throw new ArgumentNullException("dib");
     }
     if (FreeImage.GetImageType(dib) != FREE_IMAGE_TYPE.FIT_BITMAP)
     {
         throw new ArgumentException("dib");
     }
     if (FreeImage.GetBPP(dib) > 8u)
     {
         throw new ArgumentException("dib");
     }
 }