コード例 #1
0
ファイル: ToolkitGraphicsBase.cs プロジェクト: ForNeVeR/pnet
        // Draw the source parallelogram of an image into the parallelogram
        // defined by dest. Point[] has 3 Points, Top-Left, Top-Right and Bottom-Left.
        // The remaining point is inferred.
        public virtual void DrawImage(IToolkitImage image, Point[] src, Point[] dest)
        {
            int originX = dest[0].X;
            int originY = dest[0].Y;

            for (int i = 1; i < 3; i++)
            {
                if (originX > dest[i].X)
                {
                    originX = dest[i].X;
                }
                if (originY > dest[i].Y)
                {
                    originY = dest[i].Y;
                }
            }

            DotGNU.Images.Image gnuImage = (image as ToolkitImageBase).image;
            // Currently we only draw the first frame.
            Frame frame = gnuImage.GetFrame(0);

            frame = frame.AdjustImage(src[0].X, src[0].Y, src[1].X, src[1].Y,
                                      src[2].X, src[2].Y, dest[0].X - originX, dest[0].Y - originY,
                                      dest[1].X - originX, dest[1].Y - originY, dest[2].X - originX,
                                      dest[2].Y - originY);
            // Setup the new image and draw it.
            using (DotGNU.Images.Image newGnuImage = new DotGNU.Images.Image(gnuImage.Width,
                                                                             gnuImage.Height, gnuImage.PixelFormat))
            {
                newGnuImage.AddFrame(frame);
                IToolkitImage newImage = Toolkit.CreateImage(newGnuImage, 0);
                DrawImage(newImage, originX, originY);
            }
        }
コード例 #2
0
 // Create a texture brush.
 public IToolkitBrush CreateTextureBrush
     (TextureBrush properties, IToolkitImage image,
     RectangleF dstRect, ImageAttributes imageAttr)
 {
     return(new DrawingTextureBrush
                (properties, image as DrawingImage, dstRect, imageAttr));
 }
コード例 #3
0
ファイル: DrawingGraphics.cs プロジェクト: ForNeVeR/pnet
 public override void DrawImage(IToolkitImage image, int x, int y)
 {
     Xsharp.Image ximage = (image as DrawingImage).GetNativeImage();
     if (ximage != null)
     {
         graphics.DrawImage(x, y, ximage);
     }
 }
コード例 #4
0
 // Constructor.
 public DrawingTextureBrush(IToolkit toolkit, TextureBrush properties,
                            IToolkitImage image, RectangleF dstRect,
                            ImageAttributes imageAttr) : base(toolkit, Color.Black)
 {
     this.properties = properties;
     this.image      = image as DrawingImage;
     this.dstRect    = dstRect;
     this.imageAttr  = imageAttr;
 }
コード例 #5
0
	// Constructor.
	public DrawingTextureBrush(IToolkit toolkit, TextureBrush properties,
		IToolkitImage image, RectangleF dstRect,
		ImageAttributes imageAttr) : base(toolkit, Color.Black)
	{
		this.properties = properties;
		this.image = image as DrawingImage;
		this.dstRect = dstRect;
		this.imageAttr = imageAttr;
	}
コード例 #6
0
		// Copy image into this.image at x, y
		public override void DrawImage(IToolkitImage image, int x, int y)
				{
					DotGNU.Images.Image sourceImage = (image as ToolkitImageBase).image;
					Frame sourceFrame = sourceImage.GetFrame(0);
					DotGNU.Images.Image destImage = this.image.image;
					Frame destFrame =destImage.GetFrame(0);
					if (sourceFrame.PixelFormat != destFrame.PixelFormat)
						sourceFrame = sourceFrame.Reformat(destImage.PixelFormat);
					destFrame.Copy(sourceFrame, x, y);
					this.image.ImageChanged();
				}
コード例 #7
0
 // Implement the IDisposable interface.
 public void Dispose()
 {
     if (toolkitImage != null)
     {
         toolkitImage.Dispose();
         toolkitImage = null;
     }
     if (image != null)
     {
         image.Dispose();
         image    = null;
         frame    = null;
         frameNum = 0;
     }
 }
コード例 #8
0
 // Get the toolkit image underlying this icon.
 internal IToolkitImage GetToolkitImage(Graphics graphics)
 {
     if (toolkitImage != null)
     {
         return(toolkitImage);
     }
     else if (image != null)
     {
         toolkitImage =
             graphics.ToolkitGraphics.Toolkit.CreateImage
                 (image, frameNum);
         return(toolkitImage);
     }
     else
     {
         return(null);
     }
 }
