diff --git a/samples/GraphicsWpf/Primitives/PandaGif.cs b/samples/Graphics/Primitives/PandaGif.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/PandaGif.cs
rename to samples/Graphics/Primitives/PandaGif.cs
diff --git a/samples/GraphicsWpf/Primitives/Primitives.nfproj b/samples/Graphics/Primitives/Primitives.nfproj
similarity index 69%
rename from samples/GraphicsWpf/Primitives/Primitives.nfproj
rename to samples/Graphics/Primitives/Primitives.nfproj
index ea0f83328..17e8b6b82 100644
--- a/samples/GraphicsWpf/Primitives/Primitives.nfproj
+++ b/samples/Graphics/Primitives/Primitives.nfproj
@@ -18,8 +18,12 @@
+
+
+
+
-
+
@@ -30,18 +34,18 @@
Resource.resx
-
+
-
+
@@ -57,34 +61,45 @@
-
- ..\packages\nanoFramework.CoreLibrary.1.5.1-preview.1\lib\mscorlib.dll
+
+ ..\packages\nanoFramework.CoreLibrary.1.7.2-preview.7\lib\mscorlib.dll
True
True
-
- ..\..\..\..\..\lib-nanoFramework.Graphics.Wpf\source\nanoFramework.Graphics.Wpf\bin\Debug\nanoFramework.Graphics.Wpf.dll
+
+ packages\nanoFramework.Graphics.1.0.0-preview.1\lib\nanoFramework.Graphics.dll
+ True
+ True
- ..\packages\nanoFramework.ResourceManager.1.0.0-preview.4\lib\nanoFramework.ResourceManager.dll
+ ..\packages\nanoFramework.ResourceManager.1.0.0-preview.14\lib\nanoFramework.ResourceManager.dll
True
True
-
- ..\packages\nanoFramework.Runtime.Events.1.4.1-preview.3\lib\nanoFramework.Runtime.Events.dll
+
+ ..\packages\nanoFramework.Runtime.Events.1.4.2-preview.7\lib\nanoFramework.Runtime.Events.dll
True
True
-
- ..\packages\nanoFramework.Runtime.Native.1.2.0-preview.7\lib\nanoFramework.Runtime.Native.dll
+
+ ..\packages\nanoFramework.Runtime.Native.1.2.1-preview.1\lib\nanoFramework.Runtime.Native.dll
True
True
-
- ..\packages\nanoFramework.System.Collections.1.0.0-preview.6\lib\nanoFramework.System.Collections.dll
+
+ ..\packages\nanoFramework.System.Collections.1.0.1-preview.6\lib\nanoFramework.System.Collections.dll
True
True
+
+ packages\nanoFramework.System.Math.1.2.0-preview.16\lib\System.Math.dll
+ True
+ True
+
+
+
+
+
diff --git a/samples/Graphics/Primitives/Primitives.sln b/samples/Graphics/Primitives/Primitives.sln
new file mode 100644
index 000000000..008123226
--- /dev/null
+++ b/samples/Graphics/Primitives/Primitives.sln
@@ -0,0 +1,27 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30011.22
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Primitives", "Primitives.nfproj", "{3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {26C3D99A-F38D-49F8-82D1-4B2C1CC359EA}
+ EndGlobalSection
+EndGlobal
diff --git a/samples/GraphicsWpf/Primitives/Program.cs b/samples/Graphics/Primitives/Program.cs
similarity index 65%
rename from samples/GraphicsWpf/Primitives/Program.cs
rename to samples/Graphics/Primitives/Program.cs
index b5d44c8d4..ade25c04a 100644
--- a/samples/GraphicsWpf/Primitives/Program.cs
+++ b/samples/Graphics/Primitives/Program.cs
@@ -1,8 +1,8 @@
-using System;
-using System.Threading;
+using System.Threading;
using nanoFramework.UI;
using Primitives.SimplePrimitives;
+
namespace Primitives
{
public class Program
@@ -12,48 +12,56 @@ public static void Main()
DisplayControl dc = new DisplayControl();
int height = dc.ShorterSide;
int width = dc.LongerSide;
- int bpp = dc.BitsPerPixel;
- int delayBetween = 3000;
+ int delayBetween = 1100;
+ DisplayOrientation orientation = (DisplayOrientation)dc.Orientation;
- Bitmap fullScreenBitmap = new Bitmap(width, height); // Use this bitmap as our output to the screen.
+ Bitmap fullScreenBitmap = new Bitmap(width, height); // Use this bitmap as our buffered output to the screen.
fullScreenBitmap.Clear();
- fullScreenBitmap.Flush();
- DisplayOrientation orientation = (DisplayOrientation)dc.Orientation;
+
Font DisplayFont = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);
while (true)
{
- SetPixels sp = new SetPixels(fullScreenBitmap, DisplayFont);
+ RandomDrawLine rdlt = new RandomDrawLine(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- FontExamples fe = new FontExamples(fullScreenBitmap);
+ RotateImage ri = new RotateImage(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- StretchImage si = new StretchImage(fullScreenBitmap, DisplayFont);
+ ColourGradient colourGradient = new ColourGradient(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- RandomDrawLine rdlt = new RandomDrawLine(fullScreenBitmap, DisplayFont);
+ Colours ColourExample = new Colours(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- TileImage ti = new TileImage(fullScreenBitmap, DisplayFont);
+ PagedText pt = new PagedText(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- RandomEllipses re = new RandomEllipses(fullScreenBitmap, DisplayFont);
+ BouncingBalls bb = new BouncingBalls(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- RandomRectangles rr = new RandomRectangles(fullScreenBitmap, DisplayFont);
+ TileImage ti = new TileImage(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- SliceScaling9 ss = new SliceScaling9(fullScreenBitmap, DisplayFont);
+ StretchImage si = new StretchImage(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
-
- RotateImage ri = new RotateImage(fullScreenBitmap, DisplayFont);
+
+ SetPixels sp = new SetPixels(fullScreenBitmap, DisplayFont);
+ Thread.Sleep(delayBetween);
+
+ FontExamples fe = new FontExamples(fullScreenBitmap);
+ Thread.Sleep(delayBetween);
+
+ RandomRectangles rr = new RandomRectangles(fullScreenBitmap, DisplayFont);
+ Thread.Sleep(delayBetween);
+
+ SliceScaling9 ss = new SliceScaling9(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- RandomClipping rc = new RandomClipping(fullScreenBitmap, DisplayFont);
+ RandomClipping rc = new RandomClipping(fullScreenBitmap, DisplayFont);
Thread.Sleep(delayBetween);
- MatrixRain mr = new MatrixRain(fullScreenBitmap, DisplayFont);
+ MatrixRain mr = new MatrixRain(fullScreenBitmap);
Thread.Sleep(Timeout.Infinite);
}
}
diff --git a/samples/GraphicsWpf/Primitives/Properties/AssemblyInfo.cs b/samples/Graphics/Primitives/Properties/AssemblyInfo.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Properties/AssemblyInfo.cs
rename to samples/Graphics/Primitives/Properties/AssemblyInfo.cs
diff --git a/samples/GraphicsWpf/Primitives/Resource.Designer.cs b/samples/Graphics/Primitives/Resource.Designer.cs
similarity index 85%
rename from samples/GraphicsWpf/Primitives/Resource.Designer.cs
rename to samples/Graphics/Primitives/Resource.Designer.cs
index 76dd73cc3..8b9dedb64 100644
--- a/samples/GraphicsWpf/Primitives/Resource.Designer.cs
+++ b/samples/Graphics/Primitives/Resource.Designer.cs
@@ -8,6 +8,9 @@
//
//------------------------------------------------------------------------------
+using nanoFramework.UI;
+using System;
+
namespace Primitives
{
@@ -25,6 +28,10 @@ internal static System.Resources.ResourceManager ResourceManager
return Resource.manager;
}
}
+ internal static nanoFramework.UI.Bitmap GetBitmap(Resource.BitmapResources id)
+ {
+ return ((nanoFramework.UI.Bitmap)(nanoFramework.Runtime.Native.ResourceUtility.GetObject(ResourceManager, id)));
+ }
internal static nanoFramework.UI.Font GetFont(Resource.FontResources id)
{
return ((nanoFramework.UI.Font)(nanoFramework.Runtime.Native.ResourceUtility.GetObject(ResourceManager, id)));
@@ -42,6 +49,7 @@ internal enum StringResources : short
strCourierRegular10 = 19139,
strSegoeUIRegular12 = 25622,
}
+
[System.SerializableAttribute()]
internal enum FontResources : short
{
@@ -52,5 +60,9 @@ internal enum FontResources : short
CourierRegular10 = 27752,
MatrixFont = 28174,
}
+ internal enum BitmapResources : short
+ {
+ }
+
}
}
diff --git a/samples/GraphicsWpf/Primitives/Resource.resx b/samples/Graphics/Primitives/Resource.resx
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resource.resx
rename to samples/Graphics/Primitives/Resource.resx
diff --git a/samples/GraphicsWpf/Primitives/Resources/MatrixFont.tinyfnt b/samples/Graphics/Primitives/Resources/MatrixFont.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/MatrixFont.tinyfnt
rename to samples/Graphics/Primitives/Resources/MatrixFont.tinyfnt
diff --git a/samples/Graphics/Primitives/Resources/SoccerBall.gif b/samples/Graphics/Primitives/Resources/SoccerBall.gif
new file mode 100644
index 000000000..dbe2398d3
Binary files /dev/null and b/samples/Graphics/Primitives/Resources/SoccerBall.gif differ
diff --git a/samples/GraphicsWpf/Primitives/Resources/comicsansms16.tinyfnt b/samples/Graphics/Primitives/Resources/comicsansms16.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/comicsansms16.tinyfnt
rename to samples/Graphics/Primitives/Resources/comicsansms16.tinyfnt
diff --git a/samples/GraphicsWpf/Primitives/Resources/courierregular10.tinyfnt b/samples/Graphics/Primitives/Resources/courierregular10.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/courierregular10.tinyfnt
rename to samples/Graphics/Primitives/Resources/courierregular10.tinyfnt
diff --git a/samples/GraphicsWpf/Primitives/Resources/nanoFramework-logo.png b/samples/Graphics/Primitives/Resources/nanoFramework-logo.png
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/nanoFramework-logo.png
rename to samples/Graphics/Primitives/Resources/nanoFramework-logo.png
diff --git a/samples/GraphicsWpf/Primitives/Resources/ninab.tinyfnt b/samples/Graphics/Primitives/Resources/ninab.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/ninab.tinyfnt
rename to samples/Graphics/Primitives/Resources/ninab.tinyfnt
diff --git a/samples/GraphicsWpf/Primitives/Resources/segoeuiregular12.tinyfnt b/samples/Graphics/Primitives/Resources/segoeuiregular12.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/segoeuiregular12.tinyfnt
rename to samples/Graphics/Primitives/Resources/segoeuiregular12.tinyfnt
diff --git a/samples/GraphicsWpf/Primitives/Resources/small.tinyfnt b/samples/Graphics/Primitives/Resources/small.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Resources/small.tinyfnt
rename to samples/Graphics/Primitives/Resources/small.tinyfnt
diff --git a/samples/Graphics/Primitives/Resources/waterfall_costa_rica.jpg b/samples/Graphics/Primitives/Resources/waterfall_costa_rica.jpg
new file mode 100644
index 000000000..a119521f6
Binary files /dev/null and b/samples/Graphics/Primitives/Resources/waterfall_costa_rica.jpg differ
diff --git a/samples/Graphics/Primitives/SimplePrimitives/BouncingBalls.cs b/samples/Graphics/Primitives/SimplePrimitives/BouncingBalls.cs
new file mode 100644
index 000000000..9b66e131f
--- /dev/null
+++ b/samples/Graphics/Primitives/SimplePrimitives/BouncingBalls.cs
@@ -0,0 +1,127 @@
+using nanoFramework.Presentation.Media;
+using nanoFramework.UI;
+using System;
+
+namespace Primitives.SimplePrimitives
+{
+ public class BouncingBalls
+ {
+ struct Rectangle
+ {
+ public int X;
+ public int Y;
+ public int Width;
+ public int Height;
+ public Rectangle(int x, int y, int width, int height)
+ {
+ this.X = x;
+ this.Y = y;
+ this.Width = width;
+ this.Height = height;
+ }
+ }
+ struct Point { public int X; public int Y; };
+ private Rectangle[] BallLocation;
+ private Point[] BallVelocity;
+ private Bitmap ScreenBitmap { get; set; }
+
+ public BouncingBalls(Bitmap fullScreenBitmap, Font DisplayFont)
+ {
+ ScreenBitmap = fullScreenBitmap;
+ SetupBalls();
+
+ for (int iCount = 0; iCount < 180; iCount++)
+ {
+ MoveBalls();
+ DrawBalls();
+ }
+
+ }
+ private void SetupBalls()
+ {
+ Random rand = new Random();
+ const int num_balls = 12;
+ int vx = 0;
+ int vy = 0;
+
+ BallLocation = new Rectangle[num_balls];
+ BallVelocity = new Point[num_balls];
+
+ for (int iBall = 0; iBall < num_balls; iBall++)
+ {
+ int width = rand.Next(3, 50);
+ BallLocation[iBall] = new Rectangle
+ {
+ X = rand.Next(0, ScreenBitmap.Width - 2 * width),
+ Y = rand.Next(0, ScreenBitmap.Height - 2 * width),
+ Width = width,
+ Height = width
+ };
+ // Setup 1/2 the balls with different speeds
+ if (iBall % 2 == 0)
+ {
+ vx = rand.Next(2, 10);
+ vy = rand.Next(2, 10);
+ }
+ else
+ {
+ vx = rand.Next(12, 25);
+ vy = rand.Next(12, 25);
+ }
+
+ // Setup random directions
+ if (rand.Next(0, 2) == 0) vx = -vx;
+ if (rand.Next(0, 2) == 0) vy = -vy;
+ BallVelocity[iBall] = new Point { X = vx, Y = vy };
+ }
+ }
+
+ private void MoveBalls()
+ {
+ for (int ball_num = 0;
+ ball_num < BallLocation.Length;
+ ball_num++)
+ {
+ // Move the ball.
+ int new_x = BallLocation[ball_num].X +
+ BallVelocity[ball_num].X;
+ int new_y = BallLocation[ball_num].Y +
+ BallVelocity[ball_num].Y;
+ if (new_x < 0)
+ {
+ BallVelocity[ball_num].X = -BallVelocity[ball_num].X;
+ }
+ else if (new_x + BallLocation[ball_num].Width > ScreenBitmap.Width)
+ {
+ BallVelocity[ball_num].X = -BallVelocity[ball_num].X;
+ }
+ if (new_y < 0)
+ {
+ BallVelocity[ball_num].Y = -BallVelocity[ball_num].Y;
+ }
+ else if (new_y + BallLocation[ball_num].Height > ScreenBitmap.Height)
+ {
+ BallVelocity[ball_num].Y = -BallVelocity[ball_num].Y;
+ }
+
+ BallLocation[ball_num] = new Rectangle(new_x, new_y,
+ BallLocation[ball_num].Width,
+ BallLocation[ball_num].Height);
+ }
+ }
+
+
+ private void DrawBalls()
+ {
+ ScreenBitmap.Clear();
+ for (int i = 0; i < BallLocation.Length; i++)
+ {
+ ScreenBitmap.DrawEllipse(Color.Yellow, 1, BallLocation[i].X, BallLocation[i].Y, BallLocation[i].Width, BallLocation[i].Height,
+ 0, 0, 0, 0, 0, 0, Bitmap.OpacityOpaque);
+ }
+ ScreenBitmap.Flush();
+ }
+ }
+}
+
+
diff --git a/samples/Graphics/Primitives/SimplePrimitives/ColourGradient.cs b/samples/Graphics/Primitives/SimplePrimitives/ColourGradient.cs
new file mode 100644
index 000000000..09d4754ef
--- /dev/null
+++ b/samples/Graphics/Primitives/SimplePrimitives/ColourGradient.cs
@@ -0,0 +1,25 @@
+using nanoFramework.Presentation.Media;
+using nanoFramework.UI;
+using System;
+
+namespace Primitives.SimplePrimitives
+{
+ public class ColourGradient
+ {
+ public ColourGradient(Bitmap fullScreenBitmap, Font DisplayFont)
+ {
+ fullScreenBitmap.DrawRectangle(Color.White, // outline color
+ 1, // outline thickness
+ 100, 100, // x and y of top left corner
+ 200, 100, // width and height
+ 0, 0, // x and y corner radius
+ Color.White, // gradient start color
+ 100, 100, // gradient start coordinates
+ Color.Black, // gradient end color
+ 100 + 200, 100 + 100, // gradient end coordinates
+ Bitmap.OpacityOpaque); // opacity
+ fullScreenBitmap.Flush();
+
+ }
+ }
+}
diff --git a/samples/Graphics/Primitives/SimplePrimitives/Colours.cs b/samples/Graphics/Primitives/SimplePrimitives/Colours.cs
new file mode 100644
index 000000000..0576e0a4d
--- /dev/null
+++ b/samples/Graphics/Primitives/SimplePrimitives/Colours.cs
@@ -0,0 +1,233 @@
+using nanoFramework.Presentation.Media;
+using nanoFramework.UI;
+using System;
+using System.Reflection;
+using System.Threading;
+
+namespace Primitives.SimplePrimitives
+{
+ public class Colours
+ {
+ private struct ColourAndName
+ {
+ public string Name;
+ public Color Colour;
+ public ColourAndName(string Name, Color Colour)
+ {
+ this.Name = Name;
+ this.Colour = Colour;
+ }
+ }
+ public Colours(Bitmap fullScreenBitmap, Font DisplayFont)
+ {
+ fullScreenBitmap.Clear();
+ Font fnt12 = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);
+ ColourAndName[] ColourTest = new ColourAndName[] { new ColourAndName("AliceBlue",Color.AliceBlue),
+ new ColourAndName("AntiqueWhite",Color.AntiqueWhite),
+ new ColourAndName("Aqua",Color.Aqua),
+ new ColourAndName("Aquamarine",Color.Aquamarine),
+ new ColourAndName("Azure",Color.Azure),
+ new ColourAndName("Beige",Color.Beige),
+ new ColourAndName("Bisque",Color.Bisque),
+ new ColourAndName("Black",Color.Black),
+ new ColourAndName("BlanchedAlmond",Color.BlanchedAlmond),
+ new ColourAndName("Blue",Color.Blue),
+ new ColourAndName("BlueViolet",Color.BlueViolet),
+ new ColourAndName("Brown",Color.Brown),
+ new ColourAndName("BurlyWood",Color.BurlyWood),
+ new ColourAndName("CadetBlue",Color.CadetBlue),
+ new ColourAndName("Chartreuse",Color.Chartreuse),
+ new ColourAndName("Chocolate",Color.Chocolate),
+ new ColourAndName("Coral",Color.Coral),
+ new ColourAndName("CornflowerBlue",Color.CornflowerBlue),
+ new ColourAndName("Cornsilk",Color.Cornsilk),
+ new ColourAndName("Crimson",Color.Crimson),
+ new ColourAndName("Cyan",Color.Cyan),
+ new ColourAndName("DarkBlue",Color.DarkBlue),
+ new ColourAndName("DarkCyan",Color.DarkCyan),
+ new ColourAndName("DarkGoldenrod",Color.DarkGoldenrod),
+ new ColourAndName("DarkGray",Color.DarkGray),
+ new ColourAndName("DarkGreen",Color.DarkGreen),
+ new ColourAndName("DarkKhaki",Color.DarkKhaki),
+ new ColourAndName("DarkMagenta",Color.DarkMagenta),
+ new ColourAndName("DarkOliveGreen",Color.DarkOliveGreen),
+ new ColourAndName("DarkOrange",Color.DarkOrange),
+ new ColourAndName("DarkOrchid",Color.DarkOrchid),
+ new ColourAndName("DarkRed",Color.DarkRed),
+ new ColourAndName("DarkSalmon",Color.DarkSalmon),
+ new ColourAndName("DarkSeaGreen",Color.DarkSeaGreen),
+ new ColourAndName("DarkSlateBlue",Color.DarkSlateBlue),
+ new ColourAndName("DarkSlateGray",Color.DarkSlateGray),
+ new ColourAndName("DarkTurquoise",Color.DarkTurquoise),
+ new ColourAndName("DarkViolet",Color.DarkViolet),
+ new ColourAndName("DeepPink",Color.DeepPink),
+ new ColourAndName("DeepSkyBlue",Color.DeepSkyBlue),
+ new ColourAndName("DimGray",Color.DimGray),
+ new ColourAndName("DodgerBlue",Color.DodgerBlue),
+ new ColourAndName("Firebrick",Color.Firebrick),
+ new ColourAndName("FloralWhite",Color.FloralWhite),
+ new ColourAndName("ForestGreen",Color.ForestGreen),
+ new ColourAndName("Gainsboro",Color.Gainsboro),
+ new ColourAndName("GhostWhite",Color.GhostWhite),
+ new ColourAndName("Gold",Color.Gold),
+ new ColourAndName("Goldenrod",Color.Goldenrod),
+ new ColourAndName("Gray",Color.Gray),
+ new ColourAndName("Green",Color.Green),
+ new ColourAndName("GreenYellow",Color.GreenYellow),
+ new ColourAndName("Honeydew",Color.Honeydew),
+ new ColourAndName("HotPink",Color.HotPink),
+ new ColourAndName("IndianRed",Color.IndianRed),
+ new ColourAndName("Indigo",Color.Indigo),
+ new ColourAndName("Ivory",Color.Ivory),
+ new ColourAndName("Khaki",Color.Khaki),
+ new ColourAndName("Lavender",Color.Lavender),
+ new ColourAndName("LavenderBlush",Color.LavenderBlush),
+ new ColourAndName("LawnGreen",Color.LawnGreen),
+ new ColourAndName("LemonChiffon",Color.LemonChiffon),
+ new ColourAndName("LightBlue",Color.LightBlue),
+ new ColourAndName("LightCoral",Color.LightCoral),
+ new ColourAndName("LightCyan",Color.LightCyan),
+ new ColourAndName("LightGoldenrodYellow",Color.LightGoldenrodYellow),
+ new ColourAndName("LightGray",Color.LightGray),
+ new ColourAndName("LightGreen",Color.LightGreen),
+ new ColourAndName("LightPink",Color.LightPink),
+ new ColourAndName("LightSalmon",Color.LightSalmon),
+ new ColourAndName("LightSeaGreen",Color.LightSeaGreen),
+ new ColourAndName("LightSkyBlue",Color.LightSkyBlue),
+ new ColourAndName("LightSlateGray",Color.LightSlateGray),
+ new ColourAndName("LightSteelBlue",Color.LightSteelBlue),
+ new ColourAndName("LightYellow",Color.LightYellow),
+ new ColourAndName("Lime",Color.Lime),
+ new ColourAndName("LimeGreen",Color.LimeGreen),
+ new ColourAndName("Linen",Color.Linen),
+ new ColourAndName("Magenta",Color.Magenta),
+ new ColourAndName("Maroon",Color.Maroon),
+ new ColourAndName("MediumAquamarine",Color.MediumAquamarine),
+ new ColourAndName("MediumBlue",Color.MediumBlue),
+ new ColourAndName("MediumOrchid",Color.MediumOrchid),
+ new ColourAndName("MediumPurple",Color.MediumPurple),
+ new ColourAndName("MediumSeaGreen",Color.MediumSeaGreen),
+ new ColourAndName("MediumSlateBlue",Color.MediumSlateBlue),
+ new ColourAndName("MediumSpringGreen",Color.MediumSpringGreen),
+ new ColourAndName("MediumTurquoise",Color.MediumTurquoise),
+ new ColourAndName("MediumVioletRed",Color.MediumVioletRed),
+ new ColourAndName("MidnightBlue",Color.MidnightBlue),
+ new ColourAndName("MintCream",Color.MintCream),
+ new ColourAndName("MistyRose",Color.MistyRose),
+ new ColourAndName("Moccasin",Color.Moccasin),
+ new ColourAndName("NavajoWhite",Color.NavajoWhite),
+ new ColourAndName("Navy",Color.Navy),
+ new ColourAndName("OldLace",Color.OldLace),
+ new ColourAndName("Olive",Color.Olive),
+ new ColourAndName("OliveDrab",Color.OliveDrab),
+ new ColourAndName("Orange",Color.Orange),
+ new ColourAndName("OrangeRed",Color.OrangeRed),
+ new ColourAndName("Orchid",Color.Orchid),
+ new ColourAndName("PaleGoldenrod",Color.PaleGoldenrod),
+ new ColourAndName("PaleGreen",Color.PaleGreen),
+ new ColourAndName("PaleTurquoise",Color.PaleTurquoise),
+ new ColourAndName("PaleVioletRed",Color.PaleVioletRed),
+ new ColourAndName("PapayaWhip",Color.PapayaWhip),
+ new ColourAndName("PeachPuff",Color.PeachPuff),
+ new ColourAndName("Peru",Color.Peru),
+ new ColourAndName("Pink",Color.Pink),
+ new ColourAndName("Plum",Color.Plum),
+ new ColourAndName("PowderBlue",Color.PowderBlue),
+ new ColourAndName("Purple",Color.Purple),
+ new ColourAndName("Red",Color.Red),
+ new ColourAndName("RosyBrown",Color.RosyBrown),
+ new ColourAndName("RoyalBlue",Color.RoyalBlue),
+ new ColourAndName("SaddleBrown",Color.SaddleBrown),
+ new ColourAndName("Salmon",Color.Salmon),
+ new ColourAndName("SandyBrown",Color.SandyBrown),
+ new ColourAndName("SeaGreen",Color.SeaGreen),
+ new ColourAndName("SeaShell",Color.SeaShell),
+ new ColourAndName("Sienna",Color.Sienna),
+ new ColourAndName("Silver",Color.Silver),
+ new ColourAndName("SkyBlue",Color.SkyBlue),
+ new ColourAndName("SlateBlue",Color.SlateBlue),
+ new ColourAndName("SlateGray",Color.SlateGray),
+ new ColourAndName("Snow",Color.Snow),
+ new ColourAndName("SpringGreen",Color.SpringGreen),
+ new ColourAndName("SteelBlue",Color.SteelBlue),
+ new ColourAndName("Tan",Color.Tan),
+ new ColourAndName("Teal",Color.Teal),
+ new ColourAndName("Thistle",Color.Thistle),
+ new ColourAndName("Tomato",Color.Tomato),
+ new ColourAndName("Turquoise",Color.Turquoise),
+ new ColourAndName("Violet",Color.Violet),
+ new ColourAndName("Wheat",Color.Wheat),
+ new ColourAndName("White",Color.White),
+ new ColourAndName("WhiteSmoke",Color.WhiteSmoke),
+ new ColourAndName("Yellow",Color.Yellow),
+ new ColourAndName("YellowGreen",Color.YellowGreen),
+ };
+ int displayFourAtATime = -1;
+ int xCoord = 0;
+ int yCoord = 0;
+ int spacing = 10;
+ int width = (fullScreenBitmap.Width / 2) - spacing / 2;
+ int height = (fullScreenBitmap.Height / 2) - spacing / 2;
+ int textWidth;
+ int textHeight;
+ int xCoordText = 0;
+ int yCoordText = 0;
+
+ foreach (ColourAndName can in ColourTest)
+ {
+ fnt12.ComputeExtent(can.Name, out textWidth, out textHeight);
+
+ int remainder = displayFourAtATime % 4;
+ switch (remainder)
+ {
+ case 0:
+ xCoord = 0;
+ xCoordText = (width - textWidth) / 2;
+ yCoord = 0;
+ yCoordText = (height - textHeight) / 2;
+ break;
+ case 1:
+ xCoord = fullScreenBitmap.Width - width;
+ xCoordText = fullScreenBitmap.Width - (width + textWidth) / 2;
+ yCoord = 0;
+ yCoordText = (height - textHeight) / 2;
+ break;
+ case 2:
+ xCoord = 0;
+ xCoordText = (width - textWidth) / 2;
+ yCoord = fullScreenBitmap.Height - height;
+ yCoordText = fullScreenBitmap.Height - (height + textHeight) / 2;
+ break;
+ case 3:
+ xCoord = fullScreenBitmap.Width - width;
+ xCoordText = fullScreenBitmap.Width - (width + textWidth) / 2;
+ yCoord = fullScreenBitmap.Height - height;
+ yCoordText = fullScreenBitmap.Height - (height + textHeight) / 2;
+ break;
+ }
+ fullScreenBitmap.DrawRectangle(can.Colour, // outline color
+ 1, // outline thickness
+ xCoord, yCoord, // x and y of top left corner
+ width,
+ height,
+ 0, 0, // x and y corner radius
+ can.Colour, // gradient start color
+ 0, 0, // gradient start coordinates
+ can.Colour, // gradient end color
+ 0, 0, // gradient end coordinates
+ Bitmap.OpacityOpaque); // opacity
+ Color contrastTextColour = ColorUtility.ColorFromRGB((byte)(255 - ColorUtility.GetRValue(can.Colour)),
+ (byte)(255 - ColorUtility.GetGValue(can.Colour)),
+ (byte)(255 - ColorUtility.GetBValue(can.Colour)));
+ fullScreenBitmap.DrawText(can.Name, fnt12, contrastTextColour, xCoordText, yCoordText);
+
+ if (remainder == 3)
+ {
+ fullScreenBitmap.Flush();
+ Thread.Sleep(700);
+ }
+ displayFourAtATime++;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/Graphics/Primitives/SimplePrimitives/Extensions.cs b/samples/Graphics/Primitives/SimplePrimitives/Extensions.cs
new file mode 100644
index 000000000..cf7b76790
--- /dev/null
+++ b/samples/Graphics/Primitives/SimplePrimitives/Extensions.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace Primitives.SimplePrimitives
+{
+ public static class Extensions
+ {
+ public static int Next(this Random rand, int min, int max)
+ {
+ if (max - min == 0)
+ return min;
+ return min + rand.Next(max-min);
+ }
+ }
+}
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/FontExamples.cs b/samples/Graphics/Primitives/SimplePrimitives/FontExamples.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/FontExamples.cs
rename to samples/Graphics/Primitives/SimplePrimitives/FontExamples.cs
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/InformationBar.cs b/samples/Graphics/Primitives/SimplePrimitives/InformationBar.cs
similarity index 99%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/InformationBar.cs
rename to samples/Graphics/Primitives/SimplePrimitives/InformationBar.cs
index 35c87a20c..6cbafdf8b 100644
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/InformationBar.cs
+++ b/samples/Graphics/Primitives/SimplePrimitives/InformationBar.cs
@@ -10,7 +10,6 @@ public enum InfoBarPosition
}
public static class InformationBar
{
-
public static void DrawInformationBar(Bitmap theBitmap, Font DisplayFont, InfoBarPosition pos, string TextToDisplay)
{
theBitmap.DrawRectangle(Color.White, 0, 0, theBitmap.Height - 20, 320, 22, 0, 0, Color.White,
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/MatrixRain.cs b/samples/Graphics/Primitives/SimplePrimitives/MatrixRain.cs
similarity index 88%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/MatrixRain.cs
rename to samples/Graphics/Primitives/SimplePrimitives/MatrixRain.cs
index bb9237214..a294fa96c 100644
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/MatrixRain.cs
+++ b/samples/Graphics/Primitives/SimplePrimitives/MatrixRain.cs
@@ -1,7 +1,6 @@
using nanoFramework.Presentation.Media;
using nanoFramework.UI;
using System;
-using System.Collections;
using System.Threading;
//
@@ -46,12 +45,13 @@ public PointAndChar(int x, int y, string Character)
this.Character = Character;
}
}
- // private PointAndChar BaselineOrigin; // letter baseline origin
+ // private PointAndChar BaselineOrigin; // letter baseline origin
private int[] Drops; // Array that keep track of rain 'drops' position
private Color BackgroundColour;
private Color TextColour;
- private double LetterAdvanceWidth; //single letter height calculate from glyph typeface
- private double LetterAdvanceHeight; // single letter height calculate from glyph typeface
+ private int LetterAdvanceWidth; //single letter height calculate from glyph typeface
+ private int LetterAdvanceHeight; // single letter height calculate from glyph typeface
+
private int xOffset;
private int yOffset;
@@ -63,9 +63,9 @@ public PointAndChar(int x, int y, string Character)
// The character used for the rain will be randomly choose from this string
private String AvailableLetterChars = "abcdefghijklmnopqrstuvwxyz1234567890";
private Font MatrixFont { get; set; }
- public MatrixRain(Bitmap fullScreenBitmap, Font DisplayFont)
+ public MatrixRain(Bitmap fullScreenBitmap)
{
- int timerInterval = 10; // The number of mSec between each frame.
+ int timerInterval = 50; // The number of mSec between each frame.
FullScreenBitmap = fullScreenBitmap;
FullScreenBitmap.Clear();
Initialize();
@@ -93,7 +93,7 @@ private void _animationTimer_Tick(object state)
{
if (Drops != null & Drops.Length > 0)
{
- //Black BG with opacity to fade characters
+ // Black background with opacity to fade characters
FullScreenBitmap.DrawRectangle(colorOutline: BackgroundColour, thicknessOutline: 0,
x: 0, y: 0,
width: FullScreenBitmap.Width, height: FullScreenBitmap.Height,
@@ -108,8 +108,6 @@ private void _animationTimer_Tick(object state)
for (var i = 0; i < Drops.Length; i++) // looping over drops
{
// new drop position
- //double x = BaselineOrigin.x + LetterAdvanceWidth * i;
- //double y = BaselineOrigin.y + LetterAdvanceHeight * Drops[i];
double x = xOffset + LetterAdvanceWidth * i;
double y = yOffset + LetterAdvanceHeight * Drops[i];
@@ -127,7 +125,7 @@ private void _animationTimer_Tick(object state)
}
//sending the drop back to the top randomly after it has crossed the image
//adding a randomness to the reset to make the drops scattered on the Y axis
- if (Drops[i] * LetterAdvanceHeight > FullScreenBitmap.Height && random.NextDouble() > 0.775)
+ if (Drops[i] * LetterAdvanceHeight > FullScreenBitmap.Height && random.Next(1000) > 850)
{
Drops[i] = 0;
}
diff --git a/samples/Graphics/Primitives/SimplePrimitives/PagedText.cs b/samples/Graphics/Primitives/SimplePrimitives/PagedText.cs
new file mode 100644
index 000000000..854e5b591
--- /dev/null
+++ b/samples/Graphics/Primitives/SimplePrimitives/PagedText.cs
@@ -0,0 +1,52 @@
+using nanoFramework.Presentation.Media;
+using nanoFramework.UI;
+using System;
+using System.Reflection;
+//using System.Text;
+using System.Threading;
+
+namespace Primitives.SimplePrimitives
+{
+ class PagedText
+ {
+
+ public PagedText(Bitmap fullScreenBitmap, Font DisplayFont)
+
+ {
+ //Bitmap bmp = new Bitmap(fullScreenBitmap.Width, fullScreenBitmap.Height);
+ Font fntSegoeUIRegular12 = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);
+ string text = "There is another overload of the DrawTextInRect " +
+ "method. That method comes along with reference " +
+ "parameters for the input string and the x and y " +
+ "drawing positions. After drawing text, the " +
+ "method updates the x and y positions to tell you " +
+ "where on the display the drawing of the text " +
+ "finished. This allows you to draw parts of the text " +
+ "with a different color or font. Also, if the method " +
+ "cannot display the complete text within the specified " +
+ "rectangle, it returns the remaining text. " +
+ "In this case, the method returns false to indicate " +
+ "that there is some text left that could not " +
+ "displayed. This enables you to build up a display " +
+ "to show text over mulitple pages.";
+ bool completed;
+ do
+ {
+ int x = 0;
+ int y = 0;
+ //draw frame around text and clear old contents
+ fullScreenBitmap.DrawRectangle(Color.White, 1, 20, 20, 150, 150, 0, 0, Color.Black, 0, 0, Color.Black, 0, 0, Bitmap.OpacityOpaque);
+ completed = fullScreenBitmap.DrawTextInRect(
+ ref text,
+ ref x, ref y, // x and y text position
+ 20, 20, // x and y (rectangle top left)
+ 150, 150, // width and height of rectangle
+ Bitmap.DT_AlignmentLeft | Bitmap.DT_WordWrap,
+ Color.White, // color
+ fntSegoeUIRegular12); // font
+ fullScreenBitmap.Flush();
+ Thread.Sleep(3000); //display each page for three seconds
+ } while (!completed);
+ }
+ }
+}
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomDrawLine.cs b/samples/Graphics/Primitives/SimplePrimitives/RandomDrawLine.cs
similarity index 89%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/RandomDrawLine.cs
rename to samples/Graphics/Primitives/SimplePrimitives/RandomDrawLine.cs
index 7250d8fe8..ccb8ec90a 100644
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomDrawLine.cs
+++ b/samples/Graphics/Primitives/SimplePrimitives/RandomDrawLine.cs
@@ -1,6 +1,7 @@
using nanoFramework.Presentation.Media;
using nanoFramework.UI;
using System;
+using System.Threading;
namespace Primitives.SimplePrimitives
{
@@ -15,8 +16,9 @@ public RandomDrawLine(Bitmap fullScreenBitmap, Font DisplayFont)
for (int i = 100; i > 0; i--)
{
+ int thickness = random.Next(8);
fullScreenBitmap.DrawLine((Color)random.Next(0xFFFFFF),
- 1,
+ thickness,
random.Next(fullScreenBitmap.Width),
random.Next(fullScreenBitmap.Height - 22),
random.Next(fullScreenBitmap.Width),
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomClipping.cs b/samples/Graphics/Primitives/SimplePrimitives/RandomEllipsesAndClipping.cs
similarity index 75%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/RandomClipping.cs
rename to samples/Graphics/Primitives/SimplePrimitives/RandomEllipsesAndClipping.cs
index 75624ec51..167fb2fb5 100644
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomClipping.cs
+++ b/samples/Graphics/Primitives/SimplePrimitives/RandomEllipsesAndClipping.cs
@@ -24,46 +24,49 @@ public RandomClipping(Bitmap fullScreenBitmap, Font DisplayFont)
Rect r2 = new Rect { x = 180, y = 80, width = 100, height = 100 };
Rect r3 = new Rect { x = 20, y = 170, width = 100, height = 30 };
- string additionalInfo = "No Clipping";
+ string additionalInfo = "Random Rectangles [No Clipping]";
for (int i = 0; i < 400; i++)
{
if (i == 100)
{
- additionalInfo = "Clipping [20,20,120,120]";
+ additionalInfo = "Clipping inside region [20,20,120,120]";
DullExistingLines(fullScreenBitmap, r0);
+ ResetClippingAndDrawClippingRectangular(fullScreenBitmap, r1);
fullScreenBitmap.SetClippingRectangle(r1.x, r1.y, r1.width, r1.height);
- DrawClippingRectangular(fullScreenBitmap,r1);
fullScreenBitmap.Flush();
}
if (i == 200)
{
- additionalInfo = "Clipping [180,80,280,180]";
- DullExistingLines(fullScreenBitmap, r0);
+ additionalInfo = "Clipping inside region [180,80,280,180]";
+ ResetClippingAndDrawClippingRectangular(fullScreenBitmap, r2);
fullScreenBitmap.SetClippingRectangle(r2.x, r2.y, r2.width, r2.height);
- DrawClippingRectangular(fullScreenBitmap, r2);
fullScreenBitmap.Flush();
}
if (i == 300)
{
- additionalInfo = "Clipping [20,170,120,200]";
- DullExistingLines(fullScreenBitmap, r0);
+ additionalInfo = "Clipping inside region [20,170,120,200]";
+ ResetClippingAndDrawClippingRectangular(fullScreenBitmap, r3);
fullScreenBitmap.SetClippingRectangle(r3.x, r3.y, r3.width, r3.height);
- DrawClippingRectangular(fullScreenBitmap, r3);
fullScreenBitmap.Flush();
}
int radiusX = random.Next(100);
int radiusY = random.Next(100);
- fullScreenBitmap.DrawEllipse((nanoFramework.Presentation.Media.Color)random.Next(0xFFFFFF), 0,
- random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height - 20), radiusX, radiusY, 0, 0, 0, 0, 0, 0, (ushort)random.Next(256));
+ int thicknessOutline = random.Next(5);
+ Color colourGradientStart = ColorUtility.ColorFromRGB((byte)random.Next(255), (byte)random.Next(255), (byte)random.Next(255));
+ Color colourGradientEnd = ColorUtility.ColorFromRGB((byte)random.Next(255), (byte)random.Next(255), (byte)random.Next(255));
+
+ fullScreenBitmap.DrawEllipse((nanoFramework.Presentation.Media.Color)random.Next(0xFFFFFF), thicknessOutline,
+ random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height - 20), radiusX, radiusY, colourGradientStart, 0, 0, colourGradientEnd, radiusX, radiusY, (ushort)random.Next(256));
DrawInformationBar(fullScreenBitmap, DisplayFont, additionalInfo);
fullScreenBitmap.Flush();
}
fullScreenBitmap.SetClippingRectangle(0, 0, fullScreenBitmap.Width, fullScreenBitmap.Height);
}
- private void DrawClippingRectangular(Bitmap fullScreenBitmap,Rect r1)
+ private void ResetClippingAndDrawClippingRectangular(Bitmap fullScreenBitmap,Rect r1)
{
- fullScreenBitmap.DrawRectangle(colorOutline: Color.Cyan, thicknessOutline: 2,
+ fullScreenBitmap.SetClippingRectangle(0, 0, fullScreenBitmap.Width, fullScreenBitmap.Height);
+ fullScreenBitmap.DrawRectangle(colorOutline: Color.Bisque, thicknessOutline: 1,
x: r1.x-1, y: r1.y-1,
width: r1.width+2, height: r1.height+2,
xCornerRadius: 0, yCornerRadius: 0,
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomRectangles.cs b/samples/Graphics/Primitives/SimplePrimitives/RandomRectangles.cs
similarity index 65%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/RandomRectangles.cs
rename to samples/Graphics/Primitives/SimplePrimitives/RandomRectangles.cs
index fea209b81..a24e9ab15 100644
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomRectangles.cs
+++ b/samples/Graphics/Primitives/SimplePrimitives/RandomRectangles.cs
@@ -11,11 +11,24 @@ public RandomRectangles(Bitmap fullScreenBitmap, Font DisplayFont)
Random random = new Random();
fullScreenBitmap.Clear();
fullScreenBitmap.Flush();
+ int xCornerRadius;
+ int yCornerRadius;
for (int i = 0; i < 100; i++)
{
Color fillColor = (nanoFramework.Presentation.Media.Color)random.Next(0xFFFFFF);
+
+ if( i % 2 == 0)
+ {
+ xCornerRadius = random.Next(2, 40);
+ yCornerRadius = random.Next(2, 40);
+ }
+ else
+ {
+ xCornerRadius = 0;
+ yCornerRadius = 0;
+ }
fullScreenBitmap.DrawRectangle((nanoFramework.Presentation.Media.Color)random.Next(0xFFFFFF), random.Next(1),
- random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height - 20), random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height-20), 0, 0, fillColor, 0, 0, fillColor, 0, 0, (ushort)random.Next(256));
+ random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height - 20), random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height-20),xCornerRadius,yCornerRadius, fillColor, 0, 0, fillColor, 0, 0, (ushort)random.Next(256));
InformationBar.DrawInformationBar(fullScreenBitmap, DisplayFont, InfoBarPosition.bottom, $"Rectangle Number {i}");
fullScreenBitmap.Flush();
}
diff --git a/samples/Graphics/Primitives/SimplePrimitives/RotateImage.cs b/samples/Graphics/Primitives/SimplePrimitives/RotateImage.cs
new file mode 100644
index 000000000..25fcdbdd8
--- /dev/null
+++ b/samples/Graphics/Primitives/SimplePrimitives/RotateImage.cs
@@ -0,0 +1,88 @@
+using nanoFramework.Presentation.Media;
+using nanoFramework.Presentation.Shapes;
+using nanoFramework.UI;
+using System;
+
+namespace Primitives.SimplePrimitives
+{
+ class RotateImage
+ {
+ public RotateImage(Bitmap fullScreenBitmap, Font DisplayFont)
+ {
+ Bitmap waterFall = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);
+ try
+ {
+ int shorterSide = Math.Min(fullScreenBitmap.Width, fullScreenBitmap.Height);
+ // Calculate an image size for the waterFall bitmap that will fit inside the bounds of the destination bitmap
+ // The diaganol of the image is the longest size
+ Single diagonalLength = Math.Sqrt(waterFall.Width * waterFall.Width + waterFall.Height * waterFall.Height);
+ Single scaleFactor = shorterSide / diagonalLength;
+
+ // Stretch the watefall image into the large size
+ int scaledImageWidth = (int)(waterFall.Width * scaleFactor);
+ int scaledImageHeight = (int)(waterFall.Height * scaleFactor);
+ Bitmap scaledImage = new Bitmap(scaledImageWidth, scaledImageHeight);
+ scaledImage.StretchImage(0, 0, waterFall, scaledImageWidth, scaledImageHeight, 0xFFFF);
+
+ // Create a rectangle in the middle where the image will be displayed
+ // The same size as the stretched waterfall
+ Rect outputRectangle = new Rect { x = (fullScreenBitmap.Width - scaledImageWidth) / 2, y = (fullScreenBitmap.Height - scaledImageHeight) / 2, width = scaledImageWidth, height = scaledImageHeight };
+
+ int scaledImageXDst = 0;
+ int scaledImageYDst = 0;
+
+ int xDstImageToRotate = (fullScreenBitmap.Width - scaledImageXDst) / 2;
+ int yDstImageToRotate = (fullScreenBitmap.Height - scaledImageYDst) / 2;
+
+ int numberOfRotations = 100;
+ int degreesIncrement = 1;
+ int dynamicIncrease = 0;
+ for (int iCounter = 0; iCounter < numberOfRotations; iCounter++)
+ {
+ fullScreenBitmap.Clear();
+ // Rotate and stretch
+ fullScreenBitmap.RotateImage(degreesIncrement, outputRectangle.x, outputRectangle.y, scaledImage, scaledImageXDst, scaledImageYDst, outputRectangle.width, outputRectangle.height, 0xFFFF);
+
+ InformationBar.DrawInformationBar(fullScreenBitmap, DisplayFont, InfoBarPosition.bottom, $"Rotate Image degrees {degreesIncrement:D3}");
+ fullScreenBitmap.Flush();
+
+ if (iCounter < 50)
+ {
+ degreesIncrement += dynamicIncrease;
+ }
+ else if (iCounter == 50)
+ {
+ degreesIncrement = 0;
+ dynamicIncrease = 1;
+ }
+ else
+ {
+ degreesIncrement -= dynamicIncrease;
+ }
+ dynamicIncrease += 1;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught exception: " + e.Message);
+ }
+ finally
+ {
+ if (waterFall != null)
+ {
+ waterFall.Dispose();
+ }
+
+
+ System.Threading.Thread.Sleep(500);
+ }
+ }
+ private class Rect
+ {
+ public int x;
+ public int y;
+ public int width;
+ public int height;
+ }
+ }
+}
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/SetPixels.cs b/samples/Graphics/Primitives/SimplePrimitives/SetPixels.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/SetPixels.cs
rename to samples/Graphics/Primitives/SimplePrimitives/SetPixels.cs
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/SliceScaling9.cs b/samples/Graphics/Primitives/SimplePrimitives/SliceScaling9.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/SliceScaling9.cs
rename to samples/Graphics/Primitives/SimplePrimitives/SliceScaling9.cs
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/StretchImage.cs b/samples/Graphics/Primitives/SimplePrimitives/StretchImage.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/StretchImage.cs
rename to samples/Graphics/Primitives/SimplePrimitives/StretchImage.cs
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/TileImage.cs b/samples/Graphics/Primitives/SimplePrimitives/TileImage.cs
similarity index 92%
rename from samples/GraphicsWpf/Primitives/SimplePrimitives/TileImage.cs
rename to samples/Graphics/Primitives/SimplePrimitives/TileImage.cs
index 2d58af12b..8a065e3d6 100644
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/TileImage.cs
+++ b/samples/Graphics/Primitives/SimplePrimitives/TileImage.cs
@@ -1,5 +1,6 @@
using nanoFramework.Presentation.Media;
using nanoFramework.UI;
+using System;
namespace Primitives.SimplePrimitives
{
@@ -10,6 +11,8 @@ public TileImage(Bitmap fullScreenBitmap, Font DisplayFont)
//Bitmap btn = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);
Bitmap btn = new Bitmap(PandaGif.Panda, Bitmap.BitmapImageType.Gif);
+ fullScreenBitmap.DrawImage(10, 10, btn, 0, 0, btn.Width, btn.Height);
+
fullScreenBitmap.Clear();
fullScreenBitmap.Flush();
diff --git a/samples/GraphicsWpf/Primitives/Untitled.cs b/samples/Graphics/Primitives/Untitled.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/Untitled.cs
rename to samples/Graphics/Primitives/Untitled.cs
diff --git a/samples/GraphicsWpf/Primitives/WaterFallJpg.cs b/samples/Graphics/Primitives/WaterFallJpg.cs
similarity index 100%
rename from samples/GraphicsWpf/Primitives/WaterFallJpg.cs
rename to samples/Graphics/Primitives/WaterFallJpg.cs
diff --git a/samples/Graphics/Primitives/app.config b/samples/Graphics/Primitives/app.config
new file mode 100644
index 000000000..ffef3ce91
--- /dev/null
+++ b/samples/Graphics/Primitives/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/Graphics/Primitives/packages.config b/samples/Graphics/Primitives/packages.config
new file mode 100644
index 000000000..87727f20e
--- /dev/null
+++ b/samples/Graphics/Primitives/packages.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/GraphicsWpf/SimpleWpf/GpioButtonInputProvider.cs b/samples/Graphics/SimpleWpf/GpioButtonInputProvider.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/GpioButtonInputProvider.cs
rename to samples/Graphics/SimpleWpf/GpioButtonInputProvider.cs
diff --git a/samples/GraphicsWpf/SimpleWpf/Program.cs b/samples/Graphics/SimpleWpf/Program.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Program.cs
rename to samples/Graphics/SimpleWpf/Program.cs
diff --git a/samples/GraphicsWpf/SimpleWpf/Properties/AssemblyInfo.cs b/samples/Graphics/SimpleWpf/Properties/AssemblyInfo.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Properties/AssemblyInfo.cs
rename to samples/Graphics/SimpleWpf/Properties/AssemblyInfo.cs
diff --git a/samples/GraphicsWpf/SimpleWpf/Resource.Designer.cs b/samples/Graphics/SimpleWpf/Resource.Designer.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resource.Designer.cs
rename to samples/Graphics/SimpleWpf/Resource.Designer.cs
diff --git a/samples/GraphicsWpf/SimpleWpf/Resource.resx b/samples/Graphics/SimpleWpf/Resource.resx
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resource.resx
rename to samples/Graphics/SimpleWpf/Resource.resx
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Canvas Panel Icon Small.JPG b/samples/Graphics/SimpleWpf/Resources/Canvas Panel Icon Small.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Canvas Panel Icon Small.JPG
rename to samples/Graphics/SimpleWpf/Resources/Canvas Panel Icon Small.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Canvas Panel Icon.JPG b/samples/Graphics/SimpleWpf/Resources/Canvas Panel Icon.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Canvas Panel Icon.JPG
rename to samples/Graphics/SimpleWpf/Resources/Canvas Panel Icon.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Diagonal Panel Icon Small.JPG b/samples/Graphics/SimpleWpf/Resources/Diagonal Panel Icon Small.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Diagonal Panel Icon Small.JPG
rename to samples/Graphics/SimpleWpf/Resources/Diagonal Panel Icon Small.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Diagonal Panel Icon.JPG b/samples/Graphics/SimpleWpf/Resources/Diagonal Panel Icon.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Diagonal Panel Icon.JPG
rename to samples/Graphics/SimpleWpf/Resources/Diagonal Panel Icon.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Free Drawing Panel Icon Small.JPG b/samples/Graphics/SimpleWpf/Resources/Free Drawing Panel Icon Small.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Free Drawing Panel Icon Small.JPG
rename to samples/Graphics/SimpleWpf/Resources/Free Drawing Panel Icon Small.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Free Drawing Panel Icon.JPG b/samples/Graphics/SimpleWpf/Resources/Free Drawing Panel Icon.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Free Drawing Panel Icon.JPG
rename to samples/Graphics/SimpleWpf/Resources/Free Drawing Panel Icon.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Horizontal Stack Panel Icon Small.JPG b/samples/Graphics/SimpleWpf/Resources/Horizontal Stack Panel Icon Small.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Horizontal Stack Panel Icon Small.JPG
rename to samples/Graphics/SimpleWpf/Resources/Horizontal Stack Panel Icon Small.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Horizontal Stack Panel Icon.JPG b/samples/Graphics/SimpleWpf/Resources/Horizontal Stack Panel Icon.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Horizontal Stack Panel Icon.JPG
rename to samples/Graphics/SimpleWpf/Resources/Horizontal Stack Panel Icon.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/NinaB.tinyfnt b/samples/Graphics/SimpleWpf/Resources/NinaB.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/NinaB.tinyfnt
rename to samples/Graphics/SimpleWpf/Resources/NinaB.tinyfnt
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Scrollable Panel Icon Small.JPG b/samples/Graphics/SimpleWpf/Resources/Scrollable Panel Icon Small.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Scrollable Panel Icon Small.JPG
rename to samples/Graphics/SimpleWpf/Resources/Scrollable Panel Icon Small.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Scrollable Panel Icon.JPG b/samples/Graphics/SimpleWpf/Resources/Scrollable Panel Icon.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Scrollable Panel Icon.JPG
rename to samples/Graphics/SimpleWpf/Resources/Scrollable Panel Icon.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Vertical Stack Panel Icon Small.JPG b/samples/Graphics/SimpleWpf/Resources/Vertical Stack Panel Icon Small.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Vertical Stack Panel Icon Small.JPG
rename to samples/Graphics/SimpleWpf/Resources/Vertical Stack Panel Icon Small.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/Vertical Stack Panel Icon.JPG b/samples/Graphics/SimpleWpf/Resources/Vertical Stack Panel Icon.JPG
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/Vertical Stack Panel Icon.JPG
rename to samples/Graphics/SimpleWpf/Resources/Vertical Stack Panel Icon.JPG
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/courierregular10.tinyfnt b/samples/Graphics/SimpleWpf/Resources/courierregular10.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/courierregular10.tinyfnt
rename to samples/Graphics/SimpleWpf/Resources/courierregular10.tinyfnt
diff --git a/samples/GraphicsWpf/SimpleWpf/Resources/small.tinyfnt b/samples/Graphics/SimpleWpf/Resources/small.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/Resources/small.tinyfnt
rename to samples/Graphics/SimpleWpf/Resources/small.tinyfnt
diff --git a/samples/GraphicsWpf/SimpleWpf/SimpleWPFApplication.cs b/samples/Graphics/SimpleWpf/SimpleWPFApplication.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/SimpleWPFApplication.cs
rename to samples/Graphics/SimpleWpf/SimpleWPFApplication.cs
diff --git a/samples/GraphicsWpf/SimpleWpf/SimpleWpf.nfproj b/samples/Graphics/SimpleWpf/SimpleWpf.nfproj
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/SimpleWpf.nfproj
rename to samples/Graphics/SimpleWpf/SimpleWpf.nfproj
diff --git a/samples/GraphicsWpf/SimpleWpf/packages.config b/samples/Graphics/SimpleWpf/packages.config
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/packages.config
rename to samples/Graphics/SimpleWpf/packages.config
diff --git a/samples/GraphicsWpf/SimpleWpf/wpf/Console.cs b/samples/Graphics/SimpleWpf/wpf/Console.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/wpf/Console.cs
rename to samples/Graphics/SimpleWpf/wpf/Console.cs
diff --git a/samples/GraphicsWpf/SimpleWpf/wpf/ConsoleWindow.cs b/samples/Graphics/SimpleWpf/wpf/ConsoleWindow.cs
similarity index 100%
rename from samples/GraphicsWpf/SimpleWpf/wpf/ConsoleWindow.cs
rename to samples/Graphics/SimpleWpf/wpf/ConsoleWindow.cs
diff --git a/samples/GraphicsWpf/Tetris/ExtendedWeakReference.cs b/samples/Graphics/Tetris/ExtendedWeakReference.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/ExtendedWeakReference.cs
rename to samples/Graphics/Tetris/ExtendedWeakReference.cs
diff --git a/samples/GraphicsWpf/Tetris/GameLogic/ByteMatrix.cs b/samples/Graphics/Tetris/GameLogic/ByteMatrix.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GameLogic/ByteMatrix.cs
rename to samples/Graphics/Tetris/GameLogic/ByteMatrix.cs
diff --git a/samples/GraphicsWpf/Tetris/GameLogic/GameBlocks.cs b/samples/Graphics/Tetris/GameLogic/GameBlocks.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GameLogic/GameBlocks.cs
rename to samples/Graphics/Tetris/GameLogic/GameBlocks.cs
diff --git a/samples/GraphicsWpf/Tetris/GameLogic/GameStatistics.cs b/samples/Graphics/Tetris/GameLogic/GameStatistics.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GameLogic/GameStatistics.cs
rename to samples/Graphics/Tetris/GameLogic/GameStatistics.cs
diff --git a/samples/GraphicsWpf/Tetris/GameLogic/GameUniverse.cs b/samples/Graphics/Tetris/GameLogic/GameUniverse.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GameLogic/GameUniverse.cs
rename to samples/Graphics/Tetris/GameLogic/GameUniverse.cs
diff --git a/samples/GraphicsWpf/Tetris/GameLogic/HighScoreTable.cs b/samples/Graphics/Tetris/GameLogic/HighScoreTable.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GameLogic/HighScoreTable.cs
rename to samples/Graphics/Tetris/GameLogic/HighScoreTable.cs
diff --git a/samples/GraphicsWpf/Tetris/GameLogic/ScoreRecord.cs b/samples/Graphics/Tetris/GameLogic/ScoreRecord.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GameLogic/ScoreRecord.cs
rename to samples/Graphics/Tetris/GameLogic/ScoreRecord.cs
diff --git a/samples/GraphicsWpf/Tetris/GpioButtonInputProvider.cs b/samples/Graphics/Tetris/GpioButtonInputProvider.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/GpioButtonInputProvider.cs
rename to samples/Graphics/Tetris/GpioButtonInputProvider.cs
diff --git a/samples/GraphicsWpf/Tetris/NanoTetris.nfproj b/samples/Graphics/Tetris/NanoTetris.nfproj
similarity index 100%
rename from samples/GraphicsWpf/Tetris/NanoTetris.nfproj
rename to samples/Graphics/Tetris/NanoTetris.nfproj
diff --git a/samples/GraphicsWpf/Tetris/Presentation/BlockBrushes.cs b/samples/Graphics/Tetris/Presentation/BlockBrushes.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/BlockBrushes.cs
rename to samples/Graphics/Tetris/Presentation/BlockBrushes.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/GameWindow.cs b/samples/Graphics/Tetris/Presentation/GameWindow.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/GameWindow.cs
rename to samples/Graphics/Tetris/Presentation/GameWindow.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/GradientStackPanel.cs b/samples/Graphics/Tetris/Presentation/GradientStackPanel.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/GradientStackPanel.cs
rename to samples/Graphics/Tetris/Presentation/GradientStackPanel.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/HighScoreWindow.cs b/samples/Graphics/Tetris/Presentation/HighScoreWindow.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/HighScoreWindow.cs
rename to samples/Graphics/Tetris/Presentation/HighScoreWindow.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/MainMenuWindow.cs b/samples/Graphics/Tetris/Presentation/MainMenuWindow.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/MainMenuWindow.cs
rename to samples/Graphics/Tetris/Presentation/MainMenuWindow.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/NextBlockView.cs b/samples/Graphics/Tetris/Presentation/NextBlockView.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/NextBlockView.cs
rename to samples/Graphics/Tetris/Presentation/NextBlockView.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/ScoreItem.cs b/samples/Graphics/Tetris/Presentation/ScoreItem.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/ScoreItem.cs
rename to samples/Graphics/Tetris/Presentation/ScoreItem.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/StatisticsPanel.cs b/samples/Graphics/Tetris/Presentation/StatisticsPanel.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/StatisticsPanel.cs
rename to samples/Graphics/Tetris/Presentation/StatisticsPanel.cs
diff --git a/samples/GraphicsWpf/Tetris/Presentation/UniverseView.cs b/samples/Graphics/Tetris/Presentation/UniverseView.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Presentation/UniverseView.cs
rename to samples/Graphics/Tetris/Presentation/UniverseView.cs
diff --git a/samples/GraphicsWpf/Tetris/Properties/AssemblyInfo.cs b/samples/Graphics/Tetris/Properties/AssemblyInfo.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Properties/AssemblyInfo.cs
rename to samples/Graphics/Tetris/Properties/AssemblyInfo.cs
diff --git a/samples/GraphicsWpf/Tetris/README.md b/samples/Graphics/Tetris/README.md
similarity index 100%
rename from samples/GraphicsWpf/Tetris/README.md
rename to samples/Graphics/Tetris/README.md
diff --git a/samples/GraphicsWpf/Tetris/Resources/Consolas23.tinyfnt b/samples/Graphics/Tetris/Resources/Consolas23.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Resources/Consolas23.tinyfnt
rename to samples/Graphics/Tetris/Resources/Consolas23.tinyfnt
diff --git a/samples/GraphicsWpf/Tetris/Resources/Logo.gif b/samples/Graphics/Tetris/Resources/Logo.gif
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Resources/Logo.gif
rename to samples/Graphics/Tetris/Resources/Logo.gif
diff --git a/samples/GraphicsWpf/Tetris/Resources/NinaB.tinyfnt b/samples/Graphics/Tetris/Resources/NinaB.tinyfnt
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Resources/NinaB.tinyfnt
rename to samples/Graphics/Tetris/Resources/NinaB.tinyfnt
diff --git a/samples/GraphicsWpf/Tetris/Tetris.nfproj b/samples/Graphics/Tetris/Tetris.nfproj
similarity index 100%
rename from samples/GraphicsWpf/Tetris/Tetris.nfproj
rename to samples/Graphics/Tetris/Tetris.nfproj
diff --git a/samples/GraphicsWpf/Tetris/TetrisApp.cs b/samples/Graphics/Tetris/TetrisApp.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/TetrisApp.cs
rename to samples/Graphics/Tetris/TetrisApp.cs
diff --git a/samples/GraphicsWpf/Tetris/app.config b/samples/Graphics/Tetris/app.config
similarity index 100%
rename from samples/GraphicsWpf/Tetris/app.config
rename to samples/Graphics/Tetris/app.config
diff --git a/samples/GraphicsWpf/Tetris/nfResource.Designer.cs b/samples/Graphics/Tetris/nfResource.Designer.cs
similarity index 100%
rename from samples/GraphicsWpf/Tetris/nfResource.Designer.cs
rename to samples/Graphics/Tetris/nfResource.Designer.cs
diff --git a/samples/GraphicsWpf/Tetris/nfResource.resx b/samples/Graphics/Tetris/nfResource.resx
similarity index 100%
rename from samples/GraphicsWpf/Tetris/nfResource.resx
rename to samples/Graphics/Tetris/nfResource.resx
diff --git a/samples/GraphicsWpf/Tetris/packages.config b/samples/Graphics/Tetris/packages.config
similarity index 100%
rename from samples/GraphicsWpf/Tetris/packages.config
rename to samples/Graphics/Tetris/packages.config
diff --git a/samples/GraphicsWpf/GraphicsWpf.sln b/samples/GraphicsWpf/GraphicsWpf.sln
deleted file mode 100644
index 0d5aefc99..000000000
--- a/samples/GraphicsWpf/GraphicsWpf.sln
+++ /dev/null
@@ -1,48 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29411.108
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Primitives", "Primitives\Primitives.nfproj", "{3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}"
-EndProject
-Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "SimpleWpf", "SimpleWpf\SimpleWpf.nfproj", "{FFE43682-F092-423A-AA8C-5D0C143CB9CC}"
-EndProject
-Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Tetris", "Tetris\Tetris.nfproj", "{0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2403B83A-352D-422E-B893-B1D091D09970}"
- ProjectSection(SolutionItems) = preProject
- Readme.md = Readme.md
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Release|Any CPU.Build.0 = Release|Any CPU
- {3CB7ECF3-F8C0-4B5C-ACFF-9950F330277C}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {FFE43682-F092-423A-AA8C-5D0C143CB9CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FFE43682-F092-423A-AA8C-5D0C143CB9CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FFE43682-F092-423A-AA8C-5D0C143CB9CC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {FFE43682-F092-423A-AA8C-5D0C143CB9CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FFE43682-F092-423A-AA8C-5D0C143CB9CC}.Release|Any CPU.Build.0 = Release|Any CPU
- {FFE43682-F092-423A-AA8C-5D0C143CB9CC}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}.Release|Any CPU.Build.0 = Release|Any CPU
- {0AD3E53E-8408-4252-ADD2-70DAAFA1D1E2}.Release|Any CPU.Deploy.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {D473AAED-0580-406E-9F8B-90343739B4D8}
- EndGlobalSection
-EndGlobal
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomEllipses.cs b/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomEllipses.cs
deleted file mode 100644
index 75593f5ed..000000000
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/RandomEllipses.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using nanoFramework.Presentation.Media;
-using nanoFramework.UI;
-using System;
-
-namespace Primitives.SimplePrimitives
-{
- public class RandomEllipses
- {
- public RandomEllipses(Bitmap fullScreenBitmap, Font DisplayFont)
- {
- Random random = new Random();
- fullScreenBitmap.Clear();
- fullScreenBitmap.Flush();
- for (int i = 0; i < 100; i++)
- {
- int radiusX = random.Next(200);
- int radiusY = random.Next(200);
-
- fullScreenBitmap.DrawEllipse((nanoFramework.Presentation.Media.Color)random.Next(0xFFFFFF), 1,
- random.Next(fullScreenBitmap.Width), random.Next(fullScreenBitmap.Height - 20), radiusX, radiusY, 0, 0, 0, 0, 0, 0, 0);
- InformationBar.DrawInformationBar(fullScreenBitmap, DisplayFont, InfoBarPosition.bottom, $"Ellipse Number {i}");
- fullScreenBitmap.Flush();
- }
- }
- }
-}
diff --git a/samples/GraphicsWpf/Primitives/SimplePrimitives/RotateImage.cs b/samples/GraphicsWpf/Primitives/SimplePrimitives/RotateImage.cs
deleted file mode 100644
index d5da56a0d..000000000
--- a/samples/GraphicsWpf/Primitives/SimplePrimitives/RotateImage.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using nanoFramework.Presentation.Media;
-using nanoFramework.UI;
-using System;
-
-namespace Primitives.SimplePrimitives
-{
- class RotateImage
- {
- public RotateImage(Bitmap fullScreenBitmap, Font DisplayFont)
- {
- Bitmap bmpSrc = null;
- Bitmap bmpDst = null;
- try
- {
- bmpSrc = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);
- fullScreenBitmap.StretchImage(0, 0, bmpSrc, bmpSrc.Width, bmpSrc.Height, 0x0100);
- fullScreenBitmap.Flush();
-
- int xDst = 0;
- int yDst = 0;
-
- int rotation = 0;
- for (int i = 0; i < 66; ++i)
- {
- switch (rotation)
- {
- case 0:
- xDst = (fullScreenBitmap.Width - bmpSrc.Width) / 2;
- yDst = (fullScreenBitmap.Height - bmpSrc.Height) / 2;
- break;
- case 90:
- xDst = (fullScreenBitmap.Height - bmpSrc.Height) / 2;
- yDst = (fullScreenBitmap.Width - bmpSrc.Width) / 2;
- break;
- case 180:
- xDst = (fullScreenBitmap.Width - bmpSrc.Width) / 2;
- yDst = (fullScreenBitmap.Height - bmpSrc.Height) / 2;
- break;
- case 270:
- xDst = (fullScreenBitmap.Width - bmpSrc.Width) / 2;
- yDst = (fullScreenBitmap.Height - bmpSrc.Height) / 2;
- break;
- }
-
- fullScreenBitmap.Clear();
- fullScreenBitmap.RotateImage(rotation, xDst, yDst, bmpSrc, 0, 0, bmpSrc.Width, bmpSrc.Height, 0xFFFF);
-
- InformationBar.DrawInformationBar(fullScreenBitmap, DisplayFont, InfoBarPosition.bottom, $"Rotate Image degrees {i:D3}");
- fullScreenBitmap.Flush();
-
- rotation += 90;
- if (rotation == 360)
- {
- rotation = 0;
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("Caught exception: " + e.Message);
- }
- finally
- {
- if (bmpSrc != null)
- {
- bmpSrc.Dispose();
- }
- if (bmpDst != null)
- {
- bmpDst.Dispose();
- }
- System.Threading.Thread.Sleep(500);
- }
- }
- }
-}
diff --git a/samples/GraphicsWpf/Primitives/packages.config b/samples/GraphicsWpf/Primitives/packages.config
deleted file mode 100644
index a7bc46310..000000000
--- a/samples/GraphicsWpf/Primitives/packages.config
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/samples/GraphicsWpf/README.md b/samples/GraphicsWpf/README.md
deleted file mode 100644
index afba53fd1..000000000
--- a/samples/GraphicsWpf/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-### Graphics
-
-##### Overview
-These samples are provided to help explore the capabilities of the nanoFramework graphics.
-
- >Important note : The WPF samples are still in the testing phase and require hardware buttons
-
-### Basic Graphics
-
-| Type | Sample | Description | Status |
-| :-------------| :------------- | :----------: | -----------: |
-| Basic | [Primitives](Primitives/) |These samples use the bitmap class which contains methods for calling the underlying code written in C. | Tested
-| Wpf | [SimpleWpf](SimpleWpf/) | Original netMF wpf demo imported into nanoframework. Requires hardware buttons. A program to explore some of the controls available. | NOT Tested, in the process of modifying it to use a button provider class, not a GPIO provider to make it more flexible |
-| Tetris | [Tetris](Tetris/) | Written by Pavel Bánský for netMF, showing some techniques in using the nanoframework graphics. | NOT Tested, in the process of modifying it to use a button provider class, not a GPIO provider to make it more flexible |
-