Пример #1
0
        private void CreateObjects()
        {
            brSolid = new SolidBrushPlus(Color.CornflowerBlue);

            brHatch = new HatchBrush(HatchStyle.HatchStyle25Percent,
                Color.Black, Color.White);

            string bitmapPath = System.IO.Path.GetDirectoryName(GetType().Assembly.GetModules()[0].FullyQualifiedName);
            bitmapPath = System.IO.Path.Combine(bitmapPath, "brushPattern.bmp");
            StreamOnFile sf = new StreamOnFile(bitmapPath);
            ImagePlus img = new ImagePlus(sf, false);
            brTexture = new TextureBrushPlus(img, WrapMode.WrapModeTile);
            brLinGrad = new LinearGradientBrush(new GpPointF(0, 0),
                new GpPointF(50, 50), Color.Black, Color.White);

            // Create rectangular path
            GraphicsPath path = new GraphicsPath(FillMode.FillModeAlternate);
            path.AddRectangle(new GpRectF( 0, 0, ClientRectangle.Width,
                ClientRectangle.Height / 5));

            // Create rectangular gradient brush
            // with red in center and black in the corners
            brPathGrad = new PathGradientBrush(path);
            brPathGrad.SetCenterColor(Color.Red);
            int count = 2;
            brPathGrad.SetSurroundColors(new Color[] { Color.Black, Color.Black },
                ref count);
        }
Пример #2
0
        public GraphicsPlus(ImagePlus image)
        {
            GpGraphics Graphics = new GpGraphics();

            if (image != null)
            {
                lastResult = NativeMethods.GdipGetImageGraphicsContext(
                                                                    image.nativeImage, out Graphics);
            }
            SetNativeGraphics(Graphics);
        }
Пример #3
0
        ImagePlus GetImage()
        {
            GpImage image;

            SetStatus(NativeMethods.GdipGetTextureImage((GpTexture)nativeBrush,
                                                        out image));

            ImagePlus retimage = new ImagePlus(image, lastResult);

            return(retimage);
        }
Пример #4
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);
        }
Пример #5
0
        TextureBrushPlus(ImagePlus image,
                         GpRect dstRect,
                         ImageAttributesPlus imageAttributes)
        {
            GpTexture texture;

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

            SetNativeBrush(texture);
        }
Пример #6
0
        public TextureBrushPlus(ImagePlus image,
                                WrapMode wrapMode)
        {
            GpTexture texture;

            GpRectF rc; Unit unit;

            image.GetBounds(out rc, out unit);
            lastResult = NativeMethods.GdipCreateTextureIA(
                image.nativeImage,
                new GpImageAttributes(),
                rc.X,
                rc.Y,
                rc.Width,
                rc.Height,
                out texture);

            SetNativeBrush(texture);
        }
Пример #7
0
        TextureBrushPlus(ImagePlus image,
                         WrapMode wrapMode,
                         int dstX,
                         int dstY,
                         int dstWidth,
                         int dstHeight)
        {
            GpTexture texture;

            lastResult = NativeMethods.GdipCreateTexture2I(
                image.nativeImage,
                wrapMode,
                dstX,
                dstY,
                dstWidth,
                dstHeight,
                out texture);

            SetNativeBrush(texture);
        }
Пример #8
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);
 }
Пример #9
0
 public GpStatus DrawImage(ImagePlus image,
                  float x,
                  float y)
 {
     return SetStatus(NativeMethods.GdipDrawImage(nativeGraphics,
                                                image != null ? image.nativeImage
                                                      : null,
                                                x,
                                                y));
 }
Пример #10
0
 public static GraphicsPlus FromImage(ImagePlus image)
 {
     return new GraphicsPlus(image);
 }
Пример #11
0
        public TextureBrushPlus(ImagePlus image,
                     WrapMode wrapMode)
        {
            GpTexture texture;

            GpRectF rc; Unit unit;
            image.GetBounds(out rc, out unit);
            lastResult = NativeMethods.GdipCreateTextureIA(
                                                      image.nativeImage,
                                                      new GpImageAttributes(),
                                                      rc.X,
                                                      rc.Y,
                                                      rc.Width,
                                                      rc.Height,
                                                      out texture);

            SetNativeBrush(texture);
        }
Пример #12
0
        TextureBrushPlus(
            ImagePlus image,
            WrapMode wrapMode,

            GpRect dstRect
        )
        {
            GpTexture texture;

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

            SetNativeBrush(texture);
        }
