public static int Main() { XD x = F; XD y = Lib.GetDelegate(); return(x() + y() + 64); }
private static XDocument GetDimensionsXml(string dimensionXmlFilePath) { XD xd; using (var xmlReader = XmlReader.Create(new StreamReader(dimensionXmlFilePath, Encoding.UTF8))) // Encoding.GetEncoding("utf-8")))) { xd = XD.Load(xmlReader); } return(xd); }
private void ShowHistogramTransformed_OnClick(object sender, RoutedEventArgs e) { try { new Histogram(this._transformedImage, "przetworzonego").Show(); } catch (Exception XD) { MessageBox.Show(XD.Message, XD.GetType().ToString()); } }
private void ShowHistogramOriginal_OnClick(object sender, RoutedEventArgs e) { try { new Histogram(this._originalImage, "oryginalnego").Show(); } catch (Exception XD) { MessageBox.Show(XD.Message, XD.GetType().ToString()); } }
private void DodajObraz_OnClick(object sender, RoutedEventArgs e) { try { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.ShowDialog(); _originalImage = new BitmapImage(new Uri(openFileDialog.FileName)); OriginalImage.Source = _originalImage; } catch (Exception XD) { MessageBox.Show(XD.Message, XD.GetType().ToString()); } }
private void Save_OnClick(object sender, RoutedEventArgs e) { try { SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = "PNG Image|*.png|JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif" }; saveFileDialog.ShowDialog(); Uri uri = new Uri(saveFileDialog.FileName); SaveImage(_transformedImage, uri.AbsolutePath); } catch (Exception XD) { MessageBox.Show(XD.Message, XD.GetType().ToString()); } }
private void AddRootNode() { _catFeedXml = new XD(new XDeclaration("1.0", "utf-8", null)); _feedElement = new XE(_gNsAtom + "feed", new object[] { new XA(XN.Xmlns + "g", _gNsG), new XA(XN.Xmlns + "c", _gNsC), new XA(XN.Xmlns + "gd", _gNs) }); var titleElement = new XE(_gNsAtom + "title", "Category Feed XML"); var nameElement = new XE(_gNsAtom + "name", "TEST Feed"); var authorElement = new XE(_gNsAtom + "author", nameElement); var idElement = new XE(_gNsAtom + "id", string.Format("tag:indigo.ca,{0}:/support/products", DateTime.Now.ToString(DateTime.Now.ToString("yy-MM-dd")))); _feedElement.Add(new object[] { titleElement, authorElement, idElement }); }
private void TransformObraz_OnClick(object sender, RoutedEventArgs e) { try { //validation new Validate(Int32.Parse(ElemWidth.Text), Int32.Parse(ElemHeight.Text), Int32.Parse(CentrPntX.Text), Int32.Parse(CentrPntY.Text)).validate(); //preparing image //byte[] imageBytes = Converter.BitmapImageToBytes(_originalImage); // Bitmap bitmap = Converter.BitmapImage2Bitmap(_originalImage); // byte[] imageBytes = Converter.BitmapToBytes(bitmap); // byte[] imageHeader = Converter.GetHeader(_originalImage); int size = Converter.GetSize(_originalImage); int width = _originalImage.PixelWidth; int height = _originalImage.PixelHeight; // IntPtr imagePtr = Converter.BitmapImageToIntPtr(_originalImage); Params parameters = new Params( width, height, Int32.Parse(ElemWidth.Text), Int32.Parse(ElemHeight.Text), Int32.Parse(CentrPntX.Text), Int32.Parse(CentrPntY.Text), Int32.Parse(Threads.Text), AsmButton.IsChecked ); //sprawdzenie rozdzielenia i połączenia od razu /*List<ThreadsManaging.IntPtrWithSize> intPtrs = ThreadsManaging.SplitImage(_originalImage, Int32.Parse(Threads.Text)); * BitmapImage hejBitmapImage = ThreadsManaging.MergeImage(intPtrs, height); * //IntPtr imagePtr = Converter.BitmapImageToIntPtr(hejBitmapImage); * //int width = Converter.GetWidth(_originalImage); * //int height = Converter.GetHeight(_originalImage); * _transformedImage = hejBitmapImage; * TranformedImage.Source = hejBitmapImage; * return;*/ //sprawdzanie podziału /*List<ThreadsManaging.IntPtrWithSize> intPtrs = ThreadsManaging.SplitImage(_originalImage, Int32.Parse(Threads.Text)); * OriginalImage_Copy.Source = Converter.IntPtrToBitmapImage(intPtrs[0].GetPtr(), intPtrs[0].GetSize(), intPtrs[0].GetWidth(), 10); * OriginalImage_Copy1.Source = Converter.IntPtrToBitmapImage(intPtrs[1].GetPtr(), intPtrs[1].GetSize(), intPtrs[1].GetWidth(), 10); * OriginalImage_Copy2.Source = Converter.IntPtrToBitmapImage(intPtrs[2].GetPtr(), intPtrs[2].GetSize(), intPtrs[2].GetWidth(), 10); * return;*/ ThreadsManaging action = new ThreadsManaging(_originalImage, parameters); //pomiar czasu Stopwatch watch = new Stopwatch(); watch.Start(); //operation action.start(); watch.Stop(); speed.Text = ((((double)watch.ElapsedTicks) / ((double)Stopwatch.Frequency)) * 1000 * 1000) + " \u00b5s"; //displaying // BitmapImage transformedImage = Converter.IntPtrToBitmapImage(transformedIntPtrBytes, size, imageHeader); // _transformedImage = transformedImage; // BitmapSource transformedImage = MakeBitmapSource.FromNativePointer(transformedIntPtrBytes, // width, height, 1); // _transformedImage = Converter.BitmapSourceToBitmapImage(transformedImage); // byte[] tranformedBytes = Converter.IntPtrToBytes(transformedIntPtrBytes, size); // Bitmap transformedBitmap = Converter.BytesToBitmap(tranformedBytes, width, height); //BitmapImage transformedImage = //Converter.IntPtrToBitmapImage(transformedIntPtrBytes, size, width, height); BitmapImage transformedImage = action.GetResult(); _transformedImage = transformedImage; TranformedImage.Source = transformedImage; } catch (Exception XD) { MessageBox.Show(XD.Message, XD.GetType().ToString()); } }
public void performOperation(Object image) { try { ImageWithIndex im = (ImageWithIndex)image; //IntPtr transformedImage = Marshal.AllocHGlobal(im.image); //c function if (!(bool)parameters.Function) { dilatationC(im.image, this.transformedImages[im.index], im.extraWidth, parameters.ImageHeight, parameters.ElemWidth, parameters.ElemHeight, parameters.CentrPntX, parameters.CentrPntY); } //asm function else { dilatationAsm(im.image, this.transformedImages[im.index], im.extraWidth, parameters.ImageHeight, parameters.ElemWidth, parameters.ElemHeight, parameters.CentrPntX, parameters.CentrPntY); } Marshal.FreeHGlobal(im.image); } catch (AccessViolationException error) { MessageBox.Show("Wątek nr " + Thread.CurrentThread.Name + ": " + error.Message, error.GetType().ToString()); } catch (Exception XD) { MessageBox.Show("Wątek nr " + Thread.CurrentThread.Name + ": " + XD.Message, XD.GetType().ToString()); } }