home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / man / cat3 / xcreateimage.0 < prev    next >
Encoding:
Text File  |  1996-10-17  |  8.0 KB  |  265 lines

  1.  
  2.  
  3.  
  4. XCreateImage(3X11)      XLIB FUNCTIONS       XCreateImage(3X11)
  5.  
  6.  
  7. NNAAMMEE
  8.        XInitImage, XCreateImage, XGetPixel, XPutPixel, XSubImage,
  9.        XAddPixel, XDestroyImage - image utilities
  10.  
  11. SSYYNNTTAAXX
  12.        Status XInitImage(_i_m_a_g_e)
  13.          XImage *_i_m_a_g_e;
  14.  
  15.        XImage *XCreateImage(_d_i_s_p_l_a_y, _v_i_s_u_a_l, _d_e_p_t_h, _f_o_r_m_a_t, _o_f_f_-
  16.        _s_e_t, _d_a_t_a, _w_i_d_t_h, _h_e_i_g_h_t, _b_i_t_m_a_p___p_a_d,
  17.                    _b_y_t_e_s___p_e_r___l_i_n_e)
  18.          Display *_d_i_s_p_l_a_y;
  19.          Visual *_v_i_s_u_a_l;
  20.          unsigned int _d_e_p_t_h;
  21.          int _f_o_r_m_a_t;
  22.          int _o_f_f_s_e_t;
  23.          char *_d_a_t_a;
  24.          unsigned int _w_i_d_t_h;
  25.          unsigned int _h_e_i_g_h_t;
  26.          int _b_i_t_m_a_p___p_a_d;
  27.          int _b_y_t_e_s___p_e_r___l_i_n_e;
  28.  
  29.        unsigned long XGetPixel(_x_i_m_a_g_e, _x, _y)
  30.          XImage *_x_i_m_a_g_e;
  31.          int _x;
  32.          int _y;
  33.  
  34.        XPutPixel(_x_i_m_a_g_e, _x, _y, _p_i_x_e_l)
  35.          XImage *_x_i_m_a_g_e;
  36.          int _x;
  37.          int _y;
  38.          unsigned long _p_i_x_e_l;
  39.  
  40.        XImage *XSubImage(_x_i_m_a_g_e, _x, _y, _s_u_b_i_m_a_g_e___w_i_d_t_h,
  41.        _s_u_b_i_m_a_g_e___h_e_i_g_h_t)
  42.          XImage *_x_i_m_a_g_e;
  43.          int _x;
  44.          int _y;
  45.          unsigned int _s_u_b_i_m_a_g_e___w_i_d_t_h;
  46.          unsigned int _s_u_b_i_m_a_g_e___h_e_i_g_h_t;
  47.  
  48.        XAddPixel(_x_i_m_a_g_e, _v_a_l_u_e)
  49.          XImage *_x_i_m_a_g_e;
  50.          long _v_a_l_u_e;
  51.  
  52.        XDestroyImage(_x_i_m_a_g_e)
  53.            XImage *_x_i_m_a_g_e;
  54.  
  55. AARRGGUUMMEENNTTSS
  56.        _b_i_t_m_a_p___p_a_d
  57.          Specifies the quantum of a scanline (8, 16, or
  58.          32).  In other words, the start of one scanline
  59.          is separated in client memory from the start of
  60.          the next scanline by an integer multiple of this
  61.  
  62.  
  63.  
  64. X Version 11           Release 6.1                1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XCreateImage(3X11)      XLIB FUNCTIONS       XCreateImage(3X11)
  71.  
  72.  
  73.          many bits.
  74.  
  75.        _b_y_t_e_s___p_e_r___l_i_n_e
  76.          Specifies the number of bytes in the client
  77.          image between the start of one scanline and the
  78.          start of the next.
  79.  
  80.        _d_a_t_a     Specifies the image data.
  81.  
  82.        _d_e_p_t_h     Specifies the depth of the image.
  83.  
  84.        _d_i_s_p_l_a_y     Specifies the connection to the X server.
  85.  
  86.        _f_o_r_m_a_t     Specifies the format for the image.  You can
  87.          pass _X_Y_B_i_t_m_a_p, _X_Y_P_i_x_m_a_p, or _Z_P_i_x_m_a_p.
  88.  
  89.        _h_e_i_g_h_t     Specifies the height of the image, in pixels.
  90.  
  91.        _o_f_f_s_e_t     Specifies the number of pixels to ignore at the
  92.          beginning of the scanline.
  93.  
  94.        _p_i_x_e_l     Specifies the new pixel value.
  95.  
  96.        _s_u_b_i_m_a_g_e___h_e_i_g_h_t
  97.          Specifies the height of the new subimage, in
  98.          pixels.
  99.  
  100.        _s_u_b_i_m_a_g_e___w_i_d_t_h
  101.          Specifies the width of the new subimage, in pix-
  102.          els.
  103.  
  104.        _v_a_l_u_e     Specifies the constant value that is to be
  105.          added.
  106.  
  107.        _v_i_s_u_a_l     Specifies the _V_i_s_u_a_l structure.
  108.  
  109.        _w_i_d_t_h     Specifies the width of the image, in pixels.
  110.  
  111.        _x_i_m_a_g_e     Specifies the image.
  112.  
  113.        _x
  114.        _y     Specify the x and y coordinates.
  115.  
  116. DDEESSCCRRIIPPTTIIOONN
  117.        The _X_I_n_i_t_I_m_a_g_e function initializes the internal image
  118.        manipulation routines of an image structure, based on the
  119.        values of the various structure members.     All fields other
  120.        than the manipulation routines must already be initial-
  121.        ized.  If the bytes_per_line member is zero, _X_I_n_i_t_I_m_a_g_e
  122.        will assume the image data is contiguous in memory and set
  123.        the bytes_per_line member to an appropriate value based on
  124.        the other members; otherwise, the value of bytes_per_line
  125.        is not changed.    All of the manipulation routines are ini-
  126.        tialized to functions that other Xlib image manipulation
  127.  
  128.  
  129.  
  130. X Version 11           Release 6.1                2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XCreateImage(3X11)      XLIB FUNCTIONS       XCreateImage(3X11)
  137.  
  138.  
  139.        functions need to operate on the type of image specified
  140.        by the rest of the structure.
  141.  
  142.        This function must be called for any image constructed by
  143.        the client before passing it to any other Xlib function.
  144.        Image structures created or returned by Xlib do not need
  145.        to be initialized in this fashion.
  146.  
  147.        This function returns a nonzero status if initialization
  148.        of the structure is successful.    It returns zero if it
  149.        detected some error or inconsistency in the structure, in
  150.        which case the image is not changed.
  151.  
  152.        The _X_C_r_e_a_t_e_I_m_a_g_e function allocates the memory needed for
  153.        an _X_I_m_a_g_e structure for the specified display but does not
  154.        allocate space for the image itself.  Rather, it initial-
  155.        izes the structure byte-order, bit-order, and bitmap-unit
  156.        values from the display and returns a pointer to the _X_I_m_-
  157.        _a_g_e structure.  The red, green, and blue mask values are
  158.        defined for Z format images only and are derived from the
  159.        _V_i_s_u_a_l structure passed in.  Other values also are passed
  160.        in.  The offset permits the rapid displaying of the image
  161.        without requiring each scanline to be shifted into posi-
  162.        tion.  If you pass a zero value in bytes_per_line, Xlib
  163.        assumes that the scanlines are contiguous in memory and
  164.        calculates the value of bytes_per_line itself.
  165.  
  166.        Note that when the image is created using _X_C_r_e_a_t_e_I_m_a_g_e,
  167.        _X_G_e_t_I_m_a_g_e, or _X_S_u_b_I_m_a_g_e, the destroy procedure that the
  168.        _X_D_e_s_t_r_o_y_I_m_a_g_e function calls frees both the image struc-
  169.        ture and the data pointed to by the image structure.
  170.  
  171.        The basic functions used to get a pixel, set a pixel, cre-
  172.        ate a subimage, and add a constant value to an image are
  173.        defined in the image object.  The functions in this sec-
  174.        tion are really macro invocations of the functions in the
  175.        image object and are defined in <_X_1_1_/_X_u_t_i_l_._h>.
  176.  
  177.        The _X_G_e_t_P_i_x_e_l function returns the specified pixel from
  178.        the named image.     The pixel value is returned in normal-
  179.        ized format (that is, the least significant byte of the
  180.        long is the least significant byte of the pixel).  The
  181.        image must contain the x and y coordinates.
  182.  
  183.        The _X_P_u_t_P_i_x_e_l function overwrites the pixel in the named
  184.        image with the specified pixel value.  The input pixel
  185.        value must be in normalized format (that is, the least
  186.        significant byte of the long is the least significant byte
  187.        of the pixel).  The image must contain the x and y coordi-
  188.        nates.
  189.  
  190.        The _X_S_u_b_I_m_a_g_e function creates a new image that is a sub-
  191.        section of an existing one.  It allocates the memory nec-
  192.        essary for the new _X_I_m_a_g_e structure and returns a pointer
  193.  
  194.  
  195.  
  196. X Version 11           Release 6.1                3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XCreateImage(3X11)      XLIB FUNCTIONS       XCreateImage(3X11)
  203.  
  204.  
  205.        to the new image.  The data is copied from the source
  206.        image, and the image must contain the rectangle defined by
  207.        x, y, subimage_width, and subimage_height.
  208.  
  209.        The _X_A_d_d_P_i_x_e_l function adds a constant value to every
  210.        pixel in an image.  It is useful when you have a base
  211.        pixel value from allocating color resources and need to
  212.        manipulate the image to that form.
  213.  
  214.        The _X_D_e_s_t_r_o_y_I_m_a_g_e function deallocates the memory associ-
  215.        ated with the _X_I_m_a_g_e structure.
  216.  
  217. SSEEEE AALLSSOO
  218.        XPutImage(3X11)
  219.        _X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262. X Version 11           Release 6.1                4
  263.  
  264.  
  265.