Blame view

LiveChat/SDK/include/lemon/service/rcs/mtc_doodle.h 12.8 KB
9f17d59e   陈明泉   no message
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
  /************************************************************************
  
          Copyright (c) 2005-2011 by Juphoon System Software, Inc.
                         All rights reserved.
  
       This software is confidential and proprietary to Juphoon System,
       Inc. No part of this software may be reproduced, stored, transmitted,
       disclosed or used in any form or by any means other than as expressly
       provided by the written license agreement between Juphoon and its
       licensee.
  
       THIS SOFTWARE IS PROVIDED BY JUPHOON "AS IS" AND ANY EXPRESS OR 
       IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       ARE DISCLAIMED. IN NO EVENT SHALL JUPHOON BE LIABLE FOR ANY DIRECT, 
       INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
       OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
       HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
       STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
       IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
       POSSIBILITY OF SUCH DAMAGE. 
  
                      Juphoon System Software, Inc.
                      Email: support@juphoon.com
                      Web: http://www.juphoon.com
  
  ************************************************************************/
  /*************************************************
    File name     : mtc_doodle.h
    Module        : multimedia talk client
    Author        : xiangbo.hui
    Created on    : 2015-03-27
    Description   :
        Data structure and function declare required by MTC statistics
  
    Modify History:
    1. Date:        Author:         Modification:
  *************************************************/
  #ifndef _MTC_DOODLE_H__
  #define _MTC_DOODLE_H__
  
  /**
   * @file mtc_doodle.h
   * @brief MTC Doodle Interface Functions
   *
   * This file includes doodle interface function.
   */
  
  /**
   * @defgroup MtcDoodleKey MTC notification key for doodle.
   * @{
   */
  
  /**
   * @brief A key whose value is a number object reflecting
   * the type of image, @ref EN_MTC_DOODLE_IMAGE_TYPE.
   */
  #define MtcDoodleImageTypeKey       "MtcDoodleImageTypeKey"
  
  /**
   * @brief A key whose value is a string object reflecting
   * the image name.
   */
  #define MtcDoodleImageNameKey       "MtcDoodleImageNameKey"
  
  /**
   * @brief A key whose value is a string object reflecting
   * the image URI.
   */
  #define MtcDoodleImageUriKey        "MtcDoodleImageUriKey"
  
  /**
   * @brief A key whose value is a array object contains 2 number object reflecting
   * the resolution in pixels.
   */
  #define MtcDoodleResolutionKey      "MtcDoodleResolutionKey"
  
  /**
   * @brief A key whose value is a array object contains 2 number object reflecting
   * the position of point, which value is from -1 to 1.
   */
  #define MtcDoodlePositionKey        "MtcDoodlePositionKey"
  
  /**
   * @brief A key whose value is a number object reflecting
   * the type of action, @ref EN_MTC_DOODLE_ACTION_TYPE.
   */
  #define MtcDoodleActionTypeKey      "MtcDoodleActionTypeKey"
  
  /**
   * @brief A key whose value is a number object reflecting
   * the sequence of action.
   */
  #define MtcDoodleSeqNoKey           "MtcDoodleSeqNoKey"
  
  /**
   * @brief A key whose value is a object reflecting
   * the brush's info, contains @ref MtcDoodleWidthKey, @ref MtcDoodleColorKey.
   */
  #define MtcDoodleBrushKey           "MtcDoodleBrushKey"
  
  /**
   * @brief A key whose value is a number object reflecting
   * the width in pixels.
   */
  #define MtcDoodleWidthKey           "MtcDoodleWidthKey"
  
  /**
   * @brief A key whose value is a number object reflecting
   * the width in pixels.
   */
  #define MtcDoodleColorKey           "MtcDoodleColorKey"
  
  /**
   * @brief A key whose value is a number object reflecting
   * the index of page.
   */
  #define MtcDoodlePageIdKey          "MtcDoodlePageIdKey"
  
  /**
   * @brief A key whose value is a number object reflecting
   * the count of page.
   */
  #define MtcDoodlePageCountKey       "MtcDoodlePageCountKey"
  
  /**
   * @brief A key whose value is a string object reflecting
   * the user's URI.
   */
  #define MtcDoodleUserUriKey         "MtcDoodleUserUriKey"
  
  /**
   * @brief A key whose value is a string object reflecting
   * the action's content.
   */
  #define MtcDoodleContentKey         "MtcDoodleContentKey"
  
  /** @} */
  
  /**
   * @defgroup MtcDoodleNotification MTC notification names for doodle.
   * @{
   */
  
  /** @} */
  
  typedef ZVOID * MTC_IMG;
  typedef ZVOID * MTC_ACT;
  typedef ZVOID * MTC_SESS;
  
  /** @brief The type of image. */
  typedef enum EN_MTC_DOODLE_IMAGE_TYPE
  {
      EN_MTC_DOODLE_IMAGE_PNG = 1,
      EN_MTC_DOODLE_IMAGE_JPEG,
      EN_MTC_DOODLE_IMAGE_BMP
  } EN_MTC_DOODLE_IMAGE_TYPE;
  
  /** @brief The type of action. */
  typedef enum EN_MTC_DOODLE_ACTION_TYPE
  {
      EN_MTC_DOODLE_ACTION_DRAW,
      EN_MTC_DOODLE_ACTION_ERASE,
      EN_MTC_DOODLE_ACTION_CLEAN,
      EN_MTC_DOODLE_ACTION_UNDO,
      EN_MTC_DOODLE_ACTION_SELECT_PAGE,
      EN_MTC_DOODLE_ACTION_START,
      EN_MTC_DOODLE_ACTION_STOP,
      EN_MTC_DOODLE_ACTION_LASER_POINT,
      EN_MTC_DOODLE_ACTION_ARROW,
      EN_MTC_DOODLE_ACTION_DRAW_RECTANGLE,
      EN_MTC_DOODLE_ACTION_DRAW_ELLIPSE,
      EN_MTC_DOODLE_ACTION_TEXT,
  } EN_MTC_DOODLE_ACTION_TYPE;
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @brief Create image object.
   * @return            Image object.
   */
  MTCFUNC MTC_IMG Mtc_DoodleCreateImage(ZFUNC_VOID);
  
  /**
   * @brief Delete image object.
   * @param  zImage The image object.
   */
  MTCFUNC ZVOID Mtc_DoodleDeleteImage(MTC_IMG zImage);
  
  /**
   * @brief Create image object from text.
   * @param  pcMsg The text.
   * @return       The Image object.
   */
  MTCFUNC MTC_IMG Mtc_DoodleParseImage(ZCONST ZCHAR *pcMsg);
  
  /**
   * @brief Save image object to text.
   * @param  zImage The image object.
   * @return        The text string.
   */
  MTCFUNC ZCONST ZCHAR * Mtc_DoodlePrintImage(MTC_IMG zImage);
  
  /**
   * @brief Set image attributes.
   * @param  zImage The image object.
   * @param  pcInfo The attributes in JSON format which contains
   *                @ref MtcDoodlePageIdKey
   *                @ref MtcDoodleImageTypeKey
   *                @ref MtcDoodleImageNameKey
   *                @ref MtcDoodleImageUriKey
   *                @ref MtcDoodleResolutionKey
   *                @ref MtcDoodlePositionKey
   * @return        ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleSetImageAttr(MTC_IMG zImage,
      ZCONST ZCHAR *pcInfo);
  
  /**
   * @brief Get image attributes.
   * @param  zImage The image object.
   * @return        The attributes in JSON format which contains
   *                @ref MtcDoodlePageIdKey
   *                @ref MtcDoodleImageTypeKey
   *                @ref MtcDoodleImageNameKey
   *                @ref MtcDoodleImageUriKey
   *                @ref MtcDoodleResolutionKey
   *                @ref MtcDoodlePositionKey
   */
  MTCFUNC ZCONST ZCHAR * Mtc_DoodleGetImageAttr(MTC_IMG zImage);
  
  /**
   * @brief Create action object.
   * @return            The action object.
   */
  MTCFUNC MTC_ACT Mtc_DoodleCreateAction(ZFUNC_VOID);
  
  /**
   * @brief Delete action object.
   * @param  zAction The action object.
   */
  MTCFUNC ZVOID Mtc_DoodleDeleteAction(MTC_IMG zAction);
  
  /**
   * @brief Create action object from text.
   * @param  pcMsg The text.
   * @return       The action object.
   */
  MTCFUNC MTC_ACT Mtc_DoodleParseAction(ZCONST ZCHAR *pcMsg);
  
  /**
   * @brief Save action object to text.
   * @param  zAction The action object.
   * @return         The text string.
   */
  MTCFUNC ZCONST ZCHAR * Mtc_DoodlePrintAction(MTC_IMG zAction);
  
  /**
   * @brief Set action attributes.
   * @param  zAction The action object.
   * @param  pcInfo  The attributes in JSON format which contains
   *                 @ref MtcDoodleActionTypeKey
   *                 @ref MtcDoodleSeqNoKey
   *                 @ref MtcDoodleBrushKey
   *                 @ref MtcDoodlePageIdKey
   *                 @ref MtcDoodleContentKey
   * @return         ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleSetActionAttr(MTC_IMG zAction,
      ZCONST ZCHAR *pcInfo);
  
  /**
   * @brief Get action attributes.
   * @param  zAction The action object.
   * @return         The attributes in JSON format which contains
   *                 @ref MtcDoodleActionTypeKey
   *                 @ref MtcDoodleSeqNoKey
   *                 @ref MtcDoodleBrushKey
   *                 @ref MtcDoodlePageIdKey
   *                 @ref MtcDoodleContentKey
   */
  MTCFUNC ZCONST ZCHAR * Mtc_DoodleGetActionAttr(MTC_IMG zAction);
  
  /**
   * @brief Add action position.
   * @param  zAction The action object.
   * @param  fX      The X value from -1.0 to 1.0.
   * @param  fY      The Y value from -1.0 to 1.0.
   * @return         ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleAddActionPosition(MTC_ACT zAction,
      ZFLOAT fX, ZFLOAT fY);
  
  /**
   * @brief Set action positions.
   * @param  zAction The action object.
   * @param  fX      The value from -1.0 to 1.0.
   * @param  fY      The value from -1.0 to 1.0.
   * @param  iIntVal The interval.
   * @return         ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleAddActionPositionX(MTC_ACT zAction,
      ZFLOAT fX, ZFLOAT fY, ZUINT iIntVal);
  
  /**
   * @brief Get count of positions in action object.
   * @param  zAction The action object.
   * @return         The count of positions.
   */
  MTCFUNC ZINT Mtc_DoodleGetActionPositionCount(MTC_ACT zAction);
  
  /**
   * @brief Get the interval of position.
   * @param  zAction The action object.
   * @param  iIndex  The index of position, from 0 to count-1.
   * @return         The interval in milliseconds.
   */
  MTCFUNC ZINT Mtc_DoodleGetActionIntval(MTC_ACT zAction, ZINT iIndex);
  
  /**
   * @brief Get the X value of position.
   * @param  zAction The action object.
   * @param  iIndex  The index of position, from 0 to count-1.
   * @return         The X value of postion.
   */
  MTCFUNC ZFLOAT Mtc_DoodleGetActionPositionX(MTC_ACT zAction, ZINT iIndex);
  
  /**
   * @brief Get the Y value of position.
   * @param  zAction The action object.
   * @param  iIndex  The index of position, from 0 to count-1.
   * @return         The Y value of postion.
   */
  MTCFUNC ZFLOAT Mtc_DoodleGetActionPositionY(MTC_ACT zAction, ZINT iIndex);
  
  /**
   * @brief Get the path of action.
   * @param  zAction The action object.
   * @return         The path in JSON format which is array contains
   *                 all positions. Each position is array of number.
   *                 First number is interval in milliseoncds.
   *                 Second number is X value of position.
   *                 Third number is Y value of position.
   */
  MTCFUNC ZCONST ZCHAR * Mtc_DoodleGetActionPath(MTC_ACT zAction);
  
  /**
   * @brief Create session object.
   * @return            The session object.
   */
  MTCFUNC MTC_SESS Mtc_DoodleCreateSession(ZFUNC_VOID);
  
  /**
   * @brief Delete session object.
   * @param  zSession The session object.
   */
  MTCFUNC ZVOID Mtc_DoodleDeleteSession(MTC_SESS zSession);
  
  /**
   * @brief Set page count.
   * @param  zSession The session object.
   * @param  iCount   The count of pages.
   * @return          ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleSessionSetPageCount(MTC_SESS zSession, ZINT iCount);
  
  /**
   * @brief Add image object to session.
   *
   * You must not delete image after add this image to the session.
   * The image will replace the exist one with same MtcDoodlePageIdKey.
   * 
   * @param  zSession The session object.
   * @param  zImage   The image object.
   * @return          ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleSessionAddImage(MTC_SESS zSession, MTC_IMG zImage);
  
  /**
   * @brief Get the count of image.
   * @param  zSession The session object.
   * @return          The count of images.
   */
  MTCFUNC ZINT Mtc_DoodleSessionGetImageCount(MTC_SESS zSession);
  
  /**
   * @brief Enumrate the image object.
   * @param  zSession The session object.
   * @param  iIndex   The index of image, from 0 to count-1.
   * @return          The image object.
   */
  MTCFUNC MTC_IMG Mtc_DoodleSessionEnumImage(MTC_SESS zSession, ZUINT iIndex);
  
  /**
   * @brief Add action object to session.
   * @param  zSession The session object.
   * @param  bSelf    ZTRUE indicates the action was taken by self.
   *                  Otherwise the actions was taken by peer.
   * @param  zAction  The action object.
   * @return          ZOK on succeed, otherwise failed.
   */
  MTCFUNC ZINT Mtc_DoodleSessionAddAction(MTC_SESS zSession, ZBOOL bSelf,
      MTC_ACT zAction);
  
  /**
   * @brief Get count of actions.
   * @param  zSession The session object.
   * @return          The count of actions.
   */
  MTCFUNC ZINT Mtc_DoodleSessionGetActionCount(MTC_SESS zSession);
  
  /**
   * @brief Enumrate the actions in session.
   * @param  zSession The session object.
   * @param  iIndex   The index of action, from 0 to count-1.
   * @return          The action object.
   */
  MTCFUNC MTC_ACT Mtc_DoodleSessionEnumAction(MTC_SESS zSession, ZUINT iIndex);
  
  /**
   * @brief Enumrate the self flags in session.
   * @param  zSession The session object.
   * @param  iIndex   The index of action, from 0 to count-1.
   * @return          The self flag.
   */
  MTCFUNC ZBOOL Mtc_DoodleSessionEnumSelf(MTC_SESS zSession, ZUINT iIndex);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* _MTC_DOODLE_H__ */