Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:44

0001 /* ---------------------------------------------------------------------------- */
0002 /*                  Atmel Microcontroller Software Support                      */
0003 /*                       SAM Software Package License                           */
0004 /* ---------------------------------------------------------------------------- */
0005 /* Copyright (c) 2015, Atmel Corporation                                        */
0006 /*                                                                              */
0007 /* All rights reserved.                                                         */
0008 /*                                                                              */
0009 /* Redistribution and use in source and binary forms, with or without           */
0010 /* modification, are permitted provided that the following condition is met:    */
0011 /*                                                                              */
0012 /* - Redistributions of source code must retain the above copyright notice,     */
0013 /* this list of conditions and the disclaimer below.                            */
0014 /*                                                                              */
0015 /* Atmel's name may not be used to endorse or promote products derived from     */
0016 /* this software without specific prior written permission.                     */
0017 /*                                                                              */
0018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
0019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
0020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
0021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
0022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
0023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
0024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
0025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
0026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
0027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
0028 /* ---------------------------------------------------------------------------- */
0029 
0030 /**
0031  * \file
0032  *
0033  * Interface for draw function on LCD.
0034  *
0035  */
0036 
0037 #ifndef DRAW_H
0038 #define DRAW_H
0039 
0040 /*----------------------------------------------------------------------------
0041  *        Headers
0042  *----------------------------------------------------------------------------*/
0043 #include "board.h"
0044 #include <stdint.h>
0045 #include "lcd_gimp_image.h"
0046 
0047 /*----------------------------------------------------------------------------
0048  *        Definitions
0049  *----------------------------------------------------------------------------*/
0050 
0051 /** Horizontal direction line definition */
0052 #define DIRECTION_HLINE   0
0053 /** Vertical direction line definition */
0054 #define DIRECTION_VLINE   1
0055 
0056 typedef struct _rect {
0057     uint32_t x;
0058     uint32_t y;
0059     uint32_t width;
0060     uint32_t height;
0061 } rect;
0062 
0063 COMPILER_PACK_SET(1)
0064 typedef struct _rgb {
0065     uint8_t b;
0066     uint8_t g;
0067     uint8_t r;
0068 } sBGR;
0069 COMPILER_PACK_RESET()
0070 
0071 /*----------------------------------------------------------------------------
0072  *        Exported functions
0073  *----------------------------------------------------------------------------*/
0074 extern void LCDD_SetUpdateWindowSize(rect rc);
0075 
0076 extern void LCDD_UpdateWindow(void);
0077 
0078 extern void LCDD_UpdatePartialWindow(uint8_t *pbuf, uint32_t size);
0079 
0080 extern void LCDD_DrawRectangleWithFill(
0081         uint16_t *pbuf,
0082         uint32_t dwX,
0083         uint32_t dwY,
0084         uint32_t dwWidth,
0085         uint32_t dwHeight,
0086         uint32_t dwColor);
0087 
0088 extern uint32_t LCDD_DrawCircle(
0089         uint16_t *pbuf,
0090         uint32_t x,
0091         uint32_t y,
0092         uint32_t r,
0093         uint32_t color);
0094 
0095 extern uint32_t LCD_DrawFilledCircle(
0096         uint16_t *pbuf,
0097         uint32_t dwX,
0098         uint32_t dwY,
0099         uint32_t dwRadius,
0100         uint32_t color);
0101 
0102 extern void LCDD_DrawString(
0103         uint16_t *pbuf,
0104         uint32_t x,
0105         uint32_t y,
0106         const uint8_t *pString,
0107         uint32_t color);
0108 
0109 extern void LCDD_GetStringSize(
0110         const uint8_t *pString,
0111         uint32_t *pWidth,
0112         uint32_t *pHeight);
0113 
0114 extern void LCDD_BitBlt(
0115         uint16_t *pbuf,
0116         uint32_t dst_x,
0117         uint32_t dst_y,
0118         uint32_t dst_w,
0119         uint32_t dst_h,
0120         const LcdColor_t *src,
0121         uint32_t src_x,
0122         uint32_t src_y,
0123         uint32_t src_w,
0124         uint32_t src_h);
0125 
0126 extern void LCDD_BitBltAlphaBlend(uint16_t *pbuf,
0127                                   uint32_t dst_x,
0128                                   uint32_t dst_y,
0129                                   uint32_t dst_w,
0130                                   uint32_t dst_h,
0131                                   const LcdColor_t *src,
0132                                   uint32_t src_x,
0133                                   uint32_t src_y,
0134                                   uint32_t src_w,
0135                                   uint32_t src_h,
0136                                   uint32_t alpha);
0137 extern void LCDD_DrawImage(
0138     uint16_t *pbuf,
0139     uint32_t dwX,
0140     uint32_t dwY,
0141     const LcdColor_t *pImage,
0142     uint32_t dwWidth,
0143     uint32_t dwHeight);
0144 
0145 extern void LCDD_DrawPixel(
0146     uint16_t *pbuf,
0147     uint32_t x,
0148     uint32_t y,
0149     uint32_t color);
0150 
0151 extern void LCDD_DrawLine(
0152     uint16_t *pbuf,
0153     uint32_t dwX1,
0154     uint32_t dwY1,
0155     uint32_t dwX2,
0156     uint32_t dwY2,
0157     uint32_t color);
0158 
0159 extern uint32_t LCDD_DrawLineBresenham(
0160     uint16_t *pbuf,
0161     uint32_t dwX1,
0162     uint32_t dwY1,
0163     uint32_t dwX2,
0164     uint32_t dwY2,
0165     uint32_t color);
0166 
0167 extern void LCDD_DrawRectangle(
0168     uint16_t *pbuf,
0169     uint32_t x,
0170     uint32_t y,
0171     uint32_t width,
0172     uint32_t height,
0173     uint32_t color);
0174 
0175 extern void LCDD_SetCavasBuffer(
0176     void *pBuffer,
0177     uint32_t wBufferSize);
0178 
0179 extern void LCDD_DrawStraightLine(
0180     uint16_t *pbuf,
0181     uint32_t dwX1,
0182     uint32_t dwY1,
0183     uint32_t dwX2,
0184     uint32_t dwY2 ,
0185     uint32_t color);
0186 #endif /* #ifndef DRAW_H */