コード例 #1
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public PenPlus(BrushPlus brush, float width)
        {
            Unit unit = Unit.UnitWorld;

            nativePen  = null;
            lastResult = GdiPlus.GdipCreatePen2(brush.nativeBrush, width, unit, out nativePen);
        }
コード例 #2
0
ファイル: BrushPlus.cs プロジェクト: Radytz/DroppedBoxx
        public GpStatus SetSurroundColors(Color[] colors,
                                          ref int count)
        {
            int count1 = GetPointCount();

            if ((count > count1) || (count1 <= 0))
            {
                return(SetStatus(GpStatus.InvalidParameter));
            }

            count1 = count;

            int[] argbs = new int[count1];

            for (int i = 0; i < count1; i++)
            {
                argbs[i] = colors[i].ToArgb();
            }

            SetStatus(GdiPlus.GdipSetPathGradientSurroundColorsWithCount(
                          (GpPathGradient)nativeBrush, argbs, ref count1));

            if (lastResult == GpStatus.Ok)
            {
                count = count1;
            }


            return(lastResult);
        }
コード例 #3
0
ファイル: BrushPlus.cs プロジェクト: Radytz/DroppedBoxx
 public GpStatus SetBlend(float[] blendFactors,
                          float[] blendPositions)
 {
     return(SetStatus(GdiPlus.GdipSetPathGradientBlend(
                          (GpPathGradient)nativeBrush,
                          blendFactors, blendPositions, blendFactors.Length)));
 }
コード例 #4
0
ファイル: BrushPlus.cs プロジェクト: Radytz/DroppedBoxx
        //public LinearGradientBrush(RectangleF rect,
        //                    Color color1,
        //                    Color color2,
        //                    LinearGradientMode mode)
        //{
        //    GpLineGradient brush;

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

        //    SetNativeBrush(brush);
        //}

        //LinearGradientBrush(Rectangle rect,
        //                    Color color1,
        //                    Color color2,
        //                    LinearGradientMode mode)
        //{
        //    GpLineGradient brush;

        //    lastResult = GdiPlus.GdipCreateLineBrushFromRectI(ref rect,
        //                                                          color1.ToArgb(),
        //                                                          color2.ToArgb(),
        //                                                          mode,
        //                                                          WrapMode.WrapModeTile,
        //                                                          out brush);

        //    SetNativeBrush(brush);
        //}

        //LinearGradientBrush(RectangleF rect,
        //                    Color color1,
        //                    Color color2,
        //                    float angle,
        //                    bool isAngleScalable)
        //{
        //    GpLineGradient brush;

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

        //    SetNativeBrush(brush);
        //}

        //LinearGradientBrush(Rectangle rect,
        //                    Color color1,
        //                    Color color2,
        //                    float angle,
        //                    bool isAngleScalable)
        //{
        //    GpLineGradient brush = new GpLineGradient();

        //    lastResult = GdiPlus.GdipCreateLineBrushFromRectWithAngleI(ref rect,
        //                                                                   color1.ToArgb(),
        //                                                                   color2.ToArgb(),
        //                                                                   angle,
        //                                                                   isAngleScalable,
        //                                                                   WrapMode.WrapModeTile,
        //                                                                   out brush);

        //    SetNativeBrush(brush);
        //}
        #endregion

        GpStatus SetLinearColors(Color color1,
                                 Color color2)
        {
            return(SetStatus(GdiPlus.GdipSetLineColors((GpLineGradient)nativeBrush,
                                                       color1.ToArgb(),
                                                       color2.ToArgb())));
        }
コード例 #5
0
ファイル: BrushPlus.cs プロジェクト: Radytz/DroppedBoxx
        public GpStatus GetSurroundColors(Color[] colors, ref int count)
        {
            int count1;

            SetStatus(GdiPlus.GdipGetPathGradientSurroundColorCount(
                          (GpPathGradient)nativeBrush, out count1));

            if (lastResult != GpStatus.Ok)
            {
                return(lastResult);
            }

            if ((count < count1) || (count1 <= 0))
            {
                return(SetStatus(GpStatus.InsufficientBuffer));
            }

            int[] argbs = new int[count1];

            SetStatus(GdiPlus.GdipGetPathGradientSurroundColorsWithCount(
                          (GpPathGradient)nativeBrush, argbs, out count1));

            if (lastResult == GpStatus.Ok)
            {
                for (int i = 0; i < count1; i++)
                {
                    colors[i] = Color.FromArgb(argbs[i]);
                }
                count = count1;
            }

            return(lastResult);
        }
