public SepiaThread(byte[] rgbValues, int length, int sepiaDeeth, CreateSepia_Delegate createSepia) { this.rgbValues = rgbValues; this.length = length; this.sepiaDeeth = sepiaDeeth; CreateSepia = createSepia; }
//Ładuje biblioteke asm void LoadFromAsm(byte[] bytes, int length, int deepth) { IntPtr Handle = LoadLibrary(@"../../../x64/Debug/AsmDll.dll"); IntPtr funcaddr = GetProcAddress(Handle, "CreateSepia"); CreateSepia_Delegate function = Marshal.GetDelegateForFunctionPointer(funcaddr, typeof(CreateSepia_Delegate)) as CreateSepia_Delegate; function.Invoke(bytes, length, deepth); }
//Przycisk uruchamiający algorytm private void Button_Generate(object sender, RoutedEventArgs e) { if (isFileGood == false) { MessageBox.Show("Nie wybrano zdjęcia"); return; } if (AsmRadio.IsChecked == true) { CreateSepia = LoadFromAsm; } else { CreateSepia = LoadFromCs; } Sepia(); }