amarullz

API Header Example?

Jan 20th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.92 KB | None | 0 0
  1. /********************************************************************[libaroma]*
  2.  * Copyright (C) 2011-2015 Ahmad Amarullah (http://amarullz.com/)
  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.  * Filename    : aroma_api.h
  18.  * Description : libaroma api header
  19.  *
  20.  * + This is part of libaroma, an embedded ui toolkit.
  21.  * + 20/01/16 - Author(s): Ahmad Amarullah
  22.  *
  23.  */
  24. #ifndef __aroma_api_h__
  25. #define __aroma_api_h__  
  26. /* extern for cpp */
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. #include <stdint.h>
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34.  
  35. /* primitive unsigneds */
  36. typedef uint8_t  byte;
  37. typedef uint16_t word;
  38. typedef uint32_t dword;
  39. typedef uint32_t uchar;
  40. typedef byte * bytep;
  41. typedef word * wordp;
  42. typedef dword * dwordp;
  43. #ifndef ZLIB_H
  44. typedef void * voidp;
  45. #endif
  46. typedef uchar * ucharp;
  47. typedef word acolor;
  48. typedef wordp acolorp;
  49.  
  50. /* libaroma pointers */
  51. typedef voidp acanvas;
  52. typedef voidp awindow;
  53. typedef voidp acontrol;
  54. typedef voidp alist;
  55. typedef voidp amessage;
  56. typedef voidp astream;
  57. typedef voidp atext;
  58. typedef voidp aarray;
  59. typedef voidp azip;
  60.  
  61. /* canvas api */
  62. typedef struct{
  63.   /* new */
  64.   acanvas (*new)(int w,int h);
  65.   acanvas (*new_alpha)(int w,int h);
  66.   acanvas (*new_shmem)(int w,int h, byte alpha_canvas, const char * shmemname);
  67.   acanvas (*new_area)(acanvas parent,int x,int y, int w, int h);
  68.  
  69.   /* free */
  70.   acanvas (*free)(acanvas c);
  71.   acanvas (*free_delete_shm)(acanvas c);
  72.  
  73.   /* duplicate */
  74.   acanvas (*dup)(acanvas source);
  75.  
  76.   /* data processing */
  77.   void (*clear)(acanvas c);
  78.   void (*fill)(acanvas c, acolor color);
  79.   void (*set)(acanvas c, acolor color, byte alpha);
  80.  
  81.   /* get */
  82.   int (*width)(acanvas c);
  83.   int (*height)(acanvas c);
  84.   int (*size)(acanvas c);
  85.   int (*line)(acanvas c);
  86.   acolorp (*data)(acanvas c);
  87.   bytep (*alpha)(acanvas c);
  88.   byte (*is_shmem)(acanvas c);
  89.   byte (*is_child)(acanvas c);
  90. } acanvas_api_t, *acanvas_api;
  91.  
  92. /* draw api */
  93. typedef struct{
  94.   awindow (*window)(int x,int y, int w, int h);
  95.  
  96. } aui_api_t, *aui_api;
  97.  
  98. /* context */
  99. typedef struct{
  100.   acanvas_api   canvas;
  101.   adraw_api     draw;
  102.   aui_api       ui;
  103.   amessage_api  message;
  104.   astream_api   stream;
  105.   autil_api     util;
  106. } acontext_t, * acontext;
  107.  
  108.  
  109. /* end of extern for cpp */
  110. #ifdef __cplusplus
  111. }
  112. #endif  
  113. #endif /* __aroma_api_h__ */
Advertisement
Add Comment
Please, Sign In to add comment