zoukankan      html  css  js  c++  java
  • D3DXCOLOR 和 D3DCOLOR 和 D3DCOLORVALUE

    D3DCOLOR 是一个DWORD 型。第一个byte表示Alpha值,后面三个byte依次是r(红)g(绿)b(蓝)值。32位。

    下面是一些关于D3DCOLOR 的宏:

    • D3DCOLOR_ARGB(a,r,g,b) - 第一个byte表示Alpha值,后面三个byte本别表示红,绿,蓝。
    • D3DCOLOR_RGBA(r,g,b,a) - 前三个byte分别表示红,绿,蓝,最后一个byte是Alpha值
    • D3DCOLOR_XRGB(r,g,b) - Alpha值为1,三个byte分别表示红,绿,蓝
    typedef struct _D3DCOLORVALUE {
    float r;
    float g;
    float b;
    float a;
    } D3DCOLORVALUE;

    可以使用结构体D3DCOLORVALUE来定义Direct3D中的颜色,这种颜色类型多用于指定灯光和材质的颜色。

    D3DXCOLOR是一个C++ 的类,实现了到上述两种类型强转,所以可以上述两种类型可以用的地方,都可以用它代替。

    下面是它的定义:

    typedef struct D3DXCOLOR
    {
    #ifdef __cplusplus
    public:
        D3DXCOLOR() {}
        D3DXCOLOR( DWORD argb );
        D3DXCOLOR( CONST FLOAT * );
        D3DXCOLOR( CONST D3DXFLOAT16 * );
        D3DXCOLOR( CONST D3DCOLORVALUE& );
        D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a );
    
        // casting
        operator DWORD () const;
    
        operator FLOAT* ();
        operator CONST FLOAT* () const;
    
        operator D3DCOLORVALUE* ();
        operator CONST D3DCOLORVALUE* () const;
    
        operator D3DCOLORVALUE& ();
        operator CONST D3DCOLORVALUE& () const;
    
        // assignment operators
        D3DXCOLOR& operator += ( CONST D3DXCOLOR& );
        D3DXCOLOR& operator -= ( CONST D3DXCOLOR& );
        D3DXCOLOR& operator *= ( FLOAT );
        D3DXCOLOR& operator /= ( FLOAT );
    
        // unary operators
        D3DXCOLOR operator + () const;
        D3DXCOLOR operator - () const;
    
        // binary operators
        D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const;
        D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const;
        D3DXCOLOR operator * ( FLOAT ) const;
        D3DXCOLOR operator / ( FLOAT ) const;
    
        friend D3DXCOLOR operator * ( FLOAT, CONST D3DXCOLOR& );
    
        BOOL operator == ( CONST D3DXCOLOR& ) const;
        BOOL operator != ( CONST D3DXCOLOR& ) const;
    
    #endif //__cplusplus
        FLOAT r, g, b, a;
    } D3DXCOLOR, *LPD3DXCOLOR;
  • 相关阅读:
    周末、广州、WEB安全测试实战训练
    WEB安全测试实战训练周末精品班课程圆满结束!
    常用渗透性测试工具
    大家还在迷信工具么?
    团购网站安全性普遍堪忧
    网页安全漏洞检测 隐藏字段
    用ModSecurity+PhantomJS进行服务器端XSS攻击检测
    关于HP WebInspect 9.1
    AQA(www.AutomationQA.com)开始连载《Web Security Testing Cookbook》学习笔记
    从团购网的漏洞看网站安全性问题
  • 原文地址:https://www.cnblogs.com/lc-cnblong/p/3313212.html
Copyright © 2011-2022 走看看