public Form1() { InitializeComponent(); openFileDialog1.Filter = "Images|*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff;"; openFileDialog1.FilterIndex = 1; saveFileDialog1.DefaultExt = ".tiff"; saveFileDialog1.Filter = "Tiff|*.tiff"; saveFileDialog1.FilterIndex = 1; saveFileDialog1.AddExtension = true; saveFileDialog1.OverwritePrompt = true; saveFileDialog1.FilterIndex = 1; //radio buttons defaults fillHeightMeasure = FillHeightMeasurment.Precents; fillColorType = FillColorType.Gradient; backgroundColorType = BackgroundColorType.Fix; logic = LogicCondition.XOR; //DEBUG sourceFileName = @"D:\Dropbox\Code\Developing\ColorMatrix\ColorMatrix-V.3\Client\colors.xlsx"; colorMatrix = new ColorMatrixBL(); colorMatrix.ImageCreated += colorMatrix_ImageCreated; UpdatePointsAndHeight(); }
public void CreateImage( string imageFileName, string expression, FillHeightMeasurment fillHeightMeasure, FillColorType fillColorType, BackgroundColorType backgroundColorType, string imageSource, int rotate) { try { using (Bitmap targetBmp = new Bitmap(canvasWidth, canvasHeight), sourceBmp = new Bitmap(imageSource)) { Expression = expression; //draw point on the canvas and fill the gaps between DrawPoints(sourceBmp, targetBmp, expression, rotate); //save tiff image SaveImage(imageFileName, targetBmp, expression); } //raise event if (ImageCreated != null) ImageCreated(new FileInfo(imageFileName).Name); } catch (Exception ex) { throw new InvalidDataException(); } }