HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Friends
hi::v1::pixmap< T, Allocator > Class Template Reference

#include <hikogui/image/pixmap.hpp>

Data Structures

struct  row_iterator
 
struct  row_range
 

Public Types

using value_type = T
 The pixel format type.
 
using allocator_type = Allocator
 The allocator to use for allocating the array.
 
using size_type = size_t
 The size type.
 
using pointer = value_type *
 
using const_pointer = value_type const *
 
using reference = value_type&
 
using const_reference = value_type const&
 
using interator = pointer
 
using const_iterator = const_pointer
 
using row_type = std::span<value_type>
 The type for a row of pixels.
 
using const_row_type = std::span<value_type const>
 The type for a row of pixels.
 

Public Member Functions

constexpr pixmap (pixmap const &other)
 Copy constructor.
 
constexpr pixmap (pixmap &&other) noexcept
 Move constructor.
 
constexpr pixmapoperator= (pixmap const &other)
 Copy assignment.
 
constexpr pixmapoperator= (pixmap &&other)
 Move assignment.
 
constexpr pixmap (size_type width, size_type height, allocator_type allocator=allocator_type{})
 Create an pixmap of width and height.
 
template<std::convertible_to< value_type > O>
constexpr pixmap (O *hi_restrict data, size_type width, size_type height, size_type stride, allocator_type allocator=allocator_type{})
 
template<std::convertible_to< value_type > O>
constexpr pixmap (O *hi_restrict data, size_type width, size_type height, allocator_type allocator=allocator_type{}) noexcept
 
template<std::convertible_to< value_type > O>
constexpr pixmap (pixmap< O > const &other, allocator_type allocator=allocator_type{})
 
template<std::convertible_to< value_type > O>
constexpr pixmap (pixmap_span< O > const &other, allocator_type allocator=allocator_type{})
 
template<std::same_as< value_type const > O>
constexpr operator pixmap_span< O > () const noexcept
 
constexpr allocator_type get_allocator () const noexcept
 
constexpr size_type width () const noexcept
 
constexpr size_type height () const noexcept
 
constexpr size_type size () const noexcept
 The number of pixels (width * height) in this image.
 
constexpr size_type capacity () const noexcept
 The number of pixels of capacity allocated.
 
constexpr bool empty () const noexcept
 
constexpr pointer data () noexcept
 
constexpr const_pointer data () const noexcept
 
constexpr interator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr interator end () noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr reference operator() (size_type x, size_type y) noexcept
 
constexpr const_reference operator() (size_type x, size_type y) const noexcept
 
constexpr row_type operator[] (size_type y) noexcept
 
constexpr const_row_type operator[] (size_type y) const noexcept
 
constexpr auto rows () noexcept
 
constexpr auto rows () const noexcept
 
constexpr pixmap subimage (size_type x, size_type y, size_type new_width, size_type new_height, allocator_type allocator) const noexcept
 
constexpr pixmap subimage (size_type x, size_type y, size_type new_width, size_type new_height) const noexcept
 
constexpr void clear () noexcept
 
constexpr void shrink_to_fit ()
 

Friends

constexpr friend bool operator== (pixmap const &lhs, pixmap const &rhs) noexcept
 
constexpr friend void fill (pixmap &dst, value_type value=value_type{}) noexcept
 

Detailed Description

template<typename T, typename Allocator = std::allocator<T>>
class hi::v1::pixmap< T, Allocator >

A 2D pixel-based image.

Template Parameters
TThe pixel format.
AllocatorThe allocator to use for allocating the array of pixels.

Member Typedef Documentation

◆ allocator_type

template<typename T , typename Allocator = std::allocator<T>>
using hi::v1::pixmap< T, Allocator >::allocator_type = Allocator

The allocator to use for allocating the array.

◆ const_row_type

template<typename T , typename Allocator = std::allocator<T>>
using hi::v1::pixmap< T, Allocator >::const_row_type = std::span<value_type const>

The type for a row of pixels.

◆ row_type

template<typename T , typename Allocator = std::allocator<T>>
using hi::v1::pixmap< T, Allocator >::row_type = std::span<value_type>

The type for a row of pixels.

◆ size_type

template<typename T , typename Allocator = std::allocator<T>>
using hi::v1::pixmap< T, Allocator >::size_type = size_t

The size type.

◆ value_type

template<typename T , typename Allocator = std::allocator<T>>
using hi::v1::pixmap< T, Allocator >::value_type = T

The pixel format type.

Constructor & Destructor Documentation

◆ pixmap() [1/3]

template<typename T , typename Allocator = std::allocator<T>>
constexpr hi::v1::pixmap< T, Allocator >::pixmap ( pixmap< T, Allocator > const & other)
inlineconstexpr

Copy constructor.

Copy the image from other; using the allocator obtained using std::allocator_traits<Allocator>::select_on_container_copy_construction(other.get_allocator())

The new allocation will be fit the pixels in the image exactly.

Parameters
otherThe other image to copy.

◆ pixmap() [2/3]

template<typename T , typename Allocator = std::allocator<T>>
constexpr hi::v1::pixmap< T, Allocator >::pixmap ( pixmap< T, Allocator > && other)
inlineconstexprnoexcept

Move constructor.

Move the image.

Parameters
otherThe other image to copy.

◆ pixmap() [3/3]

template<typename T , typename Allocator = std::allocator<T>>
constexpr hi::v1::pixmap< T, Allocator >::pixmap ( size_type width,
size_type height,
allocator_type allocator = allocator_type{} )
inlineconstexpr

Create an pixmap of width and height.

Member Function Documentation

◆ capacity()

template<typename T , typename Allocator = std::allocator<T>>
constexpr size_type hi::v1::pixmap< T, Allocator >::capacity ( ) const
inlineconstexprnoexcept

The number of pixels of capacity allocated.

◆ operator=() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
constexpr pixmap & hi::v1::pixmap< T, Allocator >::operator= ( pixmap< T, Allocator > && other)
inlineconstexpr

Move assignment.

Move the image. Allocation uses the std::allocator_trait<Allocator>::propagate_on_container_move_assignment

Parameters
otherThe other image to copy.

◆ operator=() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
constexpr pixmap & hi::v1::pixmap< T, Allocator >::operator= ( pixmap< T, Allocator > const & other)
inlineconstexpr

Copy assignment.

Copy the image. Allocation uses the std::allocator_trait<Allocator>::propagate_on_container_copy_assignment

Parameters
otherThe other image to copy.

◆ size()

template<typename T , typename Allocator = std::allocator<T>>
constexpr size_type hi::v1::pixmap< T, Allocator >::size ( ) const
inlineconstexprnoexcept

The number of pixels (width * height) in this image.


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