示例#1
0
 public void GetBounds(out GpRectF rect)
 {
     rect.X      = X;
     rect.Y      = Y;
     rect.Width  = Width;
     rect.Height = Height;
 }
示例#2
0
 public bool IntersectsWith(GpRectF rect)
 {
     return(GetLeft() < rect.GetRight() &&
            GetTop() < rect.GetBottom() &&
            GetRight() > rect.GetLeft() &&
            GetBottom() > rect.GetTop());
 }
示例#3
0
 public bool Equals(GpRectF rect)
 {
     return(X == rect.X &&
            Y == rect.Y &&
            Width == rect.Width &&
            Height == rect.Height);
 }
示例#4
0
 GetBounds(out GpRectF rect,
           GraphicsPlus g)
 {
     return(SetStatus(NativeMethods.GdipGetRegionBounds(nativeRegion,
                                                        g.nativeGraphics,
                                                        out rect)));
 }
示例#5
0
 public GpStatus AddArc(GpRectF rect,
           float startAngle,
           float sweepAngle)
 {
     return AddArc(rect.X, rect.Y, rect.Width, rect.Height,
                   startAngle, sweepAngle);
 }
示例#6
0
 public GpStatus AddPie(GpRectF rect,
                        float startAngle,
                        float sweepAngle)
 {
     return(AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle,
                   sweepAngle));
 }
示例#7
0
        // Once this is called, the resultant path is made of line segments and
        // the original path information is lost.  When matrix is null, the
        // identity matrix is assumed.

        public GpStatus Warp(GpPointF[] destPoints,
                             GpRectF srcRect,
                             Matrix matrix,
                             WarpMode warpMode,
                             float flatness)
        {
            GpMatrix nativeMatrix = new GpMatrix();

            if (matrix != null)
            {
                nativeMatrix = matrix.nativeMatrix;
            }

            return(SetStatus(NativeMethods.GdipWarpPath(
                                 nativePath,
                                 nativeMatrix,
                                 destPoints,
                                 destPoints.Length,
                                 srcRect.X,
                                 srcRect.Y,
                                 srcRect.Width,
                                 srcRect.Height,
                                 warpMode,
                                 flatness)));
        }
示例#8
0
        RegionPlus(GpRectF rect)
        {
            GpRegion region = new GpRegion();

            lastResult = NativeMethods.GdipCreateRegionRect(ref rect, out region);

            SetNativeRegion(region);
        }
示例#9
0
        RegionPlus(GpRectF rect)
        {
            GpRegion region = new GpRegion();

            lastResult = NativeMethods.GdipCreateRegionRect(ref rect, out region);

            SetNativeRegion(region);
        }
示例#10
0
文件: Matrix.cs 项目: mitice/foo
        Matrix(GpRectF rect,
               GpPointF[] dstplg)
        {
            GpMatrix matrix;

            lastResult = NativeMethods.GdipCreateMatrix3(rect,
                                                         dstplg,
                                                         out matrix);

            SetNativeMatrix(matrix);
        }
示例#11
0
    Matrix( GpRectF rect, 
            GpPointF[] dstplg)
    {
        GpMatrix matrix;

        lastResult = NativeMethods.GdipCreateMatrix3(rect, 
                                                   dstplg,
                                                   out matrix);

        SetNativeMatrix(matrix);
    }
