github.com/as/shiny@v0.8.2/driver/win32/color.go (about)

     1  package win32
     2  
     3  import "unsafe"
     4  
     5  type BlendFunc struct {
     6  	Op            byte
     7  	Flags         byte
     8  	SrcConstAlpha byte
     9  	AlphaFormat   byte
    10  }
    11  
    12  // Uintptr helps to pass bf to syscall.Syscall.
    13  func (b BlendFunc) Uintptr() uintptr {
    14  	return *((*uintptr)(unsafe.Pointer(&b)))
    15  }
    16  
    17  type RGBQuad struct {
    18  	Blue     byte
    19  	Green    byte
    20  	Red      byte
    21  	Reserved byte
    22  }
    23  
    24  type ColorRef uint32
    25  
    26  func NewColorRef(c interface {
    27  	RGBA() (r, g, b, a uint32)
    28  }) ColorRef {
    29  	type cr = ColorRef
    30  	r, g, b, a := c.RGBA()
    31  	return cr(r>>8) | cr(g>>8)<<8 | cr(b>>8)<<16 | cr(a>>8)<<24
    32  }
    33  
    34  func RGB(r, g, b byte) ColorRef {
    35  	return ColorRef(r) | ColorRef(g)<<8 | ColorRef(b)<<16
    36  }