Esempio n. 1
0
 public void GetBounds(out GpRectF rect)
 {
     rect.X      = X;
     rect.Y      = Y;
     rect.Width  = Width;
     rect.Height = Height;
 }
Esempio n. 2
0
 public bool IntersectsWith(GpRectF rect)
 {
     return(GetLeft() < rect.GetRight() &&
            GetTop() < rect.GetBottom() &&
            GetRight() > rect.GetLeft() &&
            GetBottom() > rect.GetTop());
 }
Esempio n. 3
0
 public bool Equals(GpRectF rect)
 {
     return(X == rect.X &&
            Y == rect.Y &&
            Width == rect.Width &&
            Height == rect.Height);
 }
Esempio n. 4
0
 GetBounds(out GpRectF rect,
           GraphicsPlus g)
 {
     return(SetStatus(NativeMethods.GdipGetRegionBounds(nativeRegion,
                                                        g.nativeGraphics,
                                                        out rect)));
 }
Esempio n. 5
0
 public GpStatus AddArc(GpRectF rect,
           float startAngle,
           float sweepAngle)
 {
     return AddArc(rect.X, rect.Y, rect.Width, rect.Height,
                   startAngle, sweepAngle);
 }
Esempio n. 6
0
 public GpStatus AddPie(GpRectF rect,
                        float startAngle,
                        float sweepAngle)
 {
     return(AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle,
                   sweepAngle));
 }
Esempio n. 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)));
        }
Esempio n. 8
0
        RegionPlus(GpRectF rect)
        {
            GpRegion region = new GpRegion();

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

            SetNativeRegion(region);
        }
Esempio n. 9
0
        RegionPlus(GpRectF rect)
        {
            GpRegion region = new GpRegion();

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

            SetNativeRegion(region);
        }
Esempio n. 10
0
File: Matrix.cs Progetto: mitice/foo
        Matrix(GpRectF rect,
               GpPointF[] dstplg)
        {
            GpMatrix matrix;

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

            SetNativeMatrix(matrix);
        }
Esempio n. 11
0
    Matrix( GpRectF rect, 
            GpPointF[] dstplg)
    {
        GpMatrix matrix;

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

        SetNativeMatrix(matrix);
    }
Esempio n. 12
0
        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);

            }
        }
Esempio n. 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)));
 }
Esempio n. 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);
        }
Esempio n. 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());
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        // 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);
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        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);
        }
Esempio n. 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));
 }
Esempio n. 21
0
 public GpStatus DrawEllipse(PenPlus pen,
                     GpRectF rect)
 {
     return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
 }
Esempio n. 22
0
 public GpStatus FillRectangles(BrushPlus brush,
                        GpRectF[] rects)
 {
     return SetStatus(NativeMethods.GdipFillRectangles(nativeGraphics,
                                                     brush.nativeBrush,
                                                     rects, rects.Length));
 }
Esempio n. 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);
 }
Esempio n. 24
0
GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg,
                       out GpMatrix matrix);
Esempio n. 25
0
GdipDrawRectangles(GpGraphics graphics, GpPen pen, GpRectF[] rects,
        int count);
Esempio n. 26
0
 GdipGetRegionBounds(GpRegion region, GpGraphics graphics,
                     out GpRectF rect);
Esempio n. 27
0
 public static extern GpStatus GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg,
                out GpMatrix matrix);
Esempio n. 28
0
File: Image.cs Progetto: mitice/foo
 public GpStatus GetBounds(out GpRectF srcRect,
                           out Unit srcUnit)
 {
     return(SetStatus(NativeMethods.GdipGetImageBounds(nativeImage,
                                                       out srcRect, out srcUnit)));
 }
Esempio n. 29
0
 GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg,
                   out GpMatrix matrix);
Esempio n. 30
0
GdipAddPathString(GpPath path, string str,
                        int length, GpFontFamily family, int style,
                        float emSize, GpRectF layoutRect,
                        GpStringFormat format);
Esempio n. 31
0
 GdipGetClipBounds(GpGraphics graphics, out GpRectF rect);
Esempio n. 32
0
 public bool Contains(GpRectF rect)
 {
     return((X <= rect.X) && (rect.GetRight() <= GetRight()) &&
            (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()));
 }
