diff --git a/README.md b/README.md index b4c3795..03218de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # doodle-release -Version 0.2.2 +Version 0.2.4 Binaries built with Visual Studio 2019 Version **`16.8.4`** @@ -47,6 +47,7 @@ int main(void) ## Notable Changes +- added functionality to draw to an image rather than the window - The doodle Image class can now be copied like normal objects. * It is more flexible when it is created in a global scope, so debug builds shouldn't see any popups from OpenGL asserts. * Got rid of the `Image::color` type. Now there is only one color type, which is `doodle::Color` diff --git a/doodle_development/bin/Debug/Win32/doodle.lib b/doodle_development/bin/Debug/Win32/doodle.lib index c489f9c..a30a77c 100644 Binary files a/doodle_development/bin/Debug/Win32/doodle.lib and b/doodle_development/bin/Debug/Win32/doodle.lib differ diff --git a/doodle_development/bin/Debug/Win32/doodle.pdb b/doodle_development/bin/Debug/Win32/doodle.pdb index 418bfbd..3c929ce 100644 Binary files a/doodle_development/bin/Debug/Win32/doodle.pdb and b/doodle_development/bin/Debug/Win32/doodle.pdb differ diff --git a/doodle_development/bin/Debug/x64/doodle.lib b/doodle_development/bin/Debug/x64/doodle.lib index 4fba487..1dc05b4 100644 Binary files a/doodle_development/bin/Debug/x64/doodle.lib and b/doodle_development/bin/Debug/x64/doodle.lib differ diff --git a/doodle_development/bin/Debug/x64/doodle.pdb b/doodle_development/bin/Debug/x64/doodle.pdb index c8a86eb..9e2a47d 100644 Binary files a/doodle_development/bin/Debug/x64/doodle.pdb and b/doodle_development/bin/Debug/x64/doodle.pdb differ diff --git a/doodle_development/bin/Release/Win32/doodle.lib b/doodle_development/bin/Release/Win32/doodle.lib index 979f294..a8ea11a 100644 Binary files a/doodle_development/bin/Release/Win32/doodle.lib and b/doodle_development/bin/Release/Win32/doodle.lib differ diff --git a/doodle_development/bin/Release/x64/doodle.lib b/doodle_development/bin/Release/x64/doodle.lib index deeab78..5b73af2 100644 Binary files a/doodle_development/bin/Release/x64/doodle.lib and b/doodle_development/bin/Release/x64/doodle.lib differ diff --git a/doodle_development/include/doodle/angle.hpp b/doodle_development/include/doodle/angle.hpp index a28cb64..1c482ad 100644 --- a/doodle_development/include/doodle/angle.hpp +++ b/doodle_development/include/doodle/angle.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/color.hpp b/doodle_development/include/doodle/color.hpp index 4e701f9..f51618b 100644 --- a/doodle_development/include/doodle/color.hpp +++ b/doodle_development/include/doodle/color.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/doodle.hpp b/doodle_development/include/doodle/doodle.hpp index 5bf295e..361750c 100644 --- a/doodle_development/include/doodle/doodle.hpp +++ b/doodle_development/include/doodle/doodle.hpp @@ -1,11 +1,23 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. *--------------------------------------------------------------*/ #pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + /** * \mainpage * \section Angles @@ -98,6 +110,8 @@ * \subsection creating Creating Images * - doodle::Image * - capture_screenshot_to_image() + * - begin_drawing_to_image() + * - end_drawing_to_image() * \subsection display Displaying Images * - draw_image() * - set_tint_color() @@ -129,15 +143,3 @@ * - to_wstring() * */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/doodle_development/include/doodle/drawing.hpp b/doodle_development/include/doodle/drawing.hpp index 98b00e9..6bfb496 100644 --- a/doodle_development/include/doodle/drawing.hpp +++ b/doodle_development/include/doodle/drawing.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. @@ -510,8 +510,9 @@ namespace doodle * \brief Given a file path to a *.fnt file it will create a distance field bitmap font. * * It will parse that file to get all of the Bitmap information and create GPU texture instances of all the image - * files listed. It assumes that the image files are in the same folder directory as the provided *.fnt file. It will - * return a positive value on success and a negative value if it failed to parse the *.fnt file for whatever reason. + * files listed. It assumes that the image files are in the same folder directory as the provided *.fnt file. It + * will return a positive value on success and a negative value if it failed to parse the *.fnt file for whatever + * reason. * * The default font, provided with doodle has a font ID of \f$0\f$ and is specified by doodle::DEFAULT_FONT_ID. * @@ -715,7 +716,7 @@ namespace doodle * */ void draw_image(const Image& image, double x, double y, double width, double height, int texel_x, - int texel_y) noexcept; + int texel_y) noexcept; /** * \brief Draw a subsection of the image to the screen. * @@ -757,7 +758,7 @@ namespace doodle * */ void draw_image(const Image& image, double x, double y, double width, double height, int texel_x, int texel_y, - int texel_width, int texel_height) noexcept; + int texel_width, int texel_height) noexcept; /** * \brief Sets the fill value for displaying images to the specified HexColor. * @@ -915,6 +916,36 @@ namespace doodle * */ void apply_matrix(double a, double b, double c, double d, double e, double f) noexcept; + + /** @} */ + + /** + * * \addtogroup Image + * Functions for drawing to an Image. + * @{ + */ + + /** + * \brief Redirect all draw command to draw to an image + * \param image_width The desired width of the image + * \param image_height The desired height of the image + * \param apply_antialiasing Should multi-sample anti-aliasing be applied? + * + * \include begin_drawing_to_image.cpp + * + */ + void begin_drawing_to_image(int image_width, int image_height, bool apply_antialiasing = false); + + /** + * \brief End a session of drawing to an image + * \param smooth_texture Should the texture use a smooth filtering when being drawn + * \return An Image representing what was drawn. + * + * \include end_drawing_to_image.cpp + * + */ + Image end_drawing_to_image(bool smooth_texture = false); + /** @} */ } diff --git a/doodle_development/include/doodle/environment.hpp b/doodle_development/include/doodle/environment.hpp index b67e041..c4276ad 100644 --- a/doodle_development/include/doodle/environment.hpp +++ b/doodle_development/include/doodle/environment.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/eventhook.hpp b/doodle_development/include/doodle/eventhook.hpp index 1aeb838..118e8bd 100644 --- a/doodle_development/include/doodle/eventhook.hpp +++ b/doodle_development/include/doodle/eventhook.hpp @@ -1,6 +1,6 @@ #pragma once /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/image.hpp b/doodle_development/include/doodle/image.hpp index 9e4a3be..5d1040e 100644 --- a/doodle_development/include/doodle/image.hpp +++ b/doodle_development/include/doodle/image.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. @@ -178,7 +178,7 @@ namespace doodle * * Usage of this will trigger creating a new GPU texture when the Image is drawn via draw_image(). * - * Having a begin/end interface enables the Image class to be used with for range loops and the std + * Having a begin/end interface enables the Image class to be used with for range loops and the std `` * functions. * * \return iterator to the first element @@ -187,8 +187,14 @@ namespace doodle */ Color* begin(); /** - * \brief - * \return + * \brief Returns an iterator to the color following the last color of the Image. + * + * This color acts as a placeholder; attempting to access it results in undefined behavior. + * + * Having a begin/end interface enables the Image class to be used with for range loops and the std + * `` functions. + * + * \return iterator to a color following the last color * * */ @@ -197,14 +203,14 @@ namespace doodle /** * \brief Returns a const iterator to the first color of the Image. * - * Having a begin/end interface enables the Image class to be used with for range loops and the std + * Having a begin/end interface enables the Image class to be used with for range loops and the std `` * functions. * * \return const iterator to the first element * - * + * * \include ImageClass_begin_const.cpp - * + * */ const Color* begin() const; /** @@ -212,7 +218,7 @@ namespace doodle * * This color acts as a placeholder; attempting to access it results in undefined behavior. * - * Having a begin/end interface enables the Image class to be used with for range loops and the std + * Having a begin/end interface enables the Image class to be used with for range loops and the std `` * functions. * * \return const iterator to a color following the last color @@ -226,13 +232,17 @@ namespace doodle std::shared_ptr impl{}; private: - friend void draw_image(const Image& image, double x, double y) noexcept; - friend void draw_image(const Image& image, double x, double y, double width, double height) noexcept; - friend void draw_image(const Image& image, double x, double y, double width, double height) noexcept; - friend void draw_image(const Image& image, double x, double y, double width, double height, int texel_x, - int texel_y) noexcept; - friend void draw_image(const Image& image, double x, double y, double width, double height, int texel_x, - int texel_y, int texel_width, int texel_height) noexcept; + friend void draw_image(const Image& image, double x, double y) noexcept; + friend void draw_image(const Image& image, double x, double y, double width, double height) noexcept; + friend void draw_image(const Image& image, double x, double y, double width, double height) noexcept; + friend void draw_image(const Image& image, double x, double y, double width, double height, int texel_x, + int texel_y) noexcept; + friend void draw_image(const Image& image, double x, double y, double width, double height, int texel_x, + int texel_y, int texel_width, int texel_height) noexcept; + friend Image end_drawing_to_image(bool smooth_texture); + + public: + explicit Image(const std::shared_ptr& impl); }; /** @} */ } diff --git a/doodle_development/include/doodle/input.hpp b/doodle_development/include/doodle/input.hpp index 7a20a83..a212464 100644 --- a/doodle_development/include/doodle/input.hpp +++ b/doodle_development/include/doodle/input.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/noise.hpp b/doodle_development/include/doodle/noise.hpp index 0cacf5b..d719a4f 100644 --- a/doodle_development/include/doodle/noise.hpp +++ b/doodle_development/include/doodle/noise.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/random.hpp b/doodle_development/include/doodle/random.hpp index f410a10..713251b 100644 --- a/doodle_development/include/doodle/random.hpp +++ b/doodle_development/include/doodle/random.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. diff --git a/doodle_development/include/doodle/version.hpp b/doodle_development/include/doodle/version.hpp index 0e2b3e9..bae9999 100644 --- a/doodle_development/include/doodle/version.hpp +++ b/doodle_development/include/doodle/version.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details. @@ -9,5 +9,5 @@ namespace doodle { - constexpr auto VERSION = "0.2.3"; + constexpr auto VERSION = "0.2.4"; } diff --git a/doodle_development/include/doodle/window.hpp b/doodle_development/include/doodle/window.hpp index e0bc6fd..52974ec 100644 --- a/doodle_development/include/doodle/window.hpp +++ b/doodle_development/include/doodle/window.hpp @@ -1,5 +1,5 @@ /*--------------------------------------------------------------* - Copyright (C) 2019 Rudy Castan + Copyright (C) 2021 Rudy Castan This file is distributed WITHOUT ANY WARRANTY. See the file `License.md' for details.