-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainPage.xaml.cpp
593 lines (511 loc) · 19.4 KB
/
MainPage.xaml.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include <amp.h>
#include <windows.h>
#include <ppl.h>
#include "MainPage.xaml.h"
#include <robuffer.h>
#include <amp_math.h>
#define TO_XY(idnx, minX, minY, disX, disY, height, width) \
double y = ((idnx / width) / (height - 1)) * disY + minY, x = ((idnx % (int)width) / (width - 1)) * disX + minX;
#define FROM_XY(x, y, minX, minY, disX, disY, height, width) \
int idx = (int)(((y - minY) * (height - 1) / disY * width) + ((x - minX) * (width - 1) / disX));
#define ROTATE_BY__90_N(n) for(int i =0; i < n; i++) { double t = x; x = -y; y = t; }
#define ROTATE_BY_ANGLE(a) double t = cos(a)*x -sin(a)*y; y = sin(a)*x + cos(a)*y; x = t;
#define FLIP(H, V) x = H ? -x : x; y = V ? -y : y;
using namespace mandelbrot;
using namespace Platform;
using namespace concurrency::precise_math;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::Graphics::Imaging;
using namespace Windows::UI::Input::Inking;
using namespace Windows::UI::Input;
using namespace Windows::Storage;
using namespace Windows::Storage::Streams;
using namespace Windows::UI::Xaml::Navigation;
using namespace Concurrency;
using namespace concurrency;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
MainPage::MainPage()
{
InitializeComponent();
minP = Windows::Foundation::Point(-2, -2);
maxP = Windows::Foundation::Point(2, 2);
resP = Windows::Foundation::Point(800, 800);
TimeSpan tickDelay = TimeSpan();
tickDelay.Duration = 2;
this->Animator->Interval = tickDelay;
this->Animator->Tick += ref new Windows::Foundation::EventHandler<Platform::Object^>(this, &mandelbrot::MainPage::OnTick);
}
byte* mandelbrot::MainPage::GetPointerToPixelData(IBuffer^ buffer)
{
Platform::Object^ obj = buffer;
Microsoft::WRL::ComPtr<IInspectable> insp(reinterpret_cast<IInspectable*>(obj));
Microsoft::WRL::ComPtr<IBufferByteAccess> bufferByteAccess;
insp.As(&bufferByteAccess);
byte* pixels = nullptr;
bufferByteAccess->Buffer(&pixels);
return pixels;
}
double power(double d, int n) restrict(amp) {
double r = 1;
while (n--) r *= d;
return r;
}
double abs(double a) restrict(amp) {
return a > 0 ? a : -a;
}
double norm(double a, double m, double n) restrict(amp) {
return (a - m) / (m - n);
}
double fmod(double a, int m) restrict(amp) {
int n = (int)a;
int r = n % m;
return (a - n) + r;
}
void mandelbrot::MainPage::play_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->play->IsEnabled = false;
this->pause->IsEnabled = true;
if (!this->isAnimating) {
this->Animator->Start();
this->isAnimating = true;
}
}
void mandelbrot::MainPage::updateConcurrent()
{
double width = this->resP.X, height = this->resP.Y;
auto wb = ref new Imaging::WriteableBitmap(width, height);
byte* imageArray = GetPointerToPixelData(wb->PixelBuffer);
int len = (int)width * height;
double minX = minP.X, maxY = maxP.Y,
minY = minP.Y, maxX = maxP.X,
disX = disP.X, disY = disP.Y,
lim = this->limit , max = this->max,
alpha = this->alpha, beta = this->beta;
int fractalIndex = this->FractalChosen;
int* holder = new int[len]; int multiJulia = this->powerMJ;
memset(holder, 0, len * sizeof(int));
array_view<int, 1> textureView(len,holder);
bool has_red = this->Red->IsChecked->Value,
has_green = this->Green->IsChecked->Value,
has_blue = this->Blue->IsChecked->Value,
isSmooth = this->smoother->IsOn ? 1 : 0;
int alphaSrc = this->alphaRgb->Value, color_mode = this->RGBM->IsChecked->Value ? 0 : this->HSLM->IsChecked->Value? 1:2, alphaVal = 255, rotations = this->angle;
bool FlipV = this->vertFlip; bool FlipH = this->horizFlip;
concurrency::parallel_for_each(textureView.extent, [=](index<1> idx) restrict(amp)
{
int idnx = idx[0];
TO_XY(idnx, minX, minY, disX, disY, height, width);
auto Color = [](int mode, bool isContinuous, int reached, bool has_r, bool has_g, bool has_b, int is_a, double x_n, double y_n, double lim, int maxiter) {
if (mode == 0) {
if (!isContinuous) {
int b = ((has_b ? reached : 0) % 16 * 16)
, g = ((has_g ? reached : 0) % 8 * 32)
, r = ((has_r ? reached : 0) % 4 * 64)
, a = is_a & 0x0ff;
return ((a & 0x0ff) << 24) | ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff);
}
else {
int ColoringIndex = reached - log((x_n * x_n + y_n * y_n)) / log(lim);
int b = (has_b ? sin(0.010 * ColoringIndex + 1) * 230 + 25 : 0)
, g = (has_g ? sin(0.013 * ColoringIndex + 2) * 230 + 25 : 0)
, r = (has_r ? sin(0.016 * ColoringIndex + 4) * 230 + 25 : 0)
, a = is_a & 0x0ff;
return ((a & 0x0ff) << 24) | ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff);
}
}
else if (mode == 1) {
double counter = (double)(reached - maxiter)/(0 - maxiter);
float H = counter * 360, S = counter * 100, V = counter * 100;
float s = S / 100, v = V / 100, C = s * v, X = C * (1 - abs(fmod(H / 60.0, 2) - 1)), m = v - C;
float r = 0, g = 0, b = 0;
if (H >= 0 && H < 60) {
r = C, g = X, b = 0;
}
else if (H >= 60 && H < 120) {
r = X, g = C, b = 0;
}
else if (H >= 120 && H < 180) {
r = 0, g = C, b = X;
}
else if (H >= 180 && H < 240) {
r = 0, g = X, b = C;
}
else if (H >= 240 && H < 300) {
r = X, g = 0, b = C;
}
else {
r = C, g = 0, b = X;
}
int red = has_b * (r + m) * 255;
int green = has_g * (g + m) * 255;
int blue = has_b * (b + m) * 255;
return ((is_a & 0x0ff) << 24) |
((red & 0x0ff) << 16) |
((green & 0x0ff) << 8) |
(blue & 0x0ff);
}
else if (mode == 2) {
if (!isContinuous) {
int b = 255 - ((has_b ? reached : 0) % 16 * 16), g = 255 - ((has_g ? reached : 0) % 8 * 32);
int r = 255 - ((has_r ? reached : 0) % 4 * 64), a = is_a & 0x0ff;
return ((a & 0x0ff) << 24) | ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff);
}
else {
int ColoringIndex = reached - log((x_n * x_n + y_n * y_n)) / log(lim);
int b = 255 - (has_b ? sin(0.010 * ColoringIndex + 1) * 230 + 25 : 0)
, g = 255 - (has_g ? sin(0.013 * ColoringIndex + 2) * 230 + 25 : 0)
, r = 255 - (has_r ? sin(0.016 * ColoringIndex + 4) * 230 + 25 : 0)
, a = 255 - is_a & 0x0ff;
return ((a & 0x0ff) << 24) | ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff);
}
}
};
double c_x, c_y, z_x, z_y;
int iter = 0, reached = 0;
ROTATE_BY_ANGLE(rotations * 3.141529 / 180);
FLIP(FlipH, FlipV)
if (fractalIndex == 0 || fractalIndex == 1) {
iter = 0;
switch (fractalIndex) {
case 0:
c_x = x; c_y = y; z_x = alpha; z_y = beta; break;
case 1:
c_x = alpha; c_y = beta; z_x = x; z_y = y; break;
}
while (iter < max && (z_x * z_x) + (z_y * z_y) < lim) {
double x_temporary = z_x;
z_x = (z_x * z_x) - (z_y * z_y) + c_x;
z_y = (2 * x_temporary * z_y) + c_y;
iter++;
}
reached = iter;
textureView[idnx] = Color((int)color_mode, isSmooth, reached, has_red, has_green, has_blue, alphaSrc == 0 ? 255 : (255-(reached/10)%255) , z_x, z_y, lim, max);
}
else if (fractalIndex == 3 || fractalIndex == 4) {
double R = 1; iter = 0;
int n = multiJulia;
while (power(R, n) - R <= sqrt(x * x + y * y)) R++;
switch (fractalIndex)
{
case 3:
c_x = x; c_y = y; z_x = alpha; z_y = beta; break;
case 4:
c_x = alpha; c_y = beta; z_x = x; z_y = y; break;
}
while (z_x * z_x + z_y * z_y < R * R && iter < max)
{
double temprary = power((z_x * z_x + z_y * z_y), (n / 2));
double xtmp = temprary * cos(n * atan2(z_y, z_x)) + c_x;
z_y = temprary * sin(n * atan2(z_y, z_x)) + c_y;
z_x = xtmp;
iter++;
}
reached = iter;
textureView[idnx] = Color((int)color_mode, isSmooth, reached, has_red, has_green, has_blue, alphaSrc == 0 ? 255 : (255 - (reached / 10) % 255), z_x, z_y, lim, max);
}
else if (fractalIndex == 5 || fractalIndex == 6) {
switch (fractalIndex)
{
case 5:
c_x = x; c_y = y; z_x = alpha; z_y = beta; break;
case 6:
c_x = x; c_y = -y; z_x = x; z_y = -y; break;
}
while (z_x * z_x + z_y * z_y < lim && iter < max) {
double temp_x = z_x;
z_x = z_x * z_x - z_y * z_y - c_x;
z_y = 2 * abs(temp_x * z_y) - c_y;
iter++;
}
reached = iter;
textureView[idnx] = Color((int)color_mode, isSmooth, reached, has_red, has_green, has_blue, alphaSrc == 0 ? 255 : (255 - (reached / 10) % 255), z_x, z_y, lim, max);
}
else if (fractalIndex > 6 && fractalIndex < 12) {
c_x = x; c_y = y; z_x = alpha; z_y = beta;
switch (fractalIndex)
{
case 7:
case 8:
c_x = x; c_y = y; z_x = alpha; z_y = beta; break;
case 9:
c_x = x; c_y = -y; z_x = x; z_y = -y; break;
case 10:
c_x = x; c_y = -y; z_x = x; z_y = -y; break;
case 11:
c_x = x; c_y = -y; z_x = x; z_y = -y; break;
}
while (z_x * z_x + z_y * z_y < lim && iter < max) {
double temp_x = z_x;
z_x = z_x * z_x - z_y * z_y - c_x;
z_y = 2 * abs(temp_x * z_y) - c_y;
iter++;
}
reached = iter;
}
});
textureView.synchronize();
for (int i = 0; i < len*4; i+=4) {
for (int j = 0; j < 4; j++)
imageArray[i + j] = (holder[i / 4] >> (j * 8));
}
this->Board->Source = wb;
delete[] holder;
}
void mandelbrot::MainPage::translate(double dx, double dy)
{
double width = this->Board->Width;
double height = this->Board->Height;
double dx_ = -dx / ((width - 1)) * this->disP.X;
double dy_ = -dy / ((height - 1)) * this->disP.Y;
this->minP.X += dx_; this->minP.Y += dy_;
this->maxP.X += dx_; this->maxP.Y += dy_;
}
void mandelbrot::MainPage::Zoom(bool in)
{
Point zoom = Point(disP.X / 200, disP.Y / 200);
auto BinaryPoint = [](Point p1, Point p2, String^ s) {
if (s == "Add")
return Point(p2.X + p1.X, p2.Y + p1.Y);
else if (s == "Sub")
return Point(p1.X - p2.X, p1.Y - p2.Y);
};
this->minP = BinaryPoint(minP, zoom, in ? "Sub" : "Add");
this->maxP = BinaryPoint(maxP, zoom, in ? "Add" : "Sub");
}
void mandelbrot::MainPage::Board_PointerWheelChanged(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e)
{
Zoom(e->GetCurrentPoint(this)->Properties->MouseWheelDelta < 0);
updateConcurrent();
}
void mandelbrot::MainPage::Board_ManipulationDelta(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs^ e)
{
translate(e->Delta.Translation.X, e->Delta.Translation.Y);
updateConcurrent();
}
void mandelbrot::MainPage::MaxIter_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
this->max = dynamic_cast<Slider^>(sender)->Value;
}
void mandelbrot::MainPage::DivergenceLimit_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
this->limit = dynamic_cast<Slider^>(sender)->Value;
}
void mandelbrot::MainPage::Grid_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e)
{
double oldHeight = this->Board->Height;
double oldWidth = this->Board->Width;
this->Board->Height = this->ActualHeight;
this->Board->Width = this->ActualWidth;
this->BottomBar->Width = this->ActualWidth - 50;
updateConcurrent();
}
void mandelbrot::MainPage::MandelBrot_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->alphaV->Value = 0; this->betaV->Value = 0;
this->FractalChosen = 0;
updateConcurrent();
}
void mandelbrot::MainPage::JuliaSet_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->alphaV->Value = -0.1;this->betaV->Value = 0.35;
this->FractalChosen = 1;
updateConcurrent();
}
void mandelbrot::MainPage::OnTick(Platform::Object^ sender, Platform::Object^ args)
{
if (this->Animate->IsOn) {
Zoom(false);
}
else {
if (this->rndAlpha->IsChecked->Value) {
this->alphaV->Value += isReversingA ? -0.01 : 0.01;
}
if (this->rndBeta->IsChecked->Value) {
this->betaV->Value += isReversingB ? -0.01 : 0.01;
}
if (!this->rndBeta->IsChecked->Value && !this->rndAlpha->IsChecked->Value) {
int mode = rand() % 2;
this->betaV->Value += mode * (isReversingB ? -0.01 : 0.01);
this->alphaV->Value += mode * (isReversingA ? -0.01 : 0.01);
}
if (this->betaV->Value >= 1) {
this->isReversingB = true;
}
else if (this->betaV->Value <= -1) {
this->isReversingB = false;
}
if (this->alphaV->Value >= 1) {
this->isReversingA = true;
}
else if (this->alphaV->Value <= -1) {
this->isReversingA = false;
}
}
updateConcurrent();
}
void mandelbrot::MainPage::Nthpower_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
this->alphaV->Value = 0;this->betaV->Value = 0;
if (this->FractalChosen == 3) {
this->powerMJ = dynamic_cast<Slider^>(sender)->Value;
updateConcurrent();
}
}
void mandelbrot::MainPage::Beta_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
this->alpha = dynamic_cast<Slider^>(sender)->Value;
}
void mandelbrot::MainPage::Alpha_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
this->beta = dynamic_cast<Slider^>(sender)->Value;
}
void mandelbrot::MainPage::Multilia_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->alphaV->Value = 0.564; this->betaV->Value = 0;
this->FractalChosen = 4;
updateConcurrent();
}
void mandelbrot::MainPage::Multibrot_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->alphaV->Value = 0; this->betaV->Value = 0;
this->FractalChosen = 3;
updateConcurrent();
}
void mandelbrot::MainPage::BurningShip_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->FractalChosen = 6;
updateConcurrent();
}
void mandelbrot::MainPage::DuckFractals_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->alphaV->Value = -0.1; this->betaV->Value = 0.35;
this->FractalChosen = 5;
updateConcurrent();
}
void mandelbrot::MainPage::reset_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->play->IsEnabled = true;
this->pause->IsEnabled = false;
minP = Windows::Foundation::Point(-2, -2);
maxP = Windows::Foundation::Point(2, 2);
this->alphaV->Value = -0.1;
this->betaV->Value = 0.1;
this->Animator->Stop();
this->isAnimating = false;
updateConcurrent();
}
void mandelbrot::MainPage::ResolutionX_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
resP = Windows::Foundation::Point((int)dynamic_cast<Slider^>(sender)->Value, resP.Y);
}
void mandelbrot::MainPage::ResolutionY_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
resP = Windows::Foundation::Point(resP.X, (int)dynamic_cast<Slider^>(sender)->Value);
}
void mandelbrot::MainPage::ratio_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
if (dynamic_cast<CheckBox^>(sender)->IsChecked->Value) {
this->Resolution->Visibility = Windows::UI::Xaml::Visibility::Visible;
this->XYContainer->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
else {
this->Resolution->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
this->XYContainer->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
}
void mandelbrot::MainPage::Resolution_ValueChanged_1(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
double ratioX = (double)resP.X / resP.Y; int wid = (int)(dynamic_cast<Slider^>(sender)->Value* ratioX);
double ratioY = (double)resP.Y / resP.X; int hei = (int)(dynamic_cast<Slider^>(sender)->Value* ratioY);
if (this->ResolutionX != nullptr && this->ResolutionY != nullptr)
{ this->ResolutionX->Value = wid; this->ResolutionY->Value = hei;}
}
void mandelbrot::MainPage::pause_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->play->IsEnabled = true;
this->pause->IsEnabled = false;
if (this->isAnimating) {
this->Animator->Stop();
this->isAnimating = false;
}
}
void mandelbrot::MainPage::Zoom_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
Slider^ holder = dynamic_cast<Slider^>(sender);
int middle = (holder->Maximum + holder->Minimum) / 2;
if (holder->Value > middle) {
Zoom(true);
updateConcurrent();
}
else if (holder->Value < middle) {
Zoom(false);
updateConcurrent();
}
holder->Value = middle;
}
void mandelbrot::MainPage::alphaRgb_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
Slider^ holder = dynamic_cast<Slider^>(sender);
if (holder->Value == 0) {
holder->Header = "Alpha From : fixed Value 255";
}
else if (holder->Value == 1) {
holder->Header = "Alpha From : Value Iterations";
}
else if (holder->Value == -1) {
holder->Header = "Alpha From : Random Value";
}
}
void mandelbrot::MainPage::rotator_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{
this->angle = (int)(dynamic_cast<Slider^>(sender)->Value);
this->rotation = this->angle % 90;
updateConcurrent();
}
void mandelbrot::MainPage::FlipVertical_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->horizFlip = !this->horizFlip;
updateConcurrent();
}
void mandelbrot::MainPage::FlipHorizontal_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->vertFlip = !vertFlip;
updateConcurrent();
}
void mandelbrot::MainPage::RotateRight_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->DiscreteRotation = (++this->rotation) % 4;
updateConcurrent();
}
void mandelbrot::MainPage::RotateLeft_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->DiscreteRotation = (--this->rotation) < 0 ? 3 : this->rotation;
updateConcurrent();
}
void mandelbrot::MainPage::NewtonFrac_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
}
void mandelbrot::MainPage::WobblyFrac_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
}
void mandelbrot::MainPage::AtomicFrac_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
}
void mandelbrot::MainPage::CellularFrac_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
}
void mandelbrot::MainPage::CustomFractal_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
}