1. Tag Results
byte (2)
1 - 2 of 2
How to save signature as a byte array in Xamarin.Forms Signature Pad
Step 1: Create a SfSignaturePad sample that includes all required assemblies.   Please refer to the following link to create a simple SignaturePad sample along with the ways to configure it. https://help.syncfusion.com/xamarin/signaturepad/overview   Step 2: Create a simple SignaturePad sample using the following code snippet.   XAML:   <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"              xmlns:d="http://xamarin.com/schemas/2014/forms/design"              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"             mc:Ignorable="d"              xmlns:signature="clr-namespace:Syncfusion.XForms.SignaturePad;assembly=Syncfusion.SfSignaturePad.XForms"              x:Class="SignaturePadSample.MainPage">       <StackLayout>         <Label Text="Input Your Signature"/>         <Frame>             <signature:SfSignaturePad  x:Name="signature"                                       HeightRequest="250"/>         </Frame>         <Button Text="ConvertSourceToBytes" Clicked="Button_Clicked"/>     </StackLayout> </ContentPage>   Step 3: You can convert the saved SignaturePad bitmap format to byte arrays as shown in the following code sample.   XAML.cs: using SkiaSharp; using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms;   namespace SignaturePadSample {     [DesignTimeVisible(false)]     public partial class MainPage : ContentPage     {         public MainPage()         {             InitializeComponent();         }           private void Button_Clicked(object sender, EventArgs e)         {             signature.Save();             StreamImageSource streamImageSource = (StreamImageSource)signature.ImageSource;             System.Threading.CancellationToken cancellationToken =             System.Threading.CancellationToken.None;             Task<Stream> task = streamImageSource.Stream(cancellationToken);             Stream stream = task.Result;             byte[] bytes = new byte[stream.Length];             stream.Read(bytes, 0, bytes.Length);         }     } }   View Sample in GitHub
How to read image byte while rendering a WPF Chart (SfChart)?
This article explains how to read a WPF Chart (SfChart) as a stream of bytes and save it in an image format during rendering. A FileStream supports both read and write operations. In this example, a chart is captured as a stream of bytes and saved as a PNG image. The RenderTargetBitmap class specifies the target chart's width, height, and pixel format. The PngBitmapEncoder is used to encode the image to PNG format. When the button is clicked, the rendered chart image is generated in the bin\Debug folder. C# private void ImageExport_Click(object sender, RoutedEventArgs e) {            const string path = "Chart.png";   RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)ScatterChart.ActualWidth, (int)ScatterChart.ActualHeight,70d, 70d, PixelFormats.Pbgra32);   renderBitmap.Render(ScatterChart);   using (FileStream ostream = new FileStream(path, FileMode.Create))   {     PngBitmapEncoder Bitmapencoder = new PngBitmapEncoder();     Bitmapencoder.Frames.Add(BitmapFrame.Create(renderBitmap));     // encoder.Save(outStream);     ScatterChart.Save(ostream, Bitmapencoder);   } }  Output ConclusionI hope you enjoyed learning about how to read image byte while rendering a WPF Chart(SfChart).You can refer to our WPF Chart’s feature tour page to know about its other groundbreaking feature representations. You can also explore our   WPF Chart documentation to understand how to present and manipulate data.For current customers, you can check out our WPF components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our WPF Chart and other WPF components.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
No articles found
No articles found
1 of 1 pages (2 items)