diff --git a/Siv3D/include/Siv3D/Array.hpp b/Siv3D/include/Siv3D/Array.hpp index 863728b94..00fe59793 100644 --- a/Siv3D/include/Siv3D/Array.hpp +++ b/Siv3D/include/Siv3D/Array.hpp @@ -733,7 +733,13 @@ namespace s3d /// @param index /// @return [[nodiscard]] - Array removed_at(size_t index) const; + Array removed_at(size_t index) const&; + + /// @brief + /// @param index + /// @return + [[nodiscard]] + Array removed_at(size_t index) &&; /// @brief 条件を満たす要素を配列から削除します。 /// @tparam Fty 条件を記述した関数の型 @@ -1049,7 +1055,12 @@ namespace s3d /// @brief /// @return [[nodiscard]] - Array stable_uniqued() const; + Array stable_uniqued() const&; + + /// @brief + /// @return + [[nodiscard]] + Array stable_uniqued() &&; /// @brief /// @return diff --git a/Siv3D/include/Siv3D/Image.hpp b/Siv3D/include/Siv3D/Image.hpp index 161015a98..a9d6a0d9e 100644 --- a/Siv3D/include/Siv3D/Image.hpp +++ b/Siv3D/include/Siv3D/Image.hpp @@ -407,96 +407,144 @@ namespace s3d Image& negate(); [[nodiscard]] - Image negated() const; + Image negated() const&; + + [[nodiscard]] + Image negated() &&; /// @brief 画像をグレイスケール画像に変換します。 /// @return *this Image& grayscale(); [[nodiscard]] - Image grayscaled() const; + Image grayscaled() const&; + + [[nodiscard]] + Image grayscaled() &&; /// @brief 画像をセピア画像に変換します。 /// @return *this Image& sepia(); [[nodiscard]] - Image sepiaed() const; + Image sepiaed() const&; + + [[nodiscard]] + Image sepiaed() &&; Image& posterize(int32 level); [[nodiscard]] - Image posterized(int32 level) const; + Image posterized(int32 level) const&; + + [[nodiscard]] + Image posterized(int32 level) &&; Image& brighten(int32 level); [[nodiscard]] - Image brightened(int32 level) const; + Image brightened(int32 level) const&; + + [[nodiscard]] + Image brightened(int32 level) &&; /// @brief 画像を左右反転します。 /// @return *this Image& mirror(); [[nodiscard]] - Image mirrored() const; + Image mirrored() const&; + + [[nodiscard]] + Image mirrored() &&; /// @brief 画像を上下反転します。 /// @return *this Image& flip(); [[nodiscard]] - Image flipped() const; + Image flipped() const&; + + [[nodiscard]] + Image flipped() &&; /// @brief 画像を時計回りに 90° 回転します。 /// @return *this Image& rotate90(); [[nodiscard]] - Image rotated90() const; + Image rotated90() const&; + + [[nodiscard]] + Image rotated90() &&; /// @brief 画像を時計回りに 180° 回転します。 /// @return *this Image& rotate180(); [[nodiscard]] - Image rotated180() const; + Image rotated180() const&; + + [[nodiscard]] + Image rotated180() &&; /// @brief 画像を時計回りに 270° 回転します。 /// @return *this Image& rotate270(); [[nodiscard]] - Image rotated270() const; + Image rotated270() const&; + + [[nodiscard]] + Image rotated270() &&; Image& gammaCorrect(double gamma); [[nodiscard]] - Image gammaCorrected(double gamma) const; + Image gammaCorrected(double gamma) const&; + + [[nodiscard]] + Image gammaCorrected(double gamma) &&; Image& threshold(uint8 threshold, InvertColor invertColor = InvertColor::No); [[nodiscard]] - Image thresholded(uint8 threshold, InvertColor invertColor = InvertColor::No) const; + Image thresholded(uint8 threshold, InvertColor invertColor = InvertColor::No) const&; + + [[nodiscard]] + Image thresholded(uint8 threshold, InvertColor invertColor = InvertColor::No) &&; Image& threshold_Otsu(InvertColor invertColor = InvertColor::No); [[nodiscard]] - Image thresholded_Otsu(InvertColor invertColor = InvertColor::No) const; + Image thresholded_Otsu(InvertColor invertColor = InvertColor::No) const&; + + [[nodiscard]] + Image thresholded_Otsu(InvertColor invertColor = InvertColor::No) &&; Image& adaptiveThreshold(AdaptiveThresholdMethod method, int32 blockSize, double c, InvertColor invertColor = InvertColor::No); [[nodiscard]] - Image adaptiveThresholded(AdaptiveThresholdMethod method, int32 blockSize, double c, InvertColor invertColor = InvertColor::No) const; + Image adaptiveThresholded(AdaptiveThresholdMethod method, int32 blockSize, double c, InvertColor invertColor = InvertColor::No) const&; + + [[nodiscard]] + Image adaptiveThresholded(AdaptiveThresholdMethod method, int32 blockSize, double c, InvertColor invertColor = InvertColor::No) &&; Image& mosaic(int32 size); Image& mosaic(int32 horizontal, int32 vertical); [[nodiscard]] - Image mosaiced(int32 size) const; + Image mosaiced(int32 size) const&; + + [[nodiscard]] + Image mosaiced(int32 size) &&; + + [[nodiscard]] + Image mosaiced(int32 horizontal, int32 vertical) const&; [[nodiscard]] - Image mosaiced(int32 horizontal, int32 vertical) const; + Image mosaiced(int32 horizontal, int32 vertical) &&; Image& spread(int32 size); @@ -513,45 +561,72 @@ namespace s3d Image& blur(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101); [[nodiscard]] - Image blurred(int32 size, BorderType borderType = BorderType::Reflect_101) const; + Image blurred(int32 size, BorderType borderType = BorderType::Reflect_101) const&; [[nodiscard]] - Image blurred(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101) const; + Image blurred(int32 size, BorderType borderType = BorderType::Reflect_101) &&; + + [[nodiscard]] + Image blurred(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101) const&; + + [[nodiscard]] + Image blurred(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101) &&; Image& medianBlur(int32 apertureSize); [[nodiscard]] - Image medianBlurred(int32 apertureSize) const; + Image medianBlurred(int32 apertureSize) const&; + + [[nodiscard]] + Image medianBlurred(int32 apertureSize) &&; Image& gaussianBlur(int32 size, BorderType borderType = BorderType::Reflect_101); Image& gaussianBlur(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101); [[nodiscard]] - Image gaussianBlurred(int32 size, BorderType borderType = BorderType::Reflect_101) const; + Image gaussianBlurred(int32 size, BorderType borderType = BorderType::Reflect_101) const&; [[nodiscard]] - Image gaussianBlurred(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101) const; + Image gaussianBlurred(int32 size, BorderType borderType = BorderType::Reflect_101) &&; + + [[nodiscard]] + Image gaussianBlurred(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101) const&; + + [[nodiscard]] + Image gaussianBlurred(int32 horizontal, int32 vertical, BorderType borderType = BorderType::Reflect_101) &&; Image& bilateralFilter(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101); [[nodiscard]] - Image bilateralFiltered(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101) const; + Image bilateralFiltered(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101) const&; + + [[nodiscard]] + Image bilateralFiltered(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101) &&; Image& dilate(int32 iterations = 1); [[nodiscard]] - Image dilated(int32 iterations = 1) const; + Image dilated(int32 iterations = 1) const&; + + [[nodiscard]] + Image dilated(int32 iterations = 1) &&; Image& erode(int32 iterations = 1); [[nodiscard]] - Image eroded(int32 iterations = 1) const; + Image eroded(int32 iterations = 1) const&; + + [[nodiscard]] + Image eroded(int32 iterations = 1) &&; Image& floodFill(const Point& pos, const Color& color, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0); [[nodiscard]] - Image floodFilled(const Point& pos, const Color& color, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0) const; + Image floodFilled(const Point& pos, const Color& color, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0) const&; + + [[nodiscard]] + Image floodFilled(const Point& pos, const Color& color, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0) &&; Image& scale(int32 width, int32 height, InterpolationAlgorithm interpolation = InterpolationAlgorithm::Auto); diff --git a/Siv3D/include/Siv3D/LineString.hpp b/Siv3D/include/Siv3D/LineString.hpp index b7307715d..1889703a7 100644 --- a/Siv3D/include/Siv3D/LineString.hpp +++ b/Siv3D/include/Siv3D/LineString.hpp @@ -321,7 +321,12 @@ namespace s3d /// @brief 連続する線分の向きを反転した新しい LineString を返します。 /// @return 連続する線分の向きを反転した新しい LineString [[nodiscard]] - LineString reversed() const; + LineString reversed() const&; + + /// @brief 連続する線分の向きを反転した新しい LineString を返します。 + /// @return 連続する線分の向きを反転した新しい LineString + [[nodiscard]] + LineString reversed() &&; LineString& shuffle(); @@ -376,23 +381,38 @@ namespace s3d Vec2 normalAtLine(size_t index, CloseRing closeRing = CloseRing::No) const; [[nodiscard]] - LineString movedBy(double x, double y) const; + LineString movedBy(double x, double y) const&; + + [[nodiscard]] + LineString movedBy(double x, double y) && noexcept; + + [[nodiscard]] + LineString movedBy(Vec2 v) const&; [[nodiscard]] - LineString movedBy(Vec2 v) const; + LineString movedBy(Vec2 v) && noexcept; LineString& moveBy(double x, double y) noexcept; LineString& moveBy(Vec2 v) noexcept; [[nodiscard]] - LineString scaled(double s) const; + LineString scaled(double s) const&; + + [[nodiscard]] + LineString scaled(double s) &&; [[nodiscard]] - LineString scaled(double sx, double sy) const; + LineString scaled(double sx, double sy) const&; [[nodiscard]] - LineString scaled(Vec2 s) const; + LineString scaled(double sx, double sy) &&; + + [[nodiscard]] + LineString scaled(Vec2 s) const&; + + [[nodiscard]] + LineString scaled(Vec2 s) &&; LineString& scale(double s); @@ -401,13 +421,22 @@ namespace s3d LineString& scale(Vec2 s); [[nodiscard]] - LineString scaledAt(Vec2 pos, double s) const; + LineString scaledAt(Vec2 pos, double s) const&; + + [[nodiscard]] + LineString scaledAt(Vec2 pos, double s) &&; + + [[nodiscard]] + LineString scaledAt(Vec2 pos, double sx, double sy) const&; + + [[nodiscard]] + LineString scaledAt(Vec2 pos, double sx, double sy) &&; [[nodiscard]] - LineString scaledAt(Vec2 pos, double sx, double sy) const; + LineString scaledAt(Vec2 pos, Vec2 s) const&; [[nodiscard]] - LineString scaledAt(Vec2 pos, Vec2 s) const; + LineString scaledAt(Vec2 pos, Vec2 s) &&; LineString& scaleAt(Vec2 pos, double s); diff --git a/Siv3D/include/Siv3D/MultiPolygon.hpp b/Siv3D/include/Siv3D/MultiPolygon.hpp index 8e41cd753..af0a08f06 100644 --- a/Siv3D/include/Siv3D/MultiPolygon.hpp +++ b/Siv3D/include/Siv3D/MultiPolygon.hpp @@ -309,7 +309,10 @@ namespace s3d MultiPolygon& reverse(); [[nodiscard]] - MultiPolygon reversed() const; + MultiPolygon reversed() const&; + + [[nodiscard]] + MultiPolygon reversed() &&; MultiPolygon& shuffle(); @@ -321,38 +324,62 @@ namespace s3d MultiPolygon slice(size_t index, size_t length) const; [[nodiscard]] - MultiPolygon movedBy(double x, double y) const; + MultiPolygon movedBy(double x, double y) const&; + + [[nodiscard]] + MultiPolygon movedBy(double x, double y) && noexcept; + + [[nodiscard]] + MultiPolygon movedBy(Vec2 v) const&; [[nodiscard]] - MultiPolygon movedBy(Vec2 v) const; + MultiPolygon movedBy(Vec2 v) && noexcept; MultiPolygon& moveBy(double x, double y) noexcept; MultiPolygon& moveBy(Vec2 v) noexcept; [[nodiscard]] - MultiPolygon rotated(double angle) const; + MultiPolygon rotated(double angle) const&; [[nodiscard]] - MultiPolygon rotatedAt(const Vec2& pos, double angle) const; + MultiPolygon rotated(double angle) &&; + + [[nodiscard]] + MultiPolygon rotatedAt(const Vec2& pos, double angle) const&; + + [[nodiscard]] + MultiPolygon rotatedAt(const Vec2& pos, double angle) &&; MultiPolygon& rotate(double angle); MultiPolygon& rotateAt(const Vec2& pos, double angle); [[nodiscard]] - MultiPolygon transformed(double s, double c, const Vec2& pos) const; + MultiPolygon transformed(double s, double c, const Vec2& pos) const&; + + [[nodiscard]] + MultiPolygon transformed(double s, double c, const Vec2& pos) &&; MultiPolygon& transform(double s, double c, const Vec2& pos); [[nodiscard]] - MultiPolygon scaled(double s) const; + MultiPolygon scaled(double s) const&; [[nodiscard]] - MultiPolygon scaled(double sx, double sy) const; + MultiPolygon scaled(double s) &&; [[nodiscard]] - MultiPolygon scaled(Vec2 s) const; + MultiPolygon scaled(double sx, double sy) const&; + + [[nodiscard]] + MultiPolygon scaled(double sx, double sy) &&; + + [[nodiscard]] + MultiPolygon scaled(Vec2 s) const&; + + [[nodiscard]] + MultiPolygon scaled(Vec2 s) &&; MultiPolygon& scale(double s); @@ -361,13 +388,22 @@ namespace s3d MultiPolygon& scale(Vec2 s); [[nodiscard]] - MultiPolygon scaledAt(Vec2 pos, double s) const; + MultiPolygon scaledAt(Vec2 pos, double s) const&; + + [[nodiscard]] + MultiPolygon scaledAt(Vec2 pos, double s) &&; + + [[nodiscard]] + MultiPolygon scaledAt(Vec2 pos, double sx, double sy) const&; + + [[nodiscard]] + MultiPolygon scaledAt(Vec2 pos, double sx, double sy) &&; [[nodiscard]] - MultiPolygon scaledAt(Vec2 pos, double sx, double sy) const; + MultiPolygon scaledAt(Vec2 pos, Vec2 s) const&; [[nodiscard]] - MultiPolygon scaledAt(Vec2 pos, Vec2 s) const; + MultiPolygon scaledAt(Vec2 pos, Vec2 s) &&; MultiPolygon& scaleAt(Vec2 pos, double s); diff --git a/Siv3D/include/Siv3D/Polygon.hpp b/Siv3D/include/Siv3D/Polygon.hpp index 778e3a79c..15a631bfa 100644 --- a/Siv3D/include/Siv3D/Polygon.hpp +++ b/Siv3D/include/Siv3D/Polygon.hpp @@ -173,23 +173,38 @@ namespace s3d bool addHoles(Array> holes); [[nodiscard]] - Polygon movedBy(double x, double y) const; + Polygon movedBy(double x, double y) const&; [[nodiscard]] - Polygon movedBy(Vec2 v) const; + Polygon movedBy(double x, double y) && noexcept; + + [[nodiscard]] + Polygon movedBy(Vec2 v) const&; + + [[nodiscard]] + Polygon movedBy(Vec2 v) && noexcept; Polygon& moveBy(double x, double y) noexcept; Polygon& moveBy(Vec2 v) noexcept; [[nodiscard]] - Polygon rotated(double angle) const; + Polygon rotated(double angle) const&; + + [[nodiscard]] + Polygon rotated(double angle) &&; [[nodiscard]] - Polygon rotatedAt(double x, double y, double angle) const; + Polygon rotatedAt(double x, double y, double angle) const&; [[nodiscard]] - Polygon rotatedAt(Vec2 pos, double angle) const; + Polygon rotatedAt(double x, double y, double angle) &&; + + [[nodiscard]] + Polygon rotatedAt(Vec2 pos, double angle) const&; + + [[nodiscard]] + Polygon rotatedAt(Vec2 pos, double angle) &&; Polygon& rotate(double angle); @@ -198,18 +213,30 @@ namespace s3d Polygon& rotateAt(Vec2 pos, double angle); [[nodiscard]] - Polygon transformed(double s, double c, const Vec2& pos) const; + Polygon transformed(double s, double c, const Vec2& pos) const&; + + [[nodiscard]] + Polygon transformed(double s, double c, const Vec2& pos) &&; Polygon& transform(double s, double c, const Vec2& pos); [[nodiscard]] - Polygon scaled(double s) const; + Polygon scaled(double s) const&; [[nodiscard]] - Polygon scaled(double sx, double sy) const; + Polygon scaled(double s) &&; + + [[nodiscard]] + Polygon scaled(double sx, double sy) const&; + + [[nodiscard]] + Polygon scaled(double sx, double sy) &&; + + [[nodiscard]] + Polygon scaled(Vec2 s) const&; [[nodiscard]] - Polygon scaled(Vec2 s) const; + Polygon scaled(Vec2 s) &&; Polygon& scale(double s); @@ -218,13 +245,22 @@ namespace s3d Polygon& scale(Vec2 s); [[nodiscard]] - Polygon scaledAt(Vec2 pos, double s) const; + Polygon scaledAt(Vec2 pos, double s) const&; + + [[nodiscard]] + Polygon scaledAt(Vec2 pos, double s) &&; + + [[nodiscard]] + Polygon scaledAt(Vec2 pos, double sx, double sy) const&; + + [[nodiscard]] + Polygon scaledAt(Vec2 pos, double sx, double sy) &&; [[nodiscard]] - Polygon scaledAt(Vec2 pos, double sx, double sy) const; + Polygon scaledAt(Vec2 pos, Vec2 s) const&; [[nodiscard]] - Polygon scaledAt(Vec2 pos, Vec2 s) const; + Polygon scaledAt(Vec2 pos, Vec2 s) &&; Polygon& scaleAt(Vec2 pos, double s); diff --git a/Siv3D/include/Siv3D/String.hpp b/Siv3D/include/Siv3D/String.hpp index 315505a01..362fc68e4 100644 --- a/Siv3D/include/Siv3D/String.hpp +++ b/Siv3D/include/Siv3D/String.hpp @@ -809,7 +809,13 @@ namespace s3d /// @param s 除去対象の文字列 /// @return 新しい文字列 [[nodiscard]] - String removed(StringView s) const; + String removed(StringView s) const&; + + /// @brief 指定した文字列を除去した新しい文字列を返します。 + /// @param s 除去対象の文字列 + /// @return 新しい文字列 + [[nodiscard]] + String removed(StringView s) &&; /// @brief 指定したインデックスにある要素を文字列から削除します。 /// @param index インデックス @@ -1163,7 +1169,12 @@ namespace s3d /// @brief 文字列をソートせずに、重複する文字を削除した新しい文字列を返します。 /// @return 新しい文字列 [[nodiscard]] - String stable_uniqued() const; + String stable_uniqued() const&; + + /// @brief 文字列をソートせずに、重複する文字を削除した新しい文字列を返します。 + /// @return 新しい文字列 + [[nodiscard]] + String stable_uniqued() &&; /// @brief 文字列をソートし、重複する文字を削除します。 /// @return *this diff --git a/Siv3D/include/Siv3D/Wave.hpp b/Siv3D/include/Siv3D/Wave.hpp index e7dfdaa4e..cfead26ca 100644 --- a/Siv3D/include/Siv3D/Wave.hpp +++ b/Siv3D/include/Siv3D/Wave.hpp @@ -357,7 +357,10 @@ namespace s3d Wave& reverse(); [[nodiscard]] - Wave reversed() const; + Wave reversed() const&; + + [[nodiscard]] + Wave reversed() &&; [[nodiscard]] Wave slice(size_t index) const; diff --git a/Siv3D/include/Siv3D/detail/Array.ipp b/Siv3D/include/Siv3D/detail/Array.ipp index c12954d74..c761768ba 100644 --- a/Siv3D/include/Siv3D/detail/Array.ipp +++ b/Siv3D/include/Siv3D/detail/Array.ipp @@ -935,7 +935,7 @@ namespace s3d } template - inline Array Array::removed_at(const size_t index) const + inline Array Array::removed_at(const size_t index) const& { if (index >= size()) { @@ -951,6 +951,12 @@ namespace s3d return new_array; } + template + inline Array Array::removed_at(const size_t index) && + { + return std::move(remove_at(index)); + } + template template >*> inline Array& Array::remove_if(Fty f) @@ -1436,7 +1442,7 @@ namespace s3d } template - inline Array Array::stable_uniqued() const + inline Array Array::stable_uniqued() const& { Array result; @@ -1447,6 +1453,14 @@ namespace s3d return result; } + template + inline Array Array::stable_uniqued() && + { + // stable_unique() が最適化されたら次の実装に変更する + // return std::move(stable_unique()); + return stable_uniqued(); + } + template inline Array& Array::sort_and_unique() { diff --git a/Siv3D/include/Siv3D/detail/BoolArray.ipp b/Siv3D/include/Siv3D/detail/BoolArray.ipp index 88505c07a..150fd9a7a 100644 --- a/Siv3D/include/Siv3D/detail/BoolArray.ipp +++ b/Siv3D/include/Siv3D/detail/BoolArray.ipp @@ -608,7 +608,7 @@ namespace s3d } [[nodiscard]] - Array removed_at(const size_t index) const + Array removed_at(const size_t index) const& { if (index >= size()) { @@ -624,6 +624,12 @@ namespace s3d return new_array; } + [[nodiscard]] + Array removed_at(const size_t index) && + { + return std::move(remove_at(index)); + } + template >* = nullptr> Array& remove_if(Fty f) { @@ -1045,7 +1051,7 @@ namespace s3d } [[nodiscard]] - Array stable_uniqued() const + Array stable_uniqued() const& { Array result; @@ -1070,6 +1076,14 @@ namespace s3d return result; } + [[nodiscard]] + Array stable_uniqued() && + { + // stable_unique() が最適化されたら次の実装に変更する + // return std::move(stable_unique()); + return stable_uniqued(); + } + Array& sort_and_unique() { return *this = stable_uniqued().sort(); diff --git a/Siv3D/src/Siv3D/Image/SivImage.cpp b/Siv3D/src/Siv3D/Image/SivImage.cpp index d6ec1f24e..5e41c47fd 100644 --- a/Siv3D/src/Siv3D/Image/SivImage.cpp +++ b/Siv3D/src/Siv3D/Image/SivImage.cpp @@ -733,7 +733,7 @@ namespace s3d return *this; } - Image Image::negated() const + Image Image::negated() const& { // 1. パラメータチェック { @@ -756,6 +756,11 @@ namespace s3d } } + Image Image::negated() && + { + return std::move(negate()); + } + Image& Image::grayscale() { // 1. パラメータチェック @@ -780,7 +785,7 @@ namespace s3d return *this; } - Image Image::grayscaled() const + Image Image::grayscaled() const& { // 1. パラメータチェック { @@ -806,6 +811,11 @@ namespace s3d } } + Image Image::grayscaled() && + { + return std::move(grayscale()); + } + Image& Image::sepia() { // 1. パラメータチェック @@ -827,7 +837,7 @@ namespace s3d return *this; } - Image Image::sepiaed() const + Image Image::sepiaed() const& { // 1. パラメータチェック { @@ -850,6 +860,11 @@ namespace s3d } } + Image Image::sepiaed() && + { + return std::move(sepia()); + } + Image& Image::posterize(const int32 level) { // 1. パラメータチェック @@ -876,7 +891,7 @@ namespace s3d return *this; } - Image Image::posterized(const int32 level) const + Image Image::posterized(const int32 level) const& { // 1. パラメータチェック { @@ -904,6 +919,11 @@ namespace s3d } } + Image Image::posterized(const int32 level) && + { + return std::move(posterize(level)); + } + Image& Image::brighten(const int32 level) { // 1. パラメータチェック @@ -939,7 +959,7 @@ namespace s3d return *this; } - Image Image::brightened(const int32 level) const + Image Image::brightened(const int32 level) const& { // 1. パラメータチェック { @@ -976,6 +996,11 @@ namespace s3d } } + Image Image::brightened(const int32 level) && + { + return std::move(brighten(level)); + } + Image& Image::mirror() { // 1. パラメータチェック @@ -1001,7 +1026,7 @@ namespace s3d return *this; } - Image Image::mirrored() const + Image Image::mirrored() const& { // 1. パラメータチェック { @@ -1034,6 +1059,11 @@ namespace s3d } } + Image Image::mirrored() && + { + return std::move(mirror()); + } + Image& Image::flip() { // 1. パラメータチェック @@ -1061,7 +1091,7 @@ namespace s3d return *this; } - Image Image::flipped() const + Image Image::flipped() const& { // 1. パラメータチェック { @@ -1090,6 +1120,11 @@ namespace s3d } } + Image Image::flipped() && + { + return std::move(flip()); + } + Image& Image::rotate90() { // 1. パラメータチェック @@ -1122,7 +1157,7 @@ namespace s3d return *this; } - Image Image::rotated90() const + Image Image::rotated90() const& { // 1. パラメータチェック { @@ -1152,6 +1187,13 @@ namespace s3d } } + Image Image::rotated90() && + { + // rotate90() が最適化されたら次の実装に変更する + // return std::move(rotate90()); + return rotated90(); + } + Image& Image::rotate180() { std::reverse(begin(), end()); @@ -1159,7 +1201,7 @@ namespace s3d return *this; } - Image Image::rotated180() const + Image Image::rotated180() const& { // 1. パラメータチェック { @@ -1186,6 +1228,11 @@ namespace s3d } } + Image Image::rotated180() && + { + return std::move(rotate180()); + } + Image& Image::rotate270() { // 1. パラメータチェック @@ -1217,7 +1264,7 @@ namespace s3d return *this; } - Image Image::rotated270() const + Image Image::rotated270() const& { // 1. パラメータチェック { @@ -1245,6 +1292,13 @@ namespace s3d } } + Image Image::rotated270() && + { + // rotate270() が最適化されたら次の実装に変更する + // return std::move(rotate270()); + return rotated270(); + } + Image& Image::gammaCorrect(const double gamma) { // 1. パラメータチェック @@ -1271,7 +1325,7 @@ namespace s3d return *this; } - Image Image::gammaCorrected(const double gamma) const + Image Image::gammaCorrected(const double gamma) const& { // 1. パラメータチェック { @@ -1299,6 +1353,11 @@ namespace s3d } } + Image Image::gammaCorrected(const double gamma) && + { + return std::move(gammaCorrect(gamma)); + } + Image& Image::threshold(const uint8 threshold, const InvertColor invertColor) { // 1. パラメータチェック @@ -1352,7 +1411,7 @@ namespace s3d return *this; } - Image Image::thresholded(const uint8 threshold, const InvertColor invertColor) const + Image Image::thresholded(const uint8 threshold, const InvertColor invertColor) const& { // 1. パラメータチェック { @@ -1407,6 +1466,11 @@ namespace s3d } } + Image Image::thresholded(const uint8 threshold, const InvertColor invertColor) && + { + return std::move(this->threshold(threshold, invertColor)); + } + Image& Image::threshold_Otsu(const InvertColor invertColor) { // 1. パラメータチェック @@ -1432,7 +1496,7 @@ namespace s3d return *this; } - Image Image::thresholded_Otsu(const InvertColor invertColor) const + Image Image::thresholded_Otsu(const InvertColor invertColor) const& { // 1. パラメータチェック { @@ -1459,6 +1523,11 @@ namespace s3d } } + Image Image::thresholded_Otsu(const InvertColor invertColor) && + { + return std::move(threshold_Otsu(invertColor)); + } + Image& Image::adaptiveThreshold(const AdaptiveThresholdMethod method, int32 blockSize, const double c, const InvertColor invertColor) { // 1. パラメータチェック @@ -1488,7 +1557,7 @@ namespace s3d return *this; } - Image Image::adaptiveThresholded(const AdaptiveThresholdMethod method, int32 blockSize, const double c, const InvertColor invertColor) const + Image Image::adaptiveThresholded(const AdaptiveThresholdMethod method, int32 blockSize, const double c, const InvertColor invertColor) const& { // 1. パラメータチェック { @@ -1519,6 +1588,11 @@ namespace s3d } } + Image Image::adaptiveThresholded(const AdaptiveThresholdMethod method, int32 blockSize, const double c, const InvertColor invertColor) && + { + return std::move(adaptiveThreshold(method, blockSize, c, invertColor)); + } + Image& Image::mosaic(const int32 size) { return mosaic(size, size); @@ -1575,12 +1649,17 @@ namespace s3d return *this; } - Image Image::mosaiced(const int32 size) const + Image Image::mosaiced(const int32 size) const& { return mosaiced(size, size); } - Image Image::mosaiced(const int32 horizontal, const int32 vertical) const + Image Image::mosaiced(const int32 size) && + { + return std::move(mosaic(size)); + } + + Image Image::mosaiced(const int32 horizontal, const int32 vertical) const& { // 1. パラメータチェック { @@ -1633,6 +1712,11 @@ namespace s3d } } + Image Image::mosaiced(const int32 horizontal, const int32 vertical) && + { + return std::move(mosaic(horizontal, vertical)); + } + Image& Image::spread(const int32 size) { return spread(size, size); @@ -1752,12 +1836,17 @@ namespace s3d return *this; } - Image Image::blurred(const int32 size, const BorderType borderType) const + Image Image::blurred(const int32 size, const BorderType borderType) const& { return blurred(size, size, borderType); } - Image Image::blurred(const int32 horizontal, const int32 vertical, const BorderType borderType) const + Image Image::blurred(const int32 size, const BorderType borderType) && + { + return std::move(blur(size, size, borderType)); + } + + Image Image::blurred(const int32 horizontal, const int32 vertical, const BorderType borderType) const& { // 1. パラメータチェック { @@ -1783,6 +1872,11 @@ namespace s3d } } + Image Image::blurred(const int32 horizontal, const int32 vertical, const BorderType borderType) && + { + return std::move(blur(horizontal, vertical, borderType)); + } + Image& Image::medianBlur(int32 apertureSize) { // 1. パラメータチェック @@ -1812,7 +1906,7 @@ namespace s3d return *this; } - Image Image::medianBlurred(int32 apertureSize) const + Image Image::medianBlurred(int32 apertureSize) const& { // 1. パラメータチェック { @@ -1843,6 +1937,11 @@ namespace s3d } } + Image Image::medianBlurred(int32 apertureSize) && + { + return std::move(medianBlur(apertureSize)); + } + Image& Image::gaussianBlur(const int32 size, const BorderType borderType) { return gaussianBlur(size, size, borderType); @@ -1872,12 +1971,17 @@ namespace s3d return *this; } - Image Image::gaussianBlurred(const int32 size, const BorderType borderType) const + Image Image::gaussianBlurred(const int32 size, const BorderType borderType) const& { return gaussianBlurred(size, size, borderType); } - Image Image::gaussianBlurred(const int32 horizontal, const int32 vertical, const BorderType borderType) const + Image Image::gaussianBlurred(const int32 size, const BorderType borderType) && + { + return std::move(gaussianBlur(size, size, borderType)); + } + + Image Image::gaussianBlurred(const int32 horizontal, const int32 vertical, const BorderType borderType) const& { // 1. パラメータチェック { @@ -1903,6 +2007,11 @@ namespace s3d } } + Image Image::gaussianBlurred(const int32 horizontal, const int32 vertical, const BorderType borderType) && + { + return std::move(gaussianBlur(horizontal, vertical, borderType)); + } + Image& Image::bilateralFilter(const int32 d, const double sigmaColor, const double sigmaSpace, const BorderType borderType) { // 1. パラメータチェック @@ -1924,7 +2033,7 @@ namespace s3d return *this; } - Image Image::bilateralFiltered(const int32 d, const double sigmaColor, const double sigmaSpace, const BorderType borderType) const + Image Image::bilateralFiltered(const int32 d, const double sigmaColor, const double sigmaSpace, const BorderType borderType) const& { // 1. パラメータチェック { @@ -1946,6 +2055,11 @@ namespace s3d } } + Image Image::bilateralFiltered(const int32 d, const double sigmaColor, const double sigmaSpace, const BorderType borderType) && + { + return std::move(bilateralFilter(d, sigmaColor, sigmaSpace, borderType)); + } + Image& Image::dilate(const int32 iterations) { // 1. パラメータチェック @@ -1970,7 +2084,7 @@ namespace s3d return *this; } - Image Image::dilated(const int32 iterations) const + Image Image::dilated(const int32 iterations) const& { // 1. パラメータチェック { @@ -1996,6 +2110,11 @@ namespace s3d } } + Image Image::dilated(const int32 iterations) && + { + return std::move(dilate(iterations)); + } + Image& Image::erode(const int32 iterations) { // 1. パラメータチェック @@ -2020,7 +2139,7 @@ namespace s3d return *this; } - Image Image::eroded(const int32 iterations) const + Image Image::eroded(const int32 iterations) const& { // 1. パラメータチェック { @@ -2046,6 +2165,11 @@ namespace s3d } } + Image Image::eroded(const int32 iterations) && + { + return std::move(erode(iterations)); + } + Image& Image::floodFill(const Point& pos, const Color& color, const FloodFillConnectivity connectivity, const int32 lowerDifference, const int32 upperDifference) { // 1. パラメータチェック @@ -2082,7 +2206,7 @@ namespace s3d return *this; } - Image Image::floodFilled(const Point& pos, const Color& color, const FloodFillConnectivity connectivity, const int32 lowerDifference, const int32 upperDifference) const + Image Image::floodFilled(const Point& pos, const Color& color, const FloodFillConnectivity connectivity, const int32 lowerDifference, const int32 upperDifference) const& { // 1. パラメータチェック { @@ -2118,6 +2242,11 @@ namespace s3d } } + Image Image::floodFilled(const Point& pos, const Color& color, const FloodFillConnectivity connectivity, const int32 lowerDifference, const int32 upperDifference) && + { + return std::move(floodFill(pos, color, connectivity, lowerDifference, upperDifference)); + } + Image& Image::scale(int32 width, int32 height, InterpolationAlgorithm interpolation) { // 1. パラメータチェック diff --git a/Siv3D/src/Siv3D/LineString/SivLineString.cpp b/Siv3D/src/Siv3D/LineString/SivLineString.cpp index 8e491e6ec..5ef2270ba 100644 --- a/Siv3D/src/Siv3D/LineString/SivLineString.cpp +++ b/Siv3D/src/Siv3D/LineString/SivLineString.cpp @@ -147,11 +147,16 @@ namespace s3d return *this; } - LineString LineString::reversed() const + LineString LineString::reversed() const& { return LineString(rbegin(), rend()); } + LineString LineString::reversed() && + { + return std::move(reverse()); + } + LineString& LineString::shuffle() { m_data.shuffle(); @@ -298,7 +303,7 @@ namespace s3d return{ v.y, -v.x }; } - LineString LineString::movedBy(const double x, const double y) const + LineString LineString::movedBy(const double x, const double y) const& { LineString lines{ *this }; @@ -307,11 +312,21 @@ namespace s3d return lines; } - LineString LineString::movedBy(const Vec2 v) const + LineString LineString::movedBy(const double x, const double y) && noexcept + { + return std::move(moveBy(x, y)); + } + + LineString LineString::movedBy(const Vec2 v) const& { return movedBy(v.x, v.y); } + LineString LineString::movedBy(const Vec2 v) && noexcept + { + return std::move(moveBy(v)); + } + LineString& LineString::moveBy(const double x, const double y) noexcept { for (auto& point : *this) @@ -327,7 +342,7 @@ namespace s3d return moveBy(v.x, v.y); } - LineString LineString::scaled(const double s) const + LineString LineString::scaled(const double s) const& { LineString result{ *this }; @@ -339,12 +354,22 @@ namespace s3d return result; } - LineString LineString::scaled(const double sx, const double sy) const + LineString LineString::scaled(const double s) && + { + return std::move(scale(s)); + } + + LineString LineString::scaled(const double sx, const double sy) const& { return scaled(Vec2{ sx, sy }); } - LineString LineString::scaled(const Vec2 s) const + LineString LineString::scaled(const double sx, const double sy) && + { + return std::move(scale(sx, sy)); + } + + LineString LineString::scaled(const Vec2 s) const& { LineString result{ *this }; @@ -356,6 +381,11 @@ namespace s3d return result; } + LineString LineString::scaled(const Vec2 s) && + { + return std::move(scale(s)); + } + LineString& LineString::scale(const double s) { for (auto& point : m_data) @@ -381,7 +411,7 @@ namespace s3d return *this; } - LineString LineString::scaledAt(const Vec2 pos, const double s) const + LineString LineString::scaledAt(const Vec2 pos, const double s) const& { LineString result{ *this }; @@ -393,12 +423,22 @@ namespace s3d return result; } - LineString LineString::scaledAt(const Vec2 pos, const double sx, const double sy) const + LineString LineString::scaledAt(const Vec2 pos, const double s) && + { + return std::move(scaleAt(pos, s)); + } + + LineString LineString::scaledAt(const Vec2 pos, const double sx, const double sy) const& { return scaledAt(pos, Vec2{ sx, sy }); } - LineString LineString::scaledAt(const Vec2 pos, const Vec2 s) const + LineString LineString::scaledAt(const Vec2 pos, const double sx, const double sy) && + { + return std::move(scaleAt(pos, sx, sy)); + } + + LineString LineString::scaledAt(const Vec2 pos, const Vec2 s) const& { LineString result{ *this }; @@ -410,6 +450,11 @@ namespace s3d return result; } + LineString LineString::scaledAt(const Vec2 pos, const Vec2 s) && + { + return std::move(scaleAt(pos, s)); + } + LineString& LineString::scaleAt(const Vec2 pos, const double s) { for (auto& point : m_data) diff --git a/Siv3D/src/Siv3D/MultiPolygon/SivMultiPolygon.cpp b/Siv3D/src/Siv3D/MultiPolygon/SivMultiPolygon.cpp index 04d52f6d2..d63a12e71 100644 --- a/Siv3D/src/Siv3D/MultiPolygon/SivMultiPolygon.cpp +++ b/Siv3D/src/Siv3D/MultiPolygon/SivMultiPolygon.cpp @@ -60,11 +60,16 @@ namespace s3d return *this; } - MultiPolygon MultiPolygon::reversed() const + MultiPolygon MultiPolygon::reversed() const& { return MultiPolygon(rbegin(), rend()); } + MultiPolygon MultiPolygon::reversed() && + { + return std::move(reverse()); + } + MultiPolygon& MultiPolygon::shuffle() { m_data.shuffle(); @@ -92,7 +97,7 @@ namespace s3d return MultiPolygon(begin() + index, begin() + Min(index + length, size())); } - MultiPolygon MultiPolygon::movedBy(const double x, const double y) const + MultiPolygon MultiPolygon::movedBy(const double x, const double y) const& { MultiPolygon polygons{ *this }; @@ -101,11 +106,21 @@ namespace s3d return polygons; } - MultiPolygon MultiPolygon::movedBy(const Vec2 v) const + MultiPolygon MultiPolygon::movedBy(const double x, const double y) && noexcept + { + return std::move(moveBy(x, y)); + } + + MultiPolygon MultiPolygon::movedBy(const Vec2 v) const& { return movedBy(v.x, v.y); } + MultiPolygon MultiPolygon::movedBy(const Vec2 v) && noexcept + { + return std::move(moveBy(v)); + } + MultiPolygon& MultiPolygon::moveBy(const double x, const double y) noexcept { for (auto& polygon : *this) @@ -121,16 +136,26 @@ namespace s3d return moveBy(v.x, v.y); } - MultiPolygon MultiPolygon::rotated(const double angle) const + MultiPolygon MultiPolygon::rotated(const double angle) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.rotated(angle); }) }; } - MultiPolygon MultiPolygon::rotatedAt(const Vec2& pos, const double angle) const + MultiPolygon MultiPolygon::rotated(const double angle) && + { + return std::move(rotate(angle)); + } + + MultiPolygon MultiPolygon::rotatedAt(const Vec2& pos, const double angle) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.rotatedAt(pos, angle); }) }; } + MultiPolygon MultiPolygon::rotatedAt(const Vec2& pos, const double angle) && + { + return std::move(rotateAt(pos, angle)); + } + MultiPolygon& MultiPolygon::rotate(const double angle) { for (auto& polygon : *this) @@ -151,11 +176,16 @@ namespace s3d return *this; } - MultiPolygon MultiPolygon::transformed(const double s, double c, const Vec2& pos) const + MultiPolygon MultiPolygon::transformed(const double s, double c, const Vec2& pos) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.transformed(s, c, pos); }) }; } + MultiPolygon MultiPolygon::transformed(const double s, double c, const Vec2& pos) && + { + return std::move(transform(s, c, pos)); + } + MultiPolygon& MultiPolygon::transform(const double s, const double c, const Vec2& pos) { for (auto& polygon : *this) @@ -166,21 +196,36 @@ namespace s3d return *this; } - MultiPolygon MultiPolygon::scaled(const double s) const + MultiPolygon MultiPolygon::scaled(const double s) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.scaled(s); }) }; } - MultiPolygon MultiPolygon::scaled(const double sx, const double sy) const + MultiPolygon MultiPolygon::scaled(const double s) && + { + return std::move(scale(s)); + } + + MultiPolygon MultiPolygon::scaled(const double sx, const double sy) const& { return scaled(Vec2{ sx, sy }); } - MultiPolygon MultiPolygon::scaled(const Vec2 s) const + MultiPolygon MultiPolygon::scaled(const double sx, const double sy) && + { + return std::move(scale(sx, sy)); + } + + MultiPolygon MultiPolygon::scaled(const Vec2 s) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.scaled(s); }) }; } + MultiPolygon MultiPolygon::scaled(const Vec2 s) && + { + return std::move(scale(s)); + } + MultiPolygon& MultiPolygon::scale(const double s) { for (auto& polygon : *this) @@ -206,11 +251,16 @@ namespace s3d return *this; } - MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const double s) const + MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const double s) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.scaledAt(pos, s); }) }; } + MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const double s) && + { + return std::move(scaleAt(pos, s)); + } + MultiPolygon& MultiPolygon::scaleAt(const Vec2 pos, const double s) { for (auto& polygon : *this) @@ -221,16 +271,26 @@ namespace s3d return *this; } - MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const double sx, const double sy) const + MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const double sx, const double sy) const& { return scaledAt(pos, Vec2{ sx, sy }); } - MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const Vec2 s) const + MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const double sx, const double sy) && + { + return std::move(scaleAt(pos, sx, sy)); + } + + MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const Vec2 s) const& { return MultiPolygon{ m_data.map([=](const Polygon& p) { return p.scaledAt(pos, s); }) }; } + MultiPolygon MultiPolygon::scaledAt(const Vec2 pos, const Vec2 s) && + { + return std::move(scaleAt(pos, s)); + } + MultiPolygon& MultiPolygon::scaleAt(const Vec2 pos, const double sx, const double sy) { return scaleAt(pos, Vec2{ sx, sy }); diff --git a/Siv3D/src/Siv3D/Polygon/SivPolygon.cpp b/Siv3D/src/Siv3D/Polygon/SivPolygon.cpp index 9c0e72432..35bc65782 100644 --- a/Siv3D/src/Siv3D/Polygon/SivPolygon.cpp +++ b/Siv3D/src/Siv3D/Polygon/SivPolygon.cpp @@ -480,12 +480,17 @@ namespace s3d return true; } - Polygon Polygon::movedBy(const double x, const double y) const + Polygon Polygon::movedBy(const double x, const double y) const& { return movedBy(Vec2{ x, y }); } - Polygon Polygon::movedBy(const Vec2 v) const + Polygon Polygon::movedBy(const double x, const double y) && noexcept + { + return std::move(moveBy(x, y)); + } + + Polygon Polygon::movedBy(const Vec2 v) const& { Polygon result{ *this }; @@ -494,6 +499,11 @@ namespace s3d return result; } + Polygon Polygon::movedBy(const Vec2 v) && noexcept + { + return std::move(moveBy(v)); + } + Polygon& Polygon::moveBy(const double x, const double y) noexcept { return moveBy(Vec2{ x, y }); @@ -506,17 +516,27 @@ namespace s3d return *this; } - Polygon Polygon::rotated(const double angle) const + Polygon Polygon::rotated(const double angle) const& { return rotatedAt(Vec2{ 0, 0 }, angle); } - Polygon Polygon::rotatedAt(const double x, const double y, const double angle) const + Polygon Polygon::rotated(const double angle) && + { + return std::move(rotate(angle)); + } + + Polygon Polygon::rotatedAt(const double x, const double y, const double angle) const& { return rotatedAt(Vec2{ x, y }, angle); } - Polygon Polygon::rotatedAt(const Vec2 pos, const double angle) const + Polygon Polygon::rotatedAt(const double x, const double y, const double angle) && + { + return std::move(rotateAt(x, y, angle)); + } + + Polygon Polygon::rotatedAt(const Vec2 pos, const double angle) const& { Polygon result{ *this }; @@ -525,6 +545,11 @@ namespace s3d return result; } + Polygon Polygon::rotatedAt(const Vec2 v, const double angle) && + { + return std::move(rotateAt(v, angle)); + } + Polygon& Polygon::rotate(const double angle) { return rotateAt(Vec2{ 0, 0 }, angle); @@ -542,7 +567,7 @@ namespace s3d return *this; } - Polygon Polygon::transformed(const double s, const double c, const Vec2& pos) const + Polygon Polygon::transformed(const double s, const double c, const Vec2& pos) const& { Polygon result{ *this }; @@ -551,6 +576,11 @@ namespace s3d return result; } + Polygon Polygon::transformed(const double s, const double c, const Vec2& pos) && + { + return std::move(transform(s, c, pos)); + } + Polygon& Polygon::transform(const double s, const double c, const Vec2& pos) { pImpl->transform(s, c, pos); @@ -558,7 +588,7 @@ namespace s3d return *this; } - Polygon Polygon::scaled(const double s) const + Polygon Polygon::scaled(const double s) const& { Polygon result{ *this }; @@ -567,12 +597,22 @@ namespace s3d return result; } - Polygon Polygon::scaled(const double sx, double sy) const + Polygon Polygon::scaled(const double s) && + { + return std::move(scale(s)); + } + + Polygon Polygon::scaled(const double sx, double sy) const& { return scaled(Vec2{ sx, sy }); } - Polygon Polygon::scaled(const Vec2 s) const + Polygon Polygon::scaled(const double sx, double sy) && + { + return std::move(scale(sx, sy)); + } + + Polygon Polygon::scaled(const Vec2 s) const& { Polygon result{ *this }; @@ -581,6 +621,11 @@ namespace s3d return result; } + Polygon Polygon::scaled(const Vec2 s) && + { + return std::move(scale(s)); + } + Polygon& Polygon::scale(const double s) { pImpl->scale(s); @@ -600,7 +645,7 @@ namespace s3d return *this; } - Polygon Polygon::scaledAt(const Vec2 pos, const double s) const + Polygon Polygon::scaledAt(const Vec2 pos, const double s) const& { Polygon result{ *this }; @@ -609,6 +654,11 @@ namespace s3d return result; } + Polygon Polygon::scaledAt(const Vec2 pos, const double s) && + { + return std::move(scaleAt(pos, s)); + } + Polygon& Polygon::scaleAt(const Vec2 pos, const double s) { pImpl->scaleAt(pos, s); @@ -616,12 +666,17 @@ namespace s3d return *this; } - Polygon Polygon::scaledAt(const Vec2 pos, const double sx, const double sy) const + Polygon Polygon::scaledAt(const Vec2 pos, const double sx, const double sy) const& { return scaledAt(pos, Vec2{ sx, sy }); } - Polygon Polygon::scaledAt(const Vec2 pos, const Vec2 s) const + Polygon Polygon::scaledAt(const Vec2 pos, const double sx, const double sy) && + { + return std::move(scaleAt(pos, sx, sy)); + } + + Polygon Polygon::scaledAt(const Vec2 pos, const Vec2 s) const& { Polygon result{ *this }; @@ -630,6 +685,11 @@ namespace s3d return result; } + Polygon Polygon::scaledAt(const Vec2 pos, const Vec2 s) && + { + return std::move(scaleAt(pos, s)); + } + Polygon& Polygon::scaleAt(const Vec2 pos, const double sx, const double sy) { return scaleAt(pos, Vec2{ sx, sy }); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptImage.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptImage.cpp index a3df0de7a..c08cf2ea9 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptImage.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptImage.cpp @@ -239,51 +239,51 @@ namespace s3d // ... r = engine->RegisterObjectMethod(TypeName, "Image& negate()", asMETHODPR(BindType, negate, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image negated() const", asMETHODPR(BindType, negated, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image negated() const", asMETHODPR(BindType, negated, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& grayscale()", asMETHODPR(BindType, grayscale, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image grayscaled() const", asMETHODPR(BindType, grayscaled, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image grayscaled() const", asMETHODPR(BindType, grayscaled, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& sepia()", asMETHODPR(BindType, sepia, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image sepiaed() const", asMETHODPR(BindType, sepiaed, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image sepiaed() const", asMETHODPR(BindType, sepiaed, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& posterize(int32)", asMETHODPR(BindType, posterize, (int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image posterized(int32) const", asMETHODPR(BindType, posterized, (int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image posterized(int32) const", asMETHODPR(BindType, posterized, (int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& brighten(int32)", asMETHODPR(BindType, brighten, (int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image brightened(int32) const", asMETHODPR(BindType, brightened, (int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image brightened(int32) const", asMETHODPR(BindType, brightened, (int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& mirror()", asMETHODPR(BindType, mirror, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image mirrored() const", asMETHODPR(BindType, mirrored, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image mirrored() const", asMETHODPR(BindType, mirrored, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& flip()", asMETHODPR(BindType, flip, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image flipped() const", asMETHODPR(BindType, flipped, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image flipped() const", asMETHODPR(BindType, flipped, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& rotate90()", asMETHODPR(BindType, rotate90, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image rotated90() const", asMETHODPR(BindType, rotated90, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image rotated90() const", asMETHODPR(BindType, rotated90, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& rotate180()", asMETHODPR(BindType, rotate180, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image rotated180() const", asMETHODPR(BindType, rotated180, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image rotated180() const", asMETHODPR(BindType, rotated180, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& rotate270()", asMETHODPR(BindType, rotate270, (), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image rotated270() const", asMETHODPR(BindType, rotated270, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image rotated270() const", asMETHODPR(BindType, rotated270, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& gammaCorrect(double)", asMETHODPR(BindType, gammaCorrect, (double), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image gammaCorrected(double) const", asMETHODPR(BindType, gammaCorrected, (double) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image gammaCorrected(double) const", asMETHODPR(BindType, gammaCorrected, (double) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& threshold(uint8, bool invertColor = InvertColor::No)", asMETHODPR(BindType, threshold, (uint8, InvertColor), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image thresholded(uint8, bool invertColor = InvertColor::No) const", asMETHODPR(BindType, thresholded, (uint8, InvertColor) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image thresholded(uint8, bool invertColor = InvertColor::No) const", asMETHODPR(BindType, thresholded, (uint8, InvertColor) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& threshold_Otsu(bool invertColor = InvertColor::No)", asMETHODPR(BindType, threshold_Otsu, (InvertColor), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image thresholded_Otsu(bool invertColor = InvertColor::No) const", asMETHODPR(BindType, thresholded_Otsu, (InvertColor) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image thresholded_Otsu(bool invertColor = InvertColor::No) const", asMETHODPR(BindType, thresholded_Otsu, (InvertColor) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& adaptiveThreshold(AdaptiveThresholdMethod method, int32 blockSize, double c, bool invertColor = InvertColor::No)", asMETHODPR(BindType, adaptiveThreshold, (AdaptiveThresholdMethod, int32, double, InvertColor), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image adaptiveThresholded(AdaptiveThresholdMethod method, int32 blockSize, double c, bool invertColor = InvertColor::No) const", asMETHODPR(BindType, mirrored, () const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image adaptiveThresholded(AdaptiveThresholdMethod method, int32 blockSize, double c, bool invertColor = InvertColor::No) const", asMETHODPR(BindType, mirrored, () const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& mosaic(int32)", asMETHODPR(BindType, mosaic, (int32), Image&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& mosaic(int32, int32)", asMETHODPR(BindType, mosaic, (int32, int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image mosaiced(int32) const", asMETHODPR(BindType, mosaiced, (int32) const, Image), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image mosaiced(int32, int32) const", asMETHODPR(BindType, mosaiced, (int32, int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image mosaiced(int32) const", asMETHODPR(BindType, mosaiced, (int32) const&, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image mosaiced(int32, int32) const", asMETHODPR(BindType, mosaiced, (int32, int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& spread(int32)", asMETHODPR(BindType, spread, (int32), Image&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& spread(int32, int32)", asMETHODPR(BindType, spread, (int32, int32), Image&), asCALL_THISCALL); assert(r >= 0); @@ -292,28 +292,28 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "Image& blur(int32, BorderType borderType = BorderType::Reflect_101)", asMETHODPR(BindType, blur, (int32, BorderType), Image&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& blur(int32, int32, BorderType borderType = BorderType::Reflect_101)", asMETHODPR(BindType, blur, (int32, int32, BorderType), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image blurred(int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, blurred, (int32, BorderType) const, Image), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image blurred(int32, int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, blurred, (int32, int32, BorderType) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image blurred(int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, blurred, (int32, BorderType) const&, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image blurred(int32, int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, blurred, (int32, int32, BorderType) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& medianBlur(int32)", asMETHODPR(BindType, medianBlur, (int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image medianBlurred(int32) const", asMETHODPR(BindType, medianBlurred, (int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image medianBlurred(int32) const", asMETHODPR(BindType, medianBlurred, (int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& gaussianBlur(int32, BorderType borderType = BorderType::Reflect_101)", asMETHODPR(BindType, gaussianBlur, (int32, BorderType), Image&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& gaussianBlur(int32, int32, BorderType borderType = BorderType::Reflect_101)", asMETHODPR(BindType, gaussianBlur, (int32, int32, BorderType), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image gaussianBlurred(int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, gaussianBlurred, (int32, BorderType) const, Image), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image gaussianBlurred(int32, int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, gaussianBlurred, (int32, int32, BorderType) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image gaussianBlurred(int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, gaussianBlurred, (int32, BorderType) const&, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image gaussianBlurred(int32, int32, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, gaussianBlurred, (int32, int32, BorderType) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& bilateralFilter(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101)", asMETHODPR(BindType, bilateralFilter, (int32, double, double, BorderType), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image bilateralFiltered(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, bilateralFiltered, (int32, double, double, BorderType) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image bilateralFiltered(int32 d, double sigmaColor, double sigmaSpace, BorderType borderType = BorderType::Reflect_101) const", asMETHODPR(BindType, bilateralFiltered, (int32, double, double, BorderType) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& dilate(int32 iterations = 1)", asMETHODPR(BindType, dilate, (int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image dilated(int32 iterations = 1) const", asMETHODPR(BindType, dilated, (int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image dilated(int32 iterations = 1) const", asMETHODPR(BindType, dilated, (int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& erode(int32 iterations = 1)", asMETHODPR(BindType, erode, (int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image eroded(int32 iterations = 1) const", asMETHODPR(BindType, eroded, (int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image eroded(int32 iterations = 1) const", asMETHODPR(BindType, eroded, (int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& floodFill(const Point& in, const Color& in, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0)", asMETHODPR(BindType, floodFill, (const Point&, const Color&, FloodFillConnectivity, int32, int32), Image&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Image floodFilled(const Point& in, const Color& in, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0) const", asMETHODPR(BindType, floodFilled, (const Point&, const Color&, FloodFillConnectivity, int32, int32) const, Image), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Image floodFilled(const Point& in, const Color& in, FloodFillConnectivity connectivity = FloodFillConnectivity::Value4, int32 lowerDifference = 0, int32 upperDifference = 0) const", asMETHODPR(BindType, floodFilled, (const Point&, const Color&, FloodFillConnectivity, int32, int32) const&, Image), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image& scale(int32 width, int32 height, InterpolationAlgorithm interpolation = InterpolationAlgorithm::Auto)", asMETHODPR(BindType, scale, (int32, int32, InterpolationAlgorithm), Image&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Image scaled(int32 width, int32 height, InterpolationAlgorithm interpolation = InterpolationAlgorithm::Auto) const", asMETHODPR(BindType, scaled, (int32, int32, InterpolationAlgorithm) const, Image), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptLineString.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptLineString.cpp index d04d4270b..32975cdfb 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptLineString.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptLineString.cpp @@ -165,21 +165,21 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "Vec2 normalAtPoint(size_t index, bool closeRing = CloseRing::No) const", asMETHODPR(LineString, normalAtPoint, (size_t, CloseRing) const, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 normalAtLine(size_t index, bool closeRing = CloseRing::No) const", asMETHODPR(LineString, normalAtLine, (size_t, CloseRing) const, Vec2), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString movedBy(double, double) const", asMETHODPR(LineString, movedBy, (double, double) const, LineString), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString movedBy(Vec2) const", asMETHODPR(LineString, movedBy, (Vec2) const, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString movedBy(double, double) const", asMETHODPR(LineString, movedBy, (double, double) const&, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString movedBy(Vec2) const", asMETHODPR(LineString, movedBy, (Vec2) const&, LineString), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& moveBy(double, double)", asMETHODPR(LineString, moveBy, (double, double), LineString&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& moveBy(Vec2)", asMETHODPR(LineString, moveBy, (Vec2), LineString&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString scaled(double) const", asMETHODPR(LineString, scaled, (double) const, LineString), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString scaled(double, double) const", asMETHODPR(LineString, scaled, (double, double) const, LineString), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString scaled(Vec2) const", asMETHODPR(LineString, scaled, (Vec2) const, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString scaled(double) const", asMETHODPR(LineString, scaled, (double) const&, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString scaled(double, double) const", asMETHODPR(LineString, scaled, (double, double) const&, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString scaled(Vec2) const", asMETHODPR(LineString, scaled, (Vec2) const&, LineString), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& scale(double)", asMETHODPR(LineString, scale, (double), LineString&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& scale(double, double)", asMETHODPR(LineString, scale, (double, double), LineString&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& scale(Vec2)", asMETHODPR(LineString, scale, (Vec2), LineString&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString scaledAt(Vec2, double) const", asMETHODPR(LineString, scaledAt, (Vec2, double) const, LineString), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString scaledAt(Vec2, double, double) const", asMETHODPR(LineString, scaledAt, (Vec2, double, double) const, LineString), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "LineString scaledAt(Vec2, Vec2) const", asMETHODPR(LineString, scaledAt, (Vec2, Vec2) const, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString scaledAt(Vec2, double) const", asMETHODPR(LineString, scaledAt, (Vec2, double) const&, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString scaledAt(Vec2, double, double) const", asMETHODPR(LineString, scaledAt, (Vec2, double, double) const&, LineString), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "LineString scaledAt(Vec2, Vec2) const", asMETHODPR(LineString, scaledAt, (Vec2, Vec2) const&, LineString), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& scaleAt(Vec2, double)", asMETHODPR(LineString, scaleAt, (Vec2, double), LineString&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& scaleAt(Vec2, double, double)", asMETHODPR(LineString, scaleAt, (Vec2, double, double), LineString&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "LineString& scaleAt(Vec2, Vec2)", asMETHODPR(LineString, scaleAt, (Vec2, Vec2), LineString&), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptPolygon.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptPolygon.cpp index b5e9c7de8..c55487a8b 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptPolygon.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptPolygon.cpp @@ -157,33 +157,33 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "bool addHole(const RoundRect& in, uint32 quality = 24) const", asMETHODPR(ShapeType, addHole, (const RoundRect&, uint32), bool), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "bool addHole(const Array& in) const", asFUNCTION(AddHole), asCALL_CDECL_OBJLAST); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon movedBy(double, double) const", asMETHODPR(ShapeType, movedBy, (double, double) const, Polygon), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon movedBy(Vec2) const", asMETHODPR(ShapeType, movedBy, (Vec2) const, Polygon), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon movedBy(double, double) const", asMETHODPR(ShapeType, movedBy, (double, double) const&, Polygon), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon movedBy(Vec2) const", asMETHODPR(ShapeType, movedBy, (Vec2) const&, Polygon), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& moveBy(double, double)", asMETHODPR(ShapeType, moveBy, (double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& moveBy(Vec2)", asMETHODPR(ShapeType, moveBy, (Vec2), ShapeType&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon rotated(double) const", asMETHODPR(ShapeType, rotated, (double) const, Polygon), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon rotatedAt(double, double, double) const", asMETHODPR(ShapeType, rotatedAt, (double, double, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon rotatedAt(Vec2, double) const", asMETHODPR(ShapeType, rotatedAt, (Vec2, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon rotated(double) const", asMETHODPR(ShapeType, rotated, (double) const&, Polygon), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon rotatedAt(double, double, double) const", asMETHODPR(ShapeType, rotatedAt, (double, double, double) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon rotatedAt(Vec2, double) const", asMETHODPR(ShapeType, rotatedAt, (Vec2, double) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& rotate(double)", asMETHODPR(ShapeType, rotate, (double), Polygon&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& rotateAt(double, double, double)", asMETHODPR(ShapeType, rotateAt, (double, double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& rotateAt(Vec2, double)", asMETHODPR(ShapeType, rotateAt, (Vec2, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon transformed(double s, double c, const Vec2& in) const", asMETHODPR(ShapeType, transformed, (double, double, const Vec2&) const, Polygon), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon transformed(double s, double c, const Vec2& in) const", asMETHODPR(ShapeType, transformed, (double, double, const Vec2&) const&, Polygon), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& transform(double s, double c, const Vec2& in)", asMETHODPR(ShapeType, transform, (double, double, const Vec2&), Polygon&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon scaled(double s) const", asMETHODPR(ShapeType, scaled, (double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon scaled(double sx, double sy) const", asMETHODPR(ShapeType, scaled, (double, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon scaled(Vec2) const", asMETHODPR(ShapeType, scaled, (Vec2) const, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon scaled(double s) const", asMETHODPR(ShapeType, scaled, (double) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon scaled(double sx, double sy) const", asMETHODPR(ShapeType, scaled, (double, double) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon scaled(Vec2) const", asMETHODPR(ShapeType, scaled, (Vec2) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& scale(double s)", asMETHODPR(ShapeType, scale, (double), ShapeType&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& scale(double sx, double sy)", asMETHODPR(ShapeType, scale, (double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& scale(Vec2)", asMETHODPR(ShapeType, scale, (Vec2), ShapeType&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon scaledAt(Vec2, double s) const", asMETHODPR(ShapeType, scaledAt, (Vec2, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon scaledAt(Vec2, double sx, double sy) const", asMETHODPR(ShapeType, scaledAt, (Vec2, double, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Polygon scaledAt(Vec2, Vec2) const", asMETHODPR(ShapeType, scaledAt, (Vec2, Vec2) const, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon scaledAt(Vec2, double s) const", asMETHODPR(ShapeType, scaledAt, (Vec2, double) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon scaledAt(Vec2, double sx, double sy) const", asMETHODPR(ShapeType, scaledAt, (Vec2, double, double) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Polygon scaledAt(Vec2, Vec2) const", asMETHODPR(ShapeType, scaledAt, (Vec2, Vec2) const&, ShapeType), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& scaleAt(Vec2, double s)", asMETHODPR(ShapeType, scaleAt, (Vec2, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Polygon& scaleAt(Vec2, double sx, double sy)", asMETHODPR(ShapeType, scaleAt, (Vec2, double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/String/SivString.cpp b/Siv3D/src/Siv3D/String/SivString.cpp index bfcfe9dcb..5376b3e8b 100644 --- a/Siv3D/src/Siv3D/String/SivString.cpp +++ b/Siv3D/src/Siv3D/String/SivString.cpp @@ -466,7 +466,7 @@ namespace s3d return std::move(*this); } - String String::removed(const StringView s) const + String String::removed(const StringView s) const& { if (s.isEmpty()) { @@ -490,6 +490,11 @@ namespace s3d return result; } + String String::removed(const StringView s) && + { + return std::move(remove(s)); + } + String& String::remove_at(const size_t index) { if (m_string.size() <= index) @@ -814,7 +819,7 @@ namespace s3d return result; } - String String::stable_uniqued() const + String String::stable_uniqued() const& { String result; @@ -825,6 +830,13 @@ namespace s3d return result; } + String String::stable_uniqued() && + { + // stable_unique() が最適化されたら次の実装に変更する + // return std::move(stable_unique()); + return stable_uniqued(); + } + String& String::swapcase() noexcept { for (auto& v : m_string) diff --git a/Siv3D/src/Siv3D/Wave/SivWave.cpp b/Siv3D/src/Siv3D/Wave/SivWave.cpp index 29f73ac58..3397f4095 100644 --- a/Siv3D/src/Siv3D/Wave/SivWave.cpp +++ b/Siv3D/src/Siv3D/Wave/SivWave.cpp @@ -258,11 +258,16 @@ namespace s3d return *this; } - Wave Wave::reversed() const + Wave Wave::reversed() const& { return Wave(rbegin(), rend()); } + Wave Wave::reversed() && + { + return std::move(reverse()); + } + Wave Wave::slice(const size_t index) const { if (index >= size())