コード例 #1
0
def fl_set_pixmap_data(ptr_flobject, xpmdatalist):
    """fl_set_pixmap_data(ptr_flobject, xpmdatalist)

    Defines the actual pixmap being displayed from specified data. A
    number of pixmaps can be found in '/usr/include/X11/pixmaps' or
    similar places.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
             pixmap flobject
        xpmdatalist : list of str
            bits contents of pixmap

    Examples
    --------
        >>> xpmdata = ["28 28 6 2 . white x orange s s_SteelBlue * black",
                ". . . . . . * * * * . . . . . . . . . * * * * . . . . . ",
                ". . . . + * x x * . . . . . . . . . . + * x x * . . . . ",
                ". . . + * x x * . . . . . . . . . . . . + * x x * . . . ",
                ". . + * x * . . . * . . . . . . . . . * . . + * x * . . ",
                ". . + * x * . . + * . . . . . . . . + * . . + * x * . . ",
                ". . + * x * . + * * . . . . . . . . + * * . + * x * . . ",
                ". . + * x * + * * . . . . . . . . . . + * * + * x * . . ",
                ". . + * x * * * . . . . . . . . . . . . + * * x x * . . ",
                ...etc...]
        >>> fl_set_pixmap_data(pxmobj, xpmdata)

    Notes
    -----
        Status: Half-UTest + Doc + Demo = OK

    """
    _fl_set_pixmap_data = library.cfuncproto(
        library.load_so_libforms(), "fl_set_pixmap_data",
        None, [cty.POINTER(xfdata.FL_OBJECT), cty.POINTER(xfdata.STRING)],
        """void fl_set_pixmap_data(FL_OBJECT * ob, char * * bits)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    ptr_xpmdatalist = library.convert_to_ptr_stringc(xpmdatalist)
    library.keep_elem_refs(ptr_flobject, xpmdatalist, ptr_xpmdatalist)
    _fl_set_pixmap_data(ptr_flobject, ptr_xpmdatalist)
コード例 #2
0
def fl_create_from_pixmapdata(win, xpmdata, tran):
    """fl_create_from_pixmapdata(win, xpmdata, tran) -> pixmapid, width,
    height, smask, hotx, hoty

    Makes a pixmap from pixmap contents data.

    Parameters
    ----------
        win : long_pos
            window id
        xpmdata : str of ubytes
            pixmap contents data
        tran : long_pos
            XForms colormap index as color (currently not used)

    Returns
    -------
        pixmapid : long_pos
            created pixmap resource id
        width : int_pos
            width of pixmap in coord units
        height : int_pos
            height of pixmap in coord units
        smask : long_pos
            shape mask (of an existing pixmap) used as a clipping mask
            to achieve transparency, 0 for no transparency.
        hotx : int
            horizontal position of center of the pixmap (useful if the
            pixmap is to be used as a cursor)
        hoty : int
            vertical position of center of the pixmap (useful if the
            pixmap is to be used as a cursor)

    Examples
    --------
        >>> *todo*

     API_diversion
    -------------
        API changed from XForms, upstream is fl_create_from_pixmapdata(win,
        xpmdata, width, height, smask, hotx, hoty, tran)

    Notes
    -----
        Status: NA-UTest + Doc + NoDemo = Maybe

    """
    _fl_create_from_pixmapdata = library.cfuncproto(
        library.load_so_libforms(), "fl_create_from_pixmapdata",
        xfdata.Pixmap, [xfdata.Window, cty.POINTER(xfdata.STRING),
        cty.POINTER(cty.c_uint), cty.POINTER(cty.c_uint),
        cty.POINTER(xfdata.Pixmap), cty.POINTER(cty.c_int),
        cty.POINTER(cty.c_int), xfdata.FL_COLOR],
        """Pixmap fl_create_from_pixmapdata(Window win, char * * data,
        unsigned int * w, unsigned int * h, Pixmap * sm, int * hotx,
        int * hoty, FL_COLOR tran)""")
    library.check_if_flinitialized()
    ul_win = library.convert_to_Window(win)
    ptr_xpmdata = library.convert_to_ptr_stringc(xpmdata)
    ui_width, ptr_width = library.make_uintc_and_pointer()
    ui_height, ptr_height = library.make_uintc_and_pointer()
    ul_smask, ptr_smask = library.make_ulongc_and_pointer()
    i_hotx, ptr_hotx = library.make_intc_and_pointer()
    i_hoty, ptr_hoty = library.make_intc_and_pointer()
    #library.checknonfatal_allowed_value_in_list(tran, xfdata.COLOR_list)
    ul_tran = library.convert_to_FL_COLOR(tran)
    library.keep_elem_refs(win, xpmdata, ui_width, ptr_width, ui_height, \
            ptr_height, ul_smask, i_hotx, i_hoty, tran, ptr_xpmdata, ul_win, \
            ptr_smask, ptr_hotx, ptr_hoty, ul_tran)
    retval = _fl_create_from_pixmapdata(ul_win, ptr_xpmdata, ptr_width, \
            ptr_height, ptr_smask, ptr_hotx, ptr_hoty, ul_tran)
    return retval, ui_width.value, ui_height.value, ul_smask.value, \
            i_hotx.value, i_hoty.value