blob: 96b870a7718a9dd069f3b675535a9e023fa323fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.RemoteDesktop.Encoders
{
/// <summary>
/// Represents an <see cref="IFrame"/> PNG encoder.
/// </summary>
/// <seealso cref="Tango.RemoteDesktop.FrameEncoder" />
public class PngEncoder : FrameEncoder
{
/// <summary>
/// Initializes a new instance of the <see cref="PngEncoder"/> class.
/// </summary>
/// <param name="frame">The frame.</param>
public PngEncoder(IFrame frame) : base(frame)
{
}
/// <summary>
/// Returns a stream containing the encoded frame.
/// </summary>
/// <returns></returns>
public override MemoryStream ToStream()
{
MemoryStream ms = new MemoryStream();
Frame.ToBitmap().Save(ms, ImageFormat.Png);
return ms;
}
}
}
|