Last active
February 25, 2017 18:15
-
-
Save tocsoft/6d9d7757ee57a10712883cbcc11bfc35 to your computer and use it in GitHub Desktop.
image sharp logo
This file contains hidden or 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; | |
using System.Collections.Generic; | |
using System.Numerics; | |
using ImageSharp; | |
using SixLabors.Shapes; | |
namespace ConsoleApplication | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
Vector2 center = new Vector2(603); | |
// segment whoes cetner of rotation should be | |
Vector2 segmentOffset = new Vector2(301.16968f, 301.16974f); | |
IPath segment = new Polygon(new LinearLineSegment(new Vector2(230.54f, 361.0261f), new Vector2(5.8641942f, 361.46031f)), | |
new BezierLineSegment(new Vector2(5.8641942f, 361.46031f), | |
new Vector2(-11.715693f, 259.54052f), | |
new Vector2(24.441609f, 158.17478f), | |
new Vector2(78.26f, 97.0461f))).Translate(center - segmentOffset); | |
//we need to create 6 of theses all rotated about the center point | |
List<IPath> segments = new List<IPath>(); | |
for (var i = 0; i < 6; i++) | |
{ | |
float angle = i * ((float)Math.PI / 3); | |
var s = segment.Transform(Matrix3x2.CreateRotation(angle, center)); | |
segments.Add(s); | |
} | |
List<Color> colors = new List<Color>() { | |
Color.FromHex("35a849"), | |
Color.FromHex("fcee21"), | |
Color.FromHex("ed7124"), | |
Color.FromHex("cb202d"), | |
Color.FromHex("5f2c83"), | |
Color.FromHex("085ba7"), | |
}; | |
using (var img = new Image(1208, 1208)) | |
{ | |
// img.Fill(Color.Black); | |
img.Fill(Color.FromHex("e1e1e1ff"), new SixLabors.Shapes.Ellipse(center, 603f)); | |
img.Fill(Color.White, new SixLabors.Shapes.Ellipse(center, 603f-60)); | |
for (var i = 0; i < 6; i++) | |
{ | |
img.Fill(colors[i], segments[i]); | |
} | |
img.Fill(new Color(0, 0, 0, 170), new ComplexPolygon(new SixLabors.Shapes.Ellipse(center, 161f), new SixLabors.Shapes.Ellipse(center, 61f))); | |
img.Save("logo.png"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment