private bool AddFrames(Image <Bgr, byte> i) { Sizes sizes = ReadSizes(); if (sizes.IsInvalid()) { return(false); } int pixelsPerBlock = 4; int pixelsPerFrame = (int)Math.Ceiling(pixelsPerBlock * sizes.frameSize / sizes.blockSize); framedImage = Fragmenter.DrawWithFrames(i, pixelsPerBlock, pixelsPerFrame, Color.White); return(true); }
public void DrawWithFrames() { Color frameColor = Color.FromArgb(1, 1, 1); Image <Bgr, byte> result = Fragmenter.DrawWithFrames(testImage, 2, 1, frameColor); Assert.AreEqual(13, result.Rows); Assert.AreEqual(13, result.Cols); Assert.AreEqual(new Bgr(frameColor), result[0, 0]); Assert.AreEqual(new Bgr(frameColor), result[12, 12]); Assert.AreEqual(new Bgr(frameColor), result[3, 2]); Assert.AreEqual(new Bgr(255, 0, 0), result[7, 1]); Assert.AreEqual(new Bgr(0, 0, 0), result[11, 11]); Assert.AreEqual(new Bgr(0, 255, 0), result[7, 7]); }