これは私が私のUWPのアプリでこれを変換する必要があるのWinFormコードuwpアプリケーションのGraphicsクラスとPenクラスの置き換えは何ですか?
private EasyScript eScript;
/// <summary>
/// Graphics object we'll draw on to in order to produce a signature
/// image.
/// </summary>
private Graphics graphics;
/// <summary>
/// Raster backing the graphics object.
/// </summary>
private Bitmap raster;
/// <summary>
/// Pen we'll use to create strokes on our graphics object.
/// </summary>
private Pen pen;
/// <summary>
/// The last point we captured.
/// </summary>
private Coordinate lastPoint = null;
/// <summary>
/// Whether or not the next event we receive should clear the signature.
/// </summary>
private bool clearOnNext = false;
/// <summary>
/// The current stroke count.
/// </summary>
private int strokeCount = 0;
/// <summary>
/// The amount to scale the coordinates by.
/// </summary>
private double scaleFactor = 1;
/// <summary>
/// Initializes a new instance of the <see cref="ExampleForm"/> class.
/// </summary>
public ExampleForm()
{
//Create a new EasyScript object.
this.eScript = new EasyScript();
//Register ourselves as a signature listener.
eScript.AddListener(this);
//Initialize our form.
this.InitializeComponent();
//Initialize our drawing components.
raster = new Bitmap(signaturePictureBox.Width, signaturePictureBox.Height);
graphics = Graphics.FromImage(raster);
//Enable high quality drawing.
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
pen = new Pen(Brushes.Black);
//Calculate our scale factor based on the size of the picture box.
scaleFactor = signaturePictureBox.Width/eScript.GetSignatureProtocol().GetWidth();
//Clear the picture box.
ClearSignatureBox();
// this allows the form to preview all keyboard events before other parts of the form are allowed
// to get them. If a particular keyboard event is from a ScripTouch device,
// we can prevent the event from propogating to other form elements, such as a TextBox.
this.KeyPreview = true;
this.cardSwipeInfoTextBox.ReadOnly = true;
this.signatureInfoTextBox.ReadOnly = true;
}
です。しかし、私はペンの代わりにBitmapとSolidColorBrushの代わりにWriteableBitmapを使うことができます。しかしGraphicsクラスのためにはどうすべきでしょうか。私はライン graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.SmoothingMode = SmoothingMode.AntiAlias;
とgraphics.FillRectangle(Colors.White, 0, 0, signature.Width, signature.Height);
と graphics.DrawLine(pen, (float)(lastPoint.X * scaleFactor), (float)(lastPoint.Y * scaleFactor), (float)(coordinate.X * scaleFactor), (float)(coordinate.Y * scaleFactor));
署名された私のイメージオブジェクトの下にこれらから離れてWriteableBitmapとしてグラフィックスを考慮すれば
とにかくすべてが解決されます。
ありがとうございます。
グラフィックスは[WriteableBitmap](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.writeablebitmap)です。 – lindexi