コード例 #6
0
ファイル: GraphicsPlus.cs プロジェクト: Radytz/DroppedBoxx
        //public void DrawImage(ImagePlus image,
        //                  PointF[] destPoints,
        //                 float srcx,
        //                 float srcy,
        //                 float srcwidth,
        //                 float srcheight,
        //                 Unit srcUnit,
        //                  ImageAttributesPlus imageAttributes)
        //{
        //    SetStatus(GdiPlus.GdipDrawImagePointsRect(nativeGraphics,
        //                                                         image != null ? image.nativeImage
        //                                                               : null,
        //                                                         destPoints, destPoints.Length,
        //                                                         srcx, srcy,
        //                                                         srcwidth,
        //                                                         srcheight,
        //                                                         srcUnit,
        //                                                         imageAttributes != null
        //                                                          ? imageAttributes.nativeImageAttr
        //                                                          : new GpImageAttributes(),
        //                                                         IntPtr.Zero,
        //                                                         IntPtr.Zero));
        //}

        //public void DrawImage(ImagePlus image,
        //                 int x,
        //                 int y,
        //                 int srcx,
        //                 int srcy,
        //                 int srcwidth,
        //                 int srcheight,
        //                 Unit srcUnit)
        //{
        //    SetStatus(GdiPlus.GdipDrawImagePointRectI(nativeGraphics,
        //                                                         image != null ? image.nativeImage
        //                                                               : null,
        //                                                         x,
        //                                                         y,
        //                                                         srcx,
        //                                                         srcy,
        //                                                         srcwidth,
        //                                                         srcheight,
        //                                                         srcUnit));
        //}

        //public void DrawImage(ImagePlus image,
        //                  Rectangle destRect,
        //                 int srcx,
        //                 int srcy,
        //                 int srcwidth,
        //                 int srcheight,
        //                 Unit srcUnit,
        //                  ImageAttributesPlus imageAttributes)
        //{
        //    SetStatus(GdiPlus.GdipDrawImageRectRectI(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));
        //}

        public void DrawImage(ImagePlus image,
                              Point[] destPoints,
                              int srcx,
                              int srcy,
                              int srcwidth,
                              int srcheight,
                              Unit srcUnit,
                              ImageAttributesPlus imageAttributes)
        {
            SetStatus(GdiPlus.GdipDrawImagePointsRectI(nativeGraphics,
                                                       image != null ? image.nativeImage
                                                                        : null,
                                                       destPoints,
                                                       destPoints.Length,
                                                       srcx,
                                                       srcy,
                                                       srcwidth,
                                                       srcheight,
                                                       srcUnit,
                                                       imageAttributes != null
                                                                   ? imageAttributes.nativeImageAttr
                                                                   : new GpImageAttributes(),
                                                       IntPtr.Zero,
                                                       IntPtr.Zero));
        }
コード例 #7
0
ファイル: GraphicsPlus.cs プロジェクト: Radytz/DroppedBoxx
 public void DrawImage(ImagePlus image,
                       RectangleF destRect,
                       float srcx,
                       float srcy,
                       float srcwidth,
                       float srcheight,
                       Unit srcUnit,
                       ImageAttributesPlus imageAttributes)
 {
     SetStatus(GdiPlus.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));
 }
コード例 #8
0
ファイル: GraphicsPlus.cs プロジェクト: Radytz/DroppedBoxx
 public void FillRectangles(BrushPlus brush,
                            RectangleF[] rects)
 {
     SetStatus(GdiPlus.GdipFillRectangles(nativeGraphics,
                                          brush.nativeBrush,
                                          rects, rects.Length));
 }
コード例 #9
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public Color GetColor()
        {
            int argb;

            SetStatus(GdiPlus.GdipGetPenColor(nativePen, out argb));
            return(Color.FromArgb(argb));
        }
コード例 #10
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public GraphicsPath(GraphicsPath path)
        {
            GpPath clonepath = null;

            SetStatus(GdiPlus.GdipClonePath(path.nativePath, out clonepath));
            SetNativePath(clonepath);
        }
コード例 #11
0
ファイル: GraphicsPlus.cs プロジェクト: Radytz/DroppedBoxx
 public void DrawLines(PenPlus pen, Point[] points)
 {
     SetStatus(GdiPlus.GdipDrawLinesI(nativeGraphics,
                                      pen.nativePen,
                                      points,
                                      points.Length));
 }
コード例 #12
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public bool IsOutlineVisible(GraphicsPlus g, float x, float y, PenPlus pen)
        {
            bool ret;

            SetStatus(GdiPlus.GdipIsOutlineVisiblePathPoint(nativePath, x, y, pen.nativePen, g.nativeGraphics, out ret));
            return(ret);
        }
