Fix Image native fillRect and floodFill
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <math/Vector2.h>
|
||||
#include <system/System.h>
|
||||
#include <utils/Bytes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user