public bool loadAndExecute() { if (mGraphMemoryStream == null) { return(false); } mGraphMemoryStream.Seek(0, SeekOrigin.Begin); int tWidth = CoreGlobals.getEditorMain().mITerrainShared.getNumXVerts(); int tHeight = CoreGlobals.getEditorMain().mITerrainShared.getNumXVerts(); DAGCanvas dg = new DAGCanvas(512, 512); dg.loadCanvasFromMemoryStream(mGraphMemoryStream); DAGMask resMask = dg.execute(tWidth, tHeight); if (resMask == null) { MessageBox.Show("There was an error computing Mask"); return(false); } mOutputMask = new ArrayBasedMask(mCapacity); for (int x = 0; x < tWidth; x++) { for (int y = 0; y < tHeight; y++) { mOutputMask.SetMaskWeight(x * tWidth + y, resMask[x, y]); } } dg.newCanvas(); dg = null; mGraphMemoryStream.Seek(0, SeekOrigin.Begin); return(true); }
public void init() { canvas = new DAGCanvas(this.Width, this.Height); }