mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-26 06:43:58 +08:00
[GUI] Update GUI engine code and add Kconfig file.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
menu "RT-Thread UI Engine"
|
||||
|
||||
config RT_USING_GUIENGINE
|
||||
bool "Enable UI Engine"
|
||||
default n
|
||||
|
||||
if RT_USING_GUIENGINE
|
||||
|
||||
config RTGUI_NAME_MAX
|
||||
int "The maximal size of name in GUI engine"
|
||||
default 16
|
||||
|
||||
config RTGUI_USING_TTF
|
||||
bool "Support TrueType font"
|
||||
default n
|
||||
|
||||
config RTGUI_USING_FONT16
|
||||
bool "Support 16 height font"
|
||||
default y
|
||||
|
||||
config RTGUI_USING_FONT12
|
||||
bool "Support 12 height font"
|
||||
default y
|
||||
|
||||
config RTGUI_USING_FONTHZ
|
||||
bool "Support Chinese font"
|
||||
default n
|
||||
|
||||
if RTGUI_USING_FONTHZ
|
||||
config RTGUI_USING_HZ_BMP
|
||||
bool "Use bitmap Chinese font"
|
||||
default n
|
||||
endif
|
||||
|
||||
config RTGUI_IMAGE_XPM
|
||||
bool "Support XPM image format"
|
||||
default n
|
||||
|
||||
config RTGUI_IMAGE_JPEG
|
||||
bool "Support JPEG image format"
|
||||
default n
|
||||
|
||||
config RTGUI_IMAGE_TJPGD
|
||||
bool "Use TJPGD for JPEG image"
|
||||
default n
|
||||
|
||||
config RTGUI_IMAGE_PNG
|
||||
bool "Support PNG image format"
|
||||
default n
|
||||
|
||||
config RTGUI_IMAGE_LODEPNG
|
||||
bool "Use lodepng for PNG image"
|
||||
default n
|
||||
|
||||
config RTGUI_IMAGE_BMP
|
||||
bool "Support BMP image format"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
endmenu
|
||||
@@ -28,6 +28,7 @@ src/hz12font.c
|
||||
src/hz16font.c
|
||||
src/image.c
|
||||
src/image_bmp.c
|
||||
src/image_container.c
|
||||
src/image_hdc.c
|
||||
src/image_jpg.c
|
||||
src/image_png.c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : blit.h
|
||||
* This file is part of RT-Thread GUI
|
||||
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -47,6 +47,7 @@
|
||||
#define __RTGUI_BLIT_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/dc.h>
|
||||
|
||||
/* Assemble R-G-B values into a specified pixel format and store them */
|
||||
#define RGB565_FROM_RGB(Pixel, r, g, b) \
|
||||
@@ -201,13 +202,13 @@ struct rtgui_blit_info
|
||||
rt_uint8_t r, g, b, a;
|
||||
};
|
||||
|
||||
struct rtgui_blit_info_src
|
||||
struct rtgui_image_info
|
||||
{
|
||||
rt_uint8_t *src;
|
||||
int src_w, src_h;
|
||||
int src_skip;
|
||||
rt_uint8_t *pixels;
|
||||
int src_pitch;
|
||||
|
||||
rt_uint8_t src_fmt;
|
||||
rt_uint8_t src_fmt;
|
||||
rt_uint8_t a;
|
||||
};
|
||||
|
||||
extern const rt_uint8_t* rtgui_blit_expand_byte[9];
|
||||
@@ -217,6 +218,7 @@ rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
|
||||
rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp);
|
||||
|
||||
void rtgui_blit(struct rtgui_blit_info * info);
|
||||
void rtgui_image_info_blit(struct rtgui_image_info* image, struct rtgui_dc* dc, struct rtgui_rect *dc_rect);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : color.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : dc.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -23,7 +33,7 @@ extern "C" {
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/widgets/widget.h>
|
||||
|
||||
#define RTGUI_DC(dc) ((struct rtgui_dc*)(dc))
|
||||
#define RTGUI_DC(dc) ((struct rtgui_dc*)(dc))
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
@@ -51,10 +61,10 @@ struct rtgui_dc_engine
|
||||
};
|
||||
|
||||
/*
|
||||
* The abstract device context
|
||||
* The abstract device context
|
||||
*
|
||||
* Normally, a DC is a drawable canvas, user can draw point/line/cycle etc
|
||||
* on the DC.
|
||||
* on the DC.
|
||||
*
|
||||
* There are several kinds of DC:
|
||||
* - Hardware DC;
|
||||
@@ -70,44 +80,49 @@ struct rtgui_dc
|
||||
const struct rtgui_dc_engine *engine;
|
||||
};
|
||||
|
||||
/*
|
||||
* The hardware device context
|
||||
/*
|
||||
* The hardware device context
|
||||
*
|
||||
* The hardware DC is a context based on hardware device, for examle the
|
||||
* The hardware DC is a context based on hardware device, for examle the
|
||||
* LCD device. The operations on the hardware DC are reflected to the real
|
||||
* hardware.
|
||||
*
|
||||
* hardware.
|
||||
*
|
||||
*/
|
||||
struct rtgui_dc_hw
|
||||
{
|
||||
struct rtgui_dc parent;
|
||||
rtgui_widget_t *owner;
|
||||
const struct rtgui_graphic_driver *hw_driver;
|
||||
struct rtgui_dc parent;
|
||||
rtgui_widget_t *owner;
|
||||
const struct rtgui_graphic_driver *hw_driver;
|
||||
};
|
||||
|
||||
/**
|
||||
* The buffer dc is a device context with memory buffer.
|
||||
* The buffer dc is a device context with memory buffer.
|
||||
*
|
||||
* All the operations on this device context is reflected to the memory buffer.
|
||||
*/
|
||||
struct rtgui_dc_buffer
|
||||
{
|
||||
struct rtgui_dc parent;
|
||||
struct rtgui_dc parent;
|
||||
|
||||
/* graphic context */
|
||||
rtgui_gc_t gc;
|
||||
/* graphic context */
|
||||
rtgui_gc_t gc;
|
||||
|
||||
/* pixel format */
|
||||
rt_uint8_t pixel_format;
|
||||
rt_uint8_t blend_mode; /* RTGUI_BLENDMODE: None/Blend/Add/Mod */
|
||||
/* pixel format */
|
||||
rt_uint8_t pixel_format;
|
||||
rt_uint8_t blend_mode; /* RTGUI_BLENDMODE: None/Blend/Add/Mod */
|
||||
|
||||
/* width and height */
|
||||
rt_uint16_t width, height;
|
||||
/* pitch */
|
||||
rt_uint16_t pitch;
|
||||
/* width and height */
|
||||
rt_uint16_t width, height;
|
||||
/* pitch */
|
||||
rt_uint16_t pitch;
|
||||
|
||||
/* pixel data */
|
||||
rt_uint8_t *pixel;
|
||||
#ifdef RTGUI_IMAGE_CONTAINER
|
||||
/* image dc */
|
||||
struct rtgui_image_item *image_item;
|
||||
#endif
|
||||
|
||||
/* pixel data */
|
||||
rt_uint8_t *pixel;
|
||||
};
|
||||
|
||||
#define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->foreground)
|
||||
@@ -118,6 +133,10 @@ struct rtgui_dc_buffer
|
||||
/* create a buffer dc */
|
||||
struct rtgui_dc *rtgui_dc_buffer_create(int width, int height);
|
||||
struct rtgui_dc *rtgui_dc_buffer_create_pixformat(rt_uint8_t pixel_format, int w, int h);
|
||||
#ifdef RTGUI_IMAGE_CONTAINER
|
||||
struct rtgui_dc *rtgui_img_dc_create_pixformat(rt_uint8_t pixel_format, rt_uint8_t *pixel,
|
||||
struct rtgui_image_item *image_item);
|
||||
#endif
|
||||
struct rtgui_dc *rtgui_dc_buffer_create_from_dc(struct rtgui_dc* dc);
|
||||
|
||||
/* create a widget dc */
|
||||
@@ -125,11 +144,18 @@ struct rtgui_dc *rtgui_dc_widget_create(struct rtgui_widget * owner);
|
||||
|
||||
/* begin and end a drawing */
|
||||
struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner);
|
||||
void rtgui_dc_end_drawing(struct rtgui_dc *dc);
|
||||
void rtgui_dc_end_drawing(struct rtgui_dc *dc, rt_bool_t update);
|
||||
|
||||
/* destroy a dc */
|
||||
void rtgui_dc_destory(struct rtgui_dc *dc);
|
||||
|
||||
/* create a hardware dc */
|
||||
struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner);
|
||||
|
||||
/* create a client dc */
|
||||
struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner);
|
||||
void rtgui_dc_client_init(rtgui_widget_t *owner);
|
||||
|
||||
rt_uint8_t *rtgui_dc_buffer_get_pixel(struct rtgui_dc *dc);
|
||||
|
||||
void rtgui_dc_draw_line(struct rtgui_dc *dc, int x1, int y1, int x2, int y2);
|
||||
@@ -259,6 +285,9 @@ struct rtgui_dc *rtgui_dc_shrink(struct rtgui_dc *dc, int factorx, int factory);
|
||||
struct rtgui_dc *rtgui_dc_zoom(struct rtgui_dc *dc, double zoomx, double zoomy, int smooth);
|
||||
struct rtgui_dc *rtgui_dc_rotozoom(struct rtgui_dc *dc, double angle, double zoomx, double zoomy, int smooth);
|
||||
|
||||
/* dc buffer dump to file */
|
||||
void rtgui_dc_buffer_dump(struct rtgui_dc *self, char *fn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* File : dc_buffer.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
* 2010-06-14 Bernard embedded hardware dc to each widget
|
||||
* 2010-08-09 Bernard rename hardware dc to client dc
|
||||
*/
|
||||
|
||||
#ifndef __RTGUI_DC_CLIENT_H__
|
||||
#define __RTGUI_DC_CLIENT_H__
|
||||
|
||||
#include <rtgui/dc.h>
|
||||
|
||||
/* create a hardware dc */
|
||||
struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner);
|
||||
void rtgui_dc_client_init(rtgui_widget_t *owner);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : dc_blend.c
|
||||
* This file is part of RT-Thread GUI
|
||||
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
|
||||
* File : dc_draw.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* File : dc_buffer.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
* 2010-06-14 Bernard embedded hardware dc to each widget
|
||||
*/
|
||||
#ifndef __RTGUI_DC_HW_H__
|
||||
#define __RTGUI_DC_HW_H__
|
||||
|
||||
#include <rtgui/dc.h>
|
||||
|
||||
/* create a hardware dc */
|
||||
struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* File : dc_trans.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
*/
|
||||
|
||||
#ifndef __RTGUI_DC_TRANS_H__
|
||||
#define __RTGUI_DC_TRANS_H__
|
||||
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : driver.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -34,17 +44,17 @@ struct rtgui_graphic_driver_ops
|
||||
/* graphic extension operations */
|
||||
struct rtgui_graphic_ext_ops
|
||||
{
|
||||
/* some 2D operations */
|
||||
void (*draw_line)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
|
||||
/* some 2D operations */
|
||||
void (*draw_line)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
|
||||
|
||||
void (*draw_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
|
||||
void (*fill_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
|
||||
void (*draw_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
|
||||
void (*fill_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
|
||||
|
||||
void (*draw_circle)(rtgui_color_t *c, int x, int y, int r);
|
||||
void (*fill_circle)(rtgui_color_t *c, int x, int y, int r);
|
||||
void (*draw_circle)(rtgui_color_t *c, int x, int y, int r);
|
||||
void (*fill_circle)(rtgui_color_t *c, int x, int y, int r);
|
||||
|
||||
void (*draw_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
|
||||
void (*fill_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
|
||||
void (*draw_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
|
||||
void (*fill_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
|
||||
};
|
||||
|
||||
struct rtgui_graphic_driver
|
||||
@@ -63,7 +73,7 @@ struct rtgui_graphic_driver
|
||||
struct rt_device* device;
|
||||
|
||||
const struct rtgui_graphic_driver_ops *ops;
|
||||
const struct rtgui_graphic_ext_ops *ext_ops;
|
||||
const struct rtgui_graphic_ext_ops *ext_ops;
|
||||
};
|
||||
|
||||
struct rtgui_graphic_driver *rtgui_graphic_driver_get_default(void);
|
||||
@@ -77,7 +87,7 @@ void rtgui_graphic_driver_set_framebuffer(void *fb);
|
||||
|
||||
rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device()
|
||||
{
|
||||
return rtgui_graphic_driver_get_default();
|
||||
return rtgui_graphic_driver_get_default();
|
||||
}
|
||||
|
||||
#ifdef RTGUI_USING_HW_CURSOR
|
||||
@@ -86,8 +96,8 @@ rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device()
|
||||
*/
|
||||
enum rtgui_cursor_type
|
||||
{
|
||||
RTGUI_CURSOR_ARROW,
|
||||
RTGUI_CURSOR_HAND,
|
||||
RTGUI_CURSOR_ARROW,
|
||||
RTGUI_CURSOR_HAND,
|
||||
};
|
||||
|
||||
void rtgui_cursor_set_device(const char* device_name);
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : event.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -41,6 +51,7 @@ enum _rtgui_event_type
|
||||
RTGUI_EVENT_WIN_CLOSE, /* close a window */
|
||||
RTGUI_EVENT_WIN_MOVE, /* move a window */
|
||||
RTGUI_EVENT_WIN_RESIZE, /* resize a window */
|
||||
RTGUI_EVENT_WIN_UPDATE_END, /* update done for window */
|
||||
RTGUI_EVENT_WIN_MODAL_ENTER, /* the window is entering modal mode.
|
||||
This event should be sent after the
|
||||
window got setup and before the
|
||||
@@ -169,6 +180,13 @@ struct rtgui_event_win_resize
|
||||
rtgui_rect_t rect;
|
||||
};
|
||||
|
||||
struct rtgui_event_win_update_end
|
||||
{
|
||||
_RTGUI_EVENT_WIN_ELEMENTS
|
||||
|
||||
rtgui_rect_t rect;
|
||||
};
|
||||
|
||||
#define rtgui_event_win_destroy rtgui_event_win
|
||||
#define rtgui_event_win_show rtgui_event_win
|
||||
#define rtgui_event_win_hide rtgui_event_win
|
||||
@@ -187,6 +205,7 @@ struct rtgui_event_win_resize
|
||||
#define RTGUI_EVENT_WIN_CLOSE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_CLOSE)
|
||||
#define RTGUI_EVENT_WIN_MOVE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MOVE)
|
||||
#define RTGUI_EVENT_WIN_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_RESIZE)
|
||||
#define RTGUI_EVENT_WIN_UPDATE_END_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_UPDATE_END)
|
||||
#define RTGUI_EVENT_WIN_MODAL_ENTER_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MODAL_ENTER)
|
||||
|
||||
/*
|
||||
@@ -375,7 +394,7 @@ struct rtgui_event_kbd
|
||||
#define RTGUI_EVENT_KBD_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_KBD)
|
||||
|
||||
/**
|
||||
* RTGUI Touch Event
|
||||
* RTGUI Touch Event
|
||||
* NOTE: There is not touch event to user applications, it's handled by server.
|
||||
*/
|
||||
struct rtgui_event_touch
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : filerw.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : font.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -17,6 +27,7 @@
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/list.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* File : font_fnt.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
*/
|
||||
|
||||
#ifndef __FONT_FNT_H__
|
||||
#define __FONT_FNT_H__
|
||||
|
||||
@@ -7,28 +31,28 @@
|
||||
/* fnt font header */
|
||||
struct fnt_header
|
||||
{
|
||||
rt_uint8_t version[4];
|
||||
rt_uint16_t max_width;
|
||||
rt_uint16_t height;
|
||||
rt_uint16_t ascent;
|
||||
rt_uint16_t depth;
|
||||
|
||||
rt_uint32_t first_char;
|
||||
rt_uint32_t default_char;
|
||||
rt_uint32_t size;
|
||||
rt_uint32_t nbits;
|
||||
rt_uint32_t noffset;
|
||||
rt_uint32_t nwidth;
|
||||
rt_uint8_t version[4];
|
||||
rt_uint16_t max_width;
|
||||
rt_uint16_t height;
|
||||
rt_uint16_t ascent;
|
||||
rt_uint16_t depth;
|
||||
|
||||
rt_uint32_t first_char;
|
||||
rt_uint32_t default_char;
|
||||
rt_uint32_t size;
|
||||
rt_uint32_t nbits;
|
||||
rt_uint32_t noffset;
|
||||
rt_uint32_t nwidth;
|
||||
};
|
||||
typedef rt_uint8_t MWIMAGEBITS;
|
||||
|
||||
struct fnt_font
|
||||
{
|
||||
struct fnt_header header;
|
||||
struct fnt_header header;
|
||||
|
||||
const MWIMAGEBITS *bits; /* nbits */
|
||||
const rt_uint16_t *offset; /* noffset */
|
||||
const rt_uint8_t *width; /* nwidth */
|
||||
const MWIMAGEBITS *bits; /* nbits */
|
||||
const rt_uint16_t *offset; /* noffset */
|
||||
const rt_uint8_t *width; /* nwidth */
|
||||
};
|
||||
extern const struct rtgui_font_engine fnt_font_engine;
|
||||
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* File : font_freetype.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
*/
|
||||
|
||||
#ifndef __RTGUI_FONT_TTF_H__
|
||||
#define __RTGUI_FONT_TTF_H__
|
||||
|
||||
@@ -8,7 +32,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
rtgui_font_t *rtgui_freetype_font_create(const char *filename, int bold, int italic, rt_size_t size);
|
||||
void rtgui_ttf_system_init(void);
|
||||
rtgui_font_t *rtgui_freetype_font_create(const char *filename, rt_size_t size);
|
||||
void rtgui_freetype_font_destroy(rtgui_font_t *font);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : image.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : image_bmp.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* File : image_container.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
*/
|
||||
|
||||
#ifndef __RTGUI_IMAGE_CONTAINER_H__
|
||||
#define __RTGUI_IMAGE_CONTAINER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/image.h>
|
||||
|
||||
#if defined(RTGUI_IMAGE_CONTAINER)
|
||||
/* image item in image container */
|
||||
struct rtgui_image_item
|
||||
{
|
||||
rtgui_image_t *image;
|
||||
char *filename;
|
||||
|
||||
rt_uint32_t refcount;
|
||||
};
|
||||
typedef struct rtgui_image_item rtgui_image_item_t;
|
||||
|
||||
void rtgui_system_image_container_init(void);
|
||||
|
||||
struct rtgui_image_item *rtgui_image_container_get(const char *filename);
|
||||
void rtgui_image_container_put(struct rtgui_image_item *item);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : image_xpm.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* File : image_hdc.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -27,6 +37,21 @@ struct rtgui_image_hdcmm
|
||||
rt_uint8_t *pixels;
|
||||
};
|
||||
|
||||
struct rtgui_image_hdc
|
||||
{
|
||||
rt_bool_t is_loaded;
|
||||
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
rt_uint16_t pitch;
|
||||
rt_uint8_t pixel_format;
|
||||
|
||||
rt_size_t pixel_offset;
|
||||
rt_uint8_t *pixels;
|
||||
|
||||
struct rtgui_filerw *filerw;
|
||||
};
|
||||
|
||||
void rtgui_image_hdc_init(void);
|
||||
extern const struct rtgui_image_engine rtgui_image_hdcmm_engine;
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef __RTGUI_IMAGE_JPEG_H__
|
||||
#define __RTGUI_IMAGE_JPEG_H__
|
||||
|
||||
#include <rtgui/image.h>
|
||||
|
||||
void rtgui_image_jpeg_init(void);
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* File : image_png.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_PNG_H__
|
||||
#define __RTGUI_IMAGE_PNG_H__
|
||||
|
||||
#include <rtgui/image.h>
|
||||
|
||||
void rtgui_image_png_init(void);
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* File : image_xpm.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_XPM_H__
|
||||
#define __RTGUI_IMAGE_XPM_H__
|
||||
|
||||
#include <rtgui/image.h>
|
||||
|
||||
void rtgui_image_xpm_init(void);
|
||||
|
||||
#endif
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : kbddef.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : list.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* File : matrix.h
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Grissiom The first version
|
||||
*/
|
||||
|
||||
#ifndef __MATRIX_H__
|
||||
#define __MATRIX_H__
|
||||
|
||||
@@ -12,7 +36,7 @@
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
@@ -60,7 +84,7 @@ struct rtgui_matrix
|
||||
* fraction(m/RTGUI_MATRIX_FRAC). While the unit of m[4-5] is pixel.
|
||||
*
|
||||
*/
|
||||
int m[6];
|
||||
int m[6];
|
||||
};
|
||||
|
||||
rt_inline int32_t _rtgui_matrix_round_div32(int32_t n, int32_t d)
|
||||
@@ -100,22 +124,22 @@ rt_inline void rtgui_matrix_mul(struct rtgui_matrix *mm,
|
||||
const struct rtgui_matrix *mm1,
|
||||
const struct rtgui_matrix *mm2)
|
||||
{
|
||||
int *m = mm->m;
|
||||
const int *m1 = mm1->m;
|
||||
const int *m2 = mm2->m;
|
||||
int *m = mm->m;
|
||||
const int *m1 = mm1->m;
|
||||
const int *m2 = mm2->m;
|
||||
|
||||
m[0] = _rtgui_matrix_round_div32(m1[0] * m2[0] + m1[1] * m2[2], RTGUI_MATRIX_FRAC);
|
||||
m[1] = _rtgui_matrix_round_div32(m1[0] * m2[1] + m1[1] * m2[3], RTGUI_MATRIX_FRAC);
|
||||
m[2] = _rtgui_matrix_round_div32(m1[2] * m2[0] + m1[3] * m2[2], RTGUI_MATRIX_FRAC);
|
||||
m[3] = _rtgui_matrix_round_div32(m1[2] * m2[1] + m1[3] * m2[3], RTGUI_MATRIX_FRAC);
|
||||
m[4] = _rtgui_matrix_round_div32(m1[4] * m2[0] + m1[5] * m2[2], RTGUI_MATRIX_FRAC) + m2[4];
|
||||
m[5] = _rtgui_matrix_round_div32(m1[4] * m2[1] + m1[5] * m2[3], RTGUI_MATRIX_FRAC) + m2[5];
|
||||
m[0] = _rtgui_matrix_round_div32(m1[0] * m2[0] + m1[1] * m2[2], RTGUI_MATRIX_FRAC);
|
||||
m[1] = _rtgui_matrix_round_div32(m1[0] * m2[1] + m1[1] * m2[3], RTGUI_MATRIX_FRAC);
|
||||
m[2] = _rtgui_matrix_round_div32(m1[2] * m2[0] + m1[3] * m2[2], RTGUI_MATRIX_FRAC);
|
||||
m[3] = _rtgui_matrix_round_div32(m1[2] * m2[1] + m1[3] * m2[3], RTGUI_MATRIX_FRAC);
|
||||
m[4] = _rtgui_matrix_round_div32(m1[4] * m2[0] + m1[5] * m2[2], RTGUI_MATRIX_FRAC) + m2[4];
|
||||
m[5] = _rtgui_matrix_round_div32(m1[4] * m2[1] + m1[5] * m2[3], RTGUI_MATRIX_FRAC) + m2[5];
|
||||
}
|
||||
|
||||
/* Matrix multiply point[(p) = (x, y) * m], ignore the movement components. */
|
||||
rt_inline void rtgui_matrix_mul_point_nomove(struct rtgui_point *p,
|
||||
int x, int y,
|
||||
struct rtgui_matrix *m)
|
||||
int x, int y,
|
||||
struct rtgui_matrix *m)
|
||||
{
|
||||
int *mm = m->m;
|
||||
|
||||
@@ -137,13 +161,13 @@ rt_inline void rtgui_matrix_mul_point(struct rtgui_point *p,
|
||||
/** Set @mm to an identity matrix. */
|
||||
rt_inline void rtgu_matrix_identity(struct rtgui_matrix *mm)
|
||||
{
|
||||
int *mat = mm->m;
|
||||
mat[0] = RTGUI_MATRIX_FRAC;
|
||||
mat[1] = 0;
|
||||
mat[2] = 0;
|
||||
mat[3] = RTGUI_MATRIX_FRAC;
|
||||
mat[4] = 0;
|
||||
mat[5] = 0;
|
||||
int *mat = mm->m;
|
||||
mat[0] = RTGUI_MATRIX_FRAC;
|
||||
mat[1] = 0;
|
||||
mat[2] = 0;
|
||||
mat[3] = RTGUI_MATRIX_FRAC;
|
||||
mat[4] = 0;
|
||||
mat[5] = 0;
|
||||
}
|
||||
|
||||
/** Save the inversed matrix of @mm to @mo.
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : region.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -90,6 +100,7 @@ int rtgui_region_is_flat(rtgui_region_t *region);
|
||||
extern rtgui_rect_t rtgui_empty_rect;
|
||||
|
||||
void rtgui_rect_moveto(rtgui_rect_t *rect, int x, int y);
|
||||
void rtgui_rect_moveto_point(rtgui_rect_t *rect, int x, int y);
|
||||
void rtgui_rect_moveto_align(const rtgui_rect_t *rect, rtgui_rect_t *to, int align);
|
||||
void rtgui_rect_inflate(rtgui_rect_t *rect, int d);
|
||||
void rtgui_rect_intersect(rtgui_rect_t *src, rtgui_rect_t *dest);
|
||||
@@ -98,11 +109,14 @@ int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect
|
||||
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
|
||||
rtgui_rect_t *rtgui_rect_set(rtgui_rect_t *rect, int x, int y, int w, int h);
|
||||
rt_bool_t rtgui_rect_is_empty(const rtgui_rect_t *rect);
|
||||
void rtgui_rect_union(rtgui_rect_t *src, rtgui_rect_t *dest);
|
||||
|
||||
rt_inline void rtgui_rect_init(rtgui_rect_t* rect, int x, int y, int width, int height)
|
||||
{
|
||||
rect->x1 = x; rect->y1 = y;
|
||||
rect->x2 = x + width; rect->y2 = y + height;
|
||||
rect->x1 = x;
|
||||
rect->y1 = y;
|
||||
rect->x2 = x + width;
|
||||
rect->y2 = y + height;
|
||||
}
|
||||
|
||||
#define RTGUI_RECT(rect, x, y, w, h) \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : rtgui.h
|
||||
* This file is part of RT-Thread GUI
|
||||
* COPYRIGHT (C) 2009 - 2013, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,19 +31,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RTGUI_VERSION 0L /**< major version number */
|
||||
#define RTGUI_SUBVERSION 8L /**< minor version number */
|
||||
#define RTGUI_REVISION 1L /**< revise version number */
|
||||
#define RTGUI_CODENAME "Newton" /**< code name */
|
||||
|
||||
#define RT_INT16_MAX 32767
|
||||
#define RT_INT16_MIN (-RT_INT16_MAX-1)
|
||||
#define RTGUI_NOT_FOUND (-1)
|
||||
|
||||
#define _UI_MIN(x, y) (((x)<(y))?(x):(y))
|
||||
#define _UI_MAX(x, y) (((x)>(y))?(x):(y))
|
||||
#define _UI_BITBYTES(bits) ((bits + 7)/8)
|
||||
#define _UI_ABS(x) ((x)>=0? (x):-(x))
|
||||
#define _UI_MIN(x, y) (((x)<(y))?(x):(y))
|
||||
#define _UI_MAX(x, y) (((x)>(y))?(x):(y))
|
||||
#define _UI_BITBYTES(bits) ((bits + 7)/8)
|
||||
#define _UI_ABS(x) ((x)>=0? (x):-(x))
|
||||
|
||||
/* MDK, GCC and MSVC all support __restrict keyword. */
|
||||
#define RTGUI_RESTRICT __restrict
|
||||
@@ -136,13 +127,13 @@ enum RTGUI_BORDER_STYLE
|
||||
|
||||
/**
|
||||
* Blend mode
|
||||
*/
|
||||
*/
|
||||
enum RTGUI_BLENDMODE
|
||||
{
|
||||
RTGUI_BLENDMODE_NONE = 0x00,
|
||||
RTGUI_BLENDMODE_BLEND,
|
||||
RTGUI_BLENDMODE_ADD,
|
||||
RTGUI_BLENDMODE_MOD,
|
||||
RTGUI_BLENDMODE_NONE = 0x00,
|
||||
RTGUI_BLENDMODE_BLEND,
|
||||
RTGUI_BLENDMODE_ADD,
|
||||
RTGUI_BLENDMODE_MOD,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -180,7 +171,8 @@ enum RTGUI_TEXTSTYLE
|
||||
enum RTGUI_MODAL_CODE
|
||||
{
|
||||
RTGUI_MODAL_OK,
|
||||
RTGUI_MODAL_CANCEL
|
||||
RTGUI_MODAL_CANCEL,
|
||||
RTGUI_MODAL_MAX = 0xFFFF,
|
||||
};
|
||||
typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
|
||||
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : rtgui_app.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : rtgui_config.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : rtgui_object.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -81,10 +91,10 @@ const char *rtgui_type_name_get(const rtgui_type_t *type);
|
||||
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object);
|
||||
|
||||
#ifdef RTGUI_USING_CAST_CHECK
|
||||
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
|
||||
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
|
||||
((c_type *)rtgui_object_check_cast((rtgui_object_t *)(obj), (obj_type), __FUNCTION__, __LINE__))
|
||||
#else
|
||||
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj))
|
||||
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj))
|
||||
#endif
|
||||
|
||||
#define RTGUI_OBJECT_CHECK_TYPE(_obj, _type) \
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : rtgui_server.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -14,6 +24,10 @@
|
||||
#ifndef __RTGUI_SERVER_H__
|
||||
#define __RTGUI_SERVER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtservice.h>
|
||||
#include <rtgui/list.h>
|
||||
|
||||
@@ -72,8 +86,11 @@ void rtgui_server_install_show_win_hook(void (*hk)(void));
|
||||
void rtgui_server_install_act_win_hook(void (*hk)(void));
|
||||
|
||||
/* post an event to server */
|
||||
void rtgui_server_post_event(struct rtgui_event *event, rt_size_t size);
|
||||
rt_err_t rtgui_server_post_event(struct rtgui_event *event, rt_size_t size);
|
||||
rt_err_t rtgui_server_post_event_sync(struct rtgui_event *event, rt_size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : rtgui_system.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : box.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : container.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : title.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : widget.h
|
||||
* This file is part of RT-Thread GUI
|
||||
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -110,6 +110,10 @@ struct rtgui_widget
|
||||
|
||||
/* the widget extent */
|
||||
rtgui_rect_t extent;
|
||||
/* the visiable extent (includes the rectangles of children) */
|
||||
rtgui_rect_t extent_visiable;
|
||||
/* the rect clip information */
|
||||
rtgui_region_t clip;
|
||||
|
||||
/* minimal width and height of widget */
|
||||
rt_int16_t min_width, min_height;
|
||||
@@ -117,13 +121,10 @@ struct rtgui_widget
|
||||
rt_int32_t align;
|
||||
rt_uint16_t border;
|
||||
rt_uint16_t border_style;
|
||||
/* the rect clip */
|
||||
rtgui_region_t clip;
|
||||
|
||||
/* call back */
|
||||
rt_bool_t (*on_focus_in)(struct rtgui_object *widget, struct rtgui_event *event);
|
||||
rt_bool_t (*on_focus_out)(struct rtgui_object *widget, struct rtgui_event *event);
|
||||
rt_bool_t (*on_paint)(struct rtgui_object *widget, struct rtgui_event *event);
|
||||
|
||||
/* user private data */
|
||||
rt_uint32_t user_data;
|
||||
@@ -142,7 +143,6 @@ void rtgui_widget_unfocus(rtgui_widget_t *widget);
|
||||
/* event handler for each command */
|
||||
void rtgui_widget_set_onfocus(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
|
||||
void rtgui_widget_set_onunfocus(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
|
||||
void rtgui_widget_set_onpaint(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
|
||||
|
||||
/* get and set rect of widget */
|
||||
void rtgui_widget_get_rect(rtgui_widget_t *widget, rtgui_rect_t *rect);
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : window.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -80,6 +90,7 @@ struct rtgui_win
|
||||
|
||||
/* drawing count */
|
||||
rt_base_t drawing;
|
||||
struct rtgui_rect drawing_rect;
|
||||
|
||||
/* parent window. RT_NULL if the window is a top level window */
|
||||
struct rtgui_win *parent_window;
|
||||
@@ -135,9 +146,9 @@ rtgui_win_t *rtgui_mainwin_create(struct rtgui_win *parent_window, const char *t
|
||||
void rtgui_win_destroy(rtgui_win_t *win);
|
||||
|
||||
int rtgui_win_init(struct rtgui_win *win, struct rtgui_win *parent_window,
|
||||
const char *title,
|
||||
rtgui_rect_t *rect,
|
||||
rt_uint16_t style);
|
||||
const char *title,
|
||||
rtgui_rect_t *rect,
|
||||
rt_uint16_t style);
|
||||
int rtgui_win_fini(struct rtgui_win* win);
|
||||
|
||||
/** Close window.
|
||||
@@ -183,6 +194,8 @@ struct rtgui_dc *rtgui_win_get_drawing(rtgui_win_t * win);
|
||||
struct rtgui_win* rtgui_win_get_topmost_shown(void);
|
||||
struct rtgui_win* rtgui_win_get_next_shown(void);
|
||||
|
||||
void rtgui_theme_draw_win(struct rtgui_wintitle *wint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : asc12font.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
+271
-261
File diff suppressed because it is too large
Load Diff
+585
-262
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : box.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : color.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : container.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -49,15 +59,41 @@ rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_eve
|
||||
{
|
||||
/* handle in child widget */
|
||||
struct rtgui_list_node *node;
|
||||
rtgui_event_t _event, save_event = *event;
|
||||
rtgui_widget_t *widget = (rtgui_widget_t *)container;
|
||||
|
||||
rtgui_list_foreach(node, &(container->children))
|
||||
{
|
||||
struct rtgui_widget *w;
|
||||
w = rtgui_list_entry(node, struct rtgui_widget, sibling);
|
||||
|
||||
_event = save_event;
|
||||
|
||||
if (RTGUI_EVENT_PAINT & _event.type)
|
||||
{
|
||||
if (widget->extent.x1 > w->extent.x2)
|
||||
{
|
||||
_event.type &= !RTGUI_EVENT_PAINT;
|
||||
}
|
||||
else if (widget->extent.x2 < w->extent.x1)
|
||||
{
|
||||
_event.type &= !RTGUI_EVENT_PAINT;
|
||||
}
|
||||
else if (widget->extent.y1 > w->extent.y2)
|
||||
{
|
||||
_event.type &= !RTGUI_EVENT_PAINT;
|
||||
}
|
||||
else if (widget->extent.y2 < w->extent.y1)
|
||||
{
|
||||
_event.type &= !RTGUI_EVENT_PAINT;
|
||||
}
|
||||
}
|
||||
|
||||
if (RTGUI_OBJECT(w)->event_handler &&
|
||||
RTGUI_OBJECT(w)->event_handler(RTGUI_OBJECT(w), event) == RT_TRUE)
|
||||
RTGUI_OBJECT(w)->event_handler(RTGUI_OBJECT(w), &_event) == RT_TRUE)
|
||||
{
|
||||
return RT_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
@@ -140,7 +176,7 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object *object, struct rtgu
|
||||
/* paint on each child */
|
||||
rtgui_container_dispatch_event(container, event);
|
||||
|
||||
rtgui_dc_end_drawing(dc);
|
||||
rtgui_dc_end_drawing(dc, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -158,8 +194,8 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object *object, struct rtgu
|
||||
rtgui_container_dispatch_event(container, event);
|
||||
break;
|
||||
case RTGUI_EVENT_HIDE:
|
||||
rtgui_widget_onhide(RTGUI_OBJECT(container), event);
|
||||
rtgui_container_dispatch_event(container, event);
|
||||
rtgui_widget_onhide(RTGUI_OBJECT(container), event);
|
||||
break;
|
||||
case RTGUI_EVENT_COMMAND:
|
||||
rtgui_container_dispatch_event(container, event);
|
||||
|
||||
+81
-52
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : dc.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -19,8 +29,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/dc_hw.h>
|
||||
#include <rtgui/dc_client.h>
|
||||
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
@@ -690,21 +698,20 @@ void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16
|
||||
|
||||
/*
|
||||
* Draw arc
|
||||
* Octant labelling
|
||||
*
|
||||
* \ 5 | 6 /
|
||||
* \ | /
|
||||
* 4 \ | / 7
|
||||
* \|/
|
||||
*------+------ +x
|
||||
* /|\
|
||||
* 3 / | \ 0
|
||||
* / | \
|
||||
* / 2 | 1 \
|
||||
* +y
|
||||
*/
|
||||
|
||||
// Octant labelling
|
||||
//
|
||||
// \ 5 | 6 /
|
||||
// \ | /
|
||||
// 4 \ | / 7
|
||||
// \|/
|
||||
//------+------ +x
|
||||
// /|\
|
||||
// 3 / | \ 0
|
||||
// / | \
|
||||
// / 2 | 1 \
|
||||
// +y
|
||||
|
||||
drawoct = 0; // 0x00000000
|
||||
// whether or not to keep drawing a given octant.
|
||||
// For example: 0x00111100 means we're drawing in octants 2-5
|
||||
@@ -1319,18 +1326,20 @@ void rtgui_dc_draw_pie(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16
|
||||
}
|
||||
RTM_EXPORT(rtgui_dc_draw_pie);
|
||||
|
||||
// Octant labelling
|
||||
//
|
||||
// \ 5 | 6 /
|
||||
// \ | /
|
||||
// 4 \ | / 7
|
||||
// \|/
|
||||
//------+------ +x
|
||||
// /|\
|
||||
// 3 / | \ 0
|
||||
// / | \
|
||||
// / 2 | 1 \
|
||||
// +y
|
||||
/*
|
||||
* Octant labelling
|
||||
*
|
||||
* \ 5 | 6 /
|
||||
* \ | /
|
||||
* 4 \ | / 7
|
||||
* \|/
|
||||
*------+------ +x
|
||||
* /|\
|
||||
* 3 / | \ 0
|
||||
* / | \
|
||||
* / 2 | 1 \
|
||||
* +y
|
||||
*/
|
||||
static void _draw_octant(struct rtgui_dc *dc,
|
||||
rt_int16_t ox, rt_int16_t oy,
|
||||
rt_int16_t y1, rt_int16_t y2, rt_int16_t x, int oct)
|
||||
@@ -1814,6 +1823,10 @@ struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner)
|
||||
return RT_NULL;
|
||||
|
||||
/* increase drawing count */
|
||||
if (win->drawing == 0)
|
||||
{
|
||||
memset(&(win->drawing_rect), 0x0, sizeof(struct rtgui_rect));
|
||||
}
|
||||
win->drawing ++;
|
||||
|
||||
/* always drawing on the virtual mode */
|
||||
@@ -1873,7 +1886,7 @@ struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner)
|
||||
}
|
||||
RTM_EXPORT(rtgui_dc_begin_drawing);
|
||||
|
||||
void rtgui_dc_end_drawing(struct rtgui_dc *dc)
|
||||
void rtgui_dc_end_drawing(struct rtgui_dc *dc, rt_bool_t update)
|
||||
{
|
||||
struct rtgui_widget *owner;
|
||||
struct rtgui_win *win;
|
||||
@@ -1889,30 +1902,47 @@ void rtgui_dc_end_drawing(struct rtgui_dc *dc)
|
||||
/* get window */
|
||||
win = owner->toplevel;
|
||||
|
||||
/* union drawing rect */
|
||||
rtgui_rect_union(&(owner->extent_visiable), &(win->drawing_rect));
|
||||
/* decrease drawing counter */
|
||||
win->drawing --;
|
||||
if (win->drawing == 0 && rtgui_graphic_driver_is_vmode() == RT_FALSE)
|
||||
win->drawing--;
|
||||
|
||||
if (win->drawing == 0)
|
||||
{
|
||||
/* notify window to handle window update done */
|
||||
if (RTGUI_OBJECT(win)->event_handler)
|
||||
{
|
||||
struct rtgui_event_win_update_end ewin_update;
|
||||
|
||||
RTGUI_EVENT_WIN_UPDATE_END_INIT(&(ewin_update));
|
||||
ewin_update.rect = win->drawing_rect;
|
||||
|
||||
RTGUI_OBJECT(win)->event_handler(RTGUI_OBJECT(win), (struct rtgui_event *)&ewin_update);
|
||||
}
|
||||
|
||||
if (rtgui_graphic_driver_is_vmode() == RT_FALSE && update)
|
||||
{
|
||||
#ifdef RTGUI_USING_MOUSE_CURSOR
|
||||
rt_mutex_release(&cursor_mutex);
|
||||
/* show cursor */
|
||||
rtgui_mouse_show_cursor();
|
||||
rt_mutex_release(&cursor_mutex);
|
||||
/* show cursor */
|
||||
rtgui_mouse_show_cursor();
|
||||
#endif
|
||||
|
||||
if (RTGUI_IS_WINTITLE(win))
|
||||
{
|
||||
/* update screen */
|
||||
rtgui_graphic_driver_screen_update(rtgui_graphic_driver_get_default(),
|
||||
&(owner->extent));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* send to server for window update */
|
||||
struct rtgui_event_update_end eupdate;
|
||||
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
|
||||
eupdate.rect = owner->extent;
|
||||
if (RTGUI_IS_WINTITLE(win))
|
||||
{
|
||||
/* update screen */
|
||||
rtgui_graphic_driver_screen_update(rtgui_graphic_driver_get_default(),
|
||||
&(owner->extent));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* send to server for window update */
|
||||
struct rtgui_event_update_end eupdate;
|
||||
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
|
||||
eupdate.rect = owner->extent;
|
||||
|
||||
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
|
||||
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1920,4 +1950,3 @@ void rtgui_dc_end_drawing(struct rtgui_dc *dc)
|
||||
rtgui_screen_unlock();
|
||||
}
|
||||
RTM_EXPORT(rtgui_dc_end_drawing);
|
||||
|
||||
|
||||
+1316
-1058
File diff suppressed because it is too large
Load Diff
+401
-332
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : dc_client.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -16,8 +26,6 @@
|
||||
* 2010-09-14 Bernard fix vline and hline coordinate issue
|
||||
*/
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/dc_hw.h>
|
||||
#include <rtgui/dc_client.h>
|
||||
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
@@ -88,7 +96,7 @@ static void rtgui_dc_client_draw_point(struct rtgui_dc *self, int x, int y)
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
@@ -109,7 +117,7 @@ static void rtgui_dc_client_draw_color_point(struct rtgui_dc *self, int x, int y
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
@@ -133,7 +141,7 @@ static void rtgui_dc_client_draw_vline(struct rtgui_dc *self, int x, int y1, int
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
@@ -160,26 +168,26 @@ static void rtgui_dc_client_draw_vline(struct rtgui_dc *self, int x, int y1, int
|
||||
hw_driver->ops->draw_vline(&(owner->gc.foreground), x, y1, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t *prect;
|
||||
register rt_base_t draw_y1, draw_y2;
|
||||
{
|
||||
for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t *prect;
|
||||
register rt_base_t draw_y1, draw_y2;
|
||||
|
||||
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
|
||||
draw_y1 = y1;
|
||||
draw_y2 = y2;
|
||||
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
|
||||
draw_y1 = y1;
|
||||
draw_y2 = y2;
|
||||
|
||||
/* calculate vline clip */
|
||||
if (prect->x1 > x || prect->x2 <= x) continue;
|
||||
if (prect->y2 <= y1 || prect->y1 > y2) continue;
|
||||
/* calculate vline clip */
|
||||
if (prect->x1 > x || prect->x2 <= x) continue;
|
||||
if (prect->y2 <= y1 || prect->y1 > y2) continue;
|
||||
|
||||
if (prect->y1 > y1) draw_y1 = prect->y1;
|
||||
if (prect->y2 < y2) draw_y2 = prect->y2;
|
||||
if (prect->y1 > y1) draw_y1 = prect->y1;
|
||||
if (prect->y2 < y2) draw_y2 = prect->y2;
|
||||
|
||||
/* draw vline */
|
||||
hw_driver->ops->draw_vline(&(owner->gc.foreground), x, draw_y1, draw_y2);
|
||||
}
|
||||
/* draw vline */
|
||||
hw_driver->ops->draw_vline(&(owner->gc.foreground), x, draw_y1, draw_y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +200,7 @@ static void rtgui_dc_client_draw_hline(struct rtgui_dc *self, int x1, int x2, in
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
@@ -220,8 +228,8 @@ static void rtgui_dc_client_draw_hline(struct rtgui_dc *self, int x1, int x2, in
|
||||
hw_driver->ops->draw_hline(&(owner->gc.foreground), x1, x2, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t *prect;
|
||||
register rt_base_t draw_x1, draw_x2;
|
||||
@@ -252,7 +260,7 @@ static void rtgui_dc_client_fill_rect(struct rtgui_dc *self, struct rtgui_rect *
|
||||
RT_ASSERT(self);
|
||||
RT_ASSERT(rect);
|
||||
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
@@ -279,7 +287,7 @@ static void rtgui_dc_client_blit_line(struct rtgui_dc *self, int x1, int x2, int
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
if (!rtgui_dc_get_visible(self)) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
@@ -312,8 +320,8 @@ static void rtgui_dc_client_blit_line(struct rtgui_dc *self, int x1, int x2, int
|
||||
hw_driver->ops->draw_raw_hline(line_data + offset, x1, x2, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t *prect;
|
||||
register rt_base_t draw_x1, draw_x2;
|
||||
|
||||
+24
-15
@@ -1,18 +1,27 @@
|
||||
/*
|
||||
* File : dc_hw.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
* This file is part of RT-Thread GUI Engine
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/dc_hw.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/rtgui_app.h>
|
||||
@@ -54,17 +63,17 @@ struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner)
|
||||
|
||||
/* create DC */
|
||||
dc = (struct rtgui_dc_hw *) rtgui_malloc(sizeof(struct rtgui_dc_hw));
|
||||
if (dc)
|
||||
{
|
||||
dc->parent.type = RTGUI_DC_HW;
|
||||
dc->parent.engine = &dc_hw_engine;
|
||||
dc->owner = owner;
|
||||
dc->hw_driver = rtgui_graphic_driver_get_default();
|
||||
if (dc)
|
||||
{
|
||||
dc->parent.type = RTGUI_DC_HW;
|
||||
dc->parent.engine = &dc_hw_engine;
|
||||
dc->owner = owner;
|
||||
dc->hw_driver = rtgui_graphic_driver_get_default();
|
||||
|
||||
return &(dc->parent);
|
||||
}
|
||||
return &(dc->parent);
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc *dc)
|
||||
|
||||
+761
-698
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* File : dc_trans.c
|
||||
* This file is part of RT-Thread GUI
|
||||
* COPYRIGHT (C) 2006 - 2014, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2014-03-15 Grissom The first version
|
||||
*/
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/dc.h>
|
||||
@@ -91,7 +115,7 @@ void rtgui_dc_trans_get_new_wh(struct rtgui_dc_trans *dct,
|
||||
&dct->m);
|
||||
/* Transform result of (w, 0). */
|
||||
rtgui_matrix_mul_point_nomove(&bottomright,
|
||||
rect.x2, 0, &dct->m);
|
||||
rect.x2, 0, &dct->m);
|
||||
/* Transform result of (0, 0) is always (0, 0). */
|
||||
|
||||
#define NORMALIZE(x) do { if (x < 0) x = 0; } while (0)
|
||||
@@ -105,7 +129,7 @@ void rtgui_dc_trans_get_new_wh(struct rtgui_dc_trans *dct,
|
||||
NORMALIZE(bottomright.x);
|
||||
|
||||
neww = _UI_MAX(topright.x, _UI_ABS(topleft.x - bottomright.x))
|
||||
+ dct->m.m[4];
|
||||
+ dct->m.m[4];
|
||||
NORMALIZE(neww);
|
||||
|
||||
*new_wp = neww;
|
||||
@@ -119,7 +143,7 @@ void rtgui_dc_trans_get_new_wh(struct rtgui_dc_trans *dct,
|
||||
NORMALIZE(bottomright.y);
|
||||
|
||||
newh = _UI_MAX(topright.y, _UI_ABS(topleft.y - bottomright.y))
|
||||
+ dct->m.m[5];
|
||||
+ dct->m.m[5];
|
||||
NORMALIZE(newh);
|
||||
|
||||
*new_hp = newh;
|
||||
@@ -444,9 +468,9 @@ static void _blit_rotate_FR2FR_SF4B_AA(struct _fb_rect* RTGUI_RESTRICT src,
|
||||
|
||||
/* FrameRect to FrameRect, from ARGB8888 to RGB565. */
|
||||
static void _blit_rotate_FR2FR_ARGB2RGB565(struct _fb_rect* RTGUI_RESTRICT src,
|
||||
const struct rtgui_point *dc_point,
|
||||
struct _fb_rect* RTGUI_RESTRICT dst,
|
||||
const struct rtgui_matrix *invm)
|
||||
const struct rtgui_point *dc_point,
|
||||
struct _fb_rect* RTGUI_RESTRICT dst,
|
||||
const struct rtgui_matrix *invm)
|
||||
{
|
||||
rt_uint32_t* RTGUI_RESTRICT srcp = (rt_uint32_t*)src->fb;
|
||||
rt_uint16_t* RTGUI_RESTRICT dstp = (rt_uint16_t*)dst->fb;
|
||||
@@ -505,7 +529,7 @@ static void _blit_rotate_FR2FR_ARGB2RGB565(struct _fb_rect* RTGUI_RESTRICT src,
|
||||
* and blend all components at the same time
|
||||
*/
|
||||
op = ((op & 0xfc00) << 11) + (op >> 8 & 0xf800)
|
||||
+ (op >> 3 & 0x1f);
|
||||
+ (op >> 3 & 0x1f);
|
||||
d = (d | d << 16) & 0x07e0f81f;
|
||||
d += (op - d) * alpha >> 5;
|
||||
d &= 0x07e0f81f;
|
||||
@@ -518,9 +542,9 @@ static void _blit_rotate_FR2FR_ARGB2RGB565(struct _fb_rect* RTGUI_RESTRICT src,
|
||||
|
||||
/* FrameRect to FrameRect, from ARGB8888 to RGB565. */
|
||||
static void _blit_rotate_FR2FR_ARGB2RGB565_AA(struct _fb_rect* RTGUI_RESTRICT src,
|
||||
const struct rtgui_point *dc_point,
|
||||
struct _fb_rect* RTGUI_RESTRICT dst,
|
||||
const struct rtgui_matrix *invm)
|
||||
const struct rtgui_point *dc_point,
|
||||
struct _fb_rect* RTGUI_RESTRICT dst,
|
||||
const struct rtgui_matrix *invm)
|
||||
{
|
||||
rt_uint32_t* RTGUI_RESTRICT srcp = (rt_uint32_t*)src->fb;
|
||||
rt_uint16_t* RTGUI_RESTRICT dstp = (rt_uint16_t*)dst->fb;
|
||||
@@ -646,7 +670,8 @@ static void _blit_rotate_B2B(struct rtgui_dc_trans *dct,
|
||||
|
||||
if (dc->pixel_format == dest->pixel_format)
|
||||
{
|
||||
switch (rtgui_color_get_bpp(dest->pixel_format)) {
|
||||
switch (rtgui_color_get_bpp(dest->pixel_format))
|
||||
{
|
||||
case 2:
|
||||
if (dct->use_aa)
|
||||
_blit_rotate_FR2FR_SF2B_AA(&srcfb, dc_point,
|
||||
@@ -724,7 +749,8 @@ static void _blit_rotate_B2H(struct rtgui_dc_trans *dct,
|
||||
|
||||
if (dc->pixel_format == dest->hw_driver->pixel_format)
|
||||
{
|
||||
switch (rtgui_color_get_bpp(dest->hw_driver->pixel_format)) {
|
||||
switch (rtgui_color_get_bpp(dest->hw_driver->pixel_format))
|
||||
{
|
||||
case 2:
|
||||
if (dct->use_aa)
|
||||
_blit_rotate_FR2FR_SF2B_AA(&srcfb, dc_point,
|
||||
@@ -820,13 +846,13 @@ void rtgui_dc_trans_blit(struct rtgui_dc_trans *dct,
|
||||
if (dct->owner->type == RTGUI_DC_BUFFER)
|
||||
{
|
||||
if (dest->type == RTGUI_DC_BUFFER)
|
||||
_blit_rotate_B2B(dct, dc_point,
|
||||
(struct rtgui_dc_buffer*)dest,
|
||||
rect, &invm, neww, newh);
|
||||
_blit_rotate_B2B(dct, dc_point,
|
||||
(struct rtgui_dc_buffer*)dest,
|
||||
rect, &invm, neww, newh);
|
||||
else if (dest->type == RTGUI_DC_HW)
|
||||
_blit_rotate_B2H(dct, dc_point,
|
||||
(struct rtgui_dc_hw*)dest,
|
||||
rect, &invm, neww, newh);
|
||||
_blit_rotate_B2H(dct, dc_point,
|
||||
(struct rtgui_dc_hw*)dest,
|
||||
rect, &invm, neww, newh);
|
||||
else if (dest->type == RTGUI_DC_CLIENT)
|
||||
// TODO:
|
||||
;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user