Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->系统管理 ->正文

GDK Reference Manual

来源:Linux-cn.com 作者:Webmaster 时间:2007-05-05 点击: [收藏] [投稿]
[

  aidcode]Description

  The way that the data stored on the screen is stored in memory can vary considerably between different X servers; some X servers even support multiple formats used simultaneously. An X visual represents a particular format for screen data. It includes information about the number of bits used for each color, the way the bits are translated into an RGB value for display, and the way the bits are stored in memory.

  There are several standard visuals. The visual returned by gdk_visual_get_system() is the system's default visual. gdk_rgb_get_visual() return the visual most suited to displaying full-color image data. If you use the calls in GdkRGB, you should create your windows using this visual (and the colormap returned by gdk_rgb_get_colormap()).

  A number of functions are provided for determining the "best" available visual. For the purposes of making this determination, higher bit depths are considered better, and for visuals of the same bit depth, GDK_VISUAL_PSEUDO_COLOR is preferred at 8bpp, otherwise, the visual types are ranked in the order of (highest to lowest) GDK_VISUAL_DIRECT_COLOR, GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_GRAYSCALE, then GDK_VISUAL_STATIC_GRAY.

  Details

  struct GdkVisual


struct GdkVisual
{
GdkVisualType type;
gint depth;
GdkByteOrder byte_order;
gint colormap_size;
gint bits_per_rgb;
guint32 red_mask;
gint red_shift;
gint red_prec;
guint32 green_mask;
gint green_shift;
gint green_prec;
guint32 blue_mask;
gint blue_shift;
gint blue_prec;
}; 

  The GdkVisual structure contains information about a particular visual. It contains the following public fields.

  type The type of this visual.

  depth The number of bits per pixel.

  byte_order The byte-order for this visual.

  colormap_size The number of entries in the colormap, for visuals of type GDK_VISUAL_PSEUDO_COLOR or GDK_VISUAL_GRAY_SCALE. For other visual types, it is the number of possible levels per color component. If the visual has different numbers of levels for different components, the value of this field is undefined.

  bits_per_rgb The number of significant bits per red, green, or blue when specifying colors for this visual. (For instance, for gdk_colormap_alloc_color())

  red_mask A mask giving the bits in a pixel value that correspond to the red field. Significant only for GDK_VISUAL_PSEUDOCOLOR and GDK_VISUAL_DIRECTCOLOR.

  red_shift, red_prec The red_shift and red_prec give an alternate presentation of the information in red_mask. red_mask is a contiguous sequence of red_prec starting at bit number red_shift. For example, Figure 1 shows constructing a pixel value out of three 16 bit color values.

  green_mask A mask giving the bits in a pixel value that correspond to the green field.

  green_shift, green_prec The green_shift and green_prec give an alternate presentation of the information in green_mask.

  blue_mask A mask giving the bits in a pixel value that correspond to the blue field.

  blue_shift, blue_prec The blue_shift and blue_prec give an alternate presentation of the information in blue_mask.

  Figure 1. Constructing a pixel value from components

  guint


pixel_from_rgb (GdkVisual *visual,
guchar r, guchar b, guchar g) 
{
return ((r >> (16 - visual->red_prec)) << visual->red_shift) |
((g >> (16 - visual->green_prec)) << visual->green_shift) |
((r >> (16 - visual->blue_prec))<< visual->blue_shift);
} 

  enum GdkVisualType


typedef enum
{
GDK_VISUAL_STATIC_GRAY,
GDK_VISUAL_GRAYSCALE,
GDK_VISUAL_STATIC_COLOR,
GDK_VISUAL_PSEUDO_COLOR,
GDK_VISUAL_TRUE_COLOR,
GDK_VISUAL_DIRECT_COLOR
} GdkVisualType; 

  A set of values that describe the manner in which the pixel values for a visual are converted into RGB values for display.

  GDK_VISUAL_STATIC_GRAY Each pixel value indexes a grayscale value directly.

  GDK_VISUAL_GRAYSCALE Each pixel is an index into a color map that maps pixel values into grayscale values. The color map can be changed by an application.

  GDK_VISUAL_STATIC_COLOR Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into rgb values.

  GDK_VISUAL_PSEUDO_COLOR Each pixel is an index into a color map that maps pixel values into rgb values. The color map can be changed by an application.

  GDK_TRUE_COLOR Each pixel value directly contains red, green, and blue components. The red_mask, green_mask, and blue_mask fields of the GdkVisual structure describe how the components are assembled into a pixel value. .

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<

上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2526 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 下一页


上一篇:GTK v1.2 Tutorial(英文)   下一篇:Java入门(12) 事件与错误处理

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
·Motorola微处理器bootloader分析与应用
·Fedora Core5 NFS服务器搭建过程介绍
·Linux系统:让内存不再泄漏的实用技巧
·新手看招 手把手教你安装VMware虚拟机
·“侵权事件” 红帽称微软企图干扰用户
·删除Linux后 如何找回Windows启动菜单
·菜鸟乐园 Linux中常见文件系统格式介绍
·Linux操作系统下IPTables配置方法详解
·实用技巧 Linux系统的经典使用技巧八则
·Linux系统文件优化及磁盘检查方法介绍
推荐文章
·什么时候应该使用Web Service
·如何监视某个tty?
·出错也不怕—Linux系统紧急情况处理
·Linux 指令篇:档案目录管理--ls
·开放源代码时代即将到来
·用PHP+MySQL构建一个招聘网站(10)
·理解和使用Oracle 8i分析工具-LogM
·JSP的环境引擎--websphere
精彩文章
·xfs文件系统(原创)
·Linux 指令篇:工作行程资讯与管理--
·用户界面原型开发:技巧和技术
·PHP的XML分析函数(一)
·编写Linux实用程序的艺术
·基于heartbeat的NFS HA实现
·如何阅读源代码
·一个网上理财站点的设计(二)
·Linux 指令篇:起始管理--reboot
·LInux 应用程序如何处理当前运行环
·mount使用指南
·用php生成excel文件
·Linux 常用命令(磁盘管理)
·架设 DHCP Server
·简易防火墙建置与流量统计
·J2EE概述
·[术语]GPL通用公共许可证
·内核空间SMP编程
·认识X-Window窗口管理器
·Linux内核网络参数的意义及应用
·Linux下硬盘分区的最佳方案
·JavaBean使用技巧
·基于DNS的多机均衡负载的实现
·python入门1
·Linux 网管 123 --- 第10章. 升级 L
·Oracle安装(linux)小结
Power by linux-cn.com 粤ICP备05006655号