MT2523 API Reference  LinkIt SDK v4
gdi.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef _GDI_INCLUDE_H_
36 #define _GDI_INCLUDE_H_
37 
286 #include <stdint.h>
287 #include <stdbool.h>
288 
289 #ifdef __cplusplus
290 extern "C"
291 {
292 #endif
293 
298 #define GDI_COLOR_FORMAT_1 0
299 #define GDI_COLOR_FORMAT_8 1
300 #define GDI_COLOR_FORMAT_16 2
301 #define GDI_COLOR_FORMAT_24 3
302 #define GDI_COLOR_FORMAT_32 4
304 #define GDI_SUCCEED (0)
305 #define GDI_FAILED (-1)
316 typedef uint32_t gdi_color_t;
317 typedef uint8_t gdi_color_format_t;
318 typedef int32_t gdi_result_t;
323 typedef struct {
324  int16_t x;
325  int16_t y;
326 } gdi_point_t;
339 void gdi_init(uint32_t width, uint32_t height, gdi_color_format_t color_format, uint8_t *buffer);
348 gdi_color_t gdi_get_color_from_argb(uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue);
358 void gdi_get_argb_from_color(uint8_t *alpha, uint8_t *red, uint8_t *green, uint8_t *blue, gdi_color_t color);
366 void gdi_draw_point(int32_t x, int32_t y, gdi_color_t color);
376 void gdi_draw_line(int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color);
386 void gdi_draw_rectangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color);
396 void gdi_draw_filled_rectangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color);
405 void gdi_draw_circle(int32_t x, int32_t y, int32_t radius, gdi_color_t color);
414 void gdi_draw_filled_circle(int32_t x, int32_t y, int32_t radius, gdi_color_t color);
422 void gdi_draw_filled_polygon(gdi_point_t point[], uint32_t point_num, gdi_color_t color);
430 void gdi_draw_polygon(gdi_point_t point[], uint32_t point_num, gdi_color_t color);
438 gdi_result_t gdi_image_draw_by_id(int32_t x, int32_t y, uint16_t image_id);
448 gdi_result_t gdi_image_draw_resized_by_id(int32_t x, int32_t y, uint32_t width, uint32_t height, uint16_t image_id);
456 gdi_result_t gdi_image_get_dimension_by_id(uint16_t image_id, uint32_t *width, uint32_t *height);
465 gdi_result_t gdi_lcd_update_screen(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2);
466 
467 #ifdef __cplusplus
468 }
469 #endif
470 
476 #endif /* _GDI_INCLUDE_H_ */
477 
478 
int32_t gdi_result_t
Define the GDI result type returned from the APIs.
Definition: gdi.h:318
void gdi_init(uint32_t width, uint32_t height, gdi_color_format_t color_format, uint8_t *buffer)
This function initializes the GDI.
void gdi_draw_circle(int32_t x, int32_t y, int32_t radius, gdi_color_t color)
This function draws a circle on the screen.
gdi_result_t gdi_image_draw_resized_by_id(int32_t x, int32_t y, uint32_t width, uint32_t height, uint16_t image_id)
This function draws an image from a resource with specified dimensions.
void gdi_draw_filled_polygon(gdi_point_t point[], uint32_t point_num, gdi_color_t color)
This function draws a solid polygon on current screen.
gdi_result_t gdi_image_get_dimension_by_id(uint16_t image_id, uint32_t *width, uint32_t *height)
This function gets the image dimension by the image resource ID.
void gdi_draw_rectangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color)
This function draws a rectangle on the screen.
void gdi_get_argb_from_color(uint8_t *alpha, uint8_t *red, uint8_t *green, uint8_t *blue, gdi_color_t color)
This function extracts alpha, red, green, blue from the given color, the value range of the component...
int16_t y
The y position of the point.
Definition: gdi.h:325
uint32_t gdi_color_t
Define the GDI color type.
Definition: gdi.h:316
int16_t x
The x position of the point.
Definition: gdi.h:324
gdi_result_t gdi_lcd_update_screen(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2)
This function updates the LCD screen.
void gdi_draw_filled_rectangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color)
This function draws a solid rectangle on the screen.
void gdi_draw_filled_circle(int32_t x, int32_t y, int32_t radius, gdi_color_t color)
This function draws a solid circle on the screen.
uint8_t gdi_color_format_t
Define the GDI color format type.
Definition: gdi.h:317
Point type.
Definition: gdi.h:323
gdi_result_t gdi_image_draw_by_id(int32_t x, int32_t y, uint16_t image_id)
This function draws an image from a resource with original image dimension.
void gdi_draw_polygon(gdi_point_t point[], uint32_t point_num, gdi_color_t color)
This function draws a polygon on current screen.
void gdi_draw_line(int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color)
This function draws a line on the screen.
void gdi_draw_point(int32_t x, int32_t y, gdi_color_t color)
This function draws a point on the screen.
gdi_color_t gdi_get_color_from_argb(uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue)
This function generates a color from given alpha, red, green, blue.