#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2021 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_PIXELS_DRAWING_SIMPLESHAPERENDERER_H #define NUCLEX_PIXELS_DRAWING_SIMPLESHAPERENDERER_H #include "Nuclex/Pixels/Config.h" #include "Nuclex/Pixels/Bitmap.h" #include "Nuclex/Pixels/Rectangle.h" #include "Nuclex/Pixels/ColorModels/RgbColor.h" namespace Nuclex { namespace Pixels { namespace Drawing { // ------------------------------------------------------------------------------------------- // /// Renders simple geometric shapes into bitmaps /// /// /// This only does the basics. Nuclex.Pixels is a library intended to provide /// well-defined, standardized way of dealing with Bitmaps, converting between /// different in-memory storage formats and load/saving them to disk. /// /// /// The SimpleShapeRenderer lets you place markers or indicators in /// images to aid in visualizing and debugging your graphics code. /// /// /// For advanced drawing of complex shapes and curves in high quality, take a look at /// the Blend2D library which is not only the fastest /// 2D rasterizer around, but also provides high quality output. For a mature graphics /// library, you can take a look at Cairo /// which is portable to many platforms and actively used by many applications. /// /// class NUCLEX_PIXELS_TYPE SimpleShapeRenderer { /// Draws the outline of a rectangle onto a Bitmap /// Bitmap the rectangle outline will be drawn onto /// Color of the rectangle outline /// /// Coordinates along which the rectangle outline will be drawn /// /// /// It's okay if the rectangle partially or completely leaves the Bitmap's area, /// pixels outside the Bitmap will simply not be drawn. /// public: NUCLEX_PIXELS_API static void DrawRectangleOutline( Bitmap &bitmap, const ColorModels::RgbColor &color, const Rectangle &coordinates ); /// Draws the outline of a rectangle onto a Bitmap /// Bitmap the rectangle outline will be drawn onto /// Color of the rectangle outline /// Coordinate of the rectangle's left border /// Coordinate of the rectangle's top border (Y downward) /// Width of the rectangle /// Height of the rectangle /// /// It's okay if the rectangle partially or completely leaves the Bitmap's area, /// pixels outside the Bitmap will simply not be drawn. /// public: NUCLEX_PIXELS_API static void DrawRectangleOutline( Bitmap &bitmap, const ColorModels::RgbColor &color, std::size_t x, std::size_t y, std::size_t width, std::size_t height ); /// Fills a rectangular area on the Bitmap /// Bitmap on which a filled rectangle will be drawn /// Color of the filled rectangle /// /// Coordinates along which the filled rectangle will be drawn /// /// /// It's okay if the rectangle partially or completely leaves the Bitmap's area, /// pixels outside the Bitmap will simply not be drawn. /// public: NUCLEX_PIXELS_API static void FillRectangle( Bitmap &bitmap, const ColorModels::RgbColor &color, const Rectangle &coordinates ); /// Fills a rectangular area on the Bitmap /// Bitmap on which a filled rectangle will be drawn /// Color of the filled rectangle /// Coordinate of the rectangle's left border /// Coordinate of the rectangle's top border (Y downward) /// Width of the rectangle /// Height of the rectangle /// /// It's okay if the rectangle partially or completely leaves the Bitmap's area, /// pixels outside the Bitmap will simply not be drawn. /// public: NUCLEX_PIXELS_API static void FillRectangle( Bitmap &bitmap, const ColorModels::RgbColor &color, std::size_t x, std::size_t y, std::size_t width, std::size_t height ); /// Draws a line segment onto the Bitmap /// Bitmap onto which a line segment will be drawn /// Color of the line segment /// X coordinate of the line segment's start point /// Y coordinate of the line segment's start point (Y downward) /// X coordinate of the line segment's end point /// Y coordinate of the line segment's end point (Y downward) /// /// It's okay if the rectangle partially or completely leaves the Bitmap's area, /// pixels outside the Bitmap will simply not be drawn. /// public: NUCLEX_PIXELS_API static void DrawLine( Bitmap &bitmap, const ColorModels::RgbColor &color, std::size_t fromX, std::size_t fromY, std::size_t toX, std::size_t yoY ); /// Fills the entire Bitmap with the specified color /// Bitmap that will be cleared /// Color with which the entire Bitmap will be filled public: NUCLEX_PIXELS_API static void Clear( Bitmap &bitmap, const ColorModels::RgbColor &color ); }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Pixels::ColorModels #endif // NUCLEX_PIXELS_COLORMODELS_COLORMODELCONVERTER_H