Windows 잉크를 UWP 앱에 포함하려고 시도하고 Windows Ink tutorial app을 적용하여 시작된 그림을 GIF/ISF 대신 PNG 이미지로 저장합니다.Windows 잉크를 투명 PNG 이미지로 저장 - 형광펜 선이 누락되었습니다.
그래서, XAML보기는 Windows.UI.Xaml.Controls.InkToolbar
과 Windows.UI.Xaml.Controls.InkCanvas
포함, 나는 캔버스에 선을 그린 다음 코드를 통해 이미지 파일로 저장 할 수있어 :
IReadOnlyList<InkStroke> currentStrokes = inkCanvas.InkPresenter.StrokeContainer.GetStrokes();
if (currentStrokes.Count > 0)
{
StorageFile file;
// Using a file picker to identify the target file -> omitted this part
if (file != null)
{
CanvasDevice device = CanvasDevice.GetSharedDevice();
CanvasRenderTarget renderTarget = new CanvasRenderTarget(device, (int)inkCanvas.ActualWidth, (int)inkCanvas.ActualHeight, 96);
using (var ds = renderTarget.CreateDrawingSession())
{
ds.Clear(Colors.White);
ds.DrawInk(currentStrokes);
}
using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
await renderTarget.SaveAsync(fileStream, CanvasBitmapFileFormat.Png, 1f);
}
}
다 그렇게 잘 작동 멀리. 지금, 나는 투명 배경 이미지를 저장, 그리고 다음 줄을 변경 것 :
ds.Clear(Colors.Transparent);
이 경우에도, 파일이 저장, 배경이 투명하고, 볼펜 연필 스트로크뿐만 아니라 스트로크 올바르게 렌더링됩니다. 그러나 이미지 결과에는 형광펜 도구로 그려진 획이 포함되지 않습니다.
누군가이 경우이 획들이 생략 된 이유를 설명 할 수 있습니까? 어떻게 든 투명 배경 위에 형광펜 스트로크를 렌더링 할 수 있습니까?
감사합니다. – andreask