do memegen-style text better. also fix indentation
This commit is contained in:
parent
9de8c6de51
commit
ec6be80143
33
Program.cs
33
Program.cs
@ -166,19 +166,26 @@ public class Photo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Texture Texture() {
|
public Texture Texture() {
|
||||||
if (texture == placeholder && image != null) {
|
if (texture == placeholder && image != null) {
|
||||||
IPath yourPolygon = new Star(x: 2000.0f, y: 1000.0f, prongs: 5, innerRadii: 20.0f, outerRadii: 50.0f, angle: Util.PI);
|
IPath yourPolygon = new Star(x: 2000.0f, y: 1000.0f, prongs: 5, innerRadii: 20.0f, outerRadii: 50.0f, angle: Util.PI);
|
||||||
image.Mutate(x => x.Fill(Color.White, yourPolygon));
|
image.Mutate(x => x.Fill(Color.White, yourPolygon));
|
||||||
Font font = SystemFonts.CreateFont("Consolas", 120);
|
Font font = SystemFonts.CreateFont("Impact", 120);
|
||||||
string text = "oh no i made a memegen";
|
TextOptions options = new(font) {
|
||||||
image.Mutate(x => x.DrawText(text, font, Color.White, new PointF(800, 10)));
|
WrappingLength = image.Width,
|
||||||
Console.WriteLine("making texture for " + file);
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
texture = new Texture(image);
|
Origin = new PointF(image.Width / 2, image.Height / 2 - 60),
|
||||||
image.Dispose();
|
};
|
||||||
image = null;
|
string text = "oh no i made a memegen";
|
||||||
}
|
IBrush brush = Brushes.Solid(Color.White);
|
||||||
return texture;
|
IPen pen = Pens.Solid(Color.Black, 2.5f);
|
||||||
}
|
image.Mutate(x => x.DrawText(options, text, brush, pen));
|
||||||
|
Console.WriteLine("making texture for " + file);
|
||||||
|
texture = new Texture(image);
|
||||||
|
image.Dispose();
|
||||||
|
image = null;
|
||||||
|
}
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Texture : IDisposable {
|
public class Texture : IDisposable {
|
||||||
|
Loading…
Reference in New Issue
Block a user