Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfx/src/color.c

    ra3f63ac r211fd68  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6464        color->g = g;
    6565        color->b = b;
     66        color->attr = 0xff;
     67
     68        *rcolor = color;
     69        return EOK;
     70}
     71
     72/** Create new EGA color.
     73 *
     74 * @param attr EGA attributes
     75 * @param rcolor Place to store pointer to new color
     76 *
     77 * @return EOK on success or an error code, ENOMEM if out of resources,
     78 *         EIO if the graphic device connection was lost
     79 */
     80errno_t gfx_color_new_ega(uint8_t attr, gfx_color_t **rcolor)
     81{
     82        gfx_color_t *color;
     83
     84        color = calloc(1, sizeof(gfx_color_t));
     85        if (color == NULL)
     86                return ENOMEM;
     87
     88        color->attr = attr;
    6689
    6790        *rcolor = color;
     
    93116}
    94117
     118/** Convert color to EGA attributes.
     119 *
     120 * @param color Color
     121 * @param attr Place to store EGA attributes
     122 */
     123void gfx_color_get_ega(gfx_color_t *color, uint8_t *attr)
     124{
     125        *attr = color->attr;
     126}
     127
    95128/** @}
    96129 */
Note: See TracChangeset for help on using the changeset viewer.