⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video.h

📁 The major functionality added in this release includes: - Rootless mode in X11 - Widget Templt
💻 H
📖 第 1 页 / 共 3 页
字号:
/* $Id: video.h,v 1.114 2002/11/11 07:33:04 micahjd Exp $ * * video.h - Defines an API for writing PicoGUI video *           drivers * * PicoGUI small and efficient client/server GUI * Copyright (C) 2000-2002 Micah Dowty <micahjd@users.sourceforge.net> * * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *  * Contributors: *  *  *  */#ifndef __H_VIDEO#define __H_VIDEO#include <picogui/network.h>   /* For pgshmbitmap */#include <pgserver/pgstring.h>struct fontdesc;struct quad;struct rect;struct pair;struct groprender;struct gropnode;struct divtree;/* Hardware-specific color value */typedef u32 hwrcolor;/* PicoGUI color (24-bit RGB)   Usually converted to a hwrcolor at the first opportunity*/typedef u32 pgcolor;#define getalpha(pgc)     (((pgc)>>24)&0x7F)#define getred(pgc)       (((pgc)>>16)&0xFF)#define getgreen(pgc)     (((pgc)>>8)&0xFF)#define getblue(pgc)      ((pgc)&0xFF)#define mkcolor(r,g,b)    (((r)<<16)|((g)<<8)|(b))#define mkcolora(a,r,g,b) (((a)<<24)|((r)<<16)|((g)<<8)|(b)|PGCF_ALPHA)/* Can be a hardware-specific bitmap, but usually is * a stdbitmap pointer. This is driver dependant. * It really doesn't matter what type of pointer * this is defined as, but it affects the compiler * warnings. */typedef struct stdbitmap *hwrbitmap;/* The hwrbitmap used in the default implementation * (should be sufficient for most drivers) */struct stdbitmap {  u8  *bits;                 /* actual format depends on bpp */  struct groprender *rend;   /* State for offscreen rendering */  s16 w,h;  u16 pitch;                 /* Spacing between lines, in bytes */  u16 bpp;                   /* Bits per pixel of bitmap */  int shm_id;                /* If nonzero, 'bits' is a shared memory segment.			      * use this id to unmap it and remove when this			      * bitmap is deleted.			      *//* Added by kdhong, for bitmap allocation in video memory */ int hw_handle;              /* If the value is >= 0 => Allocated in Graphic Memory                                           -1 => Allocated in Main Memory */ void* lock_handle;  unsigned int freebits:1;   /* free() bits when deleting this bitmap */};#ifdef CONFIG_DITHER/* This can be a hardware-specific dithering structure, * but usually it's a stddither pointer. */typedef struct stddither *hwrdither;/* Structure for keeping track of the state of an image being dithered. * This one is for the default floyd-steinberg dithering, but it can be * overridden. All buffers are indexed by channel. */struct stddither {  int *current_line[3];  /* Buffer for this line, pixel values * 16     */  int *next_line[3];     /* Buffer for the next line                    */  int *current[3];       /* Current position in current_line buffer     */  int *below[3];         /* Current position in next_line buffer        */  int x,y,w,h;           /* Destination rectangle                       */  int dy;                /* Delta for y motion                          */  int i;                 /* Iteration counter for the line              */  hwrbitmap dest;        /* Where to render to                          */};#endif /* CONFIG_DITHER *//* A group of functions to deal with one bitmap format */struct bitformat {  u8 name[4];     /* fourcc for the format name */  bool (*detect)(const u8 *data, u32 datalen);  g_error (*load)(hwrbitmap *bmp, const u8 *data, u32 datalen);  g_error (*save)(hwrbitmap bmp, u8 **data, u32 *datalen);};   /* A sprite node, overlaid on the actual picture */struct sprite {  hwrbitmap *bitmap,*mask,backbuffer;  handle dt; /* The divtree this sprite exists above */  s16 x,y;   /* Current coordinates, relative to the display */  s16 ox,oy; /* Coordinates last time it was drawn */  s16 w,h;   /* Dimensions of all buffers */  s16 ow,oh; /* The blit last time, with clipping */  struct divnode *clip_to;  struct sprite *next;  int lgop;  /* lgop to draw bitmap with, if there's no mask */  unsigned int onscreen : 1;   /* Displayed on screen now */  unsigned int visible  : 1;   /* Displayed under normal circumstances */};/* List of sprites to overlay */extern struct sprite *spritelist;/* This structure contains a pointer to each graphics function   in use, forming a definition for a driver. Initially, all functions   point to default implementations. It is only necessary for a driver   to implement a few functions, but it can optionally implement others   if they can be accelerated*/struct vidlib {  /* IMPORTANT:   *   when adding new primitives to the vidlib, update the rotation wrappers if necessary!   */  /******************************************** Initializing and video modes */  /* Required   *   initializes graphics device. Setmode will be called immediately   *   after this to initialize the default mode.   */  g_error (*init)(void);  /* Recommended   *   Changes the video mode immediately after initialization or at the   *   client's request. The driver should pick the closest mode, and   *   if it doesn't support mode switching simply ignore this. The client   *   needs to check the video mode afterwards, as this is only a _request_   *   for a particular mode.   *   * Default implementation: does nothing    */  g_error (*setmode)(s16 xres,s16 yres,s16 bpp,u32 flags);  /* Optional   *   This is called after mode setting is complete, including all wrappers   *   loaded. Here the driver can do any special munging that this mode   *   needs.   */  g_error (*entermode)(void);     /* Optional   *   This is called any time the current mode is exited, whether by   *   changing modes or changing drivers, but before the mode is actually   *   switched. If the driver rearranged bitmap data in setmode, put it   *   back to normal here.   */  g_error (*exitmode)(void);     /* Recommended   *   free memory, close device, etc.    *    * Default implementation: does nothing   */  void (*close)(void);  /* Optional   *   Converts physical coordinates (from an input device)   *   into logical coordinates   *    * Default implementation: does nothing   */  void (*coord_logicalize)(int *x,int *y);  /* Optional   *   Converts logical coordinates back to physical   *   * Default implementation: does nothing   */  void (*coord_physicalize)(int *x,int *y);  /* Optional   *   For video wrappers, rotate keypads along with the display   *   * Default implementation: does nothing   */  void (*coord_keyrotate)(int *k);  /* Reccomended (without double-buffer, it looks really dumb)   *   Update changes to the screen, if device is double-buffered or   *   uses page flipping   *   * Default implementation: does nothing (assumes changes are immediate)   */  void (*update)(hwrbitmap display, s16 x,s16 y,s16 w,s16 h);     /* Current mode (only used in driver)   *   * The default bitmap functions should handle 1,2,4,8,16,24,32 bpp ok   */  s16 xres,yres,bpp;  u32 flags;  /* Logical screen size, read-only outside of driver.   * Even in a rootless driver, this should return the size of the whole screen.   */  s16 lxres,lyres;     /* fb_mem and fb_bpl are no longer here. Use display->bits and   * display->pitch, also accessable with the macros FB_MEM and FB_BPL */   /* This is provided for the video drivers' convenience only!   * By default it is the bitmap indicating output to the display,   * but the video driver may redefine it using the functions in the   * window management section below.   */  hwrbitmap display;     /* Optionally process driver messages */  void (*message)(u32 message, u32 param, u32 *ret);  /******************************************** Window management */  /* The functions in this section are used by rootless mode.   * A driver may support both rootless and monolithic modes:   * rootless mode will be entered by calling setmode with the   * PG_VID_ROOTLESS flag turned on. If the driver has been successfully   * put into rootless mode, the is_rootless function should return 1.   * In a driver that supports both rootless and conventional modes,   * the user or package maintainer will select this via the app manager.   */  /* Optional   *   Return a bitmap used for drawing debug information.   *   On a normal driver, this should be one full screen.   *   On a rootless driver, this should probably be a window created   *   if it does not exist, and closed when the user requests.   *   *   The returned hwrbitmap will not be deleted. It may be deleted   *   by the driver when the user requests so, as long as it is recreated   *   the next time this function is called.   *   * Default implementation: returns vid->display   */  hwrbitmap (*window_debug)(void);    /* Optional   *   Return a bitmap used for drawing to the whole screen.   *   On a multi-display system, the display to use is at the   *   discretion of the driver. (Probably the display with the highest   *   resolution and color depth) On a rootless system this should be   *   a new window created to cover all others, or possibly a full   *   screen mode in the host system.   *   *   NOTE: This function is very likely to change when pgserver   *         needs to get real multiple display support!   *         This is also not really useful for fullscreen in rootless   *         drivers yet, as there would need to be a way for the   *         driver to know when to go in and out of fullscreen mode.   *   *   The returned hwrbitmap will not be deleted. It is expected   *   to be a persistent resource.   *   * Default implementation: returns vid->display   */  hwrbitmap (*window_fullscreen)(void);    /* Optional   *   In a rootless driver, create a new window and return a hwrbitmap   *   describing it. The divtree this window is housing is specified,   *   as it should be resized when the window is. The driver will need   *   to save this divtree and use it when sending input events.   *   *   The returned hwrbitmap will be freed with window_free   *   * Default implementation: returns vid->display   */  g_error (*window_new)(hwrbitmap *bmp, struct divtree *dt);  /* Optional   *   In a rootless driver, create a new window and return a hwrbitmap   *   describing it.   *   * Default implementation: does nothing   */  void (*window_free)(hwrbitmap window);  /* Optional   *   In a rootless driver, set the window title to the given string   *   * Default implementation: does nothing   */  void (*window_set_title)(hwrbitmap window, const struct pgstring *title);  /* Optional

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -