# split pd-maths into pd-core and pd-image (0.2.3)

This commit is contained in:
2025-02-28 21:14:20 +01:00
parent debedf59c6
commit af3d3e0b5b
32 changed files with 81 additions and 113 deletions

View File

@ -25,21 +25,21 @@ SOFTWARE.
*/
// Core
#include <pd/core/bit_util.hpp>
#include <pd/core/color.hpp>
#include <pd/core/common.hpp>
#include <pd/core/io.hpp>
#include <pd/core/strings.hpp>
#include <pd/core/sys.hpp>
#include <pd/core/timer.hpp>
#include <pd/core/timetrace.hpp>
#include <pd/core/vec.hpp>
// Graphics
#include <pd/lithium/renderer.hpp>
#include <pd/lithium/spritesheet.hpp>
// Maths
#include <pd/maths/bit_util.hpp>
#include <pd/maths/color.hpp>
#include <pd/maths/img_blur.hpp>
#include <pd/maths/img_convert.hpp>
#include <pd/maths/vec.hpp>
// Image
#include <pd/image/img_blur.hpp>
#include <pd/image/img_convert.hpp>
// Drivers
#include <pd/drivers/hid.hpp>
// Overlays

View File

@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
template <typename T>

View File

@ -24,7 +24,7 @@ SOFTWARE.
*/
#include <pd/core/common.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
class Hid : public SmartCtor<Hid> {

View File

@ -25,8 +25,7 @@ SOFTWARE.
*/
#include <pd/core/common.hpp>
#include <pd/maths/img.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace ImgBlur {
@ -38,8 +37,11 @@ std::vector<float> GaussianKernel(int radius, float si);
/// @param radius // Blur radius
/// @param si // Blur sigma
/// @param idxfn // Indexing function (if buffer is 3ds tiled)
void GaussianBlur(std::vector<u8> &buf, int w, int h, float radius, float si,
std::function<int(int, int, int)> idxfn = Img::IndexDefault);
void GaussianBlur(
std::vector<u8> &buf, int w, int h, float radius, float si,
std::function<int(int, int, int)> idxfn = [](int x, int y, int w) -> int {
return y * w + x;
});
/// @brief Advanced func to access memory directly
/// @param buf Referenvce to the buffer
/// @param w // width of the image
@ -48,7 +50,10 @@ void GaussianBlur(std::vector<u8> &buf, int w, int h, float radius, float si,
/// @param radius // Blur radius
/// @param si // Blur sigma
/// @param idxfn // Indexing function (if buffer is 3ds tiled)
void GaussianBlur(void *buf, int w, int h, int bpp, float radius, float si,
std::function<int(int, int, int)> idxfn = Img::IndexDefault);
void GaussianBlur(
void *buf, int w, int h, int bpp, float radius, float si,
std::function<int(int, int, int)> idxfn = [](int x, int y, int w) -> int {
return y * w + x;
});
} // namespace ImgBlur
} // namespace PD

View File

@ -28,7 +28,7 @@ SOFTWARE.
#include <pd/lithium/flags.hpp>
#include <pd/lithium/texture.hpp>
#include <pd/lithium/vertex.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace LI {

View File

@ -27,7 +27,7 @@ SOFTWARE.
#include <pd/core/common.hpp>
#include <pd/lithium/rect.hpp>
#include <pd/lithium/texture.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace LI {

View File

@ -30,7 +30,7 @@ SOFTWARE.
#include <pd/lithium/font.hpp>
#include <pd/lithium/texture.hpp>
#include <pd/lithium/vertex.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace LI {

View File

@ -24,7 +24,7 @@ SOFTWARE.
*/
#include <pd/core/common.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace LI {

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include <pd/lithium/screen.hpp>
#include <pd/lithium/texture.hpp>
#include <pd/lithium/vertex.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace LI {

View File

@ -27,7 +27,7 @@ SOFTWARE.
#include <citro3d.h>
#include <pd/core/common.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
class Screen : public SmartCtor<Screen> {

View File

@ -28,7 +28,7 @@ SOFTWARE.
#include <pd/core/common.hpp>
#include <pd/lithium/rect.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
class Texture : public SmartCtor<Texture> {

View File

@ -25,7 +25,7 @@ SOFTWARE.
*/
#include <pd/core/common.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
namespace PD {
namespace LI {

View File

@ -1,39 +0,0 @@
#pragma once
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <pd/core/common.hpp>
#include <pd/maths/vec.hpp>
namespace PD {
namespace Img {
inline int Index3dsTex(int x, int y, int width) {
return ((((y >> 3) * (width >> 3) + (x >> 3)) << 6) +
((x & 1) | ((y & 1) << 1) | ((x & 2) << 1) | ((y & 2) << 2) |
((x & 4) << 2) | ((y & 4) << 3)));
}
inline int IndexDefault(int x, int y, int width) { return y * width + x; }
} // namespace Img
} // namespace PD

View File

@ -24,7 +24,7 @@ SOFTWARE.
*/
#include <pd/drivers/hid.hpp>
#include <pd/maths/tween.hpp>
#include <pd/core/tween.hpp>
#include <pd/overlays/overlay.hpp>
namespace PD {

View File

@ -24,8 +24,8 @@ SOFTWARE.
*/
#include <pd/lithium/renderer.hpp>
#include <pd/maths/color.hpp>
#include <pd/maths/tween.hpp>
#include <pd/core/color.hpp>
#include <pd/core/tween.hpp>
namespace PD {
class MessageMgr : public PD::SmartCtor<MessageMgr> {

View File

@ -24,7 +24,7 @@ SOFTWARE.
*/
#include <pd/drivers/hid.hpp>
#include <pd/maths/tween.hpp>
#include <pd/core/tween.hpp>
#include <pd/overlays/overlay.hpp>
#include <pd/ui7/ui7.hpp>

View File

@ -26,7 +26,7 @@ SOFTWARE.
#include <pd/core/common.hpp>
#include <pd/core/strings.hpp>
#include <pd/drivers/hid.hpp>
#include <pd/maths/vec.hpp>
#include <pd/core/vec.hpp>
#include <pd/ui7/drawlist.hpp>
namespace PD {

View File

@ -24,7 +24,7 @@ SOFTWARE.
*/
#include <pd/drivers/hid.hpp>
#include <pd/maths/tween.hpp>
#include <pd/core/tween.hpp>
#include <pd/ui7/containers.hpp>
#include <pd/ui7/drawlist.hpp>
#include <pd/ui7/flags.hpp>