1 /** 2 * @file lv_utils.h 3 * 4 */ 5 6 #ifndef LV_UTILS_H 7 #define LV_UTILS_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "lv_types.h" 18 #include "../draw/lv_draw_buf.h" 19 20 /********************* 21 * DEFINES 22 *********************/ 23 24 /********************** 25 * TYPEDEFS 26 **********************/ 27 28 /********************** 29 * GLOBAL PROTOTYPES 30 **********************/ 31 32 /** Searches base[0] to base[n - 1] for an item that matches *key. 33 * 34 * @note The function cmp must return negative if it's first 35 * argument (the search key) is less that it's second (a table entry), 36 * zero if equal, and positive if greater. 37 * 38 * @note Items in the array must be in ascending order. 39 * 40 * @param key Pointer to item being searched for 41 * @param base Pointer to first element to search 42 * @param n Number of elements 43 * @param size Size of each element 44 * @param cmp Pointer to comparison function (see unicode_list_compare() 45 * as a comparison function example) 46 * 47 * @return a pointer to a matching item, or NULL if none exists. 48 */ 49 void * lv_utils_bsearch(const void * key, const void * base, size_t n, size_t size, 50 int (*cmp)(const void * pRef, const void * pElement)); 51 52 /** 53 * Save a draw buf to a file 54 * @param draw_buf pointer to a draw buffer 55 * @param path path to the file to save 56 * @return LV_RESULT_OK: success; LV_RESULT_INVALID: error 57 */ 58 lv_result_t lv_draw_buf_save_to_file(const lv_draw_buf_t * draw_buf, const char * path); 59 60 /********************** 61 * MACROS 62 **********************/ 63 64 #ifdef __cplusplus 65 } /*extern "C"*/ 66 #endif 67 68 #endif 69