Пример #13
0
 public GpStatus DrawImage(ImagePlus image,
                  int x,
                  int y,
                  int width,
                  int height)
 {
     return DrawImage(image, new GpRectF(x, y, width, height));
 }
Пример #14
0
 public GpStatus DrawImage(ImagePlus image,
                  int x,
                  int y)
 {
     GpRectF bounds; Unit unit;
     image.GetBounds(out bounds, out unit);
     bounds.Offset(x, y);
     return DrawImage(image, bounds, 0, 0, bounds.Width, bounds.Height, unit, null);
 }
Пример #15
0
        ImagePlus GetImage()
        {
            GpImage image;

            SetStatus(NativeMethods.GdipGetTextureImage((GpTexture)nativeBrush,
                                                      out image));

            ImagePlus retimage = new ImagePlus(image, lastResult);

            return retimage;
        }
Пример #16
0
        TextureBrushPlus(ImagePlus image,
                     WrapMode wrapMode,
                     int dstX,
                     int dstY,
                     int dstWidth,
                     int dstHeight)
        {
            GpTexture texture;

            lastResult = NativeMethods.GdipCreateTexture2I(
                                                        image.nativeImage,
                                                        wrapMode,
                                                        dstX,
                                                        dstY,
                                                        dstWidth,
                                                        dstHeight,
                                                        out texture);

            SetNativeBrush(texture);
        }
Пример #17
0
 public GpStatus DrawImage(ImagePlus image,
                  float x,
                  float y,
                  float width,
                  float height)
 {
     GpRectF bounds; Unit unit;
     image.GetBounds(out bounds, out unit);
     return DrawImage(image, new GpRectF(x, y, width, height), 0, 0, bounds.Width, bounds.Height, unit, null);
 }
Пример #18
0
 public GpStatus DrawImage(ImagePlus image,
                   GpPoint point)
 {
     return DrawImage(image, point.X, point.Y);
 }
Пример #19
0
 public GpStatus DrawImage(ImagePlus image,
                  float x,
                  float y,
                  float srcx,
                  float srcy,
                  float srcwidth,
                  float srcheight,
                  Unit srcUnit)
 {
     GpRectF bounds; Unit unit;
     image.GetBounds(out bounds, out unit);
     return DrawImage(image, new GpRectF(x, y, srcwidth, srcheight), srcx, srcy, srcwidth, srcheight, srcUnit, null);
 }
Пример #20
0
 public GpStatus DrawImage(ImagePlus image,
                   GpRect rect)
 {
     return DrawImage(image,
                      rect.X,
                      rect.Y,
                      rect.Width,
                      rect.Height);
 }
Пример #21
0
 public GpStatus DrawImage(ImagePlus image,
                  int x,
                  int y,
                  int srcx,
                  int srcy,
                  int srcwidth,
                  int srcheight,
                  Unit srcUnit)
 {
     return SetStatus(NativeMethods.GdipDrawImagePointRectI(nativeGraphics,
                                                          image != null ? image.nativeImage
                                                                : null,
                                                          x,
                                                          y,
                                                          srcx,
                                                          srcy,
                                                          srcwidth,
                                                          srcheight,
                                                          srcUnit));
 }
Пример #22
0
        public GpStatus DrawImage(ImagePlus image,
                          GpPoint[] destPoints)
        {
            int count = destPoints.Length;
            if (count != 3 && count != 4)
                return SetStatus(GpStatus.InvalidParameter);

            return SetStatus(NativeMethods.GdipDrawImagePointsI(nativeGraphics,
                                                              image != null ? image.nativeImage
                                                                    : null,
                                                              destPoints,
                                                              count));
        }
Пример #23
0
        TextureBrushPlus(ImagePlus image,
                     GpRect dstRect,
                     ImageAttributesPlus imageAttributes)
        {
            GpTexture texture;

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

            SetNativeBrush(texture);
        }
Пример #24
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));
 }
Пример #25
0
        private ImagePlus(ImagePlus C)
        {

            NativeMethods.GdipCloneImage(C.nativeImage, out this.nativeImage);
        }
Пример #26
0
 public GpStatus DrawImage(ImagePlus image,
                   GpPoint[] destPoints,
                  int srcx,
                  int srcy,
                  int srcwidth,
                  int srcheight,
                  Unit srcUnit,
                   ImageAttributesPlus imageAttributes)
 {
     return SetStatus(NativeMethods.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));
 }
Пример #27
0
 private ImagePlus(ImagePlus C)
 {
     NativeMethods.GdipCloneImage(C.nativeImage, out this.nativeImage);
 }