-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFlipBookExample.dib
45 lines (25 loc) · 1.1 KB
/
FlipBookExample.dib
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
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!markdown
# FlipBook Example
This [polyglot notebook](https://github.com/dotnet/interactive) demonstrates how a FlipBook viewer can be generated from C# and displayed in a Jupyter notebook within VS Code.
First, we load the SimpleImageIO package and output the required JavaScript code.
#!csharp
#r "nuget: SimpleImageIO"
#!markdown
Next, we generate some test images and display them with default settings.
#!csharp
var red = new RgbImage(600, 400);
red.Fill(0.3f, 0.03f, 0.05f);
var blue = new RgbImage(600, 400);
blue.Fill(0.03f, 0.3f, 0.7f);
blue[50,50] = new(100,200,10);
FlipBook.New + ("blue", blue) + ("red", red)
#!markdown
You can save the output to a static .html page via the `Save(filename)` utility method.
#!csharp
FlipBook.New.Add("blue", blue).Add("red", red).Save("test.html")
#!markdown
The size of the FlipBook can be specified as an argument to the constructor, as done below, or via the Resize() method of the fluent API.
#!csharp
new FlipBook(900, 800) + ("blue", blue) + ("red", red)