mirror of
https://github.com/raysan5/raylib.git
synced 2026-10-11 12:11:55 -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
|
||||
// to the consumer's final link via target_link_libraries
|
||||
// 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
|
||||
//
|
||||
// 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
|
||||
// Make: handled automatically — src/Makefile sets LDFLAGS += -Wl,--wrap=fopen;
|
||||
// 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
|
||||
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()
|
||||
|
||||
@ -4242,29 +4242,15 @@ void ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, f
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
unsigned int alpha = srcColor.a;
|
||||
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);
|
||||
ImageDrawPixel(dst, x, y, ColorAlphaBlend(dstColor, srcColor, tint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user