Ejemplo n.º 1
0
 private static extern int StretchDIBits(
     IntPtr HDC,
     int XDest,                    // x-coord of destination upper-left corner
     int YDest,                    // y-coord of destination upper-left corner
     int nDestWidth,               // width of destination rectangle
     int nDestHeight,              // height of destination rectangle
     int XSrc,                     // x-coord of source upper-left corner
     int YSrc,                     // y-coord of source upper-left corner
     int nSrcWidth,                // width of source rectangle
     int nSrcHeight,               // height of source rectangle
     IntPtr lpBits,								// bitmap bits
     BITMAPINFO lpBitsInfo,				// bitmap data
     uint iUsage,                  // usage options
     int dwRop											// raster operation code
     );
 /// <summary>
 /// Returns the <see cref="BITMAPINFO"/> structure of a FreeImage bitmap.
 /// The structure is a copy, so changes will have no effect on
 /// the bitmap itself.
 /// </summary>
 /// <param name="dib">Handle to a FreeImage bitmap.</param>
 /// <returns><see cref="BITMAPINFO"/> structure of the bitmap.</returns>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="dib"/> is null.</exception>
 public static BITMAPINFO GetInfoEx(FIBITMAP dib)
 {
     if (dib.IsNull)
     {
         throw new ArgumentNullException("dib");
     }
     BITMAPINFO result = new BITMAPINFO();
     result.bmiHeader = GetInfoHeaderEx(dib);
     IntPtr ptr = GetPalette(dib);
     if (ptr == IntPtr.Zero)
     {
         result.bmiColors = new RGBQUAD[0];
     }
     else
     {
         result.bmiColors = new MemoryArray<RGBQUAD>(ptr, (int)result.bmiHeader.biClrUsed).Data;
     }
     return result;
 }