gdkCursorNewFromPixmap         package:RGtk2         R Documentation

_g_d_k_C_u_r_s_o_r_N_e_w_F_r_o_m_P_i_x_m_a_p

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

     Creates a new cursor from a given pixmap and mask. Both the pixmap
     and mask must have a depth of 1 (i.e. each pixel has only 2 values
     - on or off). The standard cursor size is 16 by 16 pixels. You can
     create a bitmap  from inline data as in the below example.

_U_s_a_g_e:

     gdkCursorNewFromPixmap(source, mask, fg, bg, x, y)

_A_r_g_u_m_e_n_t_s:

'source': ['GdkPixmap']  the pixmap specifying the cursor.

  'mask': ['GdkPixmap']  the pixmap specifying the mask, which must be
          the same size as  'source'.

    'fg': ['GdkColor']  the foreground color, used for the bits in the
          source which are 1. The color does not have to be allocated
          first. 

    'bg': ['GdkColor']  the background color, used for the bits in the
          source which are 0. The color does not have to be allocated
          first.

     'x': [integer]  the horizontal offset of the 'hotspot' of the
          cursor. 

     'y': [integer]  the vertical offset of the 'hotspot' of the
          cursor.

_D_e_t_a_i_l_s:

     _Creating a custom cursor_


     ######
     # Creating a custom cursor
     ######

     ## This data is in X bitmap format, and can be created with the
     'bitmap'
     ## utility in X11
     cursor1_width <- 16
     cursor1_height <- 16
     cursor1_bits <- c(0x80, 0x01, 0x40, 0x02, 0x20, 0x04, 0x10, 0x08,
     0x08, 0x10,
                       0x04, 0x20, 0x82, 0x41, 0x41, 0x82, 0x41, 0x82,
     0x82, 0x41,
                       0x04, 0x20, 0x08, 0x10, 0x10, 0x08, 0x20, 0x04,
     0x40, 0x02,
                       0x80, 0x01)

     cursor1mask_bits <- c(0x80, 0x01, 0xc0, 0x03, 0x60, 0x06, 0x30,
     0x0c, 0x18,
                           0x18, 0x8c, 0x31, 0xc6, 0x63, 0x63, 0xc6,
     0x63, 0xc6,
                           0xc6, 0x63, 0x8c, 0x31, 0x18, 0x18, 0x30,
     0x0c, 0x60,
                           0x06, 0xc0, 0x03, 0x80, 0x01)

     fg <- c(65535, 0, 0) # Red.
     bg <- c(0, 0, 65535) # Blue.


     source <- gdkBitmapCreateFromData(NULL, cursor1_bits,
                                       cursor1_width, cursor1_height)
     mask <- gdkBitmapCreateFromData(NULL, cursor1mask_bits,
                                     cursor1_width, cursor1_height)
     cursor <- gdkCursorNewFromPixmap(source, mask, fg, bg, 8, 8)

     widget[["window"]]$setCursor(cursor)


_V_a_l_u_e:

     ['GdkCursor']  a new 'GdkCursor'.

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

     Derived by RGtkGen from GTK+ documentation

