uint16_t t1=0,t2=0,t3=0; float a,b,c; uint16_t value=0; for (int j = 0; j < count; j++) { t1 = ceil(rgbLeft->r +(floor((rgbRight->r - rgbLeft->r) * j) / (count-1))); t2 = ceil(rgbLeft->g +(floor((rgbRight->g - rgbLeft->g) * j) / (count-1))); t3 = ceil(rgbLeft->b + (floor(rgbRight->b - rgbLeft->b) * j) / (count-1)); value = (t1 << 11) | (t2 << 5) | (t3); vec.push_back(value); } typedef struct{ unsigned int r:5; unsigned int g:6; unsigned int b:5; }RGB;