Last active
January 3, 2016 03:59
-
-
Save dvdsgl/8406366 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Drawing; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
namespace HexagonApp { | |
[Register ("AppDelegate")] | |
class AppDelegate : UIApplicationDelegate { | |
UIWindow window; | |
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { | |
window = new UIWindow (UIScreen.MainScreen.Bounds) { | |
RootViewController = new UIViewController { | |
new HexagonView { | |
Center = new PointF (UIScreen.MainScreen.Bounds.Width / 2, UIScreen.MainScreen.Bounds.Height / 2) | |
} | |
} | |
}; | |
window.RootViewController.View.BackgroundColor = UIColor.White; | |
window.MakeKeyAndVisible (); | |
return true; | |
} | |
} | |
class HexagonView : UIView { | |
public HexagonView () { | |
Frame = new RectangleF (0, 0, 105, 93); | |
BackgroundColor = UIColor.Clear; | |
} | |
public override void Draw (RectangleF rect) { | |
//// Color Declarations | |
UIColor color1 = UIColor.FromRGBA (0.168f, 0.518f, 0.825f, 1.000f); | |
//// Hexagon | |
{ | |
//// Bezier Drawing | |
UIBezierPath bezierPath = new UIBezierPath (); | |
bezierPath.MoveTo (new PointF (30.3f, 0)); | |
bezierPath.AddCurveToPoint (new PointF (23.26f, 4.05f), new PointF (27.46f, 0.01f), new PointF (24.68f, 1.61f)); | |
bezierPath.AddLineTo (new PointF (1.05f, 42.45f)); | |
bezierPath.AddCurveToPoint (new PointF (1.05f, 50.55f), new PointF (-0.35f, 44.9f), new PointF (-0.35f, 48.1f)); | |
bezierPath.AddLineTo (new PointF (23.26f, 88.95f)); | |
bezierPath.AddCurveToPoint (new PointF (30.3f, 93), new PointF (24.69f, 91.39f), new PointF (27.46f, 92.99f)); | |
bezierPath.AddLineTo (new PointF (74.7f, 93)); | |
bezierPath.AddCurveToPoint (new PointF (81.74f, 88.95f), new PointF (77.54f, 92.99f), new PointF (80.31f, 91.39f)); | |
bezierPath.AddLineTo (new PointF (103.95f, 50.55f)); | |
bezierPath.AddCurveToPoint (new PointF (103.95f, 42.45f), new PointF (105.35f, 48.1f), new PointF (105.35f, 44.9f)); | |
bezierPath.AddLineTo (new PointF (81.74f, 4.05f)); | |
bezierPath.AddCurveToPoint (new PointF (74.7f, 0), new PointF (80.31f, 1.61f), new PointF (77.54f, 0.01f)); | |
bezierPath.AddLineTo (new PointF (30.3f, 0)); | |
bezierPath.AddLineTo (new PointF (30.3f, 0)); | |
bezierPath.AddLineTo (new PointF (30.3f, 0)); | |
bezierPath.AddLineTo (new PointF (30.3f, 0)); | |
bezierPath.ClosePath (); | |
bezierPath.MoveTo (new PointF (30.7f, 22.46f)); | |
bezierPath.AddCurveToPoint (new PointF (30.89f, 22.46f), new PointF (30.76f, 22.46f), new PointF (30.82f, 22.46f)); | |
bezierPath.AddLineTo (new PointF (38.55f, 22.46f)); | |
bezierPath.AddCurveToPoint (new PointF (39.38f, 22.96f), new PointF (38.88f, 22.47f), new PointF (39.21f, 22.66f)); | |
bezierPath.AddLineTo (new PointF (52.38f, 46)); | |
bezierPath.AddCurveToPoint (new PointF (52.5f, 46.38f), new PointF (52.44f, 46.12f), new PointF (52.48f, 46.25f)); | |
bezierPath.AddCurveToPoint (new PointF (52.62f, 46), new PointF (52.52f, 46.25f), new PointF (52.56f, 46.12f)); | |
bezierPath.AddLineTo (new PointF (65.59f, 22.96f)); | |
bezierPath.AddCurveToPoint (new PointF (66.45f, 22.46f), new PointF (65.76f, 22.65f), new PointF (66.1f, 22.46f)); | |
bezierPath.AddLineTo (new PointF (74.11f, 22.46f)); | |
bezierPath.AddCurveToPoint (new PointF (74.98f, 23.92f), new PointF (74.79f, 22.47f), new PointF (75.3f, 23.32f)); | |
bezierPath.AddLineTo (new PointF (62.3f, 46.5f)); | |
bezierPath.AddLineTo (new PointF (74.98f, 69.05f)); | |
bezierPath.AddCurveToPoint (new PointF (74.11f, 70.54f), new PointF (75.33f, 69.66f), new PointF (74.81f, 70.54f)); | |
bezierPath.AddLineTo (new PointF (66.45f, 70.54f)); | |
bezierPath.AddCurveToPoint (new PointF (65.59f, 70.01f), new PointF (66.1f, 70.54f), new PointF (65.75f, 70.33f)); | |
bezierPath.AddLineTo (new PointF (52.62f, 46.96f)); | |
bezierPath.AddCurveToPoint (new PointF (52.5f, 46.59f), new PointF (52.56f, 46.85f), new PointF (52.52f, 46.72f)); | |
bezierPath.AddCurveToPoint (new PointF (52.38f, 46.96f), new PointF (52.48f, 46.72f), new PointF (52.44f, 46.85f)); | |
bezierPath.AddLineTo (new PointF (39.38f, 70.01f)); | |
bezierPath.AddCurveToPoint (new PointF (38.55f, 70.54f), new PointF (39.22f, 70.32f), new PointF (38.89f, 70.53f)); | |
bezierPath.AddLineTo (new PointF (30.89f, 70.54f)); | |
bezierPath.AddCurveToPoint (new PointF (30.02f, 69.05f), new PointF (30.19f, 70.54f), new PointF (29.67f, 69.66f)); | |
bezierPath.AddLineTo (new PointF (42.7f, 46.5f)); | |
bezierPath.AddLineTo (new PointF (30.02f, 23.92f)); | |
bezierPath.AddCurveToPoint (new PointF (30.7f, 22.46f), new PointF (29.71f, 23.37f), new PointF (30.08f, 22.58f)); | |
bezierPath.AddCurveToPoint (new PointF (30.7f, 22.46f), new PointF (30.7f, 22.46f), new PointF (30.08f, 22.58f)); | |
bezierPath.AddLineTo (new PointF (30.7f, 22.46f)); | |
bezierPath.AddLineTo (new PointF (30.7f, 22.46f)); | |
bezierPath.ClosePath (); | |
bezierPath.MiterLimit = 4; | |
bezierPath.UsesEvenOddFillRule = true; | |
color1.SetFill (); | |
bezierPath.Fill (); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment