doodle
0.2
Intended to support teaching C++, doodle is a simple library that helps make a window and makes it easy to do some drawing.
|
Classes | |
class | doodle::Image |
Image class to store a 2D array of RGBA colors. Also manages an image on the Graphics Card. More... | |
Functions | |
Image | doodle::capture_screenshot_to_image () |
Captures a screenshot of the whole screen. More... | |
Image | doodle::capture_screenshot_to_image (int left_x, int bottom_y, int pixels_width, int pixels_height) noexcept |
Captures a screenshot of a subsection of the screen. More... | |
void | doodle::draw_image (const Image &image, double x, double y) noexcept |
Draw an entire image to the screen. More... | |
void | doodle::draw_image (const Image &image, double x, double y, double width, double height) noexcept |
Draw an entire image to the screen and resize it to a custom size. More... | |
void | doodle::draw_image (const Image &image, double x, double y, double width, double height, int texel_x, int texel_y) noexcept |
Draw a subsection of the image to the screen. More... | |
void | doodle::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 |
Draw a subsection of the image to the screen. More... | |
void | doodle::set_tint_color (HexColor color) noexcept |
Sets the fill value for displaying images to the specified HexColor. More... | |
void | doodle::set_tint_color (Color color) noexcept |
Sets the fill value for displaying textures to the specified Color. More... | |
void | doodle::set_tint_color (double grey, double alpha=255) noexcept |
Sets the fill value for displaying textures to the specified grey color. More... | |
void | doodle::set_tint_color (double red, double green, double blue, double alpha=255) noexcept |
Sets the fill value for displaying textures to the specified RGBA color. More... | |
void | doodle::no_tint () noexcept |
Removes the current fill value for displaying images and reverts to displaying textures with their original colors. More... | |
void | doodle::set_image_mode (RectMode mode) noexcept |
Modifies the location from which textures are drawn by changing the way in which parameters given to draw_image() are interpreted. More... | |
void | doodle::begin_drawing_to_image (int image_width, int image_height, bool apply_antialiasing=true) |
Redirect all draw command to draw to an image. More... | |
Image | doodle::end_drawing_to_image (bool smooth_texture=false) |
End a session of drawing to an image. More... | |
Functions for drawing to an Image.
Image class to store a 2D array of colors
void doodle::begin_drawing_to_image | ( | int | image_width, |
int | image_height, | ||
bool | apply_antialiasing = true |
||
) |
Redirect all draw command to draw to an image.
image_width | The desired width of the image |
image_height | The desired height of the image |
apply_antialiasing | Should multi-sample anti-aliasing be applied? |
Image doodle::capture_screenshot_to_image | ( | ) |
Captures a screenshot of the whole screen.
|
noexcept |
Captures a screenshot of a subsection of the screen.
Useful if you only want to save a portion of the screen.
The coordinates you give are assumed to be in the RightHanded_OriginBottomLeft frame of reference.
left_x | x-coordinate for the left part of the box containing the screenshot |
bottom_y | y-coordinate for the bottom part of the box containing the screenshot |
pixels_width | width of the box containing the screenshot |
pixels_height | height of the box containing the screenshot |
|
noexcept |
Draw an entire image to the screen.
The width and height of the image will be based off of the image width and image height.
image | image object to draw |
x | x-coordinate of the rectangle to draw the image. |
y | y-coordinate of the rectangle to draw the image. |
The following example uses this orange hero image file.
|
noexcept |
Draw an entire image to the screen and resize it to a custom size.
image | image object to draw |
x | x-coordinate of the rectangle to draw the image. |
y | y-coordinate of the rectangle to draw the image. |
width | how wide to draw the image |
height | how tall to draw the image |
The following example uses this orange hero image file.
|
noexcept |
Draw a subsection of the image to the screen.
The subsection is defined is defined by the box
Image (0,0) +---------------------------------------------------------------------+ | | |(texel_x,texel_y) | | o--------------------------------+ | | | | | | | | | | | | | | | | | | | | | | +--------------------------------o | | (texel_x+width,texel_y+height) | | | | | | | +---------------------------------------------------------------------+ (image_width,image_height)
image | image object to draw |
x | x-coordinate of the rectangle to draw the image. |
y | y-coordinate of the rectangle to draw the image. |
width | how wide to draw the image |
height | how tall to draw the image |
texel_x | Horizontally, where in image to start reading colors from the image. 0 is the far left and image width is the far right. |
texel_y | Vertically, where in image to start reading colors from the image. 0 is the far top and image height is the far bottom. |
The following example uses this orange hero image file.
|
noexcept |
Draw a subsection of the image to the screen.
The subsection is defined is defined by the box
Image (0,0) +---------------------------------------------------------------------+ | | |(texel_x,texel_y) | | o--------------------------------+ | | | | | | | | | | | | | | | | | | | | | | +--------------------------------o | | (texel_x+texel_width,texel_y+texel_height) | | | | | | | +---------------------------------------------------------------------+ (image_width,image_height)
image | image object to draw |
x | x-coordinate of the rectangle to draw the image. |
y | y-coordinate of the rectangle to draw the image. |
width | how wide to draw the image |
height | how tall to draw the image |
texel_x | Horizontally, where in image to start reading colors from the image. 0 is the far left and image width is the far right. |
texel_y | Vertically, where in image to start reading colors from the image. 0 is the far top and image height is the far bottom. |
texel_width | width of image subsection to read the colors from |
texel_height | height of image subsection to read the colors from |
The following example uses this orange hero image file.
Image doodle::end_drawing_to_image | ( | bool | smooth_texture = false | ) |
End a session of drawing to an image.
smooth_texture | Should the texture use a smooth filtering when being drawn |
|
noexcept |
Removes the current fill value for displaying images and reverts to displaying textures with their original colors.
The following example uses this orange hero image file.
|
noexcept |
Modifies the location from which textures are drawn by changing the way in which parameters given to draw_image() are interpreted.
The default mode is RectMode::CORNER, which interprets the first two parameters of draw_image() as upper-left or bottom-left corner of the shape in a left handed doodle::FrameOfReference and right handed doodle::FrameOfReference respectively, while the third and fourth parameters are its width and height.
RectMode::CENTER interprets the first two parameters of draw_image() as the shape's center point, while the third and fourth parameters are its width and height.
mode | either CORNER or CENTER |
|
noexcept |
Sets the fill value for displaying textures to the specified Color.
Textures can be tinted to specified colors or made transparent by including an alpha value.
color | Color to apply to textures |
The following example uses this orange hero image file.
|
noexcept |
Sets the fill value for displaying textures to the specified grey color.
Textures can be tinted to specified colors or made transparent by including an alpha value.
grey | specifies a value between white and black |
alpha | optional opacity value of the background between 0-255. The default value is 255. |
The following example uses this orange hero image file.
|
noexcept |
Sets the fill value for displaying textures to the specified RGBA color.
Textures can be tinted to specified colors or made transparent by including an alpha value.
red | value between 0-255 |
green | value between 0-255 |
blue | value between 0-255 |
alpha | optional opacity value of the background between 0-255. The default value is 255. |
The following example uses this orange hero image file.
|
noexcept |
Sets the fill value for displaying images to the specified HexColor.
Images can be tinted to specified colors or made transparent by including an alpha value.
color | HexColor to apply to images |
The following example uses this orange hero image file.