private void btnCreate_Click(object sender, EventArgs e) { string stringTemp=""; string intTemp = ""; _pm = new PictureModel() { Image = _bmp }; _service = new SketchService(); _sktc = new SketchModel(); _sktc = _service.SetSketch(_pm); for (int i = 0; i < _pm.Image.Height; i++) { for (int j = 0; j < _pm.Image.Width; j++) { stringTemp += _sktc.PixelArrayChar[j, i]; } stringTemp += (char)13; stringTemp += (char)10; } // WriteToFile(stringTemp); CreateSketch(stringTemp, txtSketch); }
private char[,] FillPixelsketch(PictureModel model) { char[,] arrTemp = new char[model.Image.Width, model.Image.Height]; string optKeyColor; for (int i = 0; i < model.Image.Width; i++) { for (int j = 0; j < model.Image.Height; j++) { optKeyColor = getOptimalKeyColor(model.PixelArrayInt[i, j]); arrTemp[i, j] = Constant.LetterConstant.SingleOrDefault(x => x.Key == optKeyColor).Value; } } return arrTemp; }
public SketchModel SetSketch(PictureModel model) { PictureModel returnModel = new PictureModel(); SketchModel returnSketch = new SketchModel(); //get Picture Information returnModel.Image = model.Image; returnModel.PixelArrayInt = new int[model.Image.Width,model.Image.Height]; returnModel.PixelArrayInt = FillPixelArray(model.Image); //Set Sketch returnSketch.PixelArrayChar = FillPixelsketch(returnModel); return returnSketch; }
public SketchService() { _picturemodel = new PictureModel(); _sketchModel = new SketchModel(); }