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() {
|
||||
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);
|
||||
image.Mutate(x => x.Fill(Color.White, yourPolygon));
|
||||
Font font = SystemFonts.CreateFont("Consolas", 120);
|
||||
string text = "oh no i made a memegen";
|
||||
image.Mutate(x => x.DrawText(text, font, Color.White, new PointF(800, 10)));
|
||||
Console.WriteLine("making texture for " + file);
|
||||
texture = new Texture(image);
|
||||
image.Dispose();
|
||||
image = null;
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
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);
|
||||
image.Mutate(x => x.Fill(Color.White, yourPolygon));
|
||||
Font font = SystemFonts.CreateFont("Impact", 120);
|
||||
TextOptions options = new(font) {
|
||||
WrappingLength = image.Width,
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
Origin = new PointF(image.Width / 2, image.Height / 2 - 60),
|
||||
};
|
||||
string text = "oh no i made a memegen";
|
||||
IBrush brush = Brushes.Solid(Color.White);
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user