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

  1.  
  2.  
  3.  
  4. XReadBitmapFile(3X11)      XLIB FUNCTIONS    XReadBitmapFile(3X11)
  5.  
  6.  
  7. NNAAMMEE
  8.        XReadBitmapFile, XReadBitmapFileData, XWriteBitmapFile,
  9.        XCreatePixmapFromBitmapData, XCreateBitmapFromData -
  10.        manipulate bitmaps
  11.  
  12. SSYYNNTTAAXX
  13.        int XReadBitmapFile(_d_i_s_p_l_a_y, _d, _f_i_l_e_n_a_m_e, _w_i_d_t_h___r_e_t_u_r_n,
  14.        _h_e_i_g_h_t___r_e_t_u_r_n, _b_i_t_m_a_p___r_e_t_u_r_n, _x___h_o_t___r_e_t_u_r_n,
  15.                   _y___h_o_t___r_e_t_u_r_n)
  16.          Display *_d_i_s_p_l_a_y;
  17.          Drawable _d;
  18.          char *_f_i_l_e_n_a_m_e;
  19.          unsigned int *_w_i_d_t_h___r_e_t_u_r_n, *_h_e_i_g_h_t___r_e_t_u_r_n;
  20.          Pixmap *_b_i_t_m_a_p___r_e_t_u_r_n;
  21.          int *_x___h_o_t___r_e_t_u_r_n, *_y___h_o_t___r_e_t_u_r_n;
  22.  
  23.        int XReadBitmapFileData(_f_i_l_e_n_a_m_e, _w_i_d_t_h___r_e_t_u_r_n,
  24.        _h_e_i_g_h_t___r_e_t_u_r_n, _d_a_t_a___r_e_t_u_r_n, _x___h_o_t___r_e_t_u_r_n, _y___h_o_t___r_e_t_u_r_n)
  25.          char *_f_i_l_e_n_a_m_e;
  26.          unsigned int *_w_i_d_t_h___r_e_t_u_r_n, *_h_e_i_g_h_t___r_e_t_u_r_n;
  27.          unsigned char *_d_a_t_a___r_e_t_u_r_n;
  28.          int *_x___h_o_t___r_e_t_u_r_n, *_y___h_o_t___r_e_t_u_r_n;
  29.  
  30.        int XWriteBitmapFile(_d_i_s_p_l_a_y, _f_i_l_e_n_a_m_e, _b_i_t_m_a_p, _w_i_d_t_h,
  31.        _h_e_i_g_h_t, _x___h_o_t, _y___h_o_t)
  32.          Display *_d_i_s_p_l_a_y;
  33.          char *_f_i_l_e_n_a_m_e;
  34.          Pixmap _b_i_t_m_a_p;
  35.          unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
  36.          int _x___h_o_t, _y___h_o_t;
  37.  
  38.        Pixmap XCreatePixmapFromBitmapData(_d_i_s_p_l_a_y, _d, _d_a_t_a,
  39.        _w_i_d_t_h, _h_e_i_g_h_t, _f_g, _b_g, _d_e_p_t_h)
  40.         Display *_d_i_s_p_l_a_y;
  41.         Drawable _d;
  42.         char *_d_a_t_a;
  43.         unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
  44.         unsigned long _f_g, _b_g;
  45.         unsigned int _d_e_p_t_h;
  46.  
  47.        Pixmap XCreateBitmapFromData(_d_i_s_p_l_a_y, _d, _d_a_t_a, _w_i_d_t_h,
  48.        _h_e_i_g_h_t)
  49.          Display *_d_i_s_p_l_a_y;
  50.          Drawable _d;
  51.          char *_d_a_t_a;
  52.          unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
  53.  
  54. AARRGGUUMMEENNTTSS
  55.        _b_i_t_m_a_p     Specifies the bitmap.
  56.  
  57.        _b_i_t_m_a_p___r_e_t_u_r_n
  58.          Returns the bitmap that is created.
  59.  
  60.        _d     Specifies the drawable that indicates the
  61.  
  62.  
  63.  
  64. X Version 11           Release 6.1                1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XReadBitmapFile(3X11)      XLIB FUNCTIONS    XReadBitmapFile(3X11)
  71.  
  72.  
  73.          screen.
  74.  
  75.        _d_a_t_a     Specifies the data in bitmap format.
  76.  
  77.        _d_a_t_a     Specifies the location of the bitmap data.
  78.  
  79.        _d_a_t_a___r_e_t_u_r_n
  80.          Returns the bitmap data.
  81.  
  82.        _d_e_p_t_h     Specifies the depth of the pixmap.
  83.  
  84.        _d_i_s_p_l_a_y     Specifies the connection to the X server.
  85.  
  86.        _f_g
  87.        _b_g     Specify the foreground and background pixel val-
  88.          ues to use.
  89.  
  90.        _f_i_l_e_n_a_m_e     Specifies the file name to use.  The format of
  91.          the file name is operating-system dependent.
  92.  
  93.        _w_i_d_t_h
  94.        _h_e_i_g_h_t     Specify the width and height.
  95.  
  96.        _w_i_d_t_h___r_e_t_u_r_n
  97.        _h_e_i_g_h_t___r_e_t_u_r_n
  98.          Return the width and height values of the read
  99.          in bitmap file.
  100.  
  101.        _x___h_o_t
  102.        _y___h_o_t     Specify where to place the hotspot coordinates
  103.          (or -1,-1 if none are present) in the file.
  104.  
  105.        _x___h_o_t___r_e_t_u_r_n
  106.        _y___h_o_t___r_e_t_u_r_n
  107.          Return the hotspot coordinates.
  108.  
  109. DDEESSCCRRIIPPTTIIOONN
  110.        The _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e function reads in a file containing a
  111.        bitmap.    The file is parsed in the encoding of the current
  112.        locale.    The ability to read other than the standard for-
  113.        mat is implementation-dependent.     If the file cannot be
  114.        opened, _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns _B_i_t_m_a_p_O_p_e_n_F_a_i_l_e_d.  If the
  115.        file can be opened but does not contain valid bitmap data,
  116.        it returns _B_i_t_m_a_p_F_i_l_e_I_n_v_a_l_i_d.  If insufficient working
  117.        storage is allocated, it returns _B_i_t_m_a_p_N_o_M_e_m_o_r_y.     If the
  118.        file is readable and valid, it returns _B_i_t_m_a_p_S_u_c_c_e_s_s.
  119.  
  120.        _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns the bitmap's height and width, as
  121.        read from the file, to width_return and height_return.  It
  122.        then creates a pixmap of the appropriate size, reads the
  123.        bitmap data from the file into the pixmap, and assigns the
  124.        pixmap to the caller's variable bitmap.    The caller must
  125.        free the bitmap using _X_F_r_e_e_P_i_x_m_a_p when finished.     If
  126.        _n_a_m_e_x_hot and _n_a_m_e_y_hot exist, _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns
  127.  
  128.  
  129.  
  130. X Version 11           Release 6.1                2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XReadBitmapFile(3X11)      XLIB FUNCTIONS    XReadBitmapFile(3X11)
  137.  
  138.  
  139.        them to x_hot_return and y_hot_return; otherwise, it
  140.        returns -1,-1.
  141.  
  142.        _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e can generate _B_a_d_A_l_l_o_c and _B_a_d_D_r_a_w_a_b_l_e
  143.        errors.
  144.  
  145.        The _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e_D_a_t_a function reads in a file contain-
  146.        ing a bitmap, in the same manner as _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e, but
  147.        returns the data directly rather than creating a pixmap in
  148.        the server.  The bitmap data is returned in data_return;
  149.        the client must free this storage when finished with it by
  150.        calling _X_F_r_e_e.  The status and other return values are the
  151.        same as for _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e.
  152.  
  153.        The _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e function writes a bitmap out to a
  154.        file in the X Version 11 format.     The name used in the
  155.        output file is derived from the file name by deleting the
  156.        directory prefix.  The file is written in the encoding of
  157.        the current locale.  If the file cannot be opened for
  158.        writing, it returns _B_i_t_m_a_p_O_p_e_n_F_a_i_l_e_d.  If insufficient
  159.        memory is allocated, _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e returns
  160.        _B_i_t_m_a_p_N_o_M_e_m_o_r_y; otherwise, on no error, it returns
  161.        _B_i_t_m_a_p_S_u_c_c_e_s_s.  If x_hot and y_hot are not -1, -1,
  162.        _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e writes them out as the hotspot coordi-
  163.        nates for the bitmap.
  164.  
  165.        _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e can generate _B_a_d_D_r_a_w_a_b_l_e and _B_a_d_M_a_t_c_h
  166.        errors.
  167.  
  168.        The _X_C_r_e_a_t_e_P_i_x_m_a_p_F_r_o_m_B_i_t_m_a_p_D_a_t_a function creates a pixmap
  169.        of the given depth and then does a bitmap-format _X_P_u_t_I_m_a_g_e
  170.        of the data into it.  The depth must be supported by the
  171.        screen of the specified drawable, or a _B_a_d_M_a_t_c_h error
  172.        results.
  173.  
  174.        _X_C_r_e_a_t_e_P_i_x_m_a_p_F_r_o_m_B_i_t_m_a_p_D_a_t_a can generate _B_a_d_A_l_l_o_c and _B_a_d_-
  175.        _M_a_t_c_h errors.
  176.  
  177.        The _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a function allows you to include
  178.        in your C program (using _#_i_n_c_l_u_d_e) a bitmap file that was
  179.        written out by _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e (X version 11 format only)
  180.        without reading in the bitmap file.  The following example
  181.        creates a gray bitmap:
  182.  
  183.        #include "gray.bitmap"
  184.        Pixmap bitmap;
  185.        bitmap = XCreateBitmapFromData(display, window, gray_bits, gray_width, gray_height);
  186.  
  187.        If insufficient working storage was allocated, _X_C_r_e_-
  188.        _a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a returns _N_o_n_e.    It is your responsibility
  189.        to free the bitmap using _X_F_r_e_e_P_i_x_m_a_p when finished.
  190.  
  191.        _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a can generate a _B_a_d_A_l_l_o_c error.
  192.  
  193.  
  194.  
  195.  
  196. X Version 11           Release 6.1                3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XReadBitmapFile(3X11)      XLIB FUNCTIONS    XReadBitmapFile(3X11)
  203.  
  204.  
  205. DDIIAAGGNNOOSSTTIICCSS
  206.        _B_a_d_A_l_l_o_c     The server failed to allocate the requested
  207.          resource or server memory.
  208.  
  209.        _B_a_d_D_r_a_w_a_b_l_e
  210.          A value for a Drawable argument does not name a
  211.          defined Window or Pixmap.
  212.  
  213.        _B_a_d_M_a_t_c_h     An _I_n_p_u_t_O_n_l_y window is used as a Drawable.
  214.  
  215. SSEEEE AALLSSOO
  216.        XCreatePixmap(3X11), XPutImage(3X11)
  217.        _X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  218.  
  219.  
  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.