示例#12
0
文件: PenDemo.cs 项目: misiek/foo
        private void Draw(Graphics graphics, GraphicsPlus g)
        {
            StringFormat sf = new StringFormat();
            sf.LineAlignment = sf.Alignment = System.Drawing.StringAlignment.Center;
            int deltaH = ClientRectangle.Height / 8;
            GpRectF rc = new GpRectF(0, 0, ClientRectangle.Width, deltaH);
            RectangleF rcf = new RectangleF(0, 0, ClientRectangle.Width, deltaH);

            using (SolidBrush brText = new SolidBrush(Color.Black))
            using (Font fnt = new Font("Tahoma", 9, System.Drawing.FontStyle.Bold))
            {
                penSolid.SetWidth(15);
                g.DrawLine(penSolid, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10);
                graphics.DrawString("Solid with caps", fnt, brText, rcf, sf);
                rcf.Y += deltaH; rc.Offset(0, deltaH);

                SmoothingMode mode = g.GetSmoothingMode();
                g.SetSmoothingMode(SmoothingMode.SmoothingModeAntiAlias);

                penSolid.SetColor(Color.Blue);
                g.DrawLine(penSolid, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10);
                graphics.DrawString("Solid with caps and anitalising", fnt, brText, rcf, sf);
                rcf.Y += deltaH; rc.Offset(0, deltaH);

                g.DrawLine(penHatch, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10);
                graphics.DrawString("Hatched", fnt, brText, rcf, sf);
                rcf.Y += deltaH; rc.Offset(0, deltaH);

                penSolidTrans.SetWidth(20);
                penSolidTrans.SetLineCap(LineCap.LineCapRound, LineCap.LineCapDiamondAnchor, DashCap.DashCapRound);
                graphics.DrawString("Solid with transparency", fnt, brText, rcf, sf);
                g.DrawLine(penSolidTrans, 15, rcf.Top + 10, rc.Width - 30, rcf.Top + 10);
                rcf.Y += deltaH; rc.Offset(0, deltaH);

                g.SetSmoothingMode(SmoothingMode.SmoothingModeAntiAlias);
                brText.Color = Color.White;
                g.DrawLine(penSolidCustomCap, 15, rcf.Top + 15, rc.Width - 50, rcf.Top + 15);
                graphics.DrawString("Custom cap", fnt, brText, rcf, sf);
                rcf.Y += deltaH; rc.Offset(0, deltaH);
                g.SetSmoothingMode(mode);

                brText.Color = Color.Gray;
                g.DrawLine(penDash, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10);
                graphics.DrawString("Dash (round)", fnt, brText, rcf, sf);
                rcf.Y += deltaH; rc.Offset(0, deltaH);

                brText.Color = Color.White;
                g.DrawLine(penGradient, 15, rcf.Top + 20, rc.Width - 30, rcf.Top + 20);
                graphics.DrawString("Gradient brush-based", fnt, brText, rcf, sf);
                rcf.Y += deltaH; rc.Offset(0, deltaH);

            }
        }
示例#13
0
 public GpStatus AddRectangle(GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipAddPathPolygon(nativePath,
                                                       new GpPointF[]
     {
         new GpPointF(rect.X, rect.Y),
         new GpPointF(rect.X, rect.Y + rect.Height),
         new GpPointF(rect.X + rect.Width, rect.Y + rect.Height),
         new GpPointF(rect.X + rect.Width, rect.Y),
     },
                                                       4)));
 }
示例#14
0
        IsVisible(GpRectF rect,
                  GraphicsPlus g)
        {
            bool booln = false;

            SetStatus(NativeMethods.GdipIsVisibleRegionRect(nativeRegion, rect.X,
                                                            rect.Y, rect.Width,
                                                            rect.Height,
                                                            (g == null) ?
                                                            new GpGraphics() : g.nativeGraphics,
                                                            out booln));
            return(booln);
        }
示例#15
0
        static public bool Union(out GpRectF c,
                                 GpRectF a,
                                 GpRectF b)
        {
            float right  = Math.Max(a.GetRight(), b.GetRight());
            float bottom = Math.Max(a.GetBottom(), b.GetBottom());
            float left   = Math.Min(a.GetLeft(), b.GetLeft());
            float top    = Math.Min(a.GetTop(), b.GetTop());

            c.X      = left;
            c.Y      = top;
            c.Width  = right - left;
            c.Height = bottom - top;
            return(!c.IsEmptyArea());
        }
示例#16
0
文件: BrushPlus.cs 项目: mitice/foo
        public LinearGradientBrush(GpRectF rect,
                                   Color color1,
                                   Color color2,
                                   LinearGradientMode mode)
        {
            GpLineGradient brush;

            lastResult = NativeMethods.GdipCreateLineBrushFromRect(ref rect,
                                                                   color1.ToArgb(),
                                                                   color2.ToArgb(),
                                                                   mode,
                                                                   WrapMode.WrapModeTile,
                                                                   out brush);

            SetNativeBrush(brush);
        }
示例#17
0
文件: BrushPlus.cs 项目: mitice/foo
        // When creating a texture brush from a metafile image, the dstRect
        // is used to specify the size that the metafile image should be
        // rendered at in the device units of the destination graphics.
        // It is NOT used to crop the metafile image, so only the width
        // and height values matter for metafiles.

        TextureBrushPlus(ImagePlus image,
                         WrapMode wrapMode,
                         GpRectF dstRect)
        {
            GpTexture texture;

            lastResult = NativeMethods.GdipCreateTexture2(
                image.nativeImage,
                wrapMode,
                dstRect.X,
                dstRect.Y,
                dstRect.Width,
                dstRect.Height,
                out texture);

            SetNativeBrush(texture);
        }
示例#18
0
文件: BrushPlus.cs 项目: mitice/foo
        public TextureBrushPlus(ImagePlus image,
                                GpRectF dstRect,
                                ImageAttributesPlus imageAttributes)
        {
            GpTexture texture;

            lastResult = NativeMethods.GdipCreateTextureIA(
                image.nativeImage,
                (imageAttributes != null) ? imageAttributes.nativeImageAttr : new GpImageAttributes(),
                dstRect.X,
                dstRect.Y,
                dstRect.Width,
                dstRect.Height,
                out texture
                );

            SetNativeBrush(texture);
        }
