示例#1
0
int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
            nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
  FAR struct nxbe_window_s *wnd = (FAR struct nxbe_window_s *)hwnd;
  struct nxsvrmsg_fill_s  outmsg;

#ifdef CONFIG_DEBUG
  if (!wnd || !rect || !color)
    {
      set_errno(EINVAL);
      return ERROR;
    }
#endif

  /* Format the fill command */

  outmsg.msgid = NX_SVRMSG_FILL;
  outmsg.wnd   = wnd;

  nxgl_rectcopy(&outmsg.rect, rect);
  nxgl_colorcopy(outmsg.color, color);

  /* Forward the fill command to the server */

  return nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_fill_s));
}
示例#2
0
int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
              FAR const void *src[CONFIG_NX_NPLANES],
              FAR const struct nxgl_point_s *origin, unsigned int stride)
{
  FAR struct nxbe_window_s *wnd = (FAR struct nxbe_window_s *)hwnd;
  struct nxsvrmsg_bitmap_s outmsg;
  int i;

#ifdef CONFIG_DEBUG
  if (!wnd || !dest || !src || !origin)
    {
      errno = EINVAL;
      return ERROR;
    }
#endif

  /* Format the bitmap command */

  outmsg.msgid      = NX_SVRMSG_BITMAP;
  outmsg.wnd        = wnd;
  outmsg.stride     = stride;

  for (i = 0; i < CONFIG_NX_NPLANES; i++)
    {
      outmsg.src[i] = src[i];
    }

  outmsg.origin.x   = origin->x;
  outmsg.origin.y   = origin->y;
  nxgl_rectcopy(&outmsg.dest, dest);

  /* Forward the fill command to the server */

  return nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_bitmap_s));
}
示例#3
0
int nx_getposition(NXWINDOW hwnd)
{
  FAR struct nxbe_window_s     *wnd = (FAR struct nxbe_window_s *)hwnd;
  struct nxsvrmsg_getposition_s outmsg;

#ifdef CONFIG_DEBUG
  if (!wnd)
    {
      errno = EINVAL;
      return ERROR;
    }
#endif

  /* Request the size/position info.
   *
   * It is tempting to just take the positional information from the window
   * structure that we have in our hands now.  However, we need to run this through
   * the server to keep things serialized.  There might, for example, be a pending
   * size/position change and, in that case, this function would return the
   * wrong info.
   */

  outmsg.msgid = NX_SVRMSG_GETPOSITION;
  outmsg.wnd   = wnd;

  return nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_getposition_s));
}
示例#4
0
int nx_setpixel(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
                nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
  FAR struct nxbe_window_s  *wnd = (FAR struct nxbe_window_s *)hwnd;
  struct nxsvrmsg_setpixel_s outmsg;

#ifdef CONFIG_DEBUG
  if (!wnd || !pos || !color)
    {
      set_errno(EINVAL);
      return ERROR;
    }
#endif

  /* Format the fill command */

  outmsg.msgid = NX_SVRMSG_SETPIXEL;
  outmsg.wnd   = wnd;
  outmsg.pos.x = pos->x;
  outmsg.pos.y = pos->y;

  nxgl_colorcopy(outmsg.color, color);

  /* Forward the fill command to the server */

  return nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_setpixel_s));
}
示例#5
0
int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
            FAR const struct nxgl_point_s *offset)
{
  FAR struct nxbe_window_s *wnd = (FAR struct nxbe_window_s *)hwnd;
  struct nxsvrmsg_move_s    outmsg;

#ifdef CONFIG_DEBUG
  if (!wnd)
    {
      set_errno(EINVAL);
      return ERROR;
    }
#endif

  /* Format the fill command */

  outmsg.msgid      = NX_SVRMSG_MOVE;
  outmsg.wnd        = wnd;
  outmsg.offset.x   = offset->x;
  outmsg.offset.y   = offset->y;

  nxgl_rectcopy(&outmsg.rect, rect);

  /* Forward the fill command to the server */

  return nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_move_s));
}
示例#6
0
void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect)
{
  FAR struct nxbe_window_s *wnd = (FAR struct nxbe_window_s *)hwnd;
  struct nxsvrmsg_redrawreq_s outmsg;
  int ret;

  DEBUGASSERT(wnd && rect);

  /* Inform the server of the changed position */

  outmsg.msgid = NX_SVRMSG_REDRAWREQ;
  outmsg.wnd   = wnd;
  nxgl_rectcopy(&outmsg.rect, rect);

  ret = nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_redrawreq_s));
  if (ret < 0)
    {
      gdbg("ERROR: nxmu_sendwindow failed: %d\n", errno);
    }
}