Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PixelInformationRaw.cs
1using System;
2using System.IO;
3using SkiaSharp;
4
6{
11 {
12 private readonly SKColorType colorType;
13 private readonly int bytesPerRow;
14
23 public PixelInformationRaw(SKColorType ColorType, byte[] Binary, int Width, int Height, int BytesPerRow)
24 : base(Binary, Width, Height)
25 {
26 this.colorType = ColorType;
27 this.bytesPerRow = BytesPerRow;
28 }
29
33 public SKColorType ColorType => this.colorType;
34
38 public int BytesPerRow => this.bytesPerRow;
39
44 public override SKImage CreateBitmap()
45 {
46 using (MemoryStream ms = new MemoryStream(this.Binary))
47 {
48 using (SKData Data = SKData.Create(ms))
49 {
50 return SKImage.FromPixels(new SKImageInfo(this.Width, this.Height, this.colorType), Data, this.bytesPerRow);
51 }
52 }
53 }
54
59 public override PixelInformationRaw GetRaw()
60 {
61 return this;
62 }
63 }
64}
Contains pixel information
byte[] Binary
Binary representation of pixels
Contains pixel information in a raw unencoded format.
PixelInformationRaw(SKColorType ColorType, byte[] Binary, int Width, int Height, int BytesPerRow)
Contains pixel information in a raw unencoded format.
override PixelInformationRaw GetRaw()
Gets raw pixel data.
SKColorType ColorType
How pixels are represented
override SKImage CreateBitmap()
Creates an SKImage image. It must be disposed by the caller.