nxbe.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. /****************************************************************************
  2. * graphics/nxbe/nxbe.h
  3. *
  4. * Copyright (C) 2008-2011, 2013, 2016, 2019 Gregory Nutt. All rights
  5. * reserved.
  6. * Author: Gregory Nutt <gnutt@nuttx.org>
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the
  17. * distribution.
  18. * 3. Neither the name NuttX nor the names of its contributors may be
  19. * used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  26. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  32. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  33. * POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ****************************************************************************/
  36. #ifndef __GRAPHICS_NXBE_NXBE_H
  37. #define __GRAPHICS_NXBE_NXBE_H
  38. /****************************************************************************
  39. * Included Files
  40. ****************************************************************************/
  41. #include <nuttx/config.h>
  42. #include <stdint.h>
  43. #include <stdbool.h>
  44. #include <nuttx/nx/nx.h>
  45. #include <nuttx/nx/nxglib.h>
  46. #include <nuttx/nx/nxcursor.h>
  47. #include <nuttx/nx/nxbe.h>
  48. /****************************************************************************
  49. * Pre-processor Definitions
  50. ****************************************************************************/
  51. /* These are the values for the clipping order provided to nx_clipper */
  52. #define NX_CLIPORDER_TLRB (0) /* Top-left-right-bottom */
  53. #define NX_CLIPORDER_TRLB (1) /* Top-right-left-bottom */
  54. #define NX_CLIPORDER_BLRT (2) /* Bottom-left-right-top */
  55. #define NX_CLIPORDER_BRLT (3) /* Bottom-right-left-top */
  56. #define NX_CLIPORDER_DEFAULT NX_CLIPORDER_TLRB
  57. /* Server flags and helper macros:
  58. *
  59. * NXBE_STATE_MODAL - One window is in a focused, modal state
  60. */
  61. #define NXBE_STATE_MODAL (1 << 0) /* Bit 0: One window is in a focused,
  62. * modal state */
  63. /* Helpful flag macros */
  64. #define NXBE_STATE_ISMODAL(nxbe) \
  65. (((nxbe)->flags & NXBE_STATE_MODAL) != 0)
  66. #define NXBE_STATE_SETMODAL(nxbe) \
  67. do { (nxbe)->flags |= NXBE_STATE_MODAL; } while (0)
  68. #define NXBE_STATE_CLRMODAL(nxbe) \
  69. do { (nxbe)->flags &= ~NXBE_STATE_MODAL; } while (0)
  70. /****************************************************************************
  71. * Public Types
  72. ****************************************************************************/
  73. /* Rasterization ************************************************************/
  74. /* A vtable of raster operation function pointers. The types of the
  75. * function points must match the device rasterizer types exported by nxglib.
  76. */
  77. struct nxbe_dev_vtable_s
  78. {
  79. CODE void (*setpixel)(FAR NX_PLANEINFOTYPE *pinfo,
  80. FAR const struct nxgl_point_s *pos,
  81. nxgl_mxpixel_t color);
  82. CODE void (*fillrectangle)(FAR NX_PLANEINFOTYPE *pinfo,
  83. FAR const struct nxgl_rect_s *rect,
  84. nxgl_mxpixel_t color);
  85. CODE void (*getrectangle)(FAR NX_PLANEINFOTYPE *pinfo,
  86. FAR const struct nxgl_rect_s *rect,
  87. FAR void *dest, unsigned int deststride);
  88. CODE void (*filltrapezoid)(FAR NX_PLANEINFOTYPE *pinfo,
  89. FAR const struct nxgl_trapezoid_s *trap,
  90. FAR const struct nxgl_rect_s *bounds,
  91. nxgl_mxpixel_t color);
  92. CODE void (*moverectangle)(FAR NX_PLANEINFOTYPE *pinfo,
  93. FAR const struct nxgl_rect_s *rect,
  94. FAR struct nxgl_point_s *offset);
  95. CODE void (*copyrectangle)(FAR NX_PLANEINFOTYPE *pinfo,
  96. FAR const struct nxgl_rect_s *dest,
  97. FAR const void *src,
  98. FAR const struct nxgl_point_s *origin,
  99. unsigned int srcstride);
  100. };
  101. #ifdef CONFIG_NX_RAMBACKED
  102. /* A vtable of raster operation function pointers. The types of the
  103. * function points must match the per-window framebuffer rasterizer types
  104. * exported by nxglib.
  105. */
  106. struct nxbe_pwfb_vtable_s
  107. {
  108. CODE void (*setpixel)(FAR struct nxbe_window_s *bwnd,
  109. FAR const struct nxgl_point_s *pos,
  110. nxgl_mxpixel_t color);
  111. CODE void (*fillrectangle)(FAR struct nxbe_window_s *bwnd,
  112. FAR const struct nxgl_rect_s *rect,
  113. nxgl_mxpixel_t color);
  114. CODE void (*getrectangle)(FAR struct nxbe_window_s *bwnd,
  115. FAR const struct nxgl_rect_s *rect,
  116. FAR void *dest, unsigned int deststride);
  117. CODE void (*filltrapezoid)(FAR struct nxbe_window_s *bwnd,
  118. FAR const struct nxgl_trapezoid_s *trap,
  119. FAR const struct nxgl_rect_s *bounds,
  120. nxgl_mxpixel_t color);
  121. CODE void (*moverectangle)(FAR struct nxbe_window_s *bwnd,
  122. FAR const struct nxgl_rect_s *rect,
  123. FAR struct nxgl_point_s *offset);
  124. CODE void (*copyrectangle)(FAR struct nxbe_window_s *bwnd,
  125. FAR const struct nxgl_rect_s *dest,
  126. FAR const void *src,
  127. FAR const struct nxgl_point_s *origin,
  128. unsigned int srcstride);
  129. };
  130. #endif
  131. #ifdef CONFIG_NX_SWCURSOR
  132. /* A vtable of raster operation function pointers. The types of the
  133. * function points must match the cursor rasterizer types exported by
  134. * nxglib.
  135. */
  136. struct nxbe_cursorops_s
  137. {
  138. CODE void (*draw)(FAR struct nxbe_state_s *be,
  139. FAR const struct nxgl_rect_s *bounds,
  140. int planeno);
  141. CODE void (*erase)(FAR struct nxbe_state_s *be,
  142. FAR const struct nxgl_rect_s *bounds,
  143. int planeno);
  144. CODE void (*backup)(FAR struct nxbe_state_s *be,
  145. FAR const struct nxgl_rect_s *bounds,
  146. int planeno);
  147. };
  148. #endif
  149. /* Encapsulates everything needed support window rasterization commands. */
  150. struct nxbe_plane_s
  151. {
  152. /* Raster device operations */
  153. struct nxbe_dev_vtable_s dev;
  154. #ifdef CONFIG_NX_RAMBACKED
  155. /* Raster per-window framebuffer operations */
  156. struct nxbe_pwfb_vtable_s pwfb;
  157. #endif
  158. #ifdef CONFIG_NX_SWCURSOR
  159. /* Cursor device operations */
  160. struct nxbe_cursorops_s cursor;
  161. #endif
  162. /* Framebuffer plane info describing destination video plane */
  163. NX_PLANEINFOTYPE pinfo;
  164. };
  165. /* Clipping *****************************************************************/
  166. /* Clipping callback functions called nxbe_clipper for each visible and
  167. * obscured region of a rectangle within a window.
  168. */
  169. struct nxbe_clipops_s
  170. {
  171. CODE void (*visible)(FAR struct nxbe_clipops_s *cops,
  172. FAR struct nxbe_plane_s *plane,
  173. FAR const struct nxgl_rect_s *rect);
  174. CODE void (*obscured)(FAR struct nxbe_clipops_s *cops,
  175. FAR struct nxbe_plane_s *plane,
  176. FAR const struct nxgl_rect_s *rect);
  177. };
  178. /* Cursor *******************************************************************/
  179. /* Cursor state structure */
  180. #if defined(CONFIG_NX_SWCURSOR)
  181. struct nxbe_cursor_s
  182. {
  183. bool visible; /* True: the cursor is visible */
  184. struct nxgl_rect_s bounds; /* Cursor image bounding box */
  185. nxgl_mxpixel_t color1[CONFIG_NX_NPLANES]; /* Color1 is main color of the cursor */
  186. nxgl_mxpixel_t color2[CONFIG_NX_NPLANES]; /* Color2 is color of any border */
  187. nxgl_mxpixel_t color3[CONFIG_NX_NPLANES]; /* Color3 is the blended color */
  188. size_t allocsize; /* Size of the background allocation */
  189. FAR const uint8_t *image; /* Cursor image at 2-bits/pixel */
  190. FAR nxgl_mxpixel_t *bkgd; /* Cursor background in device pixels */
  191. };
  192. #elif defined(CONFIG_NX_HWCURSOR)
  193. struct nxbe_cursor_s
  194. {
  195. bool visible; /* True: the cursor is visible */
  196. struct nxgl_point_s pos; /* The current cursor position */
  197. };
  198. #endif
  199. /* Back-end state ***********************************************************/
  200. /* This structure describes the overall back-end window state */
  201. struct nxbe_state_s
  202. {
  203. uint8_t flags; /* NXBE_STATE_* flags */
  204. #if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
  205. /* Cursor support */
  206. struct nxbe_cursor_s cursor; /* Cursor support */
  207. #endif
  208. /* The window list (with the background window always at the bottom) */
  209. FAR struct nxbe_window_s *topwnd; /* The window at the top of the display */
  210. struct nxbe_window_s bkgd; /* The background window is always at the bottom */
  211. /* At present, only a solid colored background is supported for refills. The
  212. * following provides the background color. It would be nice to support
  213. * background bitmap images as well.
  214. */
  215. nxgl_mxpixel_t bgcolor[CONFIG_NX_NPLANES];
  216. /* vinfo describes the video controller and plane[n].pinfo describes color
  217. * plane 'n' supported by the video controller. Most common color models
  218. * fit in one plane, but this array provides future support for hardware
  219. * with planar YUV types with 3 or 4 color planes.
  220. */
  221. struct fb_videoinfo_s vinfo;
  222. /* Rasterizing functions selected to match the BPP reported in pinfo[] */
  223. struct nxbe_plane_s plane[CONFIG_NX_NPLANES];
  224. };
  225. /****************************************************************************
  226. * Public Data
  227. ****************************************************************************/
  228. #undef EXTERN
  229. #if defined(__cplusplus)
  230. #define EXTERN extern "C"
  231. extern "C" {
  232. #else
  233. #define EXTERN extern
  234. #endif
  235. /****************************************************************************
  236. * Public Functions
  237. ****************************************************************************/
  238. /****************************************************************************
  239. * Name: nxbe_colormap
  240. *
  241. * Description:
  242. * Set the hardware color map to the palette expected by NX
  243. *
  244. ****************************************************************************/
  245. #ifdef CONFIG_FB_CMAP
  246. int nxbe_colormap(FAR NX_DRIVERTYPE *dev);
  247. #endif
  248. /****************************************************************************
  249. * Name: nx_configure
  250. *
  251. * Description:
  252. * Configure the back end state structure based on information from the
  253. * framebuffer or LCD driver
  254. *
  255. ****************************************************************************/
  256. int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be);
  257. #if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
  258. /****************************************************************************
  259. * Name: nxbe_cursor_enable
  260. *
  261. * Description:
  262. * Enable/disable presentation of the cursor
  263. *
  264. * Input Parameters:
  265. * be - The back-end state structure instance
  266. * enable - True: show the cursor, false: hide the cursor.
  267. *
  268. * Returned Value:
  269. * None
  270. *
  271. ****************************************************************************/
  272. void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable);
  273. /****************************************************************************
  274. * Name: nxbe_cursor_setimage
  275. *
  276. * Description:
  277. * Set the cursor image
  278. *
  279. * The image is provided a a 2-bits-per-pixel image. The two bit incoding
  280. * is as followings:
  281. *
  282. * 00 - The transparent background
  283. * 01 - Color1: The main color of the cursor
  284. * 10 - Color2: The color of any border
  285. * 11 - Color3: A blend color for better imaging (fake anti-aliasing).
  286. *
  287. * Input Parameters:
  288. * be - The back-end state structure instance
  289. * image - Describes the cursor image in the expected format.
  290. *
  291. * Returned Value:
  292. * None
  293. *
  294. ****************************************************************************/
  295. #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
  296. void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
  297. FAR struct nx_cursorimage_s *image);
  298. #endif
  299. /****************************************************************************
  300. * Name: nxbe_cursor_setposition
  301. *
  302. * Description:
  303. * Move the cursor to the specified position
  304. *
  305. * Input Parameters:
  306. * be - The back-end state structure instance
  307. * pos - The new cursor position
  308. *
  309. * Returned Value:
  310. * None
  311. *
  312. ****************************************************************************/
  313. void nxbe_cursor_setposition(FAR struct nxbe_state_s *be,
  314. FAR const struct nxgl_point_s *pos);
  315. #endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
  316. #ifdef CONFIG_NX_SWCURSOR
  317. /****************************************************************************
  318. * Name: nxbe_cursor_backupdraw and nxbe_cursor_backupdraw_dev
  319. *
  320. * Description:
  321. * Called after any modification to the display (in window coordinate
  322. * frame) to perform the backup-draw operation on one color plane.
  323. *
  324. * Input Parameters:
  325. * be - The back-end state structure instance, or
  326. * wnd - Window state structure
  327. * rect - The modified region of the window. In windows coordinates for
  328. * nxbe_cursor_backupdraw(); in graphics device corrdinates for
  329. * nxbe_cursor_backupdraw_dev().
  330. * plane - The plane number to use.
  331. *
  332. * Returned Value:
  333. * None
  334. *
  335. ****************************************************************************/
  336. void nxbe_cursor_backupdraw(FAR struct nxbe_window_s *wnd,
  337. FAR const struct nxgl_rect_s *rect, int plane);
  338. void nxbe_cursor_backupdraw_dev(FAR struct nxbe_state_s *be,
  339. FAR const struct nxgl_rect_s *rect,
  340. int plane);
  341. /****************************************************************************
  342. * Name: nxbe_cursor_backupdraw_all and nxbe_cursor_backupdraw_devall
  343. *
  344. * Description:
  345. * Called after any modification to the display to perform the backup-draw
  346. * operation on all color planes.
  347. *
  348. * Input Parameters:
  349. * be - The back-end state structure instance, or
  350. * wnd - Window state structure
  351. * rect - The modified region of the window. In windows coordinates for
  352. * nxbe_cursor_backupdraw(); in graphics device corrdinates for
  353. * nxbe_cursor_backupdraw_dev().
  354. *
  355. * Returned Value:
  356. * None
  357. *
  358. ****************************************************************************/
  359. void nxbe_cursor_backupdraw_all(FAR struct nxbe_window_s *wnd,
  360. FAR const struct nxgl_rect_s *rect);
  361. void nxbe_cursor_backupdraw_devall(FAR struct nxbe_state_s *be,
  362. FAR const struct nxgl_rect_s *rect);
  363. #endif /* */
  364. /****************************************************************************
  365. * Name: nxbe_closewindow
  366. *
  367. * Description:
  368. * Close an existing window
  369. *
  370. * Input Parameters:
  371. * wnd - The window to be closed (and deallocated)
  372. *
  373. * Returned Value:
  374. * None
  375. *
  376. ****************************************************************************/
  377. void nxbe_closewindow(struct nxbe_window_s *wnd);
  378. /****************************************************************************
  379. * Name: nxbe_setposition
  380. *
  381. * Description:
  382. * This function checks for intersections and redraws the display after
  383. * a change in the position of a window.
  384. *
  385. ****************************************************************************/
  386. void nxbe_setposition(FAR struct nxbe_window_s *wnd,
  387. FAR const struct nxgl_point_s *pos);
  388. /****************************************************************************
  389. * Name: nxbe_setsize
  390. *
  391. * Description:
  392. * This function checks for intersections and redraws the display after
  393. * a change in the size of a window.
  394. *
  395. ****************************************************************************/
  396. void nxbe_setsize(FAR struct nxbe_window_s *wnd,
  397. FAR const struct nxgl_size_s *size);
  398. /****************************************************************************
  399. * Name: nxbe_raise
  400. *
  401. * Description:
  402. * Bring the specified window to the top of the display.
  403. *
  404. ****************************************************************************/
  405. void nxbe_raise(FAR struct nxbe_window_s *wnd);
  406. /****************************************************************************
  407. * Name: nxbe_lower
  408. *
  409. * Description:
  410. * Lower the specified window to the bottom of the display.
  411. *
  412. ****************************************************************************/
  413. void nxbe_lower(FAR struct nxbe_window_s *wnd);
  414. /****************************************************************************
  415. * Name: nxbe_modal
  416. *
  417. * Description:
  418. * May be used to either (1) raise a window to the top of the display and
  419. * select modal behavior, or (2) disable modal behavior.
  420. *
  421. ****************************************************************************/
  422. void nxbe_modal(FAR struct nxbe_window_s *wnd, bool enable);
  423. /****************************************************************************
  424. * Name: nxbe_setvisibility
  425. *
  426. * Description:
  427. * Select if the window is visible or hidden. A hidden window is still
  428. * present will will update normally, but will be on the visiable on the
  429. * display until it is unhidden.
  430. *
  431. * Input Parameters:
  432. * wnd - The window to be modified
  433. * hide - True: Window will be hidden; false: Window will be visible
  434. *
  435. * Returned Value:
  436. * None
  437. *
  438. ****************************************************************************/
  439. void nxbe_setvisibility(FAR struct nxbe_window_s *wnd, bool hide);
  440. /****************************************************************************
  441. * Name: nxbe_setpixel
  442. *
  443. * Description:
  444. * Set a single pixel in the window to the specified color. This is simply
  445. * a degenerate case of nxbe_fill(), but may be optimized in some architectures.
  446. *
  447. * Input Parameters:
  448. * wnd - The window structure reference
  449. * pos - The pixel location to be set
  450. * col - The color to use in the set
  451. *
  452. * Returned Value:
  453. * None
  454. *
  455. ****************************************************************************/
  456. void nxbe_setpixel(FAR struct nxbe_window_s *wnd,
  457. FAR const struct nxgl_point_s *pos,
  458. nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
  459. /****************************************************************************
  460. * Name: nxbe_fill
  461. *
  462. * Description:
  463. * Fill the specified rectangle in the window with the specified color
  464. *
  465. * Input Parameters:
  466. * wnd - The window structure reference
  467. * rect - The location to be filled
  468. * col - The color to use in the fill
  469. *
  470. * Returned Value:
  471. * None
  472. *
  473. ****************************************************************************/
  474. void nxbe_fill(FAR struct nxbe_window_s *wnd,
  475. FAR const struct nxgl_rect_s *rect,
  476. nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
  477. /****************************************************************************
  478. * Name: nxbe_filltrapezoid
  479. *
  480. * Description:
  481. * Fill the specified rectangle in the window with the specified color
  482. *
  483. * Input Parameters:
  484. * wnd - The window structure reference
  485. * clip - Clipping region (may be null)
  486. * rect - The location to be filled
  487. * col - The color to use in the fill
  488. *
  489. * Returned Value:
  490. * None
  491. *
  492. ****************************************************************************/
  493. void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
  494. FAR const struct nxgl_rect_s *clip,
  495. FAR const struct nxgl_trapezoid_s *trap,
  496. nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
  497. /****************************************************************************
  498. * Name: nxbe_getrectangle
  499. *
  500. * Description:
  501. * Get the raw contents of graphic memory within a rectangular region. NOTE:
  502. * Since raw graphic memory is returned, the returned memory content may be
  503. * the memory of windows above this one and may not necessarily belong to
  504. * this window unless you assure that this is the top window.
  505. *
  506. * Input Parameters:
  507. * wnd - The window structure reference
  508. * rect - The location to be copied
  509. * plane - Specifies the color plane to get from.
  510. * dest - The location to copy the memory region
  511. * deststride - The width, in bytes, of the dest memory
  512. *
  513. * Returned Value:
  514. * None
  515. *
  516. ****************************************************************************/
  517. void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
  518. FAR const struct nxgl_rect_s *rect,
  519. unsigned int plane,
  520. FAR uint8_t *dest, unsigned int deststride);
  521. /****************************************************************************
  522. * Name: nxbe_move
  523. *
  524. * Description:
  525. * Move a rectangular region within the window
  526. *
  527. * Input Parameters:
  528. * wnd - The window within which the move is to be done
  529. * rect - Describes the rectangular region to move
  530. * offset - The offset to move the region
  531. *
  532. * Returned Value:
  533. * None
  534. *
  535. ****************************************************************************/
  536. void nxbe_move(FAR struct nxbe_window_s *wnd,
  537. FAR const struct nxgl_rect_s *rect,
  538. FAR const struct nxgl_point_s *offset);
  539. /****************************************************************************
  540. * Name: nxbe_bitmap_dev
  541. *
  542. * Description:
  543. * Copy a rectangular region of a larger image into the rectangle in the
  544. * specified window. The graphics output is written to the graphics
  545. * device unconditionally.
  546. *
  547. * Input Parameters:
  548. * wnd - The window that will receive the bitmap image
  549. * dest - Describes the rectangular region on the display that will
  550. * receive the the bit map (window coordinate frame).
  551. * src - The start of the source image.
  552. * origin - The origin of the upper, left-most corner of the full bitmap.
  553. * Both dest and origin are in window coordinates, however, origin
  554. * may lie outside of the display.
  555. * stride - The width of the full source image in pixels.
  556. *
  557. * Returned Value:
  558. * None
  559. *
  560. ****************************************************************************/
  561. void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd,
  562. FAR const struct nxgl_rect_s *dest,
  563. FAR const void *src[CONFIG_NX_NPLANES],
  564. FAR const struct nxgl_point_s *origin,
  565. unsigned int stride);
  566. /****************************************************************************
  567. * Name: nxbe_bitmap
  568. *
  569. * Description:
  570. * Copy a rectangular region of a larger image into the rectangle in the
  571. * specified window. This is a front end to nxbe_bitmap_dev() that is
  572. * used only if CONFIG_NX_RAMBACKED=y. If the per-window frame buffer is
  573. * selected, then the bit map will be written to both the graphics device
  574. * and shadowed in the per-window framebuffer.
  575. *
  576. * Input Parameters:
  577. * wnd - The window that will receive the bitmap image
  578. * dest - Describes the rectangular region on the display that will
  579. * receive the the bit map (window coordinate frame).
  580. * src - The start of the source image.
  581. * origin - The origin of the upper, left-most corner of the full bitmap.
  582. * Both dest and origin are in window coordinates, however, origin
  583. * may lie outside of the display.
  584. * stride - The width of the full source image in bytes.
  585. *
  586. * Returned Value:
  587. * None
  588. *
  589. ****************************************************************************/
  590. void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
  591. FAR const struct nxgl_rect_s *dest,
  592. FAR const void *src[CONFIG_NX_NPLANES],
  593. FAR const struct nxgl_point_s *origin,
  594. unsigned int stride);
  595. /****************************************************************************
  596. * Name: nxbe_flush
  597. *
  598. * Description:
  599. * After per-window frambuffer has been updated, the modified region must
  600. * be written to device graphics memory. That function is managed by this
  601. * simple function. It does the following:
  602. *
  603. * 1) It calls nxbe_bitmap_dev() to copy the modified per-window
  604. * framebuffer into device graphics memory.
  605. * 2) If CONFIG_NX_SWCURSOR is enabled, it calls the cursor "draw"
  606. * renderer to update re-draw the currsor image if any portion of
  607. * graphics display update overwrote the cursor. Since these
  608. * operations are performed back-to-back, any resulting flicker
  609. * should be minimized.
  610. *
  611. * Input Parameters (same as for nxbe_bitmap_dev):
  612. * wnd - The window that will receive the bitmap image
  613. * dest - Describes the rectangular region in the window that will
  614. * receive the the bit map (window coordinate frame).
  615. * src - The start of the source image.
  616. * origin - The origin of the upper, left-most corner of the full bitmap.
  617. * Both dest and origin are in window coordinates, however,
  618. * origin may lie outside of the display.
  619. * stride - The width of the full source image in bytes.
  620. *
  621. * Returned Value:
  622. * None
  623. *
  624. ****************************************************************************/
  625. #ifdef CONFIG_NX_RAMBACKED
  626. void nxbe_flush(FAR struct nxbe_window_s *wnd,
  627. FAR const struct nxgl_rect_s *dest,
  628. FAR const void *src[CONFIG_NX_NPLANES],
  629. FAR const struct nxgl_point_s *origin,
  630. unsigned int stride);
  631. #endif
  632. /****************************************************************************
  633. * Name: nxbe_redraw
  634. *
  635. * Description:
  636. * Re-draw the visible portions of the rectangular region for the
  637. * specified window
  638. *
  639. ****************************************************************************/
  640. void nxbe_redraw(FAR struct nxbe_state_s *be,
  641. FAR struct nxbe_window_s *wnd,
  642. FAR const struct nxgl_rect_s *rect);
  643. /****************************************************************************
  644. * Name: nxbe_redrawbelow
  645. *
  646. * Description:
  647. * Re-draw the visible portions of the rectangular region for all windows
  648. * below (and including) the specified window. This function is called
  649. * whenever a window is closed, moved, lowered or re-sized in order to
  650. * expose newly visible portions of lower windows.
  651. *
  652. ****************************************************************************/
  653. void nxbe_redrawbelow(FAR struct nxbe_state_s *be,
  654. FAR struct nxbe_window_s *wnd,
  655. FAR const struct nxgl_rect_s *rect);
  656. /****************************************************************************
  657. * Name: nxbe_isvisible
  658. *
  659. * Description:
  660. * Return true if the point, pt, in window wnd is visible. pt is in
  661. * absolute screen coordinates
  662. *
  663. ****************************************************************************/
  664. bool nxbe_isvisible(FAR struct nxbe_window_s *wnd,
  665. FAR const struct nxgl_point_s *pos);
  666. /****************************************************************************
  667. * Name: nxbe_clipper
  668. *
  669. * Description:
  670. * Perform flexible clipping operations. Callbacks are executed for
  671. * each obscured and visible portions of the window.
  672. *
  673. * Input Parameters:
  674. * wnd - The window to be clipped.
  675. * rect - The region of concern within the window
  676. * order - Specifies the order to process the parts of the non-intersecting
  677. * sub-rectangles.
  678. * cops - The callbacks to handle obscured and visible parts of the
  679. * sub-rectangles.
  680. * plane - The raster operations to be used by the callback functions.
  681. * These may vary with different color formats.
  682. *
  683. * Returned Value:
  684. * None
  685. *
  686. ****************************************************************************/
  687. void nxbe_clipper(FAR struct nxbe_window_s *wnd,
  688. FAR const struct nxgl_rect_s *dest, uint8_t order,
  689. FAR struct nxbe_clipops_s *cops,
  690. FAR struct nxbe_plane_s *plane);
  691. /****************************************************************************
  692. * Name: nxbe_clipnull
  693. *
  694. * Description:
  695. * The do-nothing clipping callback function
  696. *
  697. ****************************************************************************/
  698. void nxbe_clipnull(FAR struct nxbe_clipops_s *cops,
  699. FAR struct nxbe_plane_s *plane,
  700. FAR const struct nxgl_rect_s *rect);
  701. #undef EXTERN
  702. #if defined(__cplusplus)
  703. }
  704. #endif
  705. #endif /* __GRAPHICS_NXBE_NXBE_H */