示例#19
0
文件: BrushPlus.cs 项目: mitice/foo
        LinearGradientBrush(GpRectF rect,
                            Color color1,
                            Color color2,
                            float angle,
                            bool isAngleScalable)
        {
            GpLineGradient brush;

            lastResult = NativeMethods.GdipCreateLineBrushFromRectWithAngle(ref rect,
                                                                            color1.ToArgb(),
                                                                            color2.ToArgb(),
                                                                            angle,
                                                                            isAngleScalable,
                                                                            WrapMode.WrapModeTile,
                                                                            out brush);

            SetNativeBrush(brush);
        }
示例#20
0
 public GpStatus DrawImage(ImagePlus image,
                   GpRectF destRect,
                  float srcx,
                  float srcy,
                  float srcwidth,
                  float srcheight,
                  Unit srcUnit,
                   ImageAttributesPlus imageAttributes)
 {
     return SetStatus(NativeMethods.GdipDrawImageRectRect(nativeGraphics,
                                                        image != null ? image.nativeImage
                                                              : null,
                                                        destRect.X,
                                                        destRect.Y,
                                                        destRect.Width,
                                                        destRect.Height,
                                                        srcx, srcy,
                                                        srcwidth, srcheight,
                                                        srcUnit,
                                                        imageAttributes != null
                                                         ? imageAttributes.nativeImageAttr
                                                         : new GpImageAttributes(),
                                                        IntPtr.Zero,
                                                        IntPtr.Zero));
 }
示例#21
0
 public GpStatus DrawEllipse(PenPlus pen,
                     GpRectF rect)
 {
     return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
 }
示例#22
0
 public GpStatus FillRectangles(BrushPlus brush,
                        GpRectF[] rects)
 {
     return SetStatus(NativeMethods.GdipFillRectangles(nativeGraphics,
                                                     brush.nativeBrush,
                                                     rects, rects.Length));
 }
示例#23
0
 public GpStatus FillPie(BrushPlus brush,
                 GpRectF rect,
                float startAngle,
                float sweepAngle)
 {
     return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height,
                    startAngle, sweepAngle);
 }
示例#24
0
GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg,
                       out GpMatrix matrix);
示例#25
0
GdipDrawRectangles(GpGraphics graphics, GpPen pen, GpRectF[] rects,
        int count);
示例#26
0
 GdipGetRegionBounds(GpRegion region, GpGraphics graphics,
                     out GpRectF rect);
示例#27
0
文件: Matrices.cs 项目: misiek/foo
 public static extern GpStatus GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg,
                out GpMatrix matrix);
示例#28
0
文件: Image.cs 项目: mitice/foo
 public GpStatus GetBounds(out GpRectF srcRect,
                           out Unit srcUnit)
 {
     return(SetStatus(NativeMethods.GdipGetImageBounds(nativeImage,
                                                       out srcRect, out srcUnit)));
 }
示例#29
0
文件: Matrices.cs 项目: mitice/foo
 GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg,
                   out GpMatrix matrix);
示例#30
0
GdipAddPathString(GpPath path, string str,
                        int length, GpFontFamily family, int style,
                        float emSize, GpRectF layoutRect,
                        GpStringFormat format);
示例#31
0
文件: Graphics.cs 项目: mitice/foo
 GdipGetClipBounds(GpGraphics graphics, out GpRectF rect);
示例#32
0
 public bool Contains(GpRectF rect)
 {
     return((X <= rect.X) && (rect.GetRight() <= GetRight()) &&
            (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()));
 }
示例#33
0
文件: BrushPlus.cs 项目: mitice/foo
 public GpStatus GetRectangle(out GpRectF rect)
 {
     rect = new GpRectF();
     return(SetStatus(NativeMethods.GdipGetPathGradientRect(
                          (GpPathGradient)nativeBrush, out rect)));
 }
示例#34
0
 public bool Intersect(GpRectF rect)
 {
     return(Intersect(out this, this, rect));
 }
示例#35
0
文件: Paths.cs 项目: mitice/foo
 GdipAddPathString(GpPath path, string str,
                   int length, GpFontFamily family, int style,
                   float emSize, GpRectF layoutRect,
                   GpStringFormat format);
示例#36
0
 Complement(GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                          CombineMode.CombineModeComplement)));
 }
示例#37
0
 public GpStatus DrawRectangles(PenPlus pen,
                        GpRectF[] rects)
 {
     return SetStatus(NativeMethods.GdipDrawRectangles(nativeGraphics,
                                                     pen.nativePen,
                                                     rects, rects.Length));
 }
示例#38
0
 Exclude(GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                          CombineMode.CombineModeExclude)));
 }
