示例#1
0
 public IconImageSourceService(
     IFontRegistry fontRegistry,
     FontImageSourceService fontImageSourceService)
 {
     _fontRegistry           = fontRegistry;
     _fontImageSourceService = fontImageSourceService;
 }
        public async Task ThrowsForIncorrectTypes(Type type)
        {
            var service = new FontImageSourceService(null);

            var imageSource = (ImageSourceStub)Activator.CreateInstance(type);

            await Assert.ThrowsAsync <InvalidCastException>(() => service.GetDrawableAsync(imageSource, MauiProgram.DefaultContext));
        }
示例#3
0
        public IResource Decode(Java.Lang.Object model, int width, int height, Options options)
        {
            var source = (FontImageSourceModel)model;

            // TODO: do not use the static here, make the service extensible so that it can be overridden
            var bitmap = FontImageSourceService.RenderBitmap(source, (w, h, c) => _bitmapPool.Get(w, h, c));

            return(new BitmapResource(bitmap, _bitmapPool));
        }