I am trying to define an extremely simple utility method that will save me from having to use a calculator to determine RGB values ββin percent. When I look into a sample Apple code called "QuartzCache" in the file DrawView.m, line 96, I see this:
float whiteColor[4] = {1, 1, 1, 1};
However, when I try to create a method like the following, the compiler hates me. Half an hour of intense googling did not help.
+(float[])percentagesRGBArray:(float[])rgbArray{
float red = rgbArray[0];
float green = rgbArray[1];
float blue = rgbArray[2];
float alpha = rgbArray[3];
red = red/255;
green = green/255;
blue = blue/255;
alpha = alpha;
float percentagesRGBArray[4] = {red, green, blue, alpha};
return percentagesRGBArray;
}
What is the correct way to define such a method? What am I doing wrong here?
source
share