private void toolStripButton6_Click(object sender, EventArgs e) { int tWidth = TerrainGlobals.getTerrain().getNumXVerts(); int tHeight = TerrainGlobals.getTerrain().getNumZVerts(); DAGMask resMask = canvasForm.execute(tWidth, tHeight); if (resMask == null) { MessageBox.Show("There was an error computing output"); return; } Masking.clearSelectionMask(); for (int x = 0; x < tWidth; x++) { for (int y = 0; y < tHeight; y++) { float k = resMask[x, y]; Masking.addSelectedVert(x, y, k); } } Masking.rebuildVisualsAfterSelection(); resMask = null; }
private void button1_Click(object sender, EventArgs e) { int tWidth = TerrainGlobals.getTerrain().getNumXVerts(); int tHeight = TerrainGlobals.getTerrain().getNumZVerts(); DAGMask resMask = canvasForm.execute(tWidth, tHeight); if (resMask == null) { MessageBox.Show("There was an error computing output"); return; } PictureBox pixBoxHighRes = new PictureBox(); pixBoxHighRes.Width = tWidth; pixBoxHighRes.Height = tHeight; Bitmap bmp = new Bitmap(tWidth, tHeight, PixelFormat.Format24bppRgb); for (int x = 0; x < tWidth; x++) { for (int y = 0; y < tHeight; y++) { float clampK = resMask[x, y]; if (clampK < 0) { clampK = 0; } if (clampK > 1) { clampK = 1; } byte bc = (byte)(clampK * byte.MaxValue); Color col; if (mColorsImage == null) { col = Color.FromArgb(255, bc, bc, bc); } else { col = mColorsImage.GetPixel(bc, mColorLineIndex); } bmp.SetPixel(x, y, col); } } pixBoxHighRes.Image = bmp; PopupEditor pe = new PopupEditor(); pe.ShowPopup(this, pixBoxHighRes, FormBorderStyle.FixedToolWindow, false, "Preview : " + tWidth + "x" + tHeight); }
public void onUpdateCalculate(ref DAGMask m) { //convert the mask to a picture box if (m == null) { return; } Bitmap bmp = new Bitmap(m.Width, m.Height, PixelFormat.Format24bppRgb); for (int x = 0; x < m.Width; x++) { for (int y = 0; y < m.Height; y++) { float clampK = m[x, y]; if (clampK < 0) { clampK = 0; } if (clampK > 1) { clampK = 1; } byte bc = (byte)(clampK * byte.MaxValue); Color col; if (mColorsImage == null) { col = Color.FromArgb(255, bc, bc, bc); } else { col = mColorsImage.GetPixel(bc, mColorLineIndex); } bmp.SetPixel(x, y, col); } } pictureBox1.Image = bmp; }
private void toolStripButton5_Click(object sender, EventArgs e) { int tWidth = TerrainGlobals.getTerrain().getNumXVerts(); int tHeight = TerrainGlobals.getTerrain().getNumZVerts(); DAGMask resMask = canvasForm.execute(tWidth, tHeight); if (resMask == null) { MessageBox.Show("There was an error computing output"); return; } GraphBasedMask gbm = new GraphBasedMask(); bool ok = canvasForm.saveCanvasToMemoryStream(gbm.GraphMemStream); if (!ok) { MessageBox.Show("There was an error creating the mask memory stream"); return; } CoreGlobals.getEditorMain().mIMaskPickerUI.AddMaskToList(gbm, "GraphMask" + CoreGlobals.getEditorMain().mIMaskPickerUI.GetNumMasks()); }