Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Util / ImageUtil / GifFrame.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Multimedia.Util
20 {
21     /// <summary>
22     /// Represent gif image data used to encode a gif image with <see cref="GifEncoder"/>.
23     /// </summary>
24     public class GifFrame
25     {
26
27         /// <summary>
28         /// Initialize a new instance of the <see cref="GifFrame"/> class with a buffer and a delay.
29         /// </summary>
30         /// <param name="buffer">The raw image buffer to be encoded.</param>
31         /// <param name="delay">The delay for this image, in 0.001 sec units.</param>
32         /// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception>
33         /// <exception cref="ArgumentException">The length of <paramref name="buffer"/> is zero.</exception>
34         public GifFrame(byte[] buffer, uint delay)
35         {
36             if (buffer == null)
37             {
38                 throw new ArgumentNullException(nameof(buffer));
39             }
40
41             if (buffer.Length == 0)
42             {
43                 throw new ArgumentException("buffer has no element.", nameof(buffer));
44             }
45
46             Buffer = buffer;
47             Delay = delay;
48         }
49
50         /// <summary>
51         /// Gets the raw image data.
52         /// </summary>
53         public byte[] Buffer { get; }
54
55         /// <summary>
56         /// Gets or sets the delay for this image.
57         /// </summary>
58         /// <value>Time delay in 0.001 sec units.</value>
59         public uint Delay { get; set; }
60     }
61 }