diff --git a/lime/graphics/utils/ImageDataUtil.hx b/lime/graphics/utils/ImageDataUtil.hx index b4c9e5f2c..da114a52e 100644 --- a/lime/graphics/utils/ImageDataUtil.hx +++ b/lime/graphics/utils/ImageDataUtil.hx @@ -318,7 +318,7 @@ class ImageDataUtil { if (data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_fill_rect (image, rect, fillColor); else + if (!System.disableCFFI) lime_image_data_util_fill_rect (image, rect, (fillColor >> 16) & 0xFFFF, (fillColor) & 0xFFFF); else // TODO: Better Int32 solution #end { @@ -355,7 +355,7 @@ class ImageDataUtil { if (format == ARGB32) color = ((color & 0xFFFFFF) << 8) | ((color >> 24) & 0xFF); #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_flood_fill (image, x, y, color); else + if (!System.disableCFFI) lime_image_data_util_flood_fill (image, x, y, (color >> 16) & 0xFFFF, (color) & 0xFFFF); else // TODO: Better Int32 solution #end { @@ -1094,8 +1094,8 @@ class ImageDataUtil { private static var lime_image_data_util_color_transform = System.load ("lime", "lime_image_data_util_color_transform", 3); private static var lime_image_data_util_copy_channel = System.load ("lime", "lime_image_data_util_copy_channel", -1); private static var lime_image_data_util_copy_pixels = System.load ("lime", "lime_image_data_util_copy_pixels", -1); - private static var lime_image_data_util_fill_rect = System.load ("lime", "lime_image_data_util_fill_rect", 3); - private static var lime_image_data_util_flood_fill = System.load ("lime", "lime_image_data_util_flood_fill", 4); + private static var lime_image_data_util_fill_rect = System.load ("lime", "lime_image_data_util_fill_rect", 4); + private static var lime_image_data_util_flood_fill = System.load ("lime", "lime_image_data_util_flood_fill", 5); private static var lime_image_data_util_get_pixels = System.load ("lime", "lime_image_data_util_get_pixels", 4); private static var lime_image_data_util_merge = System.load ("lime", "lime_image_data_util_merge", -1); private static var lime_image_data_util_multiply_alpha = System.load ("lime", "lime_image_data_util_multiply_alpha", 1); diff --git a/project/include/graphics/utils/ImageDataUtil.h b/project/include/graphics/utils/ImageDataUtil.h index 21d72a786..b411e7992 100644 --- a/project/include/graphics/utils/ImageDataUtil.h +++ b/project/include/graphics/utils/ImageDataUtil.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace lime { @@ -23,8 +24,8 @@ namespace lime { static void ColorTransform (Image* image, Rectangle* rect, ColorMatrix* ColorMatrix); static void CopyChannel (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, int srcChannel, int destChannel); static void CopyPixels (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, Image* alphaImage, Vector2* alphaPoint, bool mergeAlpha); - static void FillRect (Image* image, Rectangle* rect, int color); - static void FloodFill (Image* image, int x, int y, int color); + static void FillRect (Image* image, Rectangle* rect, int32_t color); + static void FloodFill (Image* image, int x, int y, int32_t color); static void GetPixels (Image* image, Rectangle* rect, PixelFormat format, Bytes* pixels); static void Merge (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, int redMultiplier, int greenMultiplier, int blueMultiplier, int alphaMultiplier); static void MultiplyAlpha (Image* image); diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index d4dded491..007a7f5b5 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -559,20 +559,22 @@ namespace lime { } - value lime_image_data_util_fill_rect (value image, value rect, value color) { + value lime_image_data_util_fill_rect (value image, value rect, value rg, value ba) { Image _image = Image (image); Rectangle _rect = Rectangle (rect); - ImageDataUtil::FillRect (&_image, &_rect, val_number (color)); + int32_t color = (val_int (rg) << 16) | val_int (ba); + ImageDataUtil::FillRect (&_image, &_rect, color); return alloc_null (); } - value lime_image_data_util_flood_fill (value image, value x, value y, value color) { + value lime_image_data_util_flood_fill (value image, value x, value y, value rg, value ba) { Image _image = Image (image); - ImageDataUtil::FloodFill (&_image, val_number (x), val_number (y), val_number (color)); + int32_t color = (val_int (rg) << 16) | val_int (ba); + ImageDataUtil::FloodFill (&_image, val_number (x), val_number (y), color); return alloc_null (); } @@ -1169,8 +1171,8 @@ namespace lime { DEFINE_PRIM (lime_image_data_util_color_transform, 3); DEFINE_PRIM_MULT (lime_image_data_util_copy_channel); DEFINE_PRIM_MULT (lime_image_data_util_copy_pixels); - DEFINE_PRIM (lime_image_data_util_fill_rect, 3); - DEFINE_PRIM (lime_image_data_util_flood_fill, 4); + DEFINE_PRIM (lime_image_data_util_fill_rect, 4); + DEFINE_PRIM (lime_image_data_util_flood_fill, 5); DEFINE_PRIM (lime_image_data_util_get_pixels, 4); DEFINE_PRIM_MULT (lime_image_data_util_merge); DEFINE_PRIM (lime_image_data_util_multiply_alpha, 1); diff --git a/project/src/graphics/utils/ImageDataUtil.cpp b/project/src/graphics/utils/ImageDataUtil.cpp index 49482ef2b..7ea828f85 100644 --- a/project/src/graphics/utils/ImageDataUtil.cpp +++ b/project/src/graphics/utils/ImageDataUtil.cpp @@ -243,7 +243,7 @@ namespace lime { } - void ImageDataUtil::FillRect (Image* image, Rectangle* rect, int color) { + void ImageDataUtil::FillRect (Image* image, Rectangle* rect, int32_t color) { uint8_t* data = (uint8_t*)image->buffer->data->Data (); PixelFormat format = image->buffer->format; @@ -268,7 +268,7 @@ namespace lime { } - void ImageDataUtil::FloodFill (Image* image, int x, int y, int color) { + void ImageDataUtil::FloodFill (Image* image, int x, int y, int32_t color) { uint8_t* data = (uint8_t*)image->buffer->data->Data (); PixelFormat format = image->buffer->format;