Formatting CIColorCube data

后端 未结 3 1242
半阙折子戏
半阙折子戏 2020-12-19 19:23

Recently, I\'ve been trying to set up a CIColorCube on a CIImage to create a custom effect. Here\'s what I have now:

uint8_t color_cube_data[8*4] = {
    0,          


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-19 19:28

    The accepted answer is incorrect. While the cube data is indeed supposed to be scaled to [0 .. 1], it's supposed to be float, not int.

    float color_cube_data[8*4] = { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };

    (Technically, you don't have to put the ".0" on each number, the compiler knows how to handle it.)

提交回复
热议问题