コード例 #13
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public bool IsVisible(GraphicsPlus g, float x, float y)
        {
            bool ret;

            SetStatus(GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret));
            return(ret);
        }
コード例 #14
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public bool IsVisible(GraphicsPlus g, int x, int y)
        {
            bool ret;

            GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret);
            return(ret);
        }
コード例 #15
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public void AddBeziers(PointF[] points)
        {
            int count = points.Length;

            count -= (count - 4) % 3;
            SetStatus(GdiPlus.GdipAddPathBeziers(nativePath, points, count));
        }
コード例 #16
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        // Set/get line caps: start, end, and dash

        // Line cap and join APIs by using LineCap and LineJoin enums.

        public void SetLineCap(LineCap startCap,
                               LineCap endCap,
                               DashCap dashCap)
        {
            SetStatus(GdiPlus.GdipSetPenLineCap197819(nativePen,
                                                      startCap, endCap, dashCap));
        }
コード例 #17
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public PenPlus(Color color, float width)
        {
            Unit unit = Unit.UnitWorld;

            nativePen  = null;
            lastResult = GdiPlus.GdipCreatePen1(color.ToArgb(), width, unit, out nativePen);
        }
コード例 #18
0
ファイル: GraphicsPlus.cs プロジェクト: Radytz/DroppedBoxx
 public void DrawPath(PenPlus pen,
                      GraphicsPath path)
 {
     SetStatus(GdiPlus.GdipDrawPath(nativeGraphics,
                                    pen != null ? pen.nativePen : null,
                                    path != null ? path.nativePath : null));
 }
コード例 #19
0
        public RectangleF GetBounds(out Unit srcUnit)
        {
            RectangleF srcRect;

            SetStatus(GdiPlus.GdipGetImageBounds(nativeImage, out srcRect, out srcUnit));
            return(srcRect);
        }
コード例 #20
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public float GetDashOffset()
        {
            float dashOffset;

            SetStatus(GdiPlus.GdipGetPenDashOffset(nativePen, out dashOffset));

            return(dashOffset);
        }
コード例 #21
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public int GetPointCount()
        {
            int count = 0;

            SetStatus(GdiPlus.GdipGetPointCount(nativePath, out count));

            return(count);
        }
コード例 #22
0
 public void Dispose()
 {
     if (nativeImage != IntPtr.Zero)
     {
         GdiPlus.GdipDisposeImage(nativeImage);
         nativeImage = null;
     }
 }
コード例 #23
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        public GraphicsPath Clone()
        {
            GpPath clonepath = null;

            SetStatus(GdiPlus.GdipClonePath(nativePath, out clonepath));

            return(new GraphicsPath(clonepath));
        }
コード例 #24
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public DashStyle GetDashStyle()
        {
            DashStyle dashStyle;

            SetStatus(GdiPlus.GdipGetPenDashStyle(nativePen, out dashStyle));

            return(dashStyle);
        }
コード例 #25
0
ファイル: GraphicsPath.cs プロジェクト: windygu/haina
        private FillMode GetFillMode()
        {
            FillMode fillmode = FillMode.Alternate;

            SetStatus(GdiPlus.GdipGetPathFillMode(nativePath, out fillmode));

            return(fillmode);
        }
コード例 #26
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public int GetDashPatternCount()
        {
            int count = 0;

            SetStatus(GdiPlus.GdipGetPenDashCount(nativePen, out count));

            return(count);
        }
コード例 #27
0
        public void GetPhysicalDimension(out SizeF size)
        {
            float width, height;

            SetStatus(GdiPlus.GdipGetImageDimension(nativeImage, out width, out height));

            size = new SizeF(width, height);
        }
コード例 #28
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public PenPlus Clone()
        {
            GpPen clonePen = null;

            lastResult = GdiPlus.GdipClonePen(nativePen, out clonePen);

            return(new PenPlus(clonePen, lastResult));
        }
コード例 #29
0
        public System.Drawing.Imaging.PixelFormat GetPixelFormat()
        {
            System.Drawing.Imaging.PixelFormat format;

            SetStatus(GdiPlus.GdipGetImagePixelFormat(nativeImage, out format));

            return(format);
        }
コード例 #30
0
ファイル: PenPlus.cs プロジェクト: windygu/haina
        public float GetWidth()
        {
            float width;

            SetStatus(GdiPlus.GdipGetPenWidth(nativePen, out width));

            return(width);
        }