Changeset 61b5b73d in mainline for uspace/lib/gui/common.c


Ignore:
Timestamp:
2014-01-17T14:33:02Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
476f62c, 66be0288
Parents:
6a3d0c7
Message:

make the title bar more subtle, change the close icon to the easily recognizable cross

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/common.c

    r6a3d0c7 r61b5b73d  
    3838#include "common.h"
    3939
     40#define CROSS_WIDTH   14
     41#define CROSS_HEIGHT  14
     42
     43static uint8_t cross_texture[] = {
     44        0x00, 0x00, 0x02, 0x08, 0x04, 0x04, 0x08, 0x02, 0x10, 0x01, 0xa0, 0x00,
     45        0x40, 0x00, 0xa0, 0x00, 0x10, 0x01, 0x08, 0x02, 0x04, 0x04, 0x02, 0x08,
     46        0x01, 0x10, 0x00, 0x00
     47};
     48
     49static uint8_t cross_mask[] = {
     50        0x00, 0x00, 0x02, 0x18, 0x06, 0x0c, 0x0c, 0x06, 0x18, 0x03, 0xb0, 0x01,
     51        0xe0, 0x00, 0xe0, 0x00, 0xb0, 0x01, 0x18, 0x03, 0x0c, 0x06, 0x06, 0x0c,
     52        0x03, 0x18, 0x00, 0x00
     53};
     54
     55void draw_icon_cross(surface_t *surface, sysarg_t hpos, sysarg_t vpos,
     56    pixel_t highlight, pixel_t shadow)
     57{
     58        for (unsigned int y = 0; y < CROSS_HEIGHT; y++) {
     59                for (unsigned int x = 0; x < CROSS_WIDTH; x++) {
     60                        size_t offset = y * ((CROSS_WIDTH - 1) / 8 + 1) + x / 8;
     61                        bool visible = cross_mask[offset] & (1 << (x % 8));
     62                        pixel_t pixel = (cross_texture[offset] & (1 << (x % 8))) ?
     63                            highlight : shadow;
     64                       
     65                        if (visible)
     66                                surface_put_pixel(surface, hpos + x, vpos + y, pixel);
     67                }
     68        }
     69}
     70
    4071void draw_bevel(drawctx_t *drawctx, source_t *source, sysarg_t hpos,
    4172    sysarg_t vpos, sysarg_t width, sysarg_t height, pixel_t highlight,
Note: See TracChangeset for help on using the changeset viewer.