internal void Copy(Image sourceImage, Image destinationImage, uint width, uint height) { var transferBuffers = this.BeginSingleTimeCommand(this.transferCommandPool); ImageSubresourceLayers subresource = new ImageSubresourceLayers { AspectMask = ImageAspectFlags.Color, BaseArrayLayer = 0, LayerCount = 1, MipLevel = 0 }; ImageCopy region = new ImageCopy { DestinationSubresource = subresource, SourceSubresource = subresource, SourceOffset = new Offset3D(), DestinationOffset = new Offset3D(), Extent = new Extent3D { Width = width, Height = height, Depth = 1 } }; transferBuffers[0].CopyImage(sourceImage, ImageLayout.TransferSourceOptimal, destinationImage, ImageLayout.TransferDestinationOptimal, region); this.EndSingleTimeCommand(transferBuffers, this.transferCommandPool, this.transferQueue); }
public void TestFromSourceToDestination(string resourcePath) { // Load source image using Bitmap sourceBitmap = TestImage.FromResource(resourcePath) as Bitmap; Assert.IsNotNull(sourceBitmap); // Create blank bitmap using Bitmap copyBitmap = new(sourceBitmap.Width, sourceBitmap.Height, sourceBitmap.PixelFormat); // Crop region of image ImageCopy.FromSourceToDestination(sourceBitmap, copyBitmap); // Check size Assert.AreEqual(sourceBitmap.Width, copyBitmap.Width); Assert.AreEqual(sourceBitmap.Height, copyBitmap.Height); // Get bytes for each image byte[] sourceBytes = ImageBytes.FromImage(sourceBitmap); byte[] copiedBytes = ImageBytes.FromImage(copyBitmap); // Compare to ensure correct copy matches int limit = System.Math.Min(sourceBytes.Length, copiedBytes.Length); for (int i = 0; i < limit; i++) { Assert.AreEqual(sourceBytes[i], copiedBytes[i]); } }
public void CmdCopyImage(Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, ImageCopy?pRegion) { unsafe { ImageCopy valpRegion = pRegion ?? default(ImageCopy); ImageCopy *ptrpRegion = pRegion != null ? &valpRegion : (ImageCopy *)IntPtr.Zero; Interop.NativeMethods.vkCmdCopyImage(this.m, srcImage != null ? srcImage.m : default(UInt64), srcImageLayout, dstImage != null ? dstImage.m : default(UInt64), dstImageLayout, (UInt32)(pRegion != null ? 1 : 0), ptrpRegion); } }
public void CopyTest() { var finfo = new System.IO.FileInfo(Environment.CurrentDirectory + (@"\config\log4net.config")); log4net.Config.XmlConfigurator.Configure(finfo); ImageCopy imageCopy = new ImageCopy(); imageCopy.SourcePath = Environment.CurrentDirectory + "\\TestFiles\\Images\\"; imageCopy.TargetPath = Environment.CurrentDirectory + "\\TestFiles\\TargetImages\\"; imageCopy.Copy(); }
private void lv_Patient_MouseDoubleClick(object sender, MouseEventArgs e) { ListViewItem lvi = lv_Patient.GetItemAt(e.X, e.Y); if (lvi == null) return; if (lvi.ImageIndex != 1) return; BWorkList bwk = new BWorkList(); MWorkList mwk = (MWorkList)bwk.GetModel(lvi.Tag.ToString()); BReport brt = new BReport(); MReport mrt = (MReport)brt.GetModel(lvi.Tag.ToString()); ImageCopy ic = new ImageCopy(); string saveDir = System.Windows.Forms.Application.StartupPath + "\\temp"; List<ImgObj> arrayImg = ic.LoadImages(mwk, saveDir); frmReportEdit frmRE = new frmReportEdit(); frmRE.initForm(mwk, mrt,ILL.GetConfig.RS_OpenWord); frmRE.ShowDialog(); }
// Initalized the context values to local variables protected void InitValue(CodeActivityContext context) { try { base.LoadVariables(context); this.strCellRange = CellRange.Get(context); this.dblChartLeft = Size.Left; this.dblChartTop = Size.Top; this.dblChartWidth = Size.Width; this.dblChartHeight = Size.Height; this.strChartTitle = ChartTitle.Get(context); this.strImagecopy = ImageCopy.Get(context); } catch (Exception ex) { throw new Exception("InitValue" + ex.Message); } }
public unsafe void CopyImage(Image sourceImage, ImageLayout sourceImageLayout, Image destinationImage, ImageLayout destinationImageLayout, uint regionCount, ImageCopy* regions) { vkCmdCopyImage(this, sourceImage, sourceImageLayout, destinationImage, destinationImageLayout, regionCount, regions); }
internal static unsafe extern void vkCmdCopyImage(CommandBuffer commandBuffer, Image sourceImage, ImageLayout sourceImageLayout, Image destinationImage, ImageLayout destinationImageLayout, uint regionCount, ImageCopy* regions);