public void FromBitmapCutting(Bitmap fullBmp, Color mark) { fullBmp.MakeTransparent(fullBmp.GetPixel(0, 0)); Bitmap[] vertPieces = fullBmp.SplitVerticalByCol0(mark); vertPieces = vertPieces.Select(b => b.TrimTrailingRight(Color.Transparent)).ToArray(); /* for (int i = 0; i < vertPieces.Length; ++i) vertPieces[i].Save("vertPiece" + i + ".png"); */ Head = new NineContent(); Head.FromBitmapCutting(vertPieces[0], mark); Side = new A1A2A3(); Side.FromBitmapCutting(vertPieces[1].SliceX(1).SplitHorizontaByRow0(Color.Red)[0], mark); Waist = new NineContent(); Waist.FromBitmapCutting(vertPieces[2], mark); FootCap = new ABC(); FootCap.FromBitmapCutting(vertPieces[3].SliceX(2), mark); FootStack = new ABC(); FootStack.FromBitmapCutting(vertPieces[4].SliceX(2), mark); }
public void FromBitmapCutting(Bitmap fullBmp, Color mark) { Bitmap[] pieces = fullBmp.SplitVerticalByCol0(Color.Red); A1 = pieces[0]; A2 = pieces[1]; A3 = pieces[2]; MinHeight = fullBmp.Height; }
public static InputImageParts FromBitmap(Bitmap fullBmp) { InputImageParts ret = new InputImageParts(); Bitmap[] elements = fullBmp.SplitVerticalByCol0(Color.Red); ret.InputNumber = elements[0]; return ret; }