void apply() { cleanMap(); mRootNode.apply(); Masking.clearSelectionMask(); }
private void FromClipboardButton_Click(object sender, EventArgs e) { try { IDataObject id = Clipboard.GetDataObject(); string[] formats; if (id != null) { formats = id.GetFormats(); } System.Drawing.Image clipboardImage = null; if (Clipboard.ContainsImage()) { clipboardImage = Clipboard.GetImage(); MaskItem item = new MaskItem(); item.mMask = Masking.CreateMask(clipboardImage); MaskCheckList.Items.Add(item, false); Masking.setCurrSelectionMaskWeights(item.mMask.Clone()); } } catch { MessageBox.Show("Error importing image from clipboard. Image must be 24bpp RGB"); } }
protected override void OnDetaching() { Masking.SetMask(attachedTextBox, null); attachedTextBox = null; base.OnDetaching(); }
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; }
public void ReadTex(string graphicsName) { List <byte> byteList = new List <byte>(); FileStream fileStream = new FileStream("ShaGResource.tcd", FileMode.Open, FileAccess.Read); if (!this.parent.Tex.ContainsKey(graphicsName)) { int num1 = 0; fileStream.Position = Textures.texSizeList[graphicsName][0]; int num2; for (int index = Textures.texSizeList[graphicsName][1]; (num2 = fileStream.ReadByte()) != -1 && num1 < index - 1; ++num1) { byte code = (byte)num2; if (num1 > 1024) { byteList.Add(code); } else { byteList.Add(Masking.DecryptByte(code)); } } Stream Memory = new MemoryStream(byteList.ToArray()); try { this.parent.Tex.Add(graphicsName, new SlimTex(Memory, Usage.None)); } catch { } } fileStream.Close(); fileStream.Dispose(); }
private void btnMasking_Click(object sender, EventArgs e) { Masking masking = new Masking(); masking.MaskName("김경남"); masking.MaskCard("1234=8764-0987-9878"); masking.MaskRrn("730301-1193833"); }
private void button2_Click(object sender, EventArgs e) { Masking.clearSelectionMask(); float angleVal = (float)(trackBar1.Maximum - trackBar1.Value) / (float)trackBar1.Maximum; float range = 0.1f + (float)((trackBar2.Value)) / (float)trackBar1.Maximum; Masking.createSelectionMaskFromTerrain(-100, 100, angleVal, range); this.Close(); }
private void ToClipboardButton_Click(object sender, EventArgs e) { Image tosave = Masking.ExportMask(Masking.getCurrSelectionMaskWeights()); if (tosave != null) { Clipboard.Clear(); Clipboard.SetImage(tosave); } }
//////////////////////////////// private void SaveCurrentButton_Click(object sender, EventArgs e) { if (CoreGlobals.getEditorMain().mPhoenixScenarioEditor.CheckTopicPermission("Masks") == false) { return; } string saveName = CurrentMaskNameTextBox.Text; AddMaskToList(Masking.getCurrSelectionMaskWeights().Clone(), saveName); }
private void button7_Click(object sender, EventArgs e) { float value = (float)this.ScaleAmountSliderControl.NumericValue; bool addorpercent = this.ScaleAddCheckBox.Checked; if (addorpercent == false) { value += 1.0f; } Masking.scaleSelection(value, addorpercent); }
public List <Masking> GetEntities() { var entities = new List <Masking>(); using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Rs.Sql_Masking_Repository_GetEntities, null)) { while (rdr.Read()) { var entity = new Masking(); entity.Id = SqlTypeConverter.DBNullStringHandler(rdr["Id"]); entity.Type = SqlTypeConverter.DBNullEnmMaskTypeHandler(rdr["Type"]); entities.Add(entity); } } return(entities); }
private void ToFileButton_Click(object sender, EventArgs e) { SaveFileDialog d = new SaveFileDialog(); d.Filter = "Raw32 (*.r32)|*.r32"; if (d.ShowDialog() == DialogResult.OK) { BinaryWriter w = new BinaryWriter(File.OpenWrite(d.FileName)); IMask mask = Masking.getCurrSelectionMaskWeights(); long max = TerrainGlobals.getTerrain().getNumXVerts() * TerrainGlobals.getTerrain().getNumXVerts(); for (long i = 0; i < max; i++) { w.Write(mask.GetMaskWeight(i)); } w.Close(); } }
public void apply() { Masking.clearSelectionMask(); mMask.loadAndExecute(); long index; float value; mMask.ResetIterator(); while (mMask.MoveNext(out index, out value)) { Masking.addSelectedVert(index, value); } Masking.rebuildVisualsAfterSelection(); }
public void Tex() { string path = "ShaGPattern.tcd"; if (!File.Exists(path)) { return; } StreamReader streamReader = new StreamReader(path, Encoding.GetEncoding("Shift_JIS")); RijndaelManaged rijndaelManaged = new RijndaelManaged(); Masking.GenerateKeyFromPassword("sasanasi", rijndaelManaged.KeySize, out byte[] key, rijndaelManaged.BlockSize, out byte[] iv); FileStream fileStream = new FileStream("ShaGResource.tcd", FileMode.Open, FileAccess.Read); int num1 = 0; string sourceString; while ((sourceString = streamReader.ReadLine()) != null) { List <byte> byteList = new List <byte>(); string message = Masking.DecryptString(sourceString, "sasanasi"); string[] strArray = message.Split('_'); int num2 = int.Parse(strArray[1]); if (!File.Exists(path)) { return; } int num3 = num2; Textures.texSizeList.Add(strArray[0], new int[2] { num1, int.Parse(strArray[1]) }); num1 += num3; this.ProgressUpdated?.Invoke(this, new TextureLoadProgressUpdatedEventArgs(strArray[0], (double)num1 / fileStream.Length)); } fileStream.Close(); streamReader.Close(); for (int index = 0; index < this.parent.KeepTexList.Length; ++index) { this.ReadTex(this.parent.KeepTexList[index]); } this.ProgressUpdated?.Invoke(this, null); }
private IMask AddMasks(List <IMask> inputs) { IMask mask = MaskFactory.GetNewMask(); foreach (IMask input in inputs) { if (input is GraphBasedMask) { ((GraphBasedMask)input).loadAndExecute(); } float destVal; long index; float value; input.ResetIterator(); while (input.MoveNext(out index, out value)) { float baseValue = 1.0f; if (Masking.checkBaseWritePermission(index, out baseValue) == false) { continue; } if (value == 0) { continue; } destVal = mask.GetMaskWeight(index); //if (destVal == 0) continue; destVal = value + destVal; if (destVal > 1) { destVal = 1; } destVal = Masking.combineValueWithBaseMask(baseValue, destVal); mask.SetMaskWeight(index, destVal); } } return(mask); }
private void MaskCheckList_ItemCheck(object sender, ItemCheckEventArgs e) { List <IMask> masks = new List <IMask>(); MaskItem mClickedItem = null; mClickedItem = ((MaskItem)MaskCheckList.Items[e.Index]); if (e.NewValue == CheckState.Checked) { masks.Add(mClickedItem.mMask); //betterPropertyGrid1.SelectedObject = mClickedItem; //DeleteLinkLabel.Enabled = true; //SaveLinkLabel.Enabled = true; CurrentMaskNameTextBox.Text = mClickedItem.Name; } else { //betterPropertyGrid1.SelectedObject = null; //DeleteLinkLabel.Enabled = false; //SaveLinkLabel.Enabled = false; } foreach (MaskItem m in MaskCheckList.CheckedItems) { if (mClickedItem != m) { masks.Add(m.mMask); } } if (masks.Count > 0) { Masking.setCurrSelectionMaskWeights(AddMasks(masks)); } else { Masking.setCurrSelectionMaskWeights(MaskFactory.GetNewMask()); } }
public async Task <Result <PaymentId> > ProcessAsync(ValidPaymentRequest request) { var authorizationRequest = await _bankClient.CreateBankRequestAsync(request); var authorizationResult = await _bankClient.AuthorizeAsync(authorizationRequest); var paymentId = PaymentId.GenerateNew(); var payment = new Payment( paymentId: paymentId, cardNumber: Masking.GetMask(request.CardNumber), amount: request.Amount, currency: request.Currency, operationDate: DateTimeOffset.UtcNow, bankAuthorizationResult: authorizationResult); await _repository.PutAsync(payment); return(authorizationResult.IsSuccess ? Result <PaymentId> .CreateSuccess(paymentId) : Result <PaymentId> .CreateFailure(paymentId)); }
private void ContractSelection_Click(object sender, EventArgs e) { Masking.contractSelection(trackBar1.Value); }
private void ImportMaskButton_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "Image (*.bmp)|*.bmp|Raw32 (*.r32)|*.r32"; if (d.ShowDialog() == DialogResult.OK) { string tName = Path.GetFileNameWithoutExtension(d.FileName); bool okToLoad = true; for (int i = 0; i < MaskCheckList.Items.Count; i++) { MaskItem mi = MaskCheckList.Items[i] as MaskItem; if (Path.GetFileNameWithoutExtension(mi.Name) == tName) { if (MessageBox.Show("There exists a similar mask name already loaded. Would you still like to import this mask?", "Warning!", MessageBoxButtons.YesNo) != DialogResult.Yes) { okToLoad = false; } break; } } if (!okToLoad) { return; } if (Path.GetExtension(d.FileName.ToLower()) == ".bmp") { Image loadedImage = Masking.GetScaledImageFromFile(d.FileName, TerrainGlobals.getTerrain().getNumXVerts(), TerrainGlobals.getTerrain().getNumZVerts()); MaskItem item = new MaskItem(); item.Name = Path.GetFileName(d.FileName); item.mMask = Masking.CreateMask(loadedImage); MaskCheckList.Items.Add(item, false); Masking.setCurrSelectionMaskWeights(item.mMask.Clone()); } else if (Path.GetExtension(d.FileName.ToLower()) == ".r32") { MaskItem item = new MaskItem(); item.Name = Path.GetFileName(d.FileName); item.mMask = MaskFactory.GetNewMask(); BinaryReader r = new BinaryReader(File.OpenRead(d.FileName)); long index = 0; try { while (true) { item.mMask.SetMaskWeight(index, r.ReadSingle()); index++; } } catch (System.IO.EndOfStreamException ex) { ex.ToString(); } if (scaleToFitCheckbox.Checked) { //rescale this mask to fit current terrain int numX = (int)Math.Sqrt(index); float[] img = new float[numX * numX]; long id; float value; item.mMask.ResetIterator(); while (item.mMask.MoveNext(out id, out value)) { if (value == 0) { continue; } img[id] = value; } int newWidth = TerrainGlobals.getTerrain().getNumXVerts(); float[] outImg = ImageManipulation.resizeF32Img(img, numX, numX, newWidth, newWidth, ImageManipulation.eFilterType.cFilter_Linear); item.mMask.Clear(); for (index = 0; index < newWidth * newWidth; index++) { item.mMask.SetMaskWeight(index, outImg[index]); } } MaskCheckList.Items.Add(item, false); Masking.setCurrSelectionMaskWeights(item.mMask.Clone()); r.Close(); } } //ImageSourcePicker picker = new ImageSourcePicker(); //picker.ImageSelected += new EventHandler(picker_ImageSelected); //PopupEditor editor = new PopupEditor(); //editor.ShowPopup(this, picker); }
private void DetectEdges_Click(object sender, EventArgs e) { Masking.detectEdges(); }
private void MaskTextureButton_Click_1(object sender, EventArgs e) { Masking.MaskCurrentTexture(this.DisplacementFadeCheckBox.Checked); }
private void ClearBaseButton_Click(object sender, EventArgs e) { Masking.clearBaseMaskingMask(); }
private void SetAsCurrentButton_Click(object sender, EventArgs e) { Masking.setBaseMaskToCurrent(); }
private void ClearCurrentButton_Click(object sender, EventArgs e) { CurrentMaskNameTextBox.Text = "NewMaskName"; Masking.clearSelectionMask(); }
private void SetAsBaseButton_Click(object sender, EventArgs e) { Masking.setCurrentMaskToBase(); }
private void SmoothFilter_Click(object sender, EventArgs e) { Masking.smoothFilter(); }
private void UpdateComponentMasking() { UpdateComponentMaskingSettings(); Masking.createSelectionMaskFromTerrain(TerrainGlobals.getEditor().mComponentMaskSettings); }
private void BlurSelection_Click(object sender, EventArgs e) { Masking.blurSelection(30 /*blurWidthTrackbar.Value*/, (float)(blurSigmaTrackbar.Value / 10.0f)); }
private void SharpenFilter_Click(object sender, EventArgs e) { Masking.sharpenFilter(); }
private void ExpandSelection_Click(object sender, EventArgs e) { Masking.expandSelection(trackBar1.Value); }