Annotation of nono/lib/color.h, revision 1.1.1.1

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2021 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // 色構造体
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "header.h"
                     14: 
                     15: //
                     16: // 自前のカラー構造体
                     17: //
                     18: struct Color
                     19: {
                     20:        uint8 r {};
                     21:        uint8 g {};
                     22:        uint8 b {};
                     23: 
                     24:        Color() {}
                     25: 
                     26:        Color(uint8 r_, uint8 g_, uint8 b_) {
                     27:                r = r_;
                     28:                g = g_;
                     29:                b = b_;
                     30:        }
                     31: };
                     32: 
                     33: //
                     34: // 自前のカラー<double>構造体
                     35: //
                     36: struct ColorD
                     37: {
                     38:        double r {};
                     39:        double g {};
                     40:        double b {};
                     41: 
                     42:        ColorD() {}
                     43: 
                     44:        ColorD(double r_, double g_, double b_) {
                     45:                r = r_;
                     46:                g = g_;
                     47:                b = b_;
                     48:        }
                     49: };
                     50: 
                     51: //
                     52: // カラー構造体 (xBGR 形式)
                     53: //
                     54: union ColorXBGR
                     55: {
                     56:        uint32 xbgr {};
                     57:        struct {
                     58: #if BYTE_ORDER == LITTLE_ENDIAN
                     59:                uint8 r;
                     60:                uint8 g;
                     61:                uint8 b;
                     62:                uint8 x;
                     63: #else
                     64:                uint8 x;
                     65:                uint8 b;
                     66:                uint8 g;
                     67:                uint8 r;
                     68: #endif
                     69:        };
                     70: 
                     71:        ColorXBGR() { }
                     72:        ColorXBGR(int r_, int g_, int b_) {
                     73:                r = r_;
                     74:                g = g_;
                     75:                b = b_;
                     76:                x = 0;
                     77:        }
                     78: 
                     79:        // Color に変換
                     80:        Color ToColor() const { return Color(r, g, b); }
                     81: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.