If the characteristics of the image (for example, byte_order and bitmap_unit) differ from what the server requires, _X_P_u_t_I_m_a_g_e automatically makes the appropriate conversions.
This function uses these GC components: function, plane-mask, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. It also uses these GC mode-dependent components: foreground and background.
_X_P_u_t_I_m_a_g_e can generate _B_a_d_D_r_a_w_a_b_l_e, _B_a_d_G_C, _B_a_d_M_a_t_c_h, and _B_a_d_V_a_l_u_e errors.
The _X_G_e_t_I_m_a_g_e function returns a pointer to an _X_I_m_a_g_e structure. This structure provides you with the contents of the specified rectangle of the drawable in the format you specify. If the format argument is _X_Y_P_i_x_m_a_p, the image contains only the bit planes you passed to the plane_mask argument. If the plane_mask argument only requests a subset of the planes of the display, the depth of the returned image will be the number of planes requested. If the format argument is _Z_P_i_x_m_a_p, _X_G_e_t_I_m_a_g_e returns as zero the bits in all planes not specified in the plane_mask argument. The function performs no range checking on the values in plane_mask and ignores extraneous bits.
_X_G_e_t_I_m_a_g_e returns the depth of the image to the depth member of the _X_I_m_a_g_e structure. The depth of the image is as specified when the drawable was created, except when getting a subset of the planes in _X_Y_P_i_x_m_a_p format, when the depth is given by the number of bits set to 1 in plane_mask.
If the drawable is a pixmap, the given rectangle must be wholly contained within the pixmap, or a _B_a_d_M_a_t_c_h error results. If the drawable is a window, the window must be viewable, and it must be the case that if there were no inferiors or overlapping windows, the specified rectangle of the window would be fully visible on the screen and wholly contained within the outside edges of the window, or a _B_a_d_M_a_t_c_h error results. Note that the borders of the window can be included and read with this request. If the window has backing-store, the backing-store contents are returned for regions of the window that are obscured by noninferior windows. If the window does not have backing-store, the returned contents of such obscured regions are undefined. The returned contents of visible regions of inferiors of a different depth than the specified window's depth are also undefined. The pointer cursor image is not included in the returned contents. If a problem occurs, _X_G_e_t_I_m_a_g_e returns NULL.
_X_G_e_t_I_m_a_g_e can generate _B_a_d_D_r_a_w_a_b_l_e, _B_a_d_M_a_t_c_h, and _B_a_d_V_a_l_u_e errors.
The _X_G_e_t_S_u_b_I_m_a_g_e function updates dest_image with the specified subimage in the same manner as _X_G_e_t_I_m_a_g_e. If the format argument is _X_Y_P_i_x_m_a_p, the image contains only the bit planes you passed to the plane_mask argument. If the format argument is _Z_P_i_x_m_a_p, _X_G_e_t_S_u_b_I_m_a_g_e returns as zero the bits in all planes not specified in the plane_mask argument. The function performs no range checking on the values in plane_mask and ignores extraneous bits. As a convenience, _X_G_e_t_S_u_b_I_m_a_g_e returns a pointer to the same _X_I_m_a_g_e structure specified by dest_image.
The depth of the destination _X_I_m_a_g_e structure must be the same as that of the drawable. If the specified subimage does not fit at the specified location on the destination image, the right and bottom edges are clipped. If the drawable is a pixmap, the given rectangle must be wholly contained within the pixmap, or a _B_a_d_M_a_t_c_h error results. If the drawable is a window, the window must be viewable, and it must be the case that if there were no inferiors or overlapping windows, the specified rectangle of the window would be fully visible on the screen and wholly contained within the outside edges of the window, or a _B_a_d_M_a_t_c_h error results. If the window has backing-store, then the backing-store contents are returned for regions of the window that are obscured by noninferior windows. If the window does not have backing-store, the returned contents of such obscured regions are undefined. The returned contents of visible regions of inferiors of a different depth than the specified window's depth are also undefined. If a problem occurs, _X_G_e_t_S_u_b_I_m_a_g_e returns NULL.
_X_G_e_t_S_u_b_I_m_a_g_e can generate _B_a_d_D_r_a_w_a_b_l_e, _B_a_d_G_C, _B_a_d_M_a_t_c_h, and _B_a_d_V_a_l_u_e errors.