|
|
|
@ -1727,7 +1727,8 @@ void ImageResizeNN(Image *image, int newWidth, int newHeight) |
|
|
|
int xRatio = (int)((image->width << 16)/newWidth) + 1; |
|
|
|
int yRatio = (int)((image->height << 16)/newHeight) + 1; |
|
|
|
|
|
|
|
int x2, y2; |
|
|
|
int x2 = 0; |
|
|
|
int y2 = 0; |
|
|
|
for (int y = 0; y < newHeight; y++) |
|
|
|
{ |
|
|
|
for (int x = 0; x < newWidth; x++) |
|
|
|
@ -2488,8 +2489,13 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp) |
|
|
|
Color oldPixel = WHITE; |
|
|
|
Color newPixel = WHITE; |
|
|
|
|
|
|
|
int rError, gError, bError; |
|
|
|
unsigned short rPixel, gPixel, bPixel, aPixel; // Used for 16bit pixel composition |
|
|
|
int rError = 0; |
|
|
|
int gError = 0; |
|
|
|
int bError = 0; |
|
|
|
unsigned short rPixel = 0; // Used for 16bit pixel composition |
|
|
|
unsigned short gPixel = 0; |
|
|
|
unsigned short bPixel = 0; |
|
|
|
unsigned short aPixel = 0; |
|
|
|
|
|
|
|
#define MIN(a,b) (((a)<(b))?(a):(b)) |
|
|
|
|
|
|
|
@ -4006,7 +4012,9 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color |
|
|
|
// [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend() |
|
|
|
// [ ] TODO: Support 16bit and 32bit (float) channels drawing |
|
|
|
|
|
|
|
Color colSrc, colDst, blend; |
|
|
|
Color colSrc = { 0 }; |
|
|
|
Color colDst = { 0 }; |
|
|
|
Color blend = { 0 }; |
|
|
|
bool blendRequired = true; |
|
|
|
|
|
|
|
// Fast path: Avoid blend if source has no alpha to blend |
|
|
|
@ -4681,17 +4689,23 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, |
|
|
|
bottomBorder = patchHeight - topBorder; |
|
|
|
} |
|
|
|
|
|
|
|
Vector2 vertA, vertB, vertC, vertD; |
|
|
|
vertA.x = 0.0f; // outer left |
|
|
|
vertA.y = 0.0f; // outer top |
|
|
|
vertB.x = leftBorder; // inner left |
|
|
|
vertB.y = topBorder; // inner top |
|
|
|
vertC.x = patchWidth - rightBorder; // inner right |
|
|
|
vertC.y = patchHeight - bottomBorder; // inner bottom |
|
|
|
vertD.x = patchWidth; // outer right |
|
|
|
vertD.y = patchHeight; // outer bottom |
|
|
|
|
|
|
|
Vector2 coordA, coordB, coordC, coordD; |
|
|
|
Vector2 vertA = { 0 }; |
|
|
|
Vector2 vertB = { 0 }; |
|
|
|
Vector2 vertC = { 0 }; |
|
|
|
Vector2 vertD = { 0 }; |
|
|
|
vertA.x = 0.0f; // Outer left |
|
|
|
vertA.y = 0.0f; // Outer top |
|
|
|
vertB.x = leftBorder; // Inner left |
|
|
|
vertB.y = topBorder; // Inner top |
|
|
|
vertC.x = patchWidth - rightBorder; // Inner right |
|
|
|
vertC.y = patchHeight - bottomBorder; // Inner bottom |
|
|
|
vertD.x = patchWidth; // Outer right |
|
|
|
vertD.y = patchHeight; // Outer bottom |
|
|
|
|
|
|
|
Vector2 coordA = { 0 }; |
|
|
|
Vector2 coordB = { 0 }; |
|
|
|
Vector2 coordC = { 0 }; |
|
|
|
Vector2 coordD = { 0 }; |
|
|
|
coordA.x = nPatchInfo.source.x/width; |
|
|
|
coordA.y = nPatchInfo.source.y/height; |
|
|
|
coordB.x = (nPatchInfo.source.x + leftBorder)/width; |
|
|
|
@ -4907,7 +4921,9 @@ Vector3 ColorToHSV(Color color) |
|
|
|
{ |
|
|
|
Vector3 hsv = { 0 }; |
|
|
|
Vector3 rgb = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f }; |
|
|
|
float min, max, delta; |
|
|
|
float min = 0.0f; |
|
|
|
float max = 0.0f; |
|
|
|
float delta = 0.0f; |
|
|
|
|
|
|
|
min = rgb.x < rgb.y? rgb.x : rgb.y; |
|
|
|
min = min < rgb.z? min : rgb.z; |
|
|
|
|