/// <summary> /// Get the bits of the image for editing /// </summary> /// <param name="oImage"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="stride"></param> /// <param name="ptrRed"></param> /// <param name="ptrGreen"></param> /// <param name="ptrBlue"></param> /// <returns></returns> public override object GetImageBits(object oImage, ref int width, ref int height, ref int stride, ref IntPtr ptrRed, ref IntPtr ptrGreen, ref IntPtr ptrBlue) { if (oImage is CogImage24PlanarColor) { CogImage24PlanarColor imgColor = oImage as CogImage24PlanarColor; ICogImage8PixelMemory memRed, memGreen, memBlue; width = imgColor.Width; height = imgColor.Height; stride = width + 8; imgColor.Get24PlanarColorPixelMemory(CogImageDataModeConstants.ReadWrite, 0, 0, width, height, out memRed, out memGreen, out memBlue); ptrRed = memRed.Scan0; ptrGreen = memGreen.Scan0; ptrBlue = memBlue.Scan0; return(new ImagePixelLock() { MemRed = memRed, MemGreen = memGreen, MemBlue = memBlue }); } return(null); }
private ICogImage InvertTarget(ICogImage cogImage) { if (cogImage is CogImage24PlanarColor) { CogImage24PlanarColor imgColor = cogImage as CogImage24PlanarColor; if (HasInvertTargetEvent) { ICogImage8PixelMemory memRed, memGreen, memBlue; int width = imgColor.Width; int height = imgColor.Height; int memRowWidth = width + 8; imgColor.Get24PlanarColorPixelMemory(CogImageDataModeConstants.ReadWrite, 0, 0, width, height, out memRed, out memGreen, out memBlue); FireInvertTarget(width, height, memRowWidth, memRed.Scan0, memGreen.Scan0, memBlue.Scan0); memRed.Dispose(); memGreen.Dispose(); memBlue.Dispose(); } cogImage = imgColor; } return(cogImage); }