Practical Tools for Simple Design
Loading...
Searching...
No Matches
Util::Image Class Reference

A class representing an image. More...

#include <Image.hpp>

Inheritance diagram for Util::Image:
Core::Drawable

Public Member Functions

 Image (const std::string &filepath, bool useAA=true)
 Constructor that takes a file path to the image. More...
 
glm::vec2 GetSize () const override
 Retrieves the size of the image. More...
 
void SetImage (const std::string &filepath)
 Sets the image to the specified file path. More...
 
void UseAntiAliasing (bool useAA)
 Sets whether anti-aliasing (AA) should be enabled or disabled. More...
 
void Draw (const Core::Matrices &data) override
 Draws the image with a given transform and z-index. More...
 
virtual void Draw (const Core::Matrices &data)=0
 
virtual glm::vec2 GetSize () const =0
 

Detailed Description

A class representing an image.

This class encapsulates the properties and behaviors of an image. It includes properties such as texture and surface. It also includes behaviors such as drawing the image.

Constructor & Destructor Documentation

◆ Image()

Util::Image::Image ( const std::string &  filepath,
bool  useAA = true 
)

Constructor that takes a file path to the image.

Parameters
filepathThe file path to the image.
useAAFlag indicating whether anti-aliasing should be enabled (default is true).

Member Function Documentation

◆ Draw()

void Util::Image::Draw ( const Core::Matrices data)
overridevirtual

Draws the image with a given transform and z-index.

This function draws the image at the specified z-index and applies the given transform.

Parameters
transformThe transform to apply to the image.
zIndexThe z-index at which to draw the image.

Implements Core::Drawable.

◆ GetSize()

glm::vec2 Util::Image::GetSize ( ) const
inlineoverridevirtual

Retrieves the size of the image.

This function returns the size of the image.

Returns
The size of the image as a vec2(x, y).

Implements Core::Drawable.

◆ SetImage()

void Util::Image::SetImage ( const std::string &  filepath)

Sets the image to the specified file path.

This function sets the image to the specified file path.

Parameters
filepathThe file path to the image.

◆ UseAntiAliasing()

void Util::Image::UseAntiAliasing ( bool  useAA)

Sets whether anti-aliasing (AA) should be enabled or disabled.

Parameters
useAAA boolean value indicating whether anti-aliasing should be enabled (true) or disabled (false).
Note
This function only sets the internal flag for anti-aliasing and does not directly affect rendering. The actual effect of anti-aliasing depends on the rendering pipeline and the graphics hardware capabilities.
See also
https://en.wikipedia.org/wiki/Spatial_anti-aliasing

The documentation for this class was generated from the following file: