## draw

draw

## Synopsis

    void                ucil_convert_color                  (ucil_color_t *src,
                                                             ucil_color_t *dest);
    void                ucil_set_pixel                      (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x,
                                                             int y);
    void                ucil_draw_line                      (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);
    void                ucil_draw_rect                      (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);
    void                ucil_fill                           (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color);
    void                ucil_draw_box                       (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

## Description

## Details

### ucil_convert_color ()

    void                ucil_convert_color                  (ucil_color_t *src,
                                                             ucil_color_t *dest);

Convert colors between colorspaces. The `colorspace` field of dest needs to be set to the target colorspace, like in this example:

    src.colorspace = UCIL_COLORSPACE_RGB24;
    src.rgb24.r = 0xff;
    src.rgb24.g = 0xff;
    src.rgb24.b = 0xff;
    dest.colorspace = UCIL_COLORSPACE_YUV;
    ucil_convert_color( &dest, &src );

`src` : | source color
`dest` : | target color

### ucil_set_pixel ()

    void                ucil_set_pixel                      (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x,
                                                             int y);

Draws a pixel on the data buffer.

`data_buffer` : | target buffer
`color` : | an ucil_color_t. The colorspace of the color has to match the colorspace of the data_buffer.
`x` : | x position
`y` : | y position

### ucil_draw_line ()

    void                ucil_draw_line                      (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

Draws a line on the data buffer. The endpoints are clipped to the buffer dimensions

`data_buffer` : | target buffer
`color` : | an ucil_color_t. The colorspace of the color has to match the colorspace of the data_buffer.
`x1` : | starting point of the line ( x position )
`y1` : | starting point of the line ( y position )
`x2` : | endpoint of the line ( x position )
`y2` : | endpoint of the line ( y position )

### ucil_draw_rect ()

    void                ucil_draw_rect                      (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

Draws a rectangle filled with color.

`data_buffer` : | target buffer
`color` : | an ucil_color_t. The colorspace of the color has to match the colorspace of the data_buffer.
`x1` : | starting point of the rectangle ( x position )
`y1` : | starting point of the rectangle ( y position )
`x2` : | endpoint of the rectangle ( x position )
`y2` : | endpoint of the rectangle ( y position )

### ucil_fill ()

    void                ucil_fill                           (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color);

Fill the buffer with a color.

`data_buffer` : | target buffer
`color` : | an ucil_color_t. The colorspace of the color has to match the colorspace of the data_buffer.

### ucil_draw_box ()

    void                ucil_draw_box                       (unicap_data_buffer_t *data_buffer,
                                                             ucil_color_t *color,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

Draws a box

`data_buffer` : | target buffer
`color` : | an ucil_color_t. The colorspace of the color has to match the colorspace of the data_buffer.
`x1` : | starting point of the box ( x position )
`y1` : | starting point of the box ( y position )
`x2` : | endpoint of the box ( x position )
`y2` : | endpoint of the box ( y position )