Let's just use 1 PD_API header
This commit is contained in:
@@ -33,7 +33,7 @@ SOFTWARE.
|
||||
#include <pd/image/img_convert.hpp>
|
||||
|
||||
namespace PD {
|
||||
PD_IMAGE_API void Image::Load(const std::string& path) {
|
||||
PD_API void Image::Load(const std::string& path) {
|
||||
u8* img = pdi_load(path.c_str(), &pWidth, &pHeight, &fmt, 4);
|
||||
if (fmt == 3) {
|
||||
pdi_image_free(img);
|
||||
@@ -47,7 +47,7 @@ PD_IMAGE_API void Image::Load(const std::string& path) {
|
||||
pdi_image_free(img);
|
||||
}
|
||||
}
|
||||
PD_IMAGE_API void Image::Load(const std::vector<u8>& buf) {
|
||||
PD_API void Image::Load(const std::vector<u8>& buf) {
|
||||
u8* img =
|
||||
pdi_load_from_memory(buf.data(), buf.size(), &pWidth, &pHeight, &fmt, 4);
|
||||
if (fmt == 3) {
|
||||
@@ -63,8 +63,7 @@ PD_IMAGE_API void Image::Load(const std::vector<u8>& buf) {
|
||||
pFmt = RGBA;
|
||||
}
|
||||
}
|
||||
PD_IMAGE_API void Image::Copy(const std::vector<u8>& buf, int w, int h,
|
||||
int bpp) {
|
||||
PD_API void Image::Copy(const std::vector<u8>& buf, int w, int h, int bpp) {
|
||||
this->fmt = bpp;
|
||||
if (buf.size() != (size_t)w * h * bpp) {
|
||||
// Size Error
|
||||
@@ -76,7 +75,7 @@ PD_IMAGE_API void Image::Copy(const std::vector<u8>& buf, int w, int h,
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void Image::FlipHorizontal() {
|
||||
PD_API void Image::FlipHorizontal() {
|
||||
/**
|
||||
* Dont know if i am brain dead but i think this code
|
||||
* should Horizpntal flip an image
|
||||
@@ -96,7 +95,7 @@ PD_IMAGE_API void Image::FlipHorizontal() {
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void Image::FlipVertical() {
|
||||
PD_API void Image::FlipVertical() {
|
||||
/**
|
||||
* Dont know if i am brain dead but i think this code
|
||||
* should Vertical flip an image
|
||||
@@ -116,7 +115,7 @@ PD_IMAGE_API void Image::FlipVertical() {
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void Image::Convert(Image::Ref img, Image::Format dst) {
|
||||
PD_API void Image::Convert(Image::Ref img, Image::Format dst) {
|
||||
if (img->pFmt == dst) {
|
||||
return;
|
||||
} else if (img->pFmt == Image::RGB && dst == Image::BGR) {
|
||||
@@ -163,7 +162,7 @@ PD_IMAGE_API void Image::Convert(Image::Ref img, Image::Format dst) {
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API int Image::Fmt2Bpp(Format fmt) {
|
||||
PD_API int Image::Fmt2Bpp(Format fmt) {
|
||||
switch (fmt) {
|
||||
case RGBA:
|
||||
case ABGR:
|
||||
@@ -183,9 +182,9 @@ PD_IMAGE_API int Image::Fmt2Bpp(Format fmt) {
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void Image::ReTile(Image::Ref img,
|
||||
std::function<u32(int x, int y, int w)> src,
|
||||
std::function<u32(int x, int y, int w)> dst) {
|
||||
PD_API void Image::ReTile(Image::Ref img,
|
||||
std::function<u32(int x, int y, int w)> src,
|
||||
std::function<u32(int x, int y, int w)> dst) {
|
||||
std::vector<PD::u8> cpy = img->pBuffer;
|
||||
/** could use fmt here but for 565 that woulnt work as it is not supported by
|
||||
* file loading where fmt is used */
|
||||
|
||||
@@ -29,7 +29,7 @@ SOFTWARE.
|
||||
|
||||
namespace PD {
|
||||
namespace ImgBlur {
|
||||
PD_IMAGE_API std::vector<float> GaussianKernel(int r, float si) {
|
||||
PD_API std::vector<float> GaussianKernel(int r, float si) {
|
||||
/// Define radius as r to be shorter
|
||||
int size = 2 * r + 1;
|
||||
std::vector<float> kernel(size);
|
||||
@@ -45,15 +45,13 @@ PD_IMAGE_API std::vector<float> GaussianKernel(int r, float si) {
|
||||
}
|
||||
return kernel;
|
||||
}
|
||||
PD_IMAGE_API void GaussianBlur(std::vector<u8>& buf, int w, int h, float radius,
|
||||
float si,
|
||||
std::function<int(int, int, int)> idxfn) {
|
||||
PD_API void GaussianBlur(std::vector<u8>& buf, int w, int h, float radius,
|
||||
float si, std::function<int(int, int, int)> idxfn) {
|
||||
GaussianBlur(buf.data(), w, h, 4, radius, si, idxfn);
|
||||
}
|
||||
|
||||
PD_IMAGE_API void GaussianBlur(void* buf, int w, int h, int bpp, float radius,
|
||||
float si,
|
||||
std::function<int(int, int, int)> idxfn) {
|
||||
PD_API void GaussianBlur(void* buf, int w, int h, int bpp, float radius,
|
||||
float si, std::function<int(int, int, int)> idxfn) {
|
||||
if (bpp != 4 && bpp != 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ SOFTWARE.
|
||||
|
||||
namespace PD::ImgConvert {
|
||||
|
||||
PD_IMAGE_API void RGB24toRGBA32(std::vector<u8>& out, const std::vector<u8>& in,
|
||||
const int& w, const int& h) {
|
||||
PD_API void RGB24toRGBA32(std::vector<u8>& out, const std::vector<u8>& in,
|
||||
const int& w, const int& h) {
|
||||
// Converts RGB24 to RGBA32
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
@@ -40,8 +40,8 @@ PD_IMAGE_API void RGB24toRGBA32(std::vector<u8>& out, const std::vector<u8>& in,
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void RGB32toRGBA24(std::vector<u8>& out, const std::vector<u8>& in,
|
||||
const int& w, const int& h) {
|
||||
PD_API void RGB32toRGBA24(std::vector<u8>& out, const std::vector<u8>& in,
|
||||
const int& w, const int& h) {
|
||||
// Converts RGB24 to RGBA32
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
@@ -54,7 +54,7 @@ PD_IMAGE_API void RGB32toRGBA24(std::vector<u8>& out, const std::vector<u8>& in,
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void Reverse32(std::vector<u8>& buf, const int& w, const int& h) {
|
||||
PD_API void Reverse32(std::vector<u8>& buf, const int& w, const int& h) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
for (int y = 0; y < h; y++) {
|
||||
int i = y * w + x;
|
||||
@@ -68,7 +68,7 @@ PD_IMAGE_API void Reverse32(std::vector<u8>& buf, const int& w, const int& h) {
|
||||
}
|
||||
}
|
||||
|
||||
PD_IMAGE_API void ReverseBuf(std::vector<u8>& buf, size_t bpp, int w, int h) {
|
||||
PD_API void ReverseBuf(std::vector<u8>& buf, size_t bpp, int w, int h) {
|
||||
std::vector<u8> cpy = buf;
|
||||
for (int x = 0; x < w; x++) {
|
||||
for (int y = 0; y < h; y++) {
|
||||
|
||||
Reference in New Issue
Block a user