gdk-pixbuf-scaling           package:RGtk2           R Documentation

_S_c_a_l_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     Scaling pixbufs and scaling and compositing pixbufs

_M_e_t_h_o_d_s _a_n_d _F_u_n_c_t_i_o_n_s:

     'gdkPixbufScaleSimple(object, dest.width, dest.height,
     interp.type)'
      'gdkPixbufScale(object, dest, dest.x, dest.y, dest.width,
     dest.height, offset.x, offset.y, scale.x, scale.y, interp.type)'
      'gdkPixbufCompositeColorSimple(object, dest.width, dest.height,
     interp.type, overall.alpha, check.size, color1, color2)'
      'gdkPixbufComposite(object, dest, dest.x, dest.y, dest.width,
     dest.height, offset.x, offset.y, scale.x, scale.y, interp.type,
     overall.alpha)'
      'gdkPixbufCompositeColor(object, dest, dest.x, dest.y,
     dest.width, dest.height, offset.x, offset.y, scale.x, scale.y,
     interp.type, overall.alpha, check.x, check.y, check.size, color1,
     color2)'
      'gdkPixbufRotateSimple(object, angle)'
      'gdkPixbufFlip(object, horizontal)'

_D_e_t_a_i_l_e_d _D_e_s_c_r_i_p_t_i_o_n:

     The 'gdk-pixbuf' contains functions to scale pixbufs, to scale
     pixbufs and composite against an existing image, and to scale
     pixbufs and composite against a solid color or checkerboard.
     Compositing a checkerboard is a common way to show an image with
     an alpha channel in image-viewing and editing software.

     Since the full-featured functions ('gdkPixbufScale',
     'gdkPixbufComposite', and 'gdkPixbufCompositeColor') are rather
     complex to use and have many arguments, two simple convenience
     functions are provided, 'gdkPixbufScaleSimple' and
     'gdkPixbufCompositeColorSimple' which create a new pixbuf of a
     given size, scale an original image to fit, and then return the
     new pixbuf.

     Scaling and compositing functions take advantage of MMX hardware
     acceleration on systems where MMX is supported.  If gdk-pixbuf is
     built with the Sun mediaLib library, these functions are instead
     accelerated using mediaLib, which provides hardware acceleration
     on Intel, AMD, and Sparc chipsets.  If desired, mediaLib support
     can be turned off by setting the GDK_DISABLE_MEDIALIB environment
     variable.  

     The following example demonstrates handling an expose event by
     rendering the appropriate area of a source image (which is scaled
     to fit the widget) onto the widget's window.  The source image is
     rendered against a checkerboard, which provides a visual
     representation of the alpha channel if the image has one. If the
     image doesn't have an alpha channel, calling
     'gdkPixbufCompositeColor' function has exactly the same effect as
     calling 'gdkPixbufScale'.

     _Handling an expose event._


     expose_cb <- function(widget, event, data)
     {
       dest <- gdkPixbuf(color = "rgb", has.alpha = FALSE, bits = 8, 
                         w = event[["area"]]$width, h =
     event[["area"]]$height)

       area <- event[["area"]]
       pixbuf$compositeColor(dest, 0, 0, area$width, area$height,
                             -area$x, -area$y,
                             widget[["allocation"]]$width /
     pixbuf$getWidth(),
                             widget[["allocation"]]$height /
     pixbuf$getHeight(),
                             "bilinear", 255,
                             area$x, area$y, 16, 0xaaaaaa, 0x555555)

       dest$renderToDrawable(widget[["window"]],

     widget[["style"]][["fgGc"]][[GtkStateType["normal"]+1]],
                             0, 0, area$x, area$y,
                             area$width, area$height,
                             "normal", area$x, area$y)

       return(TRUE)
     }


_E_n_u_m_s _a_n_d _F_l_a_g_s:


     '_G_d_k_I_n_t_e_r_p_T_y_p_e' This enumeration describes the different
          interpolation modes that can be used with the scaling
          functions. 'GDK.INTERP.NEAREST' is  the fastest scaling
          method, but has horrible quality when  scaling down.
          'GDK.INTERP.BILINEAR' is the best choice if you  aren't sure
          what to choose, it has a good speed/quality balance.

          *PLEASE NOTE:*       Cubic filtering is missing from the
          list; hyperbolic interpolation is just as fast and results in
          higher quality.

          '_n_e_a_r_e_s_t' Nearest neighbor sampling; this is the fastest and
               lowest quality mode. Quality is normally unacceptable
               when scaling  down, but may be OK when scaling up.

          '_t_i_l_e_s' This is an accurate simulation of the PostScript
               image operator without any interpolation enabled.  Each
               pixel is rendered as a tiny parallelogram of solid
               color, the edges of which are implemented with
               antialiasing.  It resembles nearest neighbor for
               enlargement, and bilinear for reduction.

          '_b_i_l_i_n_e_a_r' Best quality/speed balance; use this mode by
               default. Bilinear interpolation.  For enlargement, it is
               equivalent to point-sampling the ideal
               bilinear-interpolated image. For reduction, it is
               equivalent to laying down small tiles and integrating
               over the coverage area.

          '_h_y_p_e_r' This is the slowest and highest quality
               reconstruction function. It is derived from the
               hyperbolic filters in Wolberg's "Digital Image Warping",
               and is formally defined as the hyperbolic-filter
               sampling the ideal hyperbolic-filter interpolated image
               (the filter is designed to be idempotent for 1:1 pixel
               mapping).


     '_G_d_k_P_i_x_b_u_f_R_o_t_a_t_i_o_n' The possible rotations which can be passed to
          'gdkPixbufRotateSimple'. To make them easier to use, their
          numerical values are the actual degrees.

          '_n_o_n_e' No rotation.

          '_c_o_u_n_t_e_r_c_l_o_c_k_w_i_s_e' Rotate by 90 degrees.

          '_u_p_s_i_d_e_d_o_w_n' Rotate by 180 degrees.

          '_c_l_o_c_k_w_i_s_e' Rotate by 270 degrees.


_A_u_t_h_o_r(_s):

     Derived by RGtkGen from GTK+ documentation

_R_e_f_e_r_e_n_c_e_s:

     <URL:
     http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-scaling.html>

