Esempio n. 1
0
        public SizeF MeasureString(string s, Font font, int width, StringFormat format)
        {
            int szWidth, szHeight;

            LibIGraph.MeasureString(this.native, s, font.native, width, format.native, out szWidth, out szHeight);
            return(new SizeF(szWidth, szHeight));
        }
Esempio n. 2
0
 public FontFamily(string name)
 {
     this.native = LibIGraph.CreateFontFamily_Name(name);
     if (this.native == IntPtr.Zero)
     {
         throw new ArgumentException("Font '" + name + "' cannot be found.");
     }
 }
Esempio n. 3
0
 protected virtual void Dispose(bool disposing)
 {
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposeBrush(this.native);
         this.native = IntPtr.Zero;
     }
 }
Esempio n. 4
0
 public void Dispose()
 {
     if (this.native != null)
     {
         LibIGraph.DisposeRegion(this.native);
         this.native = IntPtr.Zero;
         GC.SuppressFinalize(this);
     }
 }
Esempio n. 5
0
 public void Dispose()
 {
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposeStringFormat(this.native);
         this.native = IntPtr.Zero;
         GC.SuppressFinalize(this);
     }
 }
Esempio n. 6
0
 public void Dispose()
 {
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposeFontFamily(this.native);
         this.native = IntPtr.Zero;
         GC.SuppressFinalize(this);
     }
 }
Esempio n. 7
0
 public StringFormat(StringFormatFlags options)
 {
     this.native = LibIGraph.CreateStringFormat
                       (StringAlignment.Near, options, StringAlignment.Near, StringTrimming.None);
     this.trimming          = StringTrimming.None;
     this.alignment         = StringAlignment.Near;
     this.lineAlignment     = StringAlignment.Near;
     this.stringFormatFlags = options;
 }
Esempio n. 8
0
 public Pen(Color color, float width)
 {
     if (width < 1.0f)
     {
         width = 1.0f;
     }
     this.color = color;
     this.width = width;
     native     = LibIGraph.CreatePen_Color(width, color.ToArgb());
 }
Esempio n. 9
0
 public Bitmap(int width, int height, PixelFormat pixelFormat)
 {
     base.native = LibIGraph._CreateBitmap(width, height, pixelFormat);
     if (base.native == IntPtr.Zero)
     {
         throw new ArgumentException();
     }
     base.width       = width;
     base.height      = height;
     base.pixelFormat = pixelFormat;
 }
Esempio n. 10
0
 private void Dispose(bool disposing)
 {
     if (!this.canChange && disposing)
     {
         throw new ArgumentException("This Pen cannot be disposed of.");
     }
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposePen(this.native);
         this.native = IntPtr.Zero;
     }
 }
Esempio n. 11
0
        public static Image FromFile(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException("filename");
            }
            int         width, height;
            PixelFormat pixelFormat;
            IntPtr      native = LibIGraph.BitmapFromFile(filename, out width, out height, out pixelFormat);

            return(new Bitmap(native, width, height, pixelFormat));
        }
Esempio n. 12
0
        public static Graphics FromImage(Image image)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }
            IntPtr native = LibIGraph.GetGraphicsFromImage(image.native);

            if (native == IntPtr.Zero)
            {
                throw new ArgumentException("Failed to get Graphics from given Image", "image");
            }
            return(new Graphics(image.Width, image.Height, image.PixelFormat, native));
        }
Esempio n. 13
0
        public static Graphics FromHdc(IntPtr hdc)
        {
            if (hdc != IntPtr.Zero)
            {
                throw new NotImplementedException();
            }
            int         xSize, ySize;
            PixelFormat pixelFormat;
            IntPtr      native = LibIGraph.GetScreen(out xSize, out ySize, out pixelFormat);

            if (native == IntPtr.Zero)
            {
                throw new Exception("CreateScreen() failed");
            }
            return(new Graphics(xSize, ySize, pixelFormat, native));
        }
Esempio n. 14
0
 public void Clear(Color color)
 {
     LibIGraph.Clear(this.native, color.ToArgb());
 }
Esempio n. 15
0
 public Region()
 {
     this.native     = LibIGraph.CreateRegion_Infinite();
     this.isInfinite = true;
 }
Esempio n. 16
0
 public void CopyFromScreen(int srcX, int srcY, int destX, int destY, Size size)
 {
     LibIGraph.Graphics_CopyFromScreen(this.native, srcX, srcY, destX, destY, size.Width, size.Height);
 }
Esempio n. 17
0
 public Region(Rectangle rect)
 {
     this.native     = LibIGraph.CreateRegion_Rect(rect.X, rect.Y, rect.Width, rect.Height);
     this.isInfinite = false;
 }
Esempio n. 18
0
 public void DrawImageUnscaled(Image image, int x, int y)
 {
     LibIGraph.DrawImageUnscaled(this.native, image.native, x, y);
 }
Esempio n. 19
0
 public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format)
 {
     LibIGraph.DrawString(this.native, s, font.native, brush.native, (int)x, (int)y, int.MaxValue, int.MaxValue, (format == null) ? IntPtr.Zero : format.native);
 }
Esempio n. 20
0
 public void DrawString(string s, Font font, Brush brush, RectangleF rect, StringFormat format)
 {
     LibIGraph.DrawString(this.native, s, font.native, brush.native,
                          (int)rect.Left, (int)rect.Top, (int)rect.Right, (int)rect.Bottom, format.native);
 }
Esempio n. 21
0
 public void DrawEllipse(Pen pen, int x, int y, int width, int height)
 {
     LibIGraph.DrawEllipse_Ints(this.native, pen.native, x, y, width, height);
 }
Esempio n. 22
0
 public void FillEllipse(Brush brush, int x, int y, int width, int height)
 {
     LibIGraph.FillEllipse_Ints(this.native, brush.native, x, y, width, height);
 }
Esempio n. 23
0
 public void DrawLine(Pen pen, Point pt1, Point pt2)
 {
     LibIGraph.DrawLine_Ints(this.native, pen.native, pt1.X, pt1.Y, pt2.X, pt2.Y);
 }
Esempio n. 24
0
 public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
 {
     LibIGraph.DrawLine_Ints(this.native, pen.native, x1, y1, x2, y2);
 }
 public SolidBrush(Color col)
 {
     this.col    = col;
     base.native = LibIGraph.CreateBrush_Solid(col.ToArgb());
 }
Esempio n. 26
0
 public Font(string familyName, float emSize)
 {
     this.family = new FontFamily(familyName);
     this.native = LibIGraph._CreateFont(this.family.native, emSize, FontStyle.Regular);
 }
Esempio n. 27
0
 public Font(FontFamily family, float emSize, FontStyle style)
 {
     this.family = family;
     this.native = LibIGraph._CreateFont(family.native, emSize, style);
 }