首页>
知识库>
详情

关于DIRECTX调色板的问题

2020-07-27 来源:CloudBest 阅读量: 0
关键词:

    一般建立调色板是一下步骤
    // build up the palette data array
    for (int color=1; color < 255; color++)
    {
    // fill with random RGB values
    palette[color].peRed   = rand()%256;
    palette[color].peGreen = rand()%256;
    palette[color].peBlue  = rand()%256;
    // set flags field to PC_NOCOLLAPSE
    palette[color].peFlags = PC_NOCOLLAPSE;
    } // end for color
    // now fill in entry 0 and 255 with black and white
    palette[0].peRed     = 0;
    palette[0].peGreen   = 0;
    palette[0].peBlue    = 0;
    palette[0].peFlags   = PC_NOCOLLAPSE;
    palette[255].peRed   = 255;
    palette[255].peGreen = 255;
    palette[255].peBlue  = 255;
    palette[255].peFlags = PC_NOCOLLAPSE;
    如果每次随机取颜色,有幅图片颜色正好在这调色板里面找不到会怎么样?