HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions
v1::pixel_map< T > Class Template Reference

#include <hikogui/pixel_map.hpp>

Public Types

using value_type = T
 

Public Member Functions

 pixel_map () noexcept
 Construct an empty pixel-map.
 
 pixel_map (T *pixels, std::size_t width, std::size_t height, std::size_t stride) noexcept
 Construct an pixel-map from memory received from an API.
 
 pixel_map (T *pixels, std::size_t width, std::size_t height) noexcept
 Construct an pixel-map from memory received from an API.
 
 pixel_map (std::size_t width, std::size_t height, std::size_t stride) noexcept
 Construct an pixel-map without a memory association.
 
 pixel_map (std::size_t width, std::size_t height) noexcept
 Construct an pixel-map without a memory association.
 
 pixel_map (pixel_map const &other) noexcept
 Copy constructor of other.
 
 pixel_map (pixel_map &&other) noexcept
 
 operator bool () const noexcept
 
std::size_t width () const noexcept
 
std::size_t height () const noexcept
 
std::size_t stride () const noexcept
 
pixel_mapoperator= (pixel_map const &other)
 Disallowing copying so that life-time of selfAllocated pixels is easy to understand.
 
pixel_mapoperator= (pixel_map &&other) noexcept
 
extent2 extent () const noexcept
 
pixel_map submap (std::size_t x, std::size_t y, std::size_t width, std::size_t height) const noexcept
 Get a (smaller) view of the map.
 
pixel_map submap (aarectangle rectangle) const noexcept
 
pixel_row< T > const operator[] (std::size_t rowNr) const noexcept
 
pixel_row< T > operator[] (std::size_t rowNr) noexcept
 
pixel_row< T > const at (std::size_t rowNr) const noexcept
 
pixel_row< T > at (std::size_t rowNr) noexcept
 

Detailed Description

template<typename T>
class v1::pixel_map< T >

A 2D canvas of pixels.

This class may either allocate its own memory, or gives access to memory allocated by another API, such as a Vulkan texture.

Constructor & Destructor Documentation

◆ pixel_map() [1/6]

template<typename T >
v1::pixel_map< T >::pixel_map ( )
inlinenoexcept

Construct an empty pixel-map.

◆ pixel_map() [2/6]

template<typename T >
v1::pixel_map< T >::pixel_map ( T * pixels,
std::size_t width,
std::size_t height,
std::size_t stride )
inlinenoexcept

Construct an pixel-map from memory received from an API.

Parameters
pixelsA pointer to pixels received from the API.
widthThe width of the image.
heightThe height of the image.
strideNumber of pixel elements until the next row.

◆ pixel_map() [3/6]

template<typename T >
v1::pixel_map< T >::pixel_map ( T * pixels,
std::size_t width,
std::size_t height )
inlinenoexcept

Construct an pixel-map from memory received from an API.

Parameters
pixelsA pointer to pixels received from the API.
widthThe width of the image.
heightThe height of the image.

◆ pixel_map() [4/6]

template<typename T >
v1::pixel_map< T >::pixel_map ( std::size_t width,
std::size_t height,
std::size_t stride )
inlinenoexcept

Construct an pixel-map without a memory association.

Parameters
widthThe width of the image.
heightThe height of the image.
strideThe number of pixels in a line until the next line.

◆ pixel_map() [5/6]

template<typename T >
v1::pixel_map< T >::pixel_map ( std::size_t width,
std::size_t height )
inlinenoexcept

Construct an pixel-map without a memory association.

Parameters
widthThe width of the image.
heightThe height of the image.

◆ pixel_map() [6/6]

template<typename T >
v1::pixel_map< T >::pixel_map ( pixel_map< T > const & other)
inlinenoexcept

Copy constructor of other.

If the data in other is self allocated a new copy is created. If other is a view, then a new view is creted.

Member Function Documentation

◆ operator=()

template<typename T >
pixel_map & v1::pixel_map< T >::operator= ( pixel_map< T > const & other)
inline

Disallowing copying so that life-time of selfAllocated pixels is easy to understand.

◆ submap()

template<typename T >
pixel_map v1::pixel_map< T >::submap ( std::size_t x,
std::size_t y,
std::size_t width,
std::size_t height ) const
inlinenoexcept

Get a (smaller) view of the map.

Parameters
xx-offset in the current pixel-map
yy-offset in the current pixel-map
widthwidth of the returned image.
heightheight of the returned image.
Returns
A new pixel-map that point to the same memory as the current pixel-map.

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