minor code cleanup
This commit is contained in:
@@ -50,7 +50,6 @@ namespace UwU {
|
|||||||
uint8_t lerp8(uint8_t a, uint8_t b, uint8_t t) {
|
uint8_t lerp8(uint8_t a, uint8_t b, uint8_t t) {
|
||||||
uint16_t product = (a * (255 - t)) + (b * t);
|
uint16_t product = (a * (255 - t)) + (b * t);
|
||||||
return product / 255;
|
return product / 255;
|
||||||
// return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Color lerpColor(Color a, Color b, uint8_t t) {
|
Color lerpColor(Color a, Color b, uint8_t t) {
|
||||||
@@ -130,7 +129,6 @@ namespace UwU {
|
|||||||
int32_t y = 0;
|
int32_t y = 0;
|
||||||
for (int32_t x = 0; x < x1; x++) {
|
for (int32_t x = 0; x < x1; x++) {
|
||||||
gradLut[x] = (uint8_t)y;
|
gradLut[x] = (uint8_t)y;
|
||||||
// gradLut[x] = 240;
|
|
||||||
if (d > 0) {
|
if (d > 0) {
|
||||||
y++;
|
y++;
|
||||||
d += (2 * (dy -dx));
|
d += (2 * (dy -dx));
|
||||||
@@ -149,7 +147,6 @@ namespace UwU {
|
|||||||
int32_t x = 0;
|
int32_t x = 0;
|
||||||
for (int32_t y = 0; y < 256; y++) {
|
for (int32_t y = 0; y < 256; y++) {
|
||||||
gradLut[x] = (uint8_t)y;
|
gradLut[x] = (uint8_t)y;
|
||||||
// gradLut[x] = 69;
|
|
||||||
if (d > 0) {
|
if (d > 0) {
|
||||||
x++;
|
x++;
|
||||||
d += (2 * (dx -dy));
|
d += (2 * (dx -dy));
|
||||||
@@ -196,7 +193,6 @@ namespace UwU {
|
|||||||
|
|
||||||
// Draws a rectangle with a 4-point color gradient
|
// Draws a rectangle with a 4-point color gradient
|
||||||
void rectangleGradient(Coord2 point0, Coord2 point1, Color colorUL, Color colorUR, Color colorLL, Color colorLR) {
|
void rectangleGradient(Coord2 point0, Coord2 point1, Color colorUL, Color colorUR, Color colorLL, Color colorLR) {
|
||||||
// void rectangleGradient(Coord2 point0, Coord2 point1) {
|
|
||||||
// convert to int32_t and ensure x1>x0 && y1>y0
|
// convert to int32_t and ensure x1>x0 && y1>y0
|
||||||
int32_t x0, y0, x1, y1;
|
int32_t x0, y0, x1, y1;
|
||||||
if (point0.x > point1.x) {
|
if (point0.x > point1.x) {
|
||||||
@@ -227,11 +223,6 @@ namespace UwU {
|
|||||||
this->gradLow(w, xGrad);
|
this->gradLow(w, xGrad);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("horizontal LUT\n");
|
|
||||||
for (uint16_t i = 0; i < w; i++) {
|
|
||||||
printf("(%u, %u)\n", i, xGrad[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine m and calculate vertical gradient coefficient
|
// determine m and calculate vertical gradient coefficient
|
||||||
if (h < 256) {
|
if (h < 256) {
|
||||||
this->gradHigh(h, yGrad);
|
this->gradHigh(h, yGrad);
|
||||||
@@ -239,11 +230,6 @@ namespace UwU {
|
|||||||
this->gradLow(h, yGrad);
|
this->gradLow(h, yGrad);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("vertical LUT\n");
|
|
||||||
for (uint16_t i = 0; i < h; i++) {
|
|
||||||
printf("(%u, %u)\n", i, yGrad[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for each point calculate, alpha blend and print color
|
// for each point calculate, alpha blend and print color
|
||||||
Color Lmix = Color();
|
Color Lmix = Color();
|
||||||
Color Rmix = Color();
|
Color Rmix = Color();
|
||||||
|
|||||||
Reference in New Issue
Block a user