@@ -28,7 +28,7 @@ liblol_core_a_SOURCES = \ | |||
liblol_core_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/3rdparty/bullet3/src -I$(srcdir)/3rdparty/lua/src | |||
liblol_core_headers = \ | |||
lol/engine-internal.h lol/engine.h lol/public.h lol/extras.h \ | |||
lol/engine-internal.h lol/engine.h lol/public.h lol/extras.h lol/legacy.h \ | |||
\ | |||
lol/base/all.h \ | |||
lol/base/avl_tree.h lol/base/features.h lol/base/tuple.h lol/base/types.h \ | |||
@@ -33,14 +33,14 @@ enum class MergeMode | |||
}; | |||
template<PixelFormat FORMAT, MergeMode MODE> | |||
static Image GenericMerge(Image &src1, Image &src2, float alpha) | |||
static image GenericMerge(image &src1, image &src2, float alpha) | |||
{ | |||
typedef typename PixelType<FORMAT>::type pixel_t; | |||
ASSERT(src1.GetSize() == src2.GetSize()); | |||
int const count = src1.GetSize().x * src2.GetSize().y; | |||
Image dst(src1.GetSize()); | |||
image dst(src1.GetSize()); | |||
pixel_t const *src1p = src1.Lock<FORMAT>(); | |||
pixel_t const *src2p = src2.Lock<FORMAT>(); | |||
@@ -79,7 +79,7 @@ static Image GenericMerge(Image &src1, Image &src2, float alpha) | |||
} | |||
template<MergeMode MODE> | |||
static Image GenericMerge(Image &src1, Image &src2, float alpha) | |||
static image GenericMerge(image &src1, image &src2, float alpha) | |||
{ | |||
bool gray1 = src1.GetFormat() == PixelFormat::Y_8 | |||
|| src1.GetFormat() == PixelFormat::Y_F32; | |||
@@ -92,57 +92,57 @@ static Image GenericMerge(Image &src1, Image &src2, float alpha) | |||
} | |||
Image Image::Merge(Image &src1, Image &src2, float alpha) | |||
image image::Merge(image &src1, image &src2, float alpha) | |||
{ | |||
return GenericMerge<MergeMode::Mix>(src1, src2, alpha); | |||
} | |||
Image Image::Mean(Image &src1, Image &src2) | |||
image image::Mean(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Mix>(src1, src2, 0.5f); | |||
} | |||
Image Image::Min(Image &src1, Image &src2) | |||
image image::Min(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Min>(src1, src2, 0.0f); | |||
} | |||
Image Image::Max(Image &src1, Image &src2) | |||
image image::Max(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Max>(src1, src2, 0.0f); | |||
} | |||
Image Image::Overlay(Image &src1, Image &src2) | |||
image image::Overlay(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Overlay>(src1, src2, 0.0f); | |||
} | |||
Image Image::Screen(Image &src1, Image &src2) | |||
image image::Screen(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Screen>(src1, src2, 0.0f); | |||
} | |||
Image Image::Divide(Image &src1, Image &src2) | |||
image image::Divide(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Divide>(src1, src2, 0.0f); | |||
} | |||
Image Image::Multiply(Image &src1, Image &src2) | |||
image image::Multiply(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Multiply>(src1, src2, 0.0f); | |||
} | |||
Image Image::Add(Image &src1, Image &src2) | |||
image image::Add(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Add>(src1, src2, 0.0f); | |||
} | |||
Image Image::Sub(Image &src1, Image &src2) | |||
image image::Sub(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Sub>(src1, src2, 0.0f); | |||
} | |||
Image Image::Difference(Image &src1, Image &src2) | |||
image image::Difference(image &src1, image &src2) | |||
{ | |||
return GenericMerge<MergeMode::Difference>(src1, src2, 0.0f); | |||
} | |||
@@ -19,12 +19,12 @@ | |||
namespace lol | |||
{ | |||
Image Image::Crop(ibox2 box) const | |||
image image::Crop(ibox2 box) const | |||
{ | |||
ivec2 const srcsize = GetSize(); | |||
ivec2 const dstsize = box.extent(); | |||
Image dst(dstsize); | |||
image dst(dstsize); | |||
PixelFormat format = GetFormat(); | |||
if (format != PixelFormat::Unknown) | |||
@@ -43,12 +43,12 @@ public: | |||
array2d<typename PixelType<T>::type> m_array2d; | |||
}; | |||
class ImageData | |||
class image_data | |||
{ | |||
friend class Image; | |||
friend class image; | |||
public: | |||
ImageData() | |||
image_data() | |||
: m_size(0, 0), | |||
m_wrap_x(WrapMode::Clamp), | |||
m_wrap_y(WrapMode::Clamp), | |||
@@ -23,30 +23,30 @@ namespace lol | |||
* Public Image class | |||
*/ | |||
Image::Image() | |||
: m_data(new ImageData()) | |||
image::image() | |||
: m_data(new image_data()) | |||
{ | |||
} | |||
Image::Image(char const *path) | |||
: m_data(new ImageData()) | |||
image::image(char const *path) | |||
: m_data(new image_data()) | |||
{ | |||
Load(path); | |||
} | |||
Image::Image(ivec2 size) | |||
: m_data(new ImageData()) | |||
image::image(ivec2 size) | |||
: m_data(new image_data()) | |||
{ | |||
SetSize(size); | |||
} | |||
Image::Image (Image const &other) | |||
: m_data(new ImageData()) | |||
image::image (image const &other) | |||
: m_data(new image_data()) | |||
{ | |||
Copy(other); | |||
} | |||
Image & Image::operator =(Image other) | |||
image & image::operator =(image other) | |||
{ | |||
/* Since the argument is passed by value, we’re assured it’s a new | |||
* object and we can safely swap our m_data pointers. */ | |||
@@ -54,7 +54,7 @@ Image & Image::operator =(Image other) | |||
return *this; | |||
} | |||
Image::~Image() | |||
image::~image() | |||
{ | |||
for (int k : m_data->m_pixels.keys()) | |||
delete m_data->m_pixels[k]; | |||
@@ -62,7 +62,7 @@ Image::~Image() | |||
delete m_data; | |||
} | |||
void Image::Copy(uint8_t* src_pixels, ivec2 const& size, PixelFormat fmt) | |||
void image::Copy(uint8_t* src_pixels, ivec2 const& size, PixelFormat fmt) | |||
{ | |||
ASSERT(fmt != PixelFormat::Unknown); | |||
SetSize(size); | |||
@@ -71,7 +71,7 @@ void Image::Copy(uint8_t* src_pixels, ivec2 const& size, PixelFormat fmt) | |||
size.x * size.y * BytesPerPixel(fmt)); | |||
} | |||
void Image::Copy(Image const &src) | |||
void image::Copy(image const &src) | |||
{ | |||
ivec2 size = src.GetSize(); | |||
PixelFormat fmt = src.GetFormat(); | |||
@@ -86,12 +86,12 @@ void Image::Copy(Image const &src) | |||
} | |||
} | |||
void Image::DummyFill() | |||
void image::DummyFill() | |||
{ | |||
Load("DUMMY"); | |||
} | |||
bool Image::Load(char const *path) | |||
bool image::Load(char const *path) | |||
{ | |||
auto resource = ResourceLoader::Load(path); | |||
if (resource == nullptr) | |||
@@ -109,20 +109,20 @@ bool Image::Load(char const *path) | |||
return true; | |||
} | |||
bool Image::Save(char const *path) | |||
bool image::Save(char const *path) | |||
{ | |||
auto data = new ResourceImageData(new Image(*this)); | |||
auto data = new ResourceImageData(new image(*this)); | |||
auto result = ResourceLoader::Save(path, data); | |||
delete data; | |||
return result; | |||
} | |||
ivec2 Image::GetSize() const | |||
ivec2 image::GetSize() const | |||
{ | |||
return m_data->m_size; | |||
} | |||
void Image::SetSize(ivec2 size) | |||
void image::SetSize(ivec2 size) | |||
{ | |||
ASSERT(size.x > 0); | |||
ASSERT(size.y > 0); | |||
@@ -142,24 +142,24 @@ void Image::SetSize(ivec2 size) | |||
} | |||
/* Wrap-around mode for some operations */ | |||
WrapMode Image::GetWrapX() const | |||
WrapMode image::GetWrapX() const | |||
{ | |||
return m_data->m_wrap_x; | |||
} | |||
WrapMode Image::GetWrapY() const | |||
WrapMode image::GetWrapY() const | |||
{ | |||
return m_data->m_wrap_y; | |||
} | |||
void Image::SetWrap(WrapMode wrap_x, WrapMode wrap_y) | |||
void image::SetWrap(WrapMode wrap_x, WrapMode wrap_y) | |||
{ | |||
m_data->m_wrap_x = wrap_x; | |||
m_data->m_wrap_y = wrap_y; | |||
} | |||
/* The Lock() method */ | |||
template<PixelFormat T> typename PixelType<T>::type *Image::Lock() | |||
template<PixelFormat T> typename PixelType<T>::type *image::Lock() | |||
{ | |||
SetFormat(T); | |||
@@ -167,7 +167,7 @@ template<PixelFormat T> typename PixelType<T>::type *Image::Lock() | |||
} | |||
/* The Lock2D() method */ | |||
void *Image::Lock2DHelper(PixelFormat T) | |||
void *image::Lock2DHelper(PixelFormat T) | |||
{ | |||
SetFormat(T); | |||
@@ -175,7 +175,7 @@ void *Image::Lock2DHelper(PixelFormat T) | |||
} | |||
template<typename T> | |||
void Image::Unlock2D(array2d<T> const &array) | |||
void image::Unlock2D(array2d<T> const &array) | |||
{ | |||
ASSERT(m_data->m_pixels.has_key((int)m_data->m_format)); | |||
ASSERT(array.data() == m_data->m_pixels[(int)m_data->m_format]->data()); | |||
@@ -183,9 +183,9 @@ void Image::Unlock2D(array2d<T> const &array) | |||
/* Explicit specialisations for the above templates */ | |||
#define _T(T) \ | |||
template PixelType<T>::type *Image::Lock<T>(); \ | |||
template array2d<PixelType<T>::type> &Image::Lock2D<T>(); \ | |||
template void Image::Unlock2D(array2d<PixelType<T>::type> const &array); | |||
template PixelType<T>::type *image::Lock<T>(); \ | |||
template array2d<PixelType<T>::type> &image::Lock2D<T>(); \ | |||
template void image::Unlock2D(array2d<PixelType<T>::type> const &array); | |||
_T(PixelFormat::Y_8) | |||
_T(PixelFormat::RGB_8) | |||
_T(PixelFormat::RGBA_8) | |||
@@ -195,14 +195,14 @@ _T(PixelFormat::RGBA_F32) | |||
#undef _T | |||
/* Special case for the "any" format: return the last active buffer */ | |||
void *Image::Lock() | |||
void *image::Lock() | |||
{ | |||
ASSERT(m_data->m_format != PixelFormat::Unknown); | |||
return m_data->m_pixels[(int)m_data->m_format]->data(); | |||
} | |||
void Image::Unlock(void const *pixels) | |||
void image::Unlock(void const *pixels) | |||
{ | |||
ASSERT(m_data->m_pixels.has_key((int)m_data->m_format)); | |||
ASSERT(pixels == m_data->m_pixels[(int)m_data->m_format]->data()); | |||
@@ -17,7 +17,7 @@ | |||
namespace lol | |||
{ | |||
array2d<float> Image::BayerKernel(ivec2 size) | |||
array2d<float> image::BayerKernel(ivec2 size) | |||
{ | |||
array2d<float> ret(size); | |||
@@ -46,7 +46,7 @@ array2d<float> Image::BayerKernel(ivec2 size) | |||
return ret; | |||
} | |||
array2d<float> Image::HalftoneKernel(ivec2 size) | |||
array2d<float> image::HalftoneKernel(ivec2 size) | |||
{ | |||
array2d<float> ret(size); | |||
@@ -75,7 +75,7 @@ array2d<float> Image::HalftoneKernel(ivec2 size) | |||
return NormalizeKernel(ret); | |||
} | |||
array2d<float> Image::BlueNoiseKernel(ivec2 size, ivec2 gsize) | |||
array2d<float> image::BlueNoiseKernel(ivec2 size, ivec2 gsize) | |||
{ | |||
float const epsilon = 1.f / (size.x * size.y + 1); | |||
gsize = lol::min(size, gsize); | |||
@@ -180,7 +180,7 @@ static int cmpdot(const void *p1, const void *p2) | |||
return ((Dot const *)p1)->val > ((Dot const *)p2)->val; | |||
} | |||
array2d<float> Image::NormalizeKernel(array2d<float> const &kernel) | |||
array2d<float> image::NormalizeKernel(array2d<float> const &kernel) | |||
{ | |||
ivec2 size = kernel.size(); | |||
@@ -209,7 +209,7 @@ array2d<float> Image::NormalizeKernel(array2d<float> const &kernel) | |||
return dst; | |||
} | |||
array2d<float> Image::EdiffKernel(EdiffAlgorithm algorithm) | |||
array2d<float> image::EdiffKernel(EdiffAlgorithm algorithm) | |||
{ | |||
switch (algorithm) | |||
{ | |||
@@ -270,7 +270,7 @@ array2d<float> Image::EdiffKernel(EdiffAlgorithm algorithm) | |||
* there is little chance that any value below 0.2 will be useful. */ | |||
#define BLUR_EPSILON 0.2f | |||
array2d<float> Image::GaussianKernel(vec2 radius, float angle, vec2 delta) | |||
array2d<float> image::GaussianKernel(vec2 radius, float angle, vec2 delta) | |||
{ | |||
array2d<float> kernel; | |||
@@ -60,7 +60,7 @@ Movie::~Movie() | |||
delete m_data; | |||
} | |||
void Movie::Feed(Image const &image) | |||
void Movie::Feed(image const &image) | |||
{ | |||
#if LOL_USE_FFMPEG | |||
@@ -17,7 +17,7 @@ | |||
namespace lol | |||
{ | |||
bool Image::RenderRandom(ivec2 size) | |||
bool image::RenderRandom(ivec2 size) | |||
{ | |||
SetSize(size); | |||
vec4 *pixels = Lock<PixelFormat::RGBA_F32>(); | |||
@@ -60,7 +60,7 @@ static u8vec4 f32tou8(vec4 pixel) | |||
* Pixel-level image manipulation | |||
*/ | |||
PixelFormat Image::GetFormat() const | |||
PixelFormat image::GetFormat() const | |||
{ | |||
return m_data->m_format; | |||
} | |||
@@ -81,7 +81,7 @@ PixelFormat Image::GetFormat() const | |||
* x lossless conversion (u8 to float) | |||
* # lossy conversion (dithering and/or convert color→gray) | |||
*/ | |||
void Image::SetFormat(PixelFormat fmt) | |||
void image::SetFormat(PixelFormat fmt) | |||
{ | |||
PixelFormat old_fmt = m_data->m_format; | |||
@@ -17,10 +17,10 @@ | |||
namespace lol | |||
{ | |||
static Image ResizeBicubic(Image &image, ivec2 size); | |||
static Image ResizeBresenham(Image &image, ivec2 size); | |||
static image ResizeBicubic(image &src, ivec2 size); | |||
static image ResizeBresenham(image &src, ivec2 size); | |||
Image Image::Resize(ivec2 size, ResampleAlgorithm algorithm) | |||
image image::Resize(ivec2 size, ResampleAlgorithm algorithm) | |||
{ | |||
switch (algorithm) | |||
{ | |||
@@ -32,12 +32,12 @@ Image Image::Resize(ivec2 size, ResampleAlgorithm algorithm) | |||
} | |||
} | |||
static Image ResizeBicubic(Image &image, ivec2 size) | |||
static image ResizeBicubic(image &src, ivec2 size) | |||
{ | |||
Image dst(size); | |||
ivec2 const oldsize = image.GetSize(); | |||
image dst(size); | |||
ivec2 const oldsize = src.GetSize(); | |||
vec4 const *srcp = image.Lock<PixelFormat::RGBA_F32>(); | |||
vec4 const *srcp = src.Lock<PixelFormat::RGBA_F32>(); | |||
vec4 *dstp = dst.Lock<PixelFormat::RGBA_F32>(); | |||
float scalex = size.x > 1 ? (oldsize.x - 1.f) / (size.x - 1) : 1.f; | |||
@@ -122,7 +122,7 @@ static Image ResizeBicubic(Image &image, ivec2 size) | |||
} | |||
dst.Unlock(dstp); | |||
image.Unlock(srcp); | |||
src.Unlock(srcp); | |||
return dst; | |||
} | |||
@@ -134,13 +134,13 @@ static Image ResizeBicubic(Image &image, ivec2 size) | |||
/* FIXME: the algorithm does not handle alpha components properly. Resulting | |||
* alpha should be the mean alpha value of the neightbouring pixels, but | |||
* the colour components should be weighted with the alpha value. */ | |||
static Image ResizeBresenham(Image &image, ivec2 size) | |||
static image ResizeBresenham(image &src, ivec2 size) | |||
{ | |||
Image dst(size); | |||
ivec2 const oldsize = image.GetSize(); | |||
image dst(size); | |||
ivec2 const oldsize = src.GetSize(); | |||
float const invswsh = 1.0f / (oldsize.x * oldsize.y); | |||
vec4 const *srcp = image.Lock<PixelFormat::RGBA_F32>(); | |||
vec4 const *srcp = src.Lock<PixelFormat::RGBA_F32>(); | |||
vec4 *dstp = dst.Lock<PixelFormat::RGBA_F32>(); | |||
array<vec4> aline, line; | |||
@@ -199,7 +199,7 @@ static Image ResizeBresenham(Image &image, ivec2 size) | |||
} | |||
dst.Unlock(dstp); | |||
image.Unlock(srcp); | |||
src.Unlock(srcp); | |||
return dst; | |||
} | |||
@@ -88,13 +88,13 @@ ResourceCodecData* ResourceLoader::Load(char const *path) | |||
auto data = codec->Load(path); | |||
if (data != nullptr) | |||
{ | |||
msg::info("Image::Load: Codec %s succesfully loaded %s.\n", codec->GetName(), path); | |||
msg::info("image::Load: Codec %s succesfully loaded %s.\n", codec->GetName(), path); | |||
return data; | |||
} | |||
} | |||
//Log error, because we shouldn't be here | |||
msg::error("Image::Load: Last codec %s, Error loading resource %s.\n", last_codec->GetName(), path); | |||
msg::error("image::Load: Last codec %s, Error loading resource %s.\n", last_codec->GetName(), path); | |||
return nullptr; | |||
} | |||
@@ -106,13 +106,13 @@ bool ResourceLoader::Save(char const *path, ResourceCodecData* data) | |||
last_codec = codec; | |||
if (codec->Save(path, data)) | |||
{ | |||
msg::info("Image::Save: Codec %s succesfully saved %s.\n", codec->GetName(), path); | |||
msg::info("image::Save: Codec %s succesfully saved %s.\n", codec->GetName(), path); | |||
return true; | |||
} | |||
} | |||
//Log error, because we shouldn't be here | |||
msg::error("Image::Save: Last codec %s, Error saving resource %s.\n", last_codec->GetName(), path); | |||
msg::error("image::Save: Last codec %s, Error saving resource %s.\n", last_codec->GetName(), path); | |||
return false; | |||
} | |||
@@ -36,4 +36,5 @@ | |||
#include <lol/public.h> | |||
#include <lol/extras.h> | |||
#include <lol/legacy.h> | |||
@@ -31,4 +31,5 @@ | |||
#include <lol/public.h> | |||
#include <lol/extras.h> | |||
#include <lol/legacy.h> | |||
@@ -103,7 +103,7 @@ public: | |||
TextureUniform GetTextureUniform() const; | |||
ivec2 GetSize() const; | |||
class Image GetImage() const; | |||
class image GetImage() const; | |||
void Bind(); | |||
void Unbind(); | |||
@@ -13,7 +13,7 @@ | |||
#pragma once | |||
// | |||
// The Image class | |||
// The image class | |||
// --------------- | |||
// | |||
@@ -58,24 +58,24 @@ enum class EdiffAlgorithm : uint8_t | |||
Lite, | |||
}; | |||
//Image ----------------------------------------------------------------------- | |||
class Image | |||
// image ----------------------------------------------------------------------- | |||
class image | |||
{ | |||
public: | |||
Image(); | |||
Image(ivec2 size); | |||
image(); | |||
image(ivec2 size); | |||
/* XXX: use of this ctor should be discouraged, as it will not | |||
* return information about a possible error. */ | |||
Image(char const *path); | |||
image(char const *path); | |||
/* Rule of three */ | |||
Image(Image const &other); | |||
Image & operator =(Image other); | |||
~Image(); | |||
image(image const &other); | |||
image & operator =(image other); | |||
~image(); | |||
void DummyFill(); | |||
void Copy(uint8_t* pixels, ivec2 const& size, PixelFormat fmt); | |||
void Copy(Image const &other); | |||
void Copy(image const &other); | |||
bool Load(char const *path); | |||
bool Save(char const *path); | |||
@@ -121,51 +121,51 @@ public: | |||
bool RenderRandom(ivec2 size); | |||
/* Resize and crop */ | |||
Image Resize(ivec2 size, ResampleAlgorithm algorithm); | |||
Image Crop(ibox2 box) const; | |||
image Resize(ivec2 size, ResampleAlgorithm algorithm); | |||
image Crop(ibox2 box) const; | |||
/* Image processing */ | |||
Image AutoContrast() const; | |||
Image Brightness(float val) const; | |||
Image Contrast(float val) const; | |||
Image Convolution(array2d<float> const &kernel); | |||
Image Dilate(); | |||
Image Erode(); | |||
Image Invert() const; | |||
Image Median(ivec2 radii) const; | |||
Image Median(array2d<float> const &kernel) const; | |||
Image Sharpen(array2d<float> const &kernel); | |||
Image Threshold(float val) const; | |||
Image Threshold(vec3 val) const; | |||
Image RGBToYUV() const; | |||
Image YUVToRGB() const; | |||
image AutoContrast() const; | |||
image Brightness(float val) const; | |||
image Contrast(float val) const; | |||
image Convolution(array2d<float> const &kernel); | |||
image Dilate(); | |||
image Erode(); | |||
image Invert() const; | |||
image Median(ivec2 radii) const; | |||
image Median(array2d<float> const &kernel) const; | |||
image Sharpen(array2d<float> const &kernel); | |||
image Threshold(float val) const; | |||
image Threshold(vec3 val) const; | |||
image RGBToYUV() const; | |||
image YUVToRGB() const; | |||
/* Dithering */ | |||
Image DitherRandom() const; | |||
Image DitherEdiff(array2d<float> const &kernel, | |||
image DitherRandom() const; | |||
image DitherEdiff(array2d<float> const &kernel, | |||
ScanMode scan = ScanMode::Raster) const; | |||
Image DitherOstromoukhov(ScanMode scan = ScanMode::Raster) const; | |||
Image DitherOrdered(array2d<float> const &kernel) const; | |||
Image DitherHalftone(float radius, float angle) const; | |||
Image DitherDbs() const; | |||
image DitherOstromoukhov(ScanMode scan = ScanMode::Raster) const; | |||
image DitherOrdered(array2d<float> const &kernel) const; | |||
image DitherHalftone(float radius, float angle) const; | |||
image DitherDbs() const; | |||
/* Combine images */ | |||
static Image Merge(Image &src1, Image &src2, float alpha); | |||
static Image Mean(Image &src1, Image &src2); | |||
static Image Min(Image &src1, Image &src2); | |||
static Image Max(Image &src1, Image &src2); | |||
static Image Overlay(Image &src1, Image &src2); | |||
static Image Screen(Image &src1, Image &src2); | |||
static Image Multiply(Image &src1, Image &src2); | |||
static Image Divide(Image &src1, Image &src2); | |||
static Image Add(Image &src1, Image &src2); | |||
static Image Sub(Image &src1, Image &src2); | |||
static Image Difference(Image &src1, Image &src2); | |||
static image Merge(image &src1, image &src2, float alpha); | |||
static image Mean(image &src1, image &src2); | |||
static image Min(image &src1, image &src2); | |||
static image Max(image &src1, image &src2); | |||
static image Overlay(image &src1, image &src2); | |||
static image Screen(image &src1, image &src2); | |||
static image Multiply(image &src1, image &src2); | |||
static image Divide(image &src1, image &src2); | |||
static image Add(image &src1, image &src2); | |||
static image Sub(image &src1, image &src2); | |||
static image Difference(image &src1, image &src2); | |||
private: | |||
void *Lock2DHelper(PixelFormat T); | |||
class ImageData *m_data; | |||
class image_data *m_data; | |||
}; | |||
} /* namespace lol */ | |||
@@ -34,7 +34,7 @@ public: | |||
#endif | |||
~Movie(); | |||
void Feed(Image const &image); | |||
void Feed(image const &image); | |||
private: | |||
class MovieData *m_data; | |||
@@ -37,9 +37,9 @@ namespace lol | |||
class ResourceImageData : public ResourceCodecData | |||
{ | |||
public: | |||
ResourceImageData(Image* image) | |||
ResourceImageData(image* img) | |||
{ | |||
m_image = image; | |||
m_image = img; | |||
} | |||
virtual ~ResourceImageData() | |||
@@ -48,15 +48,15 @@ namespace lol | |||
delete m_image; | |||
} | |||
Image* m_image = nullptr; | |||
image* m_image = nullptr; | |||
}; | |||
//ResourceImageData ----------------------------------------------------------- | |||
class ResourceTilesetData : public ResourceImageData | |||
{ | |||
public: | |||
ResourceTilesetData(Image* image) | |||
: ResourceImageData(image) | |||
ResourceTilesetData(image* img) | |||
: ResourceImageData(img) | |||
{ } | |||
array<ivec2, ivec2> m_tiles; | |||
@@ -0,0 +1,26 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2017 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#pragma once | |||
// | |||
// Legacy types that will disappear one day | |||
// ---------------------------------------- | |||
// | |||
namespace lol | |||
{ | |||
typedef image Image; | |||
} /* namespace lol */ | |||
@@ -124,16 +124,16 @@ public: | |||
{ } | |||
//Returns a dummy image, and start a job to load the image on a thread | |||
Image* Load(const lol::String& path); | |||
bool CheckStatus(Image* image); | |||
image* Load(const lol::String& path); | |||
bool CheckStatus(image* img); | |||
protected: | |||
virtual void TreatResult(ThreadJob* result); | |||
private: | |||
Image m_dummy_image; | |||
map<String, Image*> m_images; | |||
array<Image*> m_loaded_images; | |||
image m_dummy_image; | |||
map<String, image*> m_images; | |||
array<image*> m_loaded_images; | |||
}; | |||
} /* namespace lol */ | |||
@@ -39,13 +39,13 @@ protected: | |||
public: | |||
TextureImage(char const *path); | |||
TextureImage(char const *path, Image* image); | |||
TextureImage(char const *path, image* img); | |||
virtual ~TextureImage(); | |||
protected: | |||
void Init(char const *path); | |||
virtual void Init(char const *path, ResourceCodecData* loaded_data); | |||
virtual void Init(char const *path, Image* image); | |||
virtual void Init(char const *path, image* img); | |||
protected: | |||
virtual void TickDraw(float seconds, Scene &scene); | |||
@@ -54,11 +54,11 @@ public: | |||
/* Inherited from Entity */ | |||
virtual char const *GetName(); | |||
void UpdateTexture(Image* image); | |||
void UpdateTexture(image* img); | |||
Texture * GetTexture(); | |||
Texture const * GetTexture() const; | |||
Image * GetImage(); | |||
Image const * GetImage() const; | |||
image * GetImage(); | |||
image const * GetImage() const; | |||
ivec2 GetImageSize() const; | |||
ivec2 GetTextureSize() const; | |||
void Bind(); | |||
@@ -30,10 +30,10 @@ public: | |||
static TileSet *Register(char const *path, ivec2 size, ivec2 count); | |||
static TileSet *Register(String const &path); | |||
static TileSet *Register(char const *path); | |||
static TileSet *Register(String const &path, Image* image, ivec2 size, ivec2 count); | |||
static TileSet *Register(char const *path, Image* image, ivec2 size, ivec2 count); | |||
static TileSet *Register(String const &path, Image* image); | |||
static TileSet *Register(char const *path, Image* image); | |||
static TileSet *Register(String const &path, image* img, ivec2 size, ivec2 count); | |||
static TileSet *Register(char const *path, image* img, ivec2 size, ivec2 count); | |||
static TileSet *Register(String const &path, image* img); | |||
static TileSet *Register(char const *path, image* img); | |||
static void Deregister(TileSet *); | |||
private: | |||
@@ -42,18 +42,18 @@ class TileSet : public TextureImage | |||
public: | |||
TileSet(char const *path); | |||
TileSet(char const *path, Image* image); | |||
TileSet(char const *path, Image* image, array<ivec2, ivec2>& tiles); | |||
TileSet(char const *path, image* img); | |||
TileSet(char const *path, image* img, array<ivec2, ivec2>& tiles); | |||
/* Old style: path to PNG file */ | |||
TileSet(char const *path, ivec2 size, ivec2 count); | |||
TileSet(char const *path, Image* image, ivec2 size, ivec2 count); | |||
TileSet(char const *path, image* img, ivec2 size, ivec2 count); | |||
virtual ~TileSet(); | |||
protected: | |||
virtual void Init(char const *path, ResourceCodecData* loaded_data); | |||
virtual void Init(char const *path, Image* image); | |||
virtual void Init(char const *path, image* img); | |||
public: | |||
/* Inherited from Entity */ | |||