Beispiel #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));
        }
Beispiel #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.");
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposeBrush(this.native);
         this.native = IntPtr.Zero;
     }
 }
Beispiel #4
0
 public void Dispose()
 {
     if (this.native != null)
     {
         LibIGraph.DisposeRegion(this.native);
         this.native = IntPtr.Zero;
         GC.SuppressFinalize(this);
     }
 }
Beispiel #5
0
 public void Dispose()
 {
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposeStringFormat(this.native);
         this.native = IntPtr.Zero;
         GC.SuppressFinalize(this);
     }
 }
Beispiel #6
0
 public void Dispose()
 {
     if (this.native != IntPtr.Zero)
     {
         LibIGraph.DisposeFontFamily(this.native);
         this.native = IntPtr.Zero;
         GC.SuppressFinalize(this);
     }
 }
Beispiel #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;
 }
Beispiel #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());
 }
 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;
 }
Beispiel #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;
     }
 }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #14
0
 public void Clear(Color color)
 {
     LibIGraph.Clear(this.native, color.ToArgb());
 }
Beispiel #15
0
 public Region()
 {
     this.native     = LibIGraph.CreateRegion_Infinite();
     this.isInfinite = true;
 }
Beispiel #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);
 }
Beispiel #17
0
 public Region(Rectangle rect)
 {
     this.native     = LibIGraph.CreateRegion_Rect(rect.X, rect.Y, rect.Width, rect.Height);
     this.isInfinite = false;
 }
Beispiel #18
0
 public void DrawImageUnscaled(Image image, int x, int y)
 {
     LibIGraph.DrawImageUnscaled(this.native, image.native, x, y);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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());
 }
Beispiel #26
0
 public Font(string familyName, float emSize)
 {
     this.family = new FontFamily(familyName);
     this.native = LibIGraph._CreateFont(this.family.native, emSize, FontStyle.Regular);
 }
Beispiel #27
0
 public Font(FontFamily family, float emSize, FontStyle style)
 {
     this.family = family;
     this.native = LibIGraph._CreateFont(family.native, emSize, style);
 }