コード例 #9
0
ファイル: DrawingGraphics.cs プロジェクト: ForNeVeR/pnet
 // Draw an image.
 public override void DrawImage
     (IToolkitImage image, System.Drawing.Point[] src,
     System.Drawing.Point[] dest)
 {
     if ((src[1].X - src[0].X) == (dest[1].X - dest[0].X) &&
         (src[2].Y - src[0].Y) == (dest[2].Y - dest[0].Y))
     {
         // Draw a sub-image, without stretching the pixels.
         Xsharp.Image ximage =
             (image as DrawingImage).GetNativeImage();
         if (ximage != null)
         {
             graphics.DrawImage(dest[0].X, dest[0].Y, ximage,
                                src[0].X, src[0].Y,
                                src[1].X - src[0].X,
                                src[2].Y - src[0].Y);
         }
     }
     else
     {
         // Hard case: stretch the image before drawing it.
         base.DrawImage(image, src, dest);
     }
 }
コード例 #10
0
ファイル: PostscriptGraphics.cs プロジェクト: ForNeVeR/pnet
        // Draw an image at the coordinates
        public override void DrawImage(IToolkitImage image, int x, int y)
        {
            PostscriptImage psi = (image as PostscriptImage);
            String          psImage;

            if (PostscriptLevel == 3)
            {
                psImage = psi.LevelThree;
            }
            else
            {
                psImage = psi.LevelTwo;
            }
            writer.WriteLine
                ("matrix currentmatrix " +
                "gsave " +
                "newpath " +
                "{0} {1} translate " +
                "0 0 moveto " +
                "{2} " +
                "grestore " +
                "setmatrix",
                x, y, psImage);
        }
コード例 #11
0
 public void DrawImage(IToolkitImage image, int x, int y)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
 public PortableGraphics(PortableToolkit parent, IToolkitImage image)
 {
     Toolkit = parent;
     DpiX    = DpiY = 96.0f; // default Windows-like value
     Target  = image;
 }
コード例 #13
0
	// Write an image at x, y taking into account the mask
	public override void DrawImage(IToolkitImage image, int x, int y)
	{
		(image as DrawingImage).Draw(hdc, x, y);
	}
コード例 #14
0
	// Create a texture brush.
	public override IToolkitBrush CreateTextureBrush
				(TextureBrush properties, IToolkitImage image,
				 RectangleF dstRect, ImageAttributes imageAttr)
			{
				return null;
			}
コード例 #15
0
 // Create an IToolkitGraphics object from an image.
 public IToolkitGraphics CreateFromImage(IToolkitImage image)
 {
     return(new DrawingGraphicsImage(this, image));
 }
コード例 #16
0
 // Create an IToolkitGraphics object from an image.
 public virtual IToolkitGraphics CreateFromImage(IToolkitImage image)
 {
     return(null);
 }
コード例 #17
0
ファイル: DrawingGraphics.cs プロジェクト: ForNeVeR/pnet
 // Write an image at x, y taking into account the mask
 public override void DrawImage(IToolkitImage image, int x, int y)
 {
     (image as DrawingImage).Draw(hdc, x, y);
 }
コード例 #18
0
 public DrawingGraphicsImage(IToolkit toolkit, IToolkitImage image)
     : base(toolkit, image)
 {
 }
コード例 #19
0
	// Draw an image.
	public override void DrawImage
				(IToolkitImage image, System.Drawing.Point[] src,
				 System.Drawing.Point[] dest)
			{
				if((src[1].X - src[0].X) == (dest[1].X - dest[0].X) &&
				   (src[2].Y - src[0].Y) == (dest[2].Y - dest[0].Y))
				{
					// Draw a sub-image, without stretching the pixels.
					Xsharp.Image ximage =
						(image as DrawingImage).GetNativeImage();
					if(ximage != null)
					{
						graphics.DrawImage(dest[0].X, dest[0].Y, ximage,
										   src[0].X, src[0].Y,
										   src[1].X - src[0].X,
										   src[2].Y - src[0].Y);
					}
				}
				else
				{
					// Hard case: stretch the image before drawing it.
					base.DrawImage(image, src, dest);
				}
			}
コード例 #20
0
		// Copy image into this.image at x, y
		public override void DrawImage(IToolkitImage image, int x, int y)
				{
					DotGNU.Images.Image sourceImage = (image as ToolkitImageBase).image;
					Frame sourceFrame = sourceImage.GetFrame(0);
					DotGNU.Images.Image destImage = this.image.image;
					Frame destFrame =destImage.GetFrame(0);
					if (sourceFrame.PixelFormat != destFrame.PixelFormat)
						sourceFrame = sourceFrame.Reformat(destImage.PixelFormat);
					destFrame.Copy(sourceFrame, x, y);
					this.image.ImageChanged();
				}
コード例 #21
0
	// Create an IToolkitGraphics object from an image.
	public virtual IToolkitGraphics CreateFromImage(IToolkitImage image)
			{
				return null;
			}
コード例 #22
0
 public IToolkitGraphics CreateFromImage(IToolkitImage image)
 {
     return(new PortableGraphics(this, image));
 }
コード例 #23
0
 public IToolkitBrush CreateTextureBrush(TextureBrush properties, IToolkitImage image, RectangleF dstRect, ImageAttributes imageAttr)
 {
     throw new NotImplementedException();
 }
コード例 #24
0
 public void DrawImage(IToolkitImage image, Point[] src, Point[] dest)
 {
     throw new NotImplementedException();
 }
