Ios 创建ColorCube CIFilter
我想为我的应用程序创建ColorCube CIFilter,我在苹果网站上找到了相关文档 我还在这里贴代码Ios 创建ColorCube CIFilter,ios,filter,cifilter,ciimage,Ios,Filter,Cifilter,Ciimage,我想为我的应用程序创建ColorCube CIFilter,我在苹果网站上找到了相关文档 我还在这里贴代码 **//Allocate memory ** **const unsigned int size = 64;** **float *cubeData = (float *)malloc (size * size * size * sizeof (float) * 4);** float rgb[3], hsv[3], *c = cubeData; // Populate cube wi
**//Allocate memory **
**const unsigned int size = 64;**
**float *cubeData = (float *)malloc (size * size * size * sizeof (float) * 4);**
float rgb[3], hsv[3], *c = cubeData;
// Populate cube with a simple gradient going from 0 to 1
for (int z = 0; z < size; z++){
rgb[2] = ((double)z)/(size-1); // Blue value
for (int y = 0; y < size; y++){
rgb[1] = ((double)y)/(size-1); // Green value
for (int x = 0; x < size; x ++){
rgb[0] = ((double)x)/(size-1); // Red value
// Convert RGB to HSV
// You can find publicly available rgbToHSV functions on the Internet
rgbToHSV(rgb, hsv);
// Use the hue value to determine which to make transparent
// The minimum and maximum hue angle depends on
// the color you want to remove
float alpha = (hsv[0] > minHueAngle && hsv[0] < maxHueAngle) ? 0.0f: 1.0f;
// Calculate premultiplied alpha values for the cube
c[0] = rgb[0] * alpha;
c[1] = rgb[1] * alpha;
c[2] = rgb[2] * alpha;
c[3] = alpha;
c += 4; // advance our pointer into memory for the next color value
}
}
}
我想知道他们取的是什么尺寸=64,代码中那条粗体的线是什么意思
感谢您的帮助……很简单,立方体是由正方形的立方体组成的,正方形有4条边,所以4的立方体是64。好的,明白了,但是所有立方体数据是什么样的?