Tag: win2d

如何使用Win2D(行间距)计算FontFamily的高度?

我想知道如何使用Win2D在Window Universal Application中计算给定字体的高度(具有其属性,如大小,重量,样式……) 。 我之前使用过CanvasTextLayout ,但它需要一个文本才能工作,就像在这一行: var ctl = new CanvasTextLayout(session, “Some text”, new CanvasTextFormat(), constraintWidth, constraintHeight ); 在我的情况下, 我将没有文本,因为我正在寻找的是给定字体的所有字形(其样式,大小,重量……)适合的高度。 编辑:我也尝试过CanvasFontFace类,但它似乎没有任何公共构造函数。

在UWP.Access中保存图像时拒绝访问被拒绝。 (来自HRESULT的exception:0x80070005(E_ACCESSDENIED))

我正在使用Windows 10 SDK上的通用Windows应用程序在图像中识别的面上绘制矩形。 我正在使用Win2D编辑图片并在其上绘制矩形。 我能够从图片库中读取文件,但是当我尝试在编辑后保存图像时,会出现以下错误: 访问被拒绝。 (来自HRESULT的exception:0x80070005(E_ACCESSDENIED)) 以下是我用于在图像上绘制矩形的方法: private async void DrawRect() { CanvasDevice device = CanvasDevice.GetSharedDevice(); CanvasBitmap bitmap = null; CanvasRenderTarget offscreen = null; Windows.Storage.StorageFile photofile = await KnownFolders.PicturesLibrary.GetFileAsync(“image.jpg”); if(photofile != null) { using (var stream = await photofile.OpenReadAsync()) { bitmap = await CanvasBitmap.LoadAsync(device, stream); } } if(bitmap != null) { offscreen = new […]