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

GDK Reference Manual

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

  To draw a GdkImage in a GdkWindow or GdkPixmap use gdk_draw_image().

  To destroy a GdkImage use gdk_image_destroy().

  Details

  struct GdkImage


struct GdkImage
{
GdkImageTypetype;
GdkVisual*visual;/* visual used to create the image */
GdkByteOrderbyte_order;
guint16width;
guint16height;
guint16depth;
guint16bpp;/* bytes per pixel */
guint16bpl;/* bytes per line */
gpointermem;
}; 

  The GdkImage struct contains information on the image and the pixel data.

  GdkImageType type the type of the image.

  GdkVisual *visual the visual.

  GdkByteOrder byte_order the byte order.

  guint16 width the width of the image in pixels.

  guint16 height the height of the image in pixels.

  guint16 depth the depth of the image, i.e. the number of bits per pixel.

  guint16 bpp the number of bytes per pixel.

  guint16 bpl the number of bytes per line of the image.

  gpointer mem the pixel data.


gdk_image_new ()
GdkImage* gdk_image_new (GdkImageType type,GdkVisual *visual,
gint width,gint height); 

  Creates a new GdkImage.

  type : the type of the GdkImage, one of GDK_IMAGE_NORMAL, GDK_IMAGE_SHARED and GDK_IMAGE_FASTEST. GDK_IMAGE_FASTEST is probably the best choice, since it will try creating a GDK_IMAGE_SHARED image first and if that fails it will then use GDK_IMAGE_NORMAL.

  visual : the GdkVisual to use for the image.

  width : the width of the image in pixels.

  height : the height of the image in pixels.

  Returns : a new GdkImage, or NULL if the image could not be created.

  enum GdkImageType


typedef enum
{
GDK_IMAGE_NORMAL,
GDK_IMAGE_SHARED,
GDK_IMAGE_FASTEST
} GdkImageType; 

  Specifies the type of a GdkImage.

  GDK_IMAGE_NORMAL The original X image type, which is quite slow since the image has to be transferred from the client to the server to display it.

  GDK_IMAGE_SHARED A faster image type, which uses shared memory to transfer the image data between client and server. However this will only be available if client and server are on the same machine and the shared memory extension is supported by the server.

  GDK_IMAGE_FASTEST Specifies that GDK_IMAGE_SHARED should be tried first, and if that fails then GDK_IMAGE_NORMAL will be used.


gdk_image_new_bitmap ()
GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
gpointer data,gint width,gint height); 

  Creates a new GdkImage with a depth of 1 from the given data.

  visual : the GdkVisual to use for the image.

  data : the pixel data.

  width : the width of the image in pixels.

  height : the height of the image in pixels.

  Returns : a new GdkImage.


gdk_image_get ()
GdkImage* gdk_image_get (GdkWindow *window,
gint x,gint y,gint width,gint height); 

  Gets part of a GdkWindow and stores it in a new GdkImage.

  window : the GdkWindow to copy from.

  x : the left edge of the rectangle to copy from window.

  y : the top edge of the rectangle to copy from window.

  width : the width of the area to copy, in pixels.

  height : the height of the area to copy, in pixels.

  Returns : a new GdkImage with a copy of the given area of window.


gdk_image_destroy ()
voidgdk_image_destroy (GdkImage *image); 

  Destroys a GdkImage, freeing any resources allocated for it.

  image : a GdkImage.


gdk_image_put_pixel ()
voidgdk_image_put_pixel (GdkImage *image,
gint x,gint y,guint32 pixel); 

  Sets a pixel in a GdkImage to a given pixel value.

  image : a GdkImage.

  x : the x coordinate of the pixel to set.

  y : the y coordinate of the pixel to set.

  pixel : the pixel value to set.


gdk_image_get_pixel ()
guint32 gdk_image_get_pixel (GdkImage *image,gint x,gint y); 


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



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

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章