コード例 #25
0
ファイル: Icon.cs プロジェクト: jjenki11/blaze-chem-rendering
	// Get the toolkit image underlying this icon.
	internal IToolkitImage GetToolkitImage(Graphics graphics)
			{
				if(toolkitImage != null)
				{
					return toolkitImage;
				}
				else if(image != null)
				{
					toolkitImage =
						graphics.ToolkitGraphics.Toolkit.CreateImage
							(image, frameNum);
					return toolkitImage;
				}
				else
				{
					return null;
				}
			}
コード例 #26
0
ファイル: ToolkitGraphicsBase.cs プロジェクト: ForNeVeR/pnet
 // Draw an image at the coordinates
 public abstract void DrawImage(IToolkitImage image, int x, int y);
コード例 #27
0
	// Draw an image at the coordinates
	public override void DrawImage(IToolkitImage image, int x, int y)
			{
				PostscriptImage psi = (image as PostscriptImage);
				String psImage;
				if(PostscriptLevel == 3)
				{
					psImage = psi.LevelThree;
				}
				else
				{
					psImage = psi.LevelTwo;
				}
				writer.WriteLine
					("matrix currentmatrix " +
					 "gsave " +
					 "newpath " +
					 "{0} {1} translate " +
					 "0 0 moveto " +
					 "{2} " +
					 "grestore " +
					 "setmatrix",
					 x, y, psImage);
			}
コード例 #28
0
	public DrawingGraphicsImage(IToolkit toolkit, IToolkitImage image)
		: base(toolkit, image) {}
コード例 #29
0
	// Create an IToolkitGraphics object from an image.
	public IToolkitGraphics CreateFromImage(IToolkitImage image)
			{
				return new DrawingGraphicsImage(this, image);
			}
コード例 #30
0
	public override void DrawImage(IToolkitImage image, int x, int y)
			{
				Xsharp.Image ximage = (image as DrawingImage).GetNativeImage();
				if(ximage != null)
				{
					graphics.DrawImage(x, y, ximage);
				}
			}
コード例 #31
0
	// Create a texture brush.
	public IToolkitBrush CreateTextureBrush
				(TextureBrush properties, IToolkitImage image,
				 RectangleF dstRect, ImageAttributes imageAttr)
			{
				return new DrawingTextureBrush
					(properties, image as DrawingImage, dstRect, imageAttr);
			}
コード例 #32
0
		protected ToolkitGraphicsImageBase(IToolkit toolkit, IToolkitImage image)
			: base(toolkit)
				{
					this.image = image as ToolkitImageBase;
				}
コード例 #33
0
	// Draw the source parallelogram of an image into the parallelogram
	// defined by dest. Point[] has 3 Points, Top-Left, Top-Right and Bottom-Left.
	// The remaining point is inferred.
	public virtual void DrawImage(IToolkitImage image, Point[] src, Point[] dest)
			{
				int originX = dest[0].X;
				int originY = dest[0].Y;
				for (int i = 1; i < 3; i++)
				{
					if (originX > dest[i].X)
						originX = dest[i].X;
					if (originY > dest[i].Y)
						originY = dest[i].Y;
				}

				DotGNU.Images.Image gnuImage = (image as ToolkitImageBase).image;
				// Currently we only draw the first frame.
				Frame frame = gnuImage.GetFrame(0);
				frame = frame.AdjustImage(src[0].X, src[0].Y, src[1].X, src[1].Y,
					src[2].X, src[2].Y, dest[0].X - originX, dest[0].Y - originY,
					dest[1].X - originX, dest[1].Y - originY, dest[2].X - originX,
					dest[2].Y - originY);
				// Setup the new image and draw it.
				using (DotGNU.Images.Image newGnuImage = new DotGNU.Images.Image(gnuImage.Width,
					gnuImage.Height, gnuImage.PixelFormat))
				{
					newGnuImage.AddFrame(frame);
					IToolkitImage newImage = Toolkit.CreateImage(newGnuImage, 0);
					DrawImage( newImage, originX, originY);
				}
			}
コード例 #34
0
		protected ToolkitGraphicsImageBase(IToolkit toolkit, IToolkitImage image)
			: base(toolkit)
				{
					this.image = image as ToolkitImageBase;
				}
コード例 #35
0
	// Draw an image at the coordinates
	public abstract void DrawImage(IToolkitImage image, int x, int y);
コード例 #36
0
 // Create a texture brush.
 public override IToolkitBrush CreateTextureBrush
     (TextureBrush properties, IToolkitImage image,
     RectangleF dstRect, ImageAttributes imageAttr)
 {
     return(null);
 }
コード例 #37
0
ファイル: Icon.cs プロジェクト: jjenki11/blaze-chem-rendering
	// Implement the IDisposable interface.
	public void Dispose()
			{
				if(toolkitImage != null)
				{
					toolkitImage.Dispose();
					toolkitImage = null;
				}
				if(image != null)
				{
					image.Dispose();
					image = null;
					frame = null;
					frameNum = 0;
				}
			}