示例#39
0
 //GpStatus Clear( Color color)
 //{
 //    return SetStatus(NativeMethods.GdipGraphicsPlusClear(
 //        nativeGraphics,
 //        color.ToArgb()));
 //}
 public GpStatus FillRectangle(BrushPlus brush,
                       GpRectF rect)
 {
     return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
 }
示例#40
0
 Complement(GpRectF rect)
  {
      return SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                         CombineMode.CombineModeComplement));
  }
示例#41
0
 public GpStatus DrawArc(PenPlus pen,
                 GpRectF rect,
                float startAngle,
                float sweepAngle)
 {
     return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height,
                    startAngle, sweepAngle);
 }
示例#42
0
       IsVisible(GpRectF rect,
                          GraphicsPlus g)
        {
            bool booln = false;

            SetStatus(NativeMethods.GdipIsVisibleRegionRect(nativeRegion, rect.X,
                                                            rect.Y, rect.Width,
                                                            rect.Height,
                                                            (g == null) ?
                                                              new GpGraphics() : g.nativeGraphics,
                                                            out booln));
            return booln;
        }
示例#43
0
 public GpStatus DrawImage(ImagePlus image,
                   GpRectF rect)
 {
     GpRectF bounds; Unit unit;
     image.GetBounds(out bounds, out unit);
     return DrawImage(image, rect, 0, 0, bounds.Width, bounds.Height, unit, null);
 }
示例#44
0
 GdipCombineRegionRect(GpRegion region, ref GpRectF rect,
                       CombineMode combineMode);
示例#45
0
GdipAddPathRectangles(GpPath path, GpRectF[] rects, int count);
示例#46
0
 public bool IntersectsWith(GpRectF rect)
 {
     return (GetLeft() < rect.GetRight() &&
             GetTop() < rect.GetBottom() &&
             GetRight() > rect.GetLeft() &&
             GetBottom() > rect.GetTop());
 }
示例#47
0
GdipGetPathWorldBounds(GpPath  path, GpRectF[] bounds, 
                       out GpMatrix matrix, out GpPen pen);
示例#48
0
    static public bool Union(out GpRectF c,
                      GpRectF a,
                      GpRectF b)
    {
        float right = Math.Max(a.GetRight(), b.GetRight());
        float bottom = Math.Max(a.GetBottom(), b.GetBottom());
        float left = Math.Min(a.GetLeft(), b.GetLeft());
        float top = Math.Min(a.GetTop(), b.GetTop());

        c.X = left;
        c.Y = top;
        c.Width = right - left;
        c.Height = bottom - top;
        return !c.IsEmptyArea();
    }
示例#49
0
 GdipGetImageBounds(GpImage image, out GpRectF srcRect, out Unit srcUnit);
示例#50
0
GdipFillRectangles(GpGraphics graphics, GpBrush brush,
     GpRectF[] rects, int count);
示例#51
0
 public GpStatus AddEllipse(GpRectF rect)
 {
     return(AddEllipse(rect.X, rect.Y, rect.Width, rect.Height));
 }
示例#52
0
文件: BrushPlus.cs 项目: mitice/foo
 GpStatus GetRectangle(out GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipGetLineRect((GpLineGradient)nativeBrush, out rect)));
 }
示例#53
0
 public void GetBounds(out GpRectF rect)
 {
     rect.X = X;
     rect.Y = Y;
     rect.Width = Width;
     rect.Height = Height;
 }
示例#54
0
 public bool Equals(GpRectF rect)
 {
     return X == rect.X &&
            Y == rect.Y &&
            Width == rect.Width &&
            Height == rect.Height;
 }
示例#55
0
 Exclude(GpRectF rect)
  {
      return SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                         CombineMode.CombineModeExclude));
  }
示例#56
0
 public bool Contains(GpRectF rect)
 {
     return (X <= rect.X) && (rect.GetRight() <= GetRight()) &&
            (Y <= rect.Y) && (rect.GetBottom() <= GetBottom());
 }
示例#57
0
 GetBounds(out GpRectF rect,
                    GraphicsPlus g)
  {
      return SetStatus(NativeMethods.GdipGetRegionBounds(nativeRegion,
                                                  g.nativeGraphics,
                                                  out rect));
  }
示例#58
0
 public bool Intersect(GpRectF rect)
 {
     return Intersect(out this, this, rect);
 }
示例#59
0
 GetRegionScans(
      Matrix matrix,
     GpRectF[] rects,
      out int count)
  {
      count = rects.Length;
      return SetStatus(NativeMethods.GdipGetRegionScans(nativeRegion,
                                            rects,
                                            ref count,
                                            matrix.nativeMatrix));
  }
示例#60
0
 GdipCreateRegionRect(ref GpRectF rect, out GpRegion region);