gtk/docs/reference/gdk/tmpl/images.sgml

198 lines
5.1 KiB
Plaintext
Raw Normal View History

1999-08-16 18:51:52 +00:00
<!-- ##### SECTION Title ##### -->
Images
<!-- ##### SECTION Short_Description ##### -->
an area for bit-mapped graphics stored on the X Windows client.
1999-08-16 18:51:52 +00:00
<!-- ##### SECTION Long_Description ##### -->
<para>
The #GdkImage type represents an area for drawing graphics.
It has now been superceded to a large extent by the much more flexible
<link linkend="gdk-GdkRGB">GdkRGB</link> functions.
</para>
<para>
To create an empty #GdkImage use gdk_image_new().
To create a #GdkImage from bitmap data use gdk_image_new_bitmap().
To create an image from part of a #GdkWindow use gdk_drawable_get_image().
</para>
<para>
The image can be manipulated with gdk_image_get_pixel() and
gdk_image_put_pixel(), or alternatively by changing the actual pixel data.
Though manipulating the pixel data requires complicated code to cope with
the different formats that may be used.
</para>
<para>
To draw a #GdkImage in a #GdkWindow or #GdkPixmap use gdk_draw_image().
</para>
<para>
To destroy a #GdkImage use gdk_image_destroy().
1999-08-16 18:51:52 +00:00
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
<variablelist>
<varlistentry>
<term><link linkend="gdk-Bitmaps-and-Pixmaps">Bitmaps and Pixmaps</link></term>
<listitem><para>
Graphics which are stored on the X Windows server.
Since these are stored on the server they can be drawn very quickly, and all
of the <link linkend="gdk-Drawing-Primitives">Drawing Primitives</link> can be
used to draw on them. Their main disadvantage is that manipulating individual
pixels can be very slow.
</para></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gdk-GdkRGB">GdkRGB</link></term>
<listitem><para>
Built on top of #GdkImage, this provides much more functionality,
including the dithering of colors to produce better output on low-color
displays.
</para></listitem>
</varlistentry>
</variablelist>
1999-08-16 18:51:52 +00:00
</para>
<!-- ##### STRUCT GdkImage ##### -->
<para>
The #GdkImage struct contains information on the image and the pixel data.
1999-08-16 18:51:52 +00:00
</para>
@parent_instance:
@type: the type of the image.
@visual: the visual.
@byte_order: the byte order.
@width: the width of the image in pixels.
@height: the height of the image in pixels.
@depth: the depth of the image, i.e. the number of bits per pixel.
@bpp: the number of bytes per pixel.
@bpl: the number of bytes per line of the image.
@bits_per_pixel:
@mem: the pixel data.
Clip the retrieved image data to the screen, using a server grab to avoid 2001-06-28 Havoc Pennington <hp@pobox.com> * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved image data to the screen, using a server grab to avoid race conditions. * gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove check for NULL return from gtk_image_new_from_stock(), it never returns NULL. (gtk_item_factory_create_item): fix bug where we parsed the stock ID as an inline pixbuf * gtk/gtktext.c (gtk_text_key_press): numeric keypad support * gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad support (should be using binding set here) * gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad support (should be using binding set here) * gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad support * gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support * gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad * gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): keypad * gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad * gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes * gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support * gtk/gtkcolorsel.c (palette_activate): keypad support (of course, should be binding-setted) * gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes * gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes * gtk/gtkcalendar.c: numeric keypad fixes * gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad support * gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop screwup * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): clip the render area to the drawable's clip region in advance, so we don't get data from the server that we don't need. * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): check return value of gdk_pixbuf_get_from_drawable(), fall back to bilevel alpha if we can't get the pixbuf to composite against. * gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap * gdk/gdkimage.c (gdk_image_get_colormap): add gdk_image_set_colormap, gdk_image_get_colormap * gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to take a region of the image, instead of converting the entire image. * gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help keybinding signal. Add default bindings for it. Add default handler for show_help that shows the tooltip for the widget. * gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and "close" keybinding signal, remove key press handler. * gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this, it's not our usual practice to leave a deprecated function around with a runtime warning, plus we don't want it to appear in docs, plus if we make them yellow no one will want to change them anyhow.
2001-06-29 01:59:02 +00:00
@colormap:
@windowing_data:
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gdk_image_new ##### -->
1999-08-16 18:51:52 +00:00
<para>
Creates a new #GdkImage.
1999-08-16 18:51:52 +00:00
</para>
@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.
1999-08-16 18:51:52 +00:00
<!-- ##### ENUM GdkImageType ##### -->
<para>
Specifies the type of a #GdkImage.
1999-08-16 18:51:52 +00:00
</para>
@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.
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gdk_image_new_bitmap ##### -->
1999-08-16 18:51:52 +00:00
<para>
Creates a new #GdkImage with a depth of 1 from the given data.
voc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_previous_line): (gtk_text_layout_move_iter_to_next_line): fix these two for invisible text, lots of other stuff still hosed. * gtk/gtkcolorsel.c (gtk_color_selection_set_change_palette_hook): new function, replaces the get/set palette stuff. This function is intended for use by libgnomeui which should set the hook to a thing which sets the palette in GConf, and we need the GConf-to-xsettings proxy which will result in the change being propagated back to the GTK app. * gtk/gtkaccelgroup.c (gtk_accel_group_add): add note to warning about unusable signals that it may be because the signal has parameters. * gtk/gtkwidget.c (gtk_widget_modify_style): always copy the style, otherwise gtkrc.c won't know to create a new GtkStyle for it. (gtk_widget_modify_color_component): call gtk_widget_modify_style() so the rc style will get copied. (gtk_widget_modify_font): ditto * gtk/gtkrc.c: make a couple variables static * gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init): hide help button by default, since it does nothing * gtk/gtkcolorsel.c: add tooltips, work on key navigation, fool around with UI * gtk/gtkentry.c (gtk_entry_realize): request enter/leave notify so we can have tooltips * gtk/gtkhsv.c (gtk_hsv_realize): request enter/leave notify so we can have tooltips * gdk/gdkimage.h: mark gdk_image_new_bitmap with GDK_ENABLE_BROKEN, because its memory behavior is completely hosed. * gtk/gtknotebook.c: remove key press handler, replace with binding set, add numeric keypad support * gtk/gtktextview.c (gtk_text_view_class_init): accept KP_Delete * gtk/gtktext.c (gtk_text_key_press): add a bunch of KP keysyms * gtk/gtkentry.c (gtk_entry_class_init): accept GDK_KP_Delete in addition to plain Delete * gtk/gtktextview.c (gtk_text_view_key_press_event): accept GDK_KP_Enter in addition to GDK_Return * gtk/gtkfontsel.c (gtk_font_selection_size_key_press): connect to activate on entry instead of key press (gtk_font_selection_on_clist_key_press): get rid of this signal handler, not needed with new font sel. * gtk/gtkfilesel.c (gtk_file_selection_key_press): remove a no-longer-needed emit_stop_by_name(), just return TRUE * gtk/gtkhscrollbar.c, gtk/gtkvscrollbar.c: remove keybindings cruft, this widget is no longer focusable. * gtk/gtkrange.h, gtk/gtkrange.c, gtk/gtkvscale.c, gtk/gtkhscale.c: Get rid of trough_keys virtual function, add move_slider action signal, add binding set for vscale/hscale, in the process support numeric keypad * gtk/gtkentry.c (gtk_entry_class_init): Add keypad bindings; make GDK_Return and GDK_KP_Enter activate the entry via binding set, instead of hardcoded.
2001-04-28 20:18:29 +00:00
<warning><para>THIS FUNCTION IS INCREDIBLY BROKEN. The passed-in data must
be allocated by malloc() (NOT g_malloc()) and will be freed when the
image is freed.</para></warning>
1999-08-16 18:51:52 +00:00
</para>
@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.
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gdk_image_get ##### -->
<para>
</para>
@drawable:
Start of integration of Erwann Chenede's multihead work from the Thu Apr 25 16:51:40 2002 Owen Taylor <otaylor@redhat.com> Start of integration of Erwann Chenede's multihead work from the gtk-multihead branch. * gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkscreen-x11.[ch] New classes representing a set of screens with attached input devices and a single contiguous area, respectively. * gdk/gdk.[ch] gdk/gdkinternals.h gdk/x11/gdkmain-x11.c: gdk/x11/gdkprivate-x11.h: Make the initialization interface simple _gdk_windowing_init() and do the rest in gdk_open_display() calls. * gdk/gdk.[ch]: Add gdk_parse_args() which can be used to do the display-independent part of initialization instead of gdk_init_[check]. * gdk/gdkcursor.h gdk/gdkfont.h gdk/gdkkeys.h gdk/gdkpixmap.h gdk/gdkproperty.h gdk/gdkselection.h gdk/gdkwindow.h: Add multihead variants (_for_display(), for_screen()) of functions getting information specific to a particular screen screen or display. * gdk/gdkscreen.[ch]: Add gdk_screen__* variants of functions like gdk_rgb_get_colormap() that used to get/list global objects. * gdk/x11/gdkx.h: Add functions for converting GdkScreen and GdkDisplay into the X equivalents. * gdk/x11/gdkwindow-x11.c: Removed gdk_window_xid_at_coords() not in the headers and unused. * configure.in gdk/x11/{gxid.c,gxid_lib.[ch],gdkinput-gxi.c}: Remove gxid support ... has not been tested for a long time... "xfree" support is more portable to non XFree86. * gdk/**.h: Add a GDK_MULTIHEAD_SAFE define that can be used to turn off functions that are inherently non-multihead safe. * gdk/**.c: add GDK_NOTE(multihead, ...) calls when functions are used in non-multihead-safe ways. * gdk/*.c gdk/x11/*.c: Changes to make the internals of GDK multihead safe.
2002-04-25 22:29:14 +00:00
@x:
@y:
@width:
@height:
@Returns:
<!-- ##### FUNCTION gdk_image_ref ##### -->
<para>
</para>
@image:
@Returns:
<!-- ##### FUNCTION gdk_image_unref ##### -->
<para>
</para>
@image:
1999-08-16 18:51:52 +00:00
<!-- ##### MACRO gdk_image_destroy ##### -->
1999-08-16 18:51:52 +00:00
<para>
Destroys a #GdkImage, freeing any resources allocated for it.
1999-08-16 18:51:52 +00:00
</para>
<!-- # Unused Parameters # -->
@image: a #GdkImage.
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gdk_image_get_colormap ##### -->
<para>
</para>
@image:
@Returns:
<!-- ##### FUNCTION gdk_image_set_colormap ##### -->
<para>
</para>
@image:
@colormap:
<!-- ##### FUNCTION gdk_image_put_pixel ##### -->
1999-08-16 18:51:52 +00:00
<para>
Sets a pixel in a #GdkImage to a given pixel value.
1999-08-16 18:51:52 +00:00
</para>
@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.
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gdk_image_get_pixel ##### -->
1999-08-16 18:51:52 +00:00
<para>
Gets a pixel value at a specified position in a #GdkImage.
1999-08-16 18:51:52 +00:00
</para>
@image: a #GdkImage.
@x: the x coordinate of the pixel to get.
@y: the y coordinate of the pixel to get.
@Returns: the pixel value at the given position.
1999-08-16 18:51:52 +00:00