summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-26 22:20:00 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-26 22:20:00 +0000
commit555e551c46f5c9dbd74f92239c0078a6feb65568 (patch)
treea6a8386ea7e9e1095291ef60bbdab7a86058a5de /nuttx/include
parent2371b78045295bfddaf54c65b579f804ef0b58b0 (diff)
downloadpx4-nuttx-555e551c46f5c9dbd74f92239c0078a6feb65568.tar.gz
px4-nuttx-555e551c46f5c9dbd74f92239c0078a6feb65568.tar.bz2
px4-nuttx-555e551c46f5c9dbd74f92239c0078a6feb65568.zip
Add more rasterizers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1316 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/nxglib.h122
1 files changed, 120 insertions, 2 deletions
diff --git a/nuttx/include/nuttx/nxglib.h b/nuttx/include/nuttx/nxglib.h
index a7abe89df..6e2d6a794 100644
--- a/nuttx/include/nuttx/nxglib.h
+++ b/nuttx/include/nuttx/nxglib.h
@@ -42,6 +42,18 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <fixedmath.h>
+
+/****************************************************************************
+ * Pre-processor definitions
+ ****************************************************************************/
+
+#define ngl_min(a,b) ((a) < (b) ? (a) : (b))
+#define ngl_max(a,b) ((a) > (b) ? (a) : (b))
+#define ngl_swap(a,b,t) do { t = a; a = b; b = t; } while (0);
+#define ngl_clipl(a,mn) ((a) < (mn) ? (mn) : (a))
+#define ngl_clipr(a,mx) ((a) > (mx) ? (mx) : (a))
+#define ngl_clip(a,mx,mn) ((a) < (mn) ? (mn) : (a) > (mx) ? (mx) : (a))
/****************************************************************************
* Public Types
@@ -60,8 +72,8 @@ typedef sint16 nxgl_coord_t;
struct nxgl_point_s
{
- nxgl_coord_t x; /* Range: 0 to screen width - 1 */
- nxgl_coord_t y; /* Rnage: 0 to screen height - 1*/
+ nxgl_coord_t x; /* X position, range: 0 to screen width - 1 */
+ nxgl_coord_t y; /* Y position, range: 0 to screen height - 1 */
};
/* Describes a rectangle on the display */
@@ -72,6 +84,28 @@ struct nxgl_rect_s
struct nxgl_point_s pt2; /* Lower, right-hand corner */
};
+/* Describes a run, i.e., a horizontal line. Note that the start/end positions
+ * have fractional precision. This is necessary for good joining of trapezoids
+ * when a more complex shape is decomposed into trapezoids
+ */
+
+struct nxgl_run_s
+{
+ b16_t x1; /* Left X position, range: 0 to x2 */
+ b16_t x2; /* Right X position, range: x1 to screen width - 1 */
+ nxgl_coord_t y; /* Top Y position, range: 0 to screen height - 1 */
+};
+
+/* Describes a horizontal trapezoid on the display in terms the run at the
+ * top of the trapezoid and the run at the bottom
+ */
+
+struct nxgl_trapezoid_s
+{
+ struct nxgl_run_s top; /* Top run */
+ struct nxgl_run_s bot; /* bottom run */
+};
+
/****************************************************************************
* Public Data
****************************************************************************/
@@ -143,6 +177,45 @@ EXTERN void nxgl_fillrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo,
uint32 color);
/****************************************************************************
+ * Name: nxglib_filltrapezoid_*bpp
+ *
+ * Descripton:
+ * Fill a trapezoidal region in the framebuffer memory with a fixed color.
+ * This is useful for drawing complex shape -- (most) complex shapes can be
+ * broken into a set of trapezoids.
+ *
+ ****************************************************************************/
+
+EXTERN void nxglib_filltrapezoid_1bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ ubyte color);
+EXTERN void nxglib_filltrapezoid_2bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ ubyte color);
+EXTERN void nxglib_filltrapezoid_4bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ ubyte color);
+EXTERN void nxglib_filltrapezoid_8bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ ubyte color);
+EXTERN void nxglib_filltrapezoid_16bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ uint16 color);
+EXTERN void nxglib_filltrapezoid_24bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ uint32 color);
+EXTERN void nxglib_filltrapezoid_32bpp(FAR struct fb_videoinfo_s *vinfo,
+ FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_trapezoid_s *trap,
+ uint32 color);
+
+/****************************************************************************
* Name: nxgl_moverectangle_*bpp
*
* Descripton:
@@ -173,6 +246,51 @@ EXTERN void nxgl_moverectangle_32bpp(FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
FAR struct nxgl_point_s *offset);
+/****************************************************************************
+ * Name: nxs_copyrectangle_*bpp
+ *
+ * Descripton:
+ * Copy a rectangular bitmap image into the specific position in the
+ * framebuffer memory.
+ *
+ ****************************************************************************/
+
+EXTERN void nxs_copyrectangle_1bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const ubyte *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+EXTERN void nxs_copyrectangle_2bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const ubyte *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+EXTERN void nxs_copyrectangle_4bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const ubyte *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+EXTERN void nxs_copyrectangle_8bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const ubyte *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+EXTERN void nxs_copyrectangle_16bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const uint16 *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+EXTERN void nxs_copyrectangle_24bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const uint32 *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+EXTERN void nxs_copyrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const uint32 *src,
+ FAR const struct nxgl_point_s *origin,
+ unsigned int srcstride);
+
#undef EXTERN
#if defined(__cplusplus)
}