public static GflImage FromHandle(Bitmap bitmap) { var handle = bitmap.GetHbitmap(); var img = new GflImage(); var p = GflAPI.Default_Load_params ; p.FormatIndex = 2; var nullPtr = IntPtr.Zero ; HandleError(GflAPI.gflLoadBitmapFromHandle(handle, out img.m_gfl_bitmap, ref p, nullPtr)); GflAPI.DeleteObject(handle); img.RefreshStruct(); return img; }
public void TestConstructors() { var img = new GflImage(500, 500, 500, GFL_BITMAP_TYPE.GFL_COLORS); string fileName = "test.tiff"; Assert.AreEqual(img.Width, 500); Assert.AreEqual(img.Height, 500); img.Save(fileName); img.Dispose(); img = new GflImage(fileName); Assert.AreEqual(img.Width, 500); Assert.AreEqual(img.Height, 500); img.Dispose(); }
internal void Rotate(double angle, Color color, GflImage final) { var c = new GFL_COLOR(color); HandleError(GflAPI.gflRotateFine(m_gfl_bitmap, ref final.m_gfl_bitmap, angle, ref c)); final.RefreshStruct(); }
public GflImage GetCopy(GFL_MODE depthMode, GFL_BITMAP_TYPE type) { var img = new GflImage(m_gfl_bitmap_struct.Width, m_gfl_bitmap_struct.Height, 1, type); GflAPI.gflChangeColorDepth(m_gfl_bitmap, img.m_gfl_bitmap, depthMode, GFL_MODE_PARAM.GFL_MODE_ADAPTIVE); img.RefreshStruct(); return img; }