home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / X11 / XInitImage.z / XInitImage
Encoding:
Text File  |  2002-10-03  |  10.5 KB  |  265 lines

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