mirror of
https://github.com/raysan5/raylib.git
synced 2026-10-11 04:01:54 -04:00
Compare commits
2 Commits
91d50e2938
...
8571d445e9
| Author | SHA1 | Date | |
|---|---|---|---|
| 8571d445e9 | |||
| 4722c9fa58 |
@ -285,7 +285,6 @@ static int android_close(void *cookie);
|
|||||||
// CMake: handled automatically — the PUBLIC flag propagates as INTERFACE_LINK_OPTIONS
|
// CMake: handled automatically — the PUBLIC flag propagates as INTERFACE_LINK_OPTIONS
|
||||||
// to the consumer's final link via target_link_libraries
|
// to the consumer's final link via target_link_libraries
|
||||||
// Make: pass -Wl,--wrap=fopen to the linker command producing the final artifact
|
// Make: pass -Wl,--wrap=fopen to the linker command producing the final artifact
|
||||||
// build.zig: pass -Wl,--wrap=fopen to the linker command producing the final artifact
|
|
||||||
// custom: pass -Wl,--wrap=fopen to the linker command producing the final artifact
|
// custom: pass -Wl,--wrap=fopen to the linker command producing the final artifact
|
||||||
//
|
//
|
||||||
// SHARED library (.so) — wrapping is self-contained:
|
// SHARED library (.so) — wrapping is self-contained:
|
||||||
@ -296,8 +295,6 @@ static int android_close(void *cookie);
|
|||||||
// only raylib internals are wrapped, app code requires a separate flag
|
// only raylib internals are wrapped, app code requires a separate flag
|
||||||
// Make: handled automatically — src/Makefile sets LDFLAGS += -Wl,--wrap=fopen;
|
// Make: handled automatically — src/Makefile sets LDFLAGS += -Wl,--wrap=fopen;
|
||||||
// only raylib internals are wrapped, app code requires a separate flag
|
// only raylib internals are wrapped, app code requires a separate flag
|
||||||
// build.zig: NOT supported — std.Build has no dedicated linker wrap helper, the flag
|
|
||||||
// is not correctly applied at the .so link step
|
|
||||||
// custom: apply -Wl,--wrap=fopen to the linker command producing the .so
|
// custom: apply -Wl,--wrap=fopen to the linker command producing the .so
|
||||||
FILE *__real_fopen(const char *fileName, const char *mode); // Real fopen, provided by the linker (--wrap=fopen)
|
FILE *__real_fopen(const char *fileName, const char *mode); // Real fopen, provided by the linker (--wrap=fopen)
|
||||||
FILE *__wrap_fopen(const char *fileName, const char *mode); // Replacement for fopen()
|
FILE *__wrap_fopen(const char *fileName, const char *mode); // Replacement for fopen()
|
||||||
|
|||||||
@ -2093,7 +2093,7 @@ static void WindowDropCallback(GLFWwindow *window, int count, const char **paths
|
|||||||
// GLFW3: Keyboard callback, runs on key pressed
|
// GLFW3: Keyboard callback, runs on key pressed
|
||||||
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
if ((key < 0) || (key >= MAX_KEYBOARD_KEYS)) return; // Security check, macOS fn key generates -1
|
if ((key < 0) || (key >= MAX_KEYBOARD_KEYS)) return; // Security check, macOS fn key generates -1
|
||||||
|
|
||||||
// WARNING: GLFW could return GLFW_REPEAT, it needs to be considered as 1
|
// WARNING: GLFW could return GLFW_REPEAT, it needs to be considered as 1
|
||||||
// to work properly with our implementation (IsKeyDown/IsKeyUp checks)
|
// to work properly with our implementation (IsKeyDown/IsKeyUp checks)
|
||||||
|
|||||||
@ -4242,29 +4242,15 @@ void ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, f
|
|||||||
|
|
||||||
Color srcColor = GetImageColor(src, srcX, srcY);
|
Color srcColor = GetImageColor(src, srcX, srcY);
|
||||||
|
|
||||||
// Apply tint
|
|
||||||
srcColor.r = (unsigned char)(srcColor.r*tint.r/255.0f);
|
|
||||||
srcColor.g = (unsigned char)(srcColor.g*tint.g/255.0f);
|
|
||||||
srcColor.b = (unsigned char)(srcColor.b*tint.b/255.0f);
|
|
||||||
srcColor.a = (unsigned char)(srcColor.a*tint.a/255.0f);
|
|
||||||
|
|
||||||
// Skip fully transparent pixels
|
// Skip fully transparent pixels
|
||||||
if (srcColor.a == 0) continue;
|
if (srcColor.a == 0) continue;
|
||||||
|
|
||||||
// Read destination pixel for alpha blending
|
// Read destination pixel and blend source over it, applying tint
|
||||||
|
// NOTE: ColorAlphaBlend() takes destination alpha into account,
|
||||||
|
// same as ImageDrawImagePro(), required to draw on transparent images
|
||||||
Color dstColor = GetImageColor(*dst, x, y);
|
Color dstColor = GetImageColor(*dst, x, y);
|
||||||
|
|
||||||
unsigned int alpha = srcColor.a;
|
ImageDrawPixel(dst, x, y, ColorAlphaBlend(dstColor, srcColor, tint));
|
||||||
unsigned int invA = 255 - alpha;
|
|
||||||
|
|
||||||
Color out = {
|
|
||||||
(unsigned char)((srcColor.r*alpha + dstColor.r*invA)/255), // red
|
|
||||||
(unsigned char)((srcColor.g*alpha + dstColor.g*invA)/255), // green
|
|
||||||
(unsigned char)((srcColor.b*alpha + dstColor.b*invA)/255), // blue
|
|
||||||
(unsigned char)(alpha + (dstColor.a*invA)/255) // alpha
|
|
||||||
};
|
|
||||||
|
|
||||||
ImageDrawPixel(dst, x, y, out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user