Esempio n. 33
0
 public GpStatus GetRectangle(out GpRectF rect)
 {
     rect = new GpRectF();
     return(SetStatus(NativeMethods.GdipGetPathGradientRect(
                          (GpPathGradient)nativeBrush, out rect)));
 }
Esempio n. 34
0
 public bool Intersect(GpRectF rect)
 {
     return(Intersect(out this, this, rect));
 }
Esempio n. 35
0
File: Paths.cs Progetto: mitice/foo
 GdipAddPathString(GpPath path, string str,
                   int length, GpFontFamily family, int style,
                   float emSize, GpRectF layoutRect,
                   GpStringFormat format);
Esempio n. 36
0
 Complement(GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                          CombineMode.CombineModeComplement)));
 }
Esempio n. 37
0
 public GpStatus DrawRectangles(PenPlus pen,
                        GpRectF[] rects)
 {
     return SetStatus(NativeMethods.GdipDrawRectangles(nativeGraphics,
                                                     pen.nativePen,
                                                     rects, rects.Length));
 }
Esempio n. 38
0
 Exclude(GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                          CombineMode.CombineModeExclude)));
 }
Esempio n. 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);
 }
Esempio n. 40
0
 Complement(GpRectF rect)
  {
      return SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                         CombineMode.CombineModeComplement));
  }
Esempio n. 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);
 }
Esempio n. 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;
        }
Esempio n. 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);
 }
Esempio n. 44
0
 GdipCombineRegionRect(GpRegion region, ref GpRectF rect,
                       CombineMode combineMode);
Esempio n. 45
0
GdipAddPathRectangles(GpPath path, GpRectF[] rects, int count);
Esempio n. 46
0
 public bool IntersectsWith(GpRectF rect)
 {
     return (GetLeft() < rect.GetRight() &&
             GetTop() < rect.GetBottom() &&
             GetRight() > rect.GetLeft() &&
             GetBottom() > rect.GetTop());
 }
Esempio n. 47
0
GdipGetPathWorldBounds(GpPath  path, GpRectF[] bounds, 
                       out GpMatrix matrix, out GpPen pen);
Esempio n. 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();
    }
Esempio n. 49
0
 GdipGetImageBounds(GpImage image, out GpRectF srcRect, out Unit srcUnit);
Esempio n. 50
0
GdipFillRectangles(GpGraphics graphics, GpBrush brush,
     GpRectF[] rects, int count);
Esempio n. 51
0
 public GpStatus AddEllipse(GpRectF rect)
 {
     return(AddEllipse(rect.X, rect.Y, rect.Width, rect.Height));
 }
Esempio n. 52
0
 GpStatus GetRectangle(out GpRectF rect)
 {
     return(SetStatus(NativeMethods.GdipGetLineRect((GpLineGradient)nativeBrush, out rect)));
 }
Esempio n. 53
0
 public void GetBounds(out GpRectF rect)
 {
     rect.X = X;
     rect.Y = Y;
     rect.Width = Width;
     rect.Height = Height;
 }
Esempio n. 54
0
 public bool Equals(GpRectF rect)
 {
     return X == rect.X &&
            Y == rect.Y &&
            Width == rect.Width &&
            Height == rect.Height;
 }
Esempio n. 55
0
 Exclude(GpRectF rect)
  {
      return SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect,
                                                         CombineMode.CombineModeExclude));
  }
Esempio n. 56
0
 public bool Contains(GpRectF rect)
 {
     return (X <= rect.X) && (rect.GetRight() <= GetRight()) &&
            (Y <= rect.Y) && (rect.GetBottom() <= GetBottom());
 }
Esempio n. 57
0
 GetBounds(out GpRectF rect,
                    GraphicsPlus g)
  {
      return SetStatus(NativeMethods.GdipGetRegionBounds(nativeRegion,
                                                  g.nativeGraphics,
                                                  out rect));
  }
Esempio n. 58
0
 public bool Intersect(GpRectF rect)
 {
     return Intersect(out this, this, rect);
 }
Esempio n. 59
0
 GetRegionScans(
      Matrix matrix,
     GpRectF[] rects,
      out int count)
  {
      count = rects.Length;
      return SetStatus(NativeMethods.GdipGetRegionScans(nativeRegion,
                                            rects,
                                            ref count,
                                            matrix.nativeMatrix));
  }
Esempio n. 60
0
 GdipCreateRegionRect(ref GpRectF rect, out GpRegion region);