From a4df531ddd6b2998171d9d80eca58e24207eb4df Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 22 Oct 2011 18:13:04 +0000 Subject: Add logic to read from graphics memory git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4057 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/include/nuttx/nx/nx.h | 29 +++++++++++++++++++++++ nuttx/include/nuttx/nx/nxglib.h | 37 ++++++++++++++++++++++++++--- nuttx/include/nuttx/nx/nxtk.h | 52 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 114 insertions(+), 4 deletions(-) (limited to 'nuttx/include') diff --git a/nuttx/include/nuttx/nx/nx.h b/nuttx/include/nuttx/nx/nx.h index d582256fb..a4e9f5baf 100644 --- a/nuttx/include/nuttx/nx/nx.h +++ b/nuttx/include/nuttx/nx/nx.h @@ -613,6 +613,35 @@ EXTERN int nx_setpixel(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, EXTERN int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); +/**************************************************************************** + * Name: nx_getrectangle + * + * Description: + * Get the raw contents of graphic memory within a rectangular region. NOTE: + * Since raw graphic memory is returned, the returned memory content may be + * the memory of windows above this one and may not necessarily belong to + * this window unless you assure that this is the top window. + * + * Input Parameters: + * wnd - The window structure reference + * rect - The location to be copied + * plane - Specifies the color plane to get from. + * dest - The location to copy the memory region + * deststride - The width, in bytes, the the dest memory + * + * Input Parameters: + * hwnd - The window handle + * rect - The location to be filled + * color - The color to use in the fill + * + * Return: + * OK on success; ERROR on failure with errno set appropriately + * + ****************************************************************************/ + +EXTERN void nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + unsigned int plane, FAR uint8_t *dest, + unsigned int deststride); /**************************************************************************** * Name: nx_filltrapezoid diff --git a/nuttx/include/nuttx/nx/nxglib.h b/nuttx/include/nuttx/nx/nxglib.h index bf54b9029..d94d6fe76 100644 --- a/nuttx/include/nuttx/nx/nxglib.h +++ b/nuttx/include/nuttx/nx/nxglib.h @@ -222,7 +222,7 @@ EXTERN void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, * Name: nxgl_setpixel_*bpp * * Descripton: - * Draw a single pixel in graphics memory memory at the given position and + * Draw a single pixel in graphics memory at the given position and * with the given color. This is equivalent to nxgl_fillrectangle_*bpp() * with a 1x1 rectangle but is more efficient. * @@ -280,11 +280,42 @@ EXTERN void nxgl_fillrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, uint32_t color); +/**************************************************************************** + * Name: nxgl_getrectangle_*bpp + * + * Descripton: + * Fetch a rectangular region from graphics memory. The source is + * expressed as a rectangle. + * + ****************************************************************************/ + +EXTERN void nxgl_getrectangle_1bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); +EXTERN void nxgl_getrectangle_2bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); +EXTERN void nxgl_getrectangle_4bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); +EXTERN void nxgl_getrectangle_8bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); +EXTERN void nxgl_getrectangle_16bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); +EXTERN void nxgl_getrectangle_24bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); +EXTERN void nxgl_getrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, + FAR const struct nxgl_rect_s *rect, + FAR void *dest, unsigned int deststride); + /**************************************************************************** * Name: nxglib_filltrapezoid_*bpp * * Descripton: - * Fill a trapezoidal region in the framebuffer memory with a fixed color. + * Fill a trapezoidal region in the graphics memory with a fixed color. * Clip the trapezoid to lie within a boundng box. This is useful for * drawing complex shapes that can be broken into a set of trapezoids. * @@ -357,7 +388,7 @@ EXTERN void nxgl_moverectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, * * Descripton: * Copy a rectangular bitmap image into the specific position in the - * framebuffer memory. + * graphics memory. * ****************************************************************************/ diff --git a/nuttx/include/nuttx/nx/nxtk.h b/nuttx/include/nuttx/nx/nxtk.h index 107d8677c..c2f6c270d 100644 --- a/nuttx/include/nuttx/nx/nxtk.h +++ b/nuttx/include/nuttx/nx/nxtk.h @@ -2,7 +2,7 @@ * include/nuttx/nx/nxtk.h * * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -220,6 +220,31 @@ EXTERN int nxtk_lower(NXTKWINDOW hfwnd); EXTERN int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); +/**************************************************************************** + * Name: nxtk_getwindow + * + * Description: + * Get the raw contents of graphic memory within a rectangular region. NOTE: + * Since raw graphic memory is returned, the returned memory content may be + * the memory of windows above this one and may not necessarily belong to + * this window unless you assure that this is the top window. + * + * Input Parameters: + * wnd - The window structure reference + * rect - The location to be copied + * plane - Specifies the color plane to get from. + * dest - The location to copy the memory region + * deststride - The width, in bytes, the the dest memory + * + * Return: + * OK on success; ERROR on failure with errno set appropriately + * + ****************************************************************************/ + +EXTERN void nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, + unsigned int plane, FAR uint8_t *dest, + unsigned int deststride); + /**************************************************************************** * Name: nxtk_filltrapwindow * @@ -416,6 +441,31 @@ EXTERN int nxtk_closetoolbar(NXTKWINDOW hfwnd); EXTERN int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); +/**************************************************************************** + * Name: nxtk_gettoolbar + * + * Description: + * Get the raw contents of graphic memory within a rectangular region. NOTE: + * Since raw graphic memory is returned, the returned memory content may be + * the memory of windows above this one and may not necessarily belong to + * this window unless you assure that this is the top window. + * + * Input Parameters: + * wnd - The window structure reference + * rect - The location to be copied + * plane - Specifies the color plane to get from. + * dest - The location to copy the memory region + * deststride - The width, in bytes, the the dest memory + * + * Return: + * OK on success; ERROR on failure with errno set appropriately + * + ****************************************************************************/ + +EXTERN void nxtk_gettoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, + unsigned int plane, FAR uint8_t *dest, + unsigned int deststride); + /**************************************************************************** * Name: nxtk_filltraptoolbar * -- cgit v1.2.3