Create a new native Bytes implementation, use it instead of ByteArray for better ByteArray and Bytes support
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
#include <hx/CFFI.h>
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
@@ -42,7 +42,7 @@ namespace lime {
|
||||
int bitsPerSample;
|
||||
int channels;
|
||||
int sampleRate;
|
||||
ByteArray *data;
|
||||
Bytes *data;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <hx/CFFI.h>
|
||||
#include <graphics/PixelFormat.h>
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
@@ -24,7 +24,7 @@ namespace lime {
|
||||
value Value ();
|
||||
|
||||
int bpp;
|
||||
ByteArray *data;
|
||||
Bytes *data;
|
||||
PixelFormat format;
|
||||
int height;
|
||||
int width;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
#include <graphics/ImageBuffer.h>
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
#include <utils/Resource.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace lime {
|
||||
public:
|
||||
|
||||
static bool Decode (Resource *resource, ImageBuffer *imageBuffer, bool decodeData = true);
|
||||
static bool Encode (ImageBuffer *imageBuffer, ByteArray *bytes, int quality);
|
||||
static bool Encode (ImageBuffer *imageBuffer, Bytes *bytes, int quality);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
#include <graphics/ImageBuffer.h>
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
#include <utils/Resource.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace lime {
|
||||
public:
|
||||
|
||||
static bool Decode (Resource *resource, ImageBuffer *imageBuffer, bool decodeData = true);
|
||||
static bool Encode (ImageBuffer *imageBuffer, ByteArray *bytes);
|
||||
static bool Encode (ImageBuffer *imageBuffer, Bytes *bytes);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <math/Rectangle.h>
|
||||
#include <math/Vector2.h>
|
||||
#include <system/System.h>
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
@@ -25,12 +25,12 @@ namespace lime {
|
||||
static void CopyPixels (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, bool mergeAlpha);
|
||||
static void FillRect (Image* image, Rectangle* rect, int color);
|
||||
static void FloodFill (Image* image, int x, int y, int color);
|
||||
static void GetPixels (Image* image, Rectangle* rect, PixelFormat format, ByteArray* pixels);
|
||||
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);
|
||||
static void Resize (Image* image, ImageBuffer* buffer, int width, int height);
|
||||
static void SetFormat (Image* image, PixelFormat format);
|
||||
static void SetPixels (Image* image, Rectangle* rect, ByteArray* bytes, PixelFormat format);
|
||||
static void SetPixels (Image* image, Rectangle* rect, Bytes* bytes, PixelFormat format);
|
||||
static void UnmultiplyAlpha (Image* image);
|
||||
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ namespace lime {
|
||||
int GetUnderlinePosition ();
|
||||
int GetUnderlineThickness ();
|
||||
int GetUnitsPerEM ();
|
||||
int RenderGlyph (int index, ByteArray *bytes, int offset = 0);
|
||||
int RenderGlyphs (value indices, ByteArray *bytes);
|
||||
int RenderGlyph (int index, Bytes *bytes, int offset = 0);
|
||||
int RenderGlyphs (value indices, Bytes *bytes);
|
||||
void SetSize (size_t size);
|
||||
|
||||
void* face;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
#include <text/Font.h>
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
@@ -27,7 +27,7 @@ namespace lime {
|
||||
TextLayout (int direction, const char *script, const char *language);
|
||||
~TextLayout ();
|
||||
|
||||
void Position (Font *font, size_t size, const char *text, ByteArray *bytes);
|
||||
void Position (Font *font, size_t size, const char *text, Bytes *bytes);
|
||||
void SetDirection (int direction);
|
||||
void SetLanguage (const char* language);
|
||||
void SetScript (const char* script);
|
||||
|
||||
39
project/include/utils/Bytes.h
Normal file
39
project/include/utils/Bytes.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef LIME_UTILS_BYTES_H
|
||||
#define LIME_UTILS_BYTES_H
|
||||
|
||||
|
||||
#include <hx/CFFI.h>
|
||||
#include <utils/QuickVec.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
struct Bytes {
|
||||
|
||||
|
||||
Bytes ();
|
||||
Bytes (int size);
|
||||
Bytes (value bytes);
|
||||
Bytes (const char* path);
|
||||
Bytes (const QuickVec<unsigned char> data);
|
||||
~Bytes ();
|
||||
|
||||
unsigned char *Data ();
|
||||
const unsigned char *Data () const;
|
||||
int Length () const;
|
||||
void Resize (int size);
|
||||
value Value ();
|
||||
|
||||
unsigned char *_data;
|
||||
int _length;
|
||||
value _value;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -2,7 +2,7 @@
|
||||
#define LIME_UTILS_RESOURCE_H
|
||||
|
||||
|
||||
#include <utils/ByteArray.h>
|
||||
#include <utils/Bytes.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
@@ -13,9 +13,9 @@ namespace lime {
|
||||
|
||||
Resource () : data (NULL), path (NULL) {}
|
||||
Resource (const char* path) : data (NULL), path (path) {}
|
||||
Resource (ByteArray *data) : data (data), path (NULL) {}
|
||||
Resource (Bytes *data) : data (data), path (NULL) {}
|
||||
|
||||
ByteArray *data;
|
||||
Bytes *data;
|
||||
const char* path;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user