protected override IMAGE32 Evaluate() { if (FontFamily == null) { return(null); } if (Size <= 0) { return(null); } var font = new SixLabors.Fonts.Font(FontFamily, Size); var context = new SixLabors.Fonts.RendererOptions(font); var characters = "0123456789ABCDEFGHIJKLM"; var padding = new Size(this.Padding, this.Padding); var cellSize = context.GetGlypthMaxBounds(characters.ToCharArray()).OuterRound().Size; cellSize += padding * 2; var image = ImageFactory.CreateImage <Rgba32>(cellSize * 16); foreach (var c in characters.ToArray()) { _DrawGlyph(image, cellSize, padding, context, c); } return(image); }
/* * private void RegisterEditUrlHelper(HandlebarsDotNet.IHandlebars hbs, IModuleControl module) * { * hbs.RegisterHelper("editurl", (writer, context, parameters) => * { * if (parameters.Length == 1) * { * string id = parameters[0] as string; * writer.WriteSafeString(module.ModuleContext.EditUrl("itemid", id)); * } * }); * } */ /// <summary> /// Retrieves image URL. /// Param1 is imageId, Param2 is Size of the image. In Bootstrap 12th, Param3 is ratio string (eg '1x1'), /// </summary> /// <param name="hbs">The HBS.</param> private void RegisterImageUrlHelper(HandlebarsDotNet.IHandlebars hbs) { hbs.RegisterHelper("imageurl", (writer, context, parameters) => { if (parameters.Length == 3) { string imageId = parameters[0] as string; int width = Normalize.DynamicValue(parameters[1], -1); string ratiostring = parameters[2] as string; bool isMobile = HttpContext.Current.Request.Browser.IsMobileDevice; ImageUri imageObject = ImageFactory.CreateImage(imageId); var imageUrl = imageObject == null ? string.Empty : imageObject.GetImageUrl(width, ratiostring, isMobile); writer.WriteSafeString(imageUrl); } }); }
public void ResolveVertices_ValidCoordinates_TriangleSorted() { //Arrange IImage gTotest = _factory.CreateImage(); List <Coordinate> locations = new List <Coordinate> { new Coordinate { X = 10, Y = 50 }, new Coordinate { X = 20, Y = 50 }, new Coordinate { X = 20, Y = 60 } }; ((RightAngleTriangle)gTotest).ResolveVertices(locations); Assert.IsTrue(gTotest != null); }
public Bird(IRoute route) : base(route, 50, 300, 5, 100, ImageFactory.CreateImage("bird.png")) { }
public Dragon(IRoute route) : base(route, 50, 500, 10, 200, ImageFactory.CreateImage("dragon.png")) { }
public Witch(IRoute route) : base(route, 100, 250, 10, 200, ImageFactory.CreateImage("witch.png")) { }
public Bat(IRoute route) : base(route, 100, 250, 10, 200, ImageFactory.CreateImage("vampire.png")) { }
public Deamon(IRoute route) : base(route, 50, 300, 5, 100, ImageFactory.CreateImage("deamon.png")) { }