The ZX Ecosystem v5.1.0;_GUI_v3.1.0
Loading...
Searching...
No Matches
Classes | Typedefs

Description

Definitions of RGB colors, palettes and images.

http://jafma.net

This program 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.

Collaboration diagram for ColorImages:

Classes

class  RGBColor
 A RGB color with 8 bits per component. More...
 
class  RGBPalette
 A palette defining a number of RGB colors. More...
 
class  RasterCursor< CELLW, CELLH >
 A cursor to access RasterImage pixels bi-linearly with certain tesselation. More...
 
class  RasterImage< PixelType >
 A 2D matrix of certain type that has contiguous storage. More...
 
class  PalettizedImage< ColorIndex >
 An image that stores pixel colors contiguously as palette indexes. More...
 

Typedefs

using ImageCoordDim = unsigned
 Type for coordinates and dimensions of images. More...
 
using ThreeBytes = uint8_t[3]
 Auxiliary type needed for RGBImage. More...
 
using RGBImage = RasterImage< ThreeBytes >
 An image that stores pixel colors contiguously in R-G-B format, 1 byteperpix. More...
 

Class Documentation

◆ RGBColor

class RGBColor

A RGB color with 8 bits per component.

Definition at line 46 of file ColorImages.h.

Public Types

using CompLevel = uint8_t
 A component level, from 0 to 255. More...
 

Static Public Attributes

static constexpr double kMaxRGBDist2 = 255.0 * 255.0 * 3.0
 Maximum squared Euclidean distance between 2 rgb colors. More...
 

Public Member Functions

 RGBColor (CompLevel r=0, CompLevel g=0, CompLevel b=0)
 Default constructor. More...
 
 RGBColor (const CompLevel *rgb)
 Constructor from an array of 3 components in R-G-B order. More...
 
 RGBColor (const RGBColor &)=default
 Moves are just copies.
 
 RGBColor (RGBColor &&)=default
 
RGBColoroperator= (const RGBColor &)=default
 
RGBColoroperator= (RGBColor &&)=default
 
CompLevel r (void) const noexcept
 Return the red component. More...
 
CompLevel g (void) const noexcept
 Return the green component. More...
 
CompLevel b (void) const noexcept
 Return the blue component. More...
 
const CompLevelrgb (void) const noexcept
 Return the three components in R-G-B order. More...
 
void rgbRead (CompLevel *rgb) const noexcept
 Fill the three components into RGB. More...
 
void setR (CompLevel r) noexcept
 Change the red component. More...
 
void setG (CompLevel g) noexcept
 Change the green component. More...
 
void setB (CompLevel b) noexcept
 Change the red component. More...
 
void set (CompLevel r, CompLevel g, CompLevel b) noexcept
 Change all components. More...
 
void set (const CompLevel *rgb) noexcept
 Change all components in R-G-B order. More...
 
void vector (const RGBColor &oth, double *rgbv) const noexcept
 Fill RGBV with the three components of a vector going from THIS to OTH. More...
 
double rgbDistance2 (const RGBColor &oth) const
 Return the squared Euclidean distance between THIS and OTH.
 
void setFromHTMLString (const std::string &c)
 C must be in '#......' HTML format. Otherwise, throw.
 
std::string getHTMLString (void) const
 In '#......' HTML format.
 
bool operator== (const RGBColor &oth) const noexcept
 
bool operator!= (const RGBColor &oth) const noexcept
 
std::string to_string (void) const
 Return a text describing the color.
 

Member Typedef Documentation

◆ CompLevel

using RGBColor::CompLevel = uint8_t

A component level, from 0 to 255.

Definition at line 51 of file ColorImages.h.

Constructor & Destructor Documentation

◆ RGBColor() [1/2]

RGBColor::RGBColor ( CompLevel  r = 0,
CompLevel  g = 0,
CompLevel  b = 0 
)
inline

Default constructor.

Definition at line 58 of file ColorImages.h.

◆ RGBColor() [2/2]

RGBColor::RGBColor ( const CompLevel rgb)
inline

Constructor from an array of 3 components in R-G-B order.

Definition at line 61 of file ColorImages.h.

Member Function Documentation

◆ r()

CompLevel RGBColor::r ( void  ) const
inlinenoexcept

Return the red component.

Definition at line 73 of file ColorImages.h.

◆ g()

CompLevel RGBColor::g ( void  ) const
inlinenoexcept

Return the green component.

Definition at line 76 of file ColorImages.h.

◆ b()

CompLevel RGBColor::b ( void  ) const
inlinenoexcept

Return the blue component.

Definition at line 79 of file ColorImages.h.

◆ rgb()

const CompLevel * RGBColor::rgb ( void  ) const
inlinenoexcept

Return the three components in R-G-B order.

Definition at line 82 of file ColorImages.h.

◆ rgbRead()

void RGBColor::rgbRead ( CompLevel rgb) const
inlinenoexcept

Fill the three components into RGB.

Definition at line 85 of file ColorImages.h.

◆ setR()

void RGBColor::setR ( CompLevel  r)
inlinenoexcept

Change the red component.

Definition at line 88 of file ColorImages.h.

◆ setG()

void RGBColor::setG ( CompLevel  g)
inlinenoexcept

Change the green component.

Definition at line 91 of file ColorImages.h.

◆ setB()

void RGBColor::setB ( CompLevel  b)
inlinenoexcept

Change the red component.

Definition at line 94 of file ColorImages.h.

◆ set() [1/2]

void RGBColor::set ( CompLevel  r,
CompLevel  g,
CompLevel  b 
)
inlinenoexcept

Change all components.

Definition at line 97 of file ColorImages.h.

◆ set() [2/2]

void RGBColor::set ( const CompLevel rgb)
inlinenoexcept

Change all components in R-G-B order.

Definition at line 101 of file ColorImages.h.

◆ vector()

void RGBColor::vector ( const RGBColor oth,
double *  rgbv 
) const
noexcept

Fill RGBV with the three components of a vector going from THIS to OTH.

The components are filled in R-G-B order and measure the distance from THIS to OTH (i.e., it is not normalized). RGBV must have room for 3 doubles.

◆ operator==()

bool RGBColor::operator== ( const RGBColor oth) const
inlinenoexcept

Definition at line 120 of file ColorImages.h.

◆ operator!=()

bool RGBColor::operator!= ( const RGBColor oth) const
inlinenoexcept

Definition at line 125 of file ColorImages.h.

Member Data Documentation

◆ kMaxRGBDist2

constexpr double RGBColor::kMaxRGBDist2 = 255.0 * 255.0 * 3.0
staticconstexpr

Maximum squared Euclidean distance between 2 rgb colors.

Definition at line 54 of file ColorImages.h.

◆ RGBPalette

class RGBPalette

A palette defining a number of RGB colors.

Definition at line 146 of file ColorImages.h.

Public Types

using Size = uint32_t
 Size of a palette. More...
 
using Index = Size
 Index of a color in a palette. More...
 

Public Member Functions

 RGBPalette (Size s)
 Constructor: S colors, all (0,0,0). If S is 0, throws.
 
 RGBPalette (const RGBColor::CompLevel *rgbs, Size s)
 Constructor: from an array of R-G-B bytes for S colors. More...
 
 RGBPalette (const RGBPalette &)=delete
 No copies; only moves.
 
RGBPaletteoperator= (const RGBPalette &)=delete
 
 RGBPalette (RGBPalette &&oth)=default
 
RGBPaletteoperator= (RGBPalette &&)=default
 
Size numColors (void) const noexcept
 Return the number of colors in the palette. More...
 
const RGBColoroperator[] (Index ind) const
 Read one of the colors. Throw if out of range index.
 
RGBColoroperator[] (Index ind)
 Read/write one of the colors. Throw if out of range index.
 
Index closestColor (const RGBColor &col) const noexcept
 Find the closest color in the palette to COL. More...
 
std::string to_string (void) const
 Return a multi-line description of the palette.
 

Member Typedef Documentation

◆ Size

using RGBPalette::Size = uint32_t

Size of a palette.

Definition at line 151 of file ColorImages.h.

◆ Index

Index of a color in a palette.

Definition at line 154 of file ColorImages.h.

Constructor & Destructor Documentation

◆ RGBPalette()

RGBPalette::RGBPalette ( const RGBColor::CompLevel rgbs,
Size  s 
)

Constructor: from an array of R-G-B bytes for S colors.

If S is 0, throws.

Member Function Documentation

◆ numColors()

Size RGBPalette::numColors ( void  ) const
inlinenoexcept

Return the number of colors in the palette.

Definition at line 173 of file ColorImages.h.

◆ closestColor()

Index RGBPalette::closestColor ( const RGBColor col) const
noexcept

Find the closest color in the palette to COL.

Find the color in the palette with minimum euclidean distance in the rgb-space. If there are several, return the first one in the palette.

◆ RasterCursor

class RasterCursor
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
class RasterCursor< CELLW, CELLH >

A cursor to access RasterImage pixels bi-linearly with certain tesselation.

This class is defined to do optimal movements left to right / top to bottom and optimal accesses to the currently pointed pixel. The tessellation is defined with CELLW and CELLH; the cursor will move following the top-left pixel of each cell defined by these lengths. The tessellation does not need to fit the image size exactly.

Definition at line 226 of file ColorImages.h.

Public Member Functions

 RasterCursor (ImageCoordDim wimage, ImageCoordDim himage)
 Default constructor / position constructor for a given sized image. More...
 
 RasterCursor (const RasterCursor &)=default
 
 RasterCursor (RasterCursor &&)=default
 
RasterCursoroperator= (const RasterCursor &)=default
 
RasterCursoroperator= (RasterCursor &&)=default
 
constexpr ImageCoordDim cellW (void) const noexcept
 To get the tesselation in X from any RasterCursor object. More...
 
constexpr ImageCoordDim cellH (void) const noexcept
 To get the tesselation in Y from any RasterCursor object. More...
 
void setRegion (ImageCoordDim xmin, ImageCoordDim xlength, ImageCoordDim ymin, ImageCoordDim ylength)
 Change the region of the image reachable by the cursor. More...
 
void resetRegion (void)
 Change area of the image reachable by the cursor to the whole image. More...
 
bool inside (void) const noexcept
 Return TRUE if the cursor is inside the current region of the image. More...
 
RasterCursor< 1, 1 > subCursor (void) const
 Return a cursor limited to the cell where this cursor is. More...
 
void set (ImageCoordDim xc, ImageCoordDim yc) noexcept
 Set the cursor to the given cell coords. Do not throw if outside. More...
 
void reset (void) noexcept
 Set the cursor to the top-left cell coords of the current region. More...
 
ImageCoordDim x (void) const noexcept
 Return the X-cell coordinate within current region. More...
 
ImageCoordDim y (void) const noexcept
 Return the Y-cell coordinate within current region. More...
 
ImageCoordDim xPixel (void) const noexcept
 Return the X-pixel coordinate within current region. More...
 
ImageCoordDim yPixel (void) const noexcept
 Return the Y-pixel coordinate within current region. More...
 
size_t globalOffset (void) const
 Return the linear offset within the image corresponding to cursor. More...
 
bool right (void) noexcept
 Move the cursor one cell to the right (no row change). More...
 
bool forward (void) noexcept
 Move the cursor one cell forward. More...
 
bool lastChangedRow (void) const noexcept
 Return TRUE if the last movement caused a change of row. More...
 
std::string to_string (bool summary=true) const
 Return a text describing the cursor. More...
 

Constructor & Destructor Documentation

◆ RasterCursor()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
RasterCursor< CELLW, CELLH >::RasterCursor ( ImageCoordDim  wimage,
ImageCoordDim  himage 
)
inline

Default constructor / position constructor for a given sized image.

The image size must be in pixels. After creation, the cursor is at the top-left pixel of the image and it is allowed to reach any part of the image (see setRegion()).

Definition at line 234 of file ColorImages.h.

Member Function Documentation

◆ cellW()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
constexpr ImageCoordDim RasterCursor< CELLW, CELLH >::cellW ( void  ) const
inlineconstexprnoexcept

To get the tesselation in X from any RasterCursor object.

Definition at line 248 of file ColorImages.h.

◆ cellH()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
constexpr ImageCoordDim RasterCursor< CELLW, CELLH >::cellH ( void  ) const
inlineconstexprnoexcept

To get the tesselation in Y from any RasterCursor object.

Definition at line 251 of file ColorImages.h.

◆ setRegion()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
void RasterCursor< CELLW, CELLH >::setRegion ( ImageCoordDim  xmin,
ImageCoordDim  xlength,
ImageCoordDim  ymin,
ImageCoordDim  ylength 
)
inline

Change the region of the image reachable by the cursor.

The limits are given in one-pixel coordinates, not in cells. They can correspond to a region smaller than a cell. If the region goes beyond the image size, it is readjusted to cover only existing image. Also reset cursor position to the top-left pixel of that region, which get cell coords (0,0) from now on.

Definition at line 259 of file ColorImages.h.

◆ resetRegion()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
void RasterCursor< CELLW, CELLH >::resetRegion ( void  )
inline

Change area of the image reachable by the cursor to the whole image.

Definition at line 287 of file ColorImages.h.

◆ inside()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
bool RasterCursor< CELLW, CELLH >::inside ( void  ) const
inlinenoexcept

Return TRUE if the cursor is inside the current region of the image.

Definition at line 290 of file ColorImages.h.

◆ subCursor()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
RasterCursor< 1, 1 > RasterCursor< CELLW, CELLH >::subCursor ( void  ) const
inline

Return a cursor limited to the cell where this cursor is.

The tesselation of the returned cursor is of 1 pixel. It is placed at the top-left corner of the current cell, i.e., at the same position as the current cursor.

Definition at line 298 of file ColorImages.h.

◆ set()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
void RasterCursor< CELLW, CELLH >::set ( ImageCoordDim  xc,
ImageCoordDim  yc 
)
inlinenoexcept

Set the cursor to the given cell coords. Do not throw if outside.

The pixel pointed by the cursor will be the top-left one of that cell. The changed-row indicator is set to false (see lastChangedRow()). XC and YC must be specified within the current region.

Definition at line 308 of file ColorImages.h.

◆ reset()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
void RasterCursor< CELLW, CELLH >::reset ( void  )
inlinenoexcept

Set the cursor to the top-left cell coords of the current region.

Definition at line 312 of file ColorImages.h.

◆ x()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
ImageCoordDim RasterCursor< CELLW, CELLH >::x ( void  ) const
inlinenoexcept

Return the X-cell coordinate within current region.

Unpredictable value if not inside (see inside()).

Definition at line 316 of file ColorImages.h.

◆ y()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
ImageCoordDim RasterCursor< CELLW, CELLH >::y ( void  ) const
inlinenoexcept

Return the Y-cell coordinate within current region.

Unpredictable value if not inside (see inside()).

Definition at line 321 of file ColorImages.h.

◆ xPixel()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
ImageCoordDim RasterCursor< CELLW, CELLH >::xPixel ( void  ) const
inlinenoexcept

Return the X-pixel coordinate within current region.

Unpredictable value if not inside (see inside()).

Definition at line 326 of file ColorImages.h.

◆ yPixel()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
ImageCoordDim RasterCursor< CELLW, CELLH >::yPixel ( void  ) const
inlinenoexcept

Return the Y-pixel coordinate within current region.

Unpredictable value if not inside (see inside()).

Definition at line 330 of file ColorImages.h.

◆ globalOffset()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
size_t RasterCursor< CELLW, CELLH >::globalOffset ( void  ) const
inline

Return the linear offset within the image corresponding to cursor.

This ignores region: the offset is in the whole image dimensions provided when the cursor was created.

Definition at line 335 of file ColorImages.h.

◆ right()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
bool RasterCursor< CELLW, CELLH >::right ( void  )
inlinenoexcept

Move the cursor one cell to the right (no row change).

If it was at the last cell of the row or outside the current region, do not do anything and return FALSE.

Definition at line 340 of file ColorImages.h.

◆ forward()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
bool RasterCursor< CELLW, CELLH >::forward ( void  )
inlinenoexcept

Move the cursor one cell forward.

Change cell row and do carrier return if goes out of the row. Return FALSE if gone out of the current region in the image.

Definition at line 347 of file ColorImages.h.

◆ lastChangedRow()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
bool RasterCursor< CELLW, CELLH >::lastChangedRow ( void  ) const
inlinenoexcept

Return TRUE if the last movement caused a change of row.

Initially or after any set/reset, it is false.

Definition at line 360 of file ColorImages.h.

◆ to_string()

template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
std::string RasterCursor< CELLW, CELLH >::to_string ( bool  summary = true) const
inline

Return a text describing the cursor.

Definition at line 364 of file ColorImages.h.

◆ RasterImage

class RasterImage
template<typename PixelType>
class RasterImage< PixelType >

A 2D matrix of certain type that has contiguous storage.

A RasterImage stores contiguously a number of pixel values of certain type PixelType and can be accessed both linearly and bi-linearly through the RasterCursor class. It can be in undefined (empty) state.

Definition at line 433 of file ColorImages.h.

Public Member Functions

 RasterImage (void)=default
 Default constructor: undefined content.
 
 RasterImage (ImageCoordDim w, ImageCoordDim h)
 Constructor: image of certain size; content not set, just stored. More...
 
 RasterImage (const RasterImage &)=delete
 Copies forbidden; moves leave the original without content.
 
 RasterImage (RasterImage &&oth)
 
RasterImageoperator= (const RasterImage &)=delete
 
RasterImageoperator= (RasterImage &&oth)
 
bool empty (void) const noexcept
 
ImageCoordDim width (void) const noexcept
 
ImageCoordDim height (void) const noexcept
 
size_t numPixels (void) const noexcept
 
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
RasterCursor< CELLW, CELLH > makeCursor (void) const
 
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
PixelType & pixel (const RasterCursor< CELLW, CELLH > &cursor)
 
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
const PixelType & pixel (const RasterCursor< CELLW, CELLH > &cursor) const
 
PixelType * contigContent (void) noexcept
 
const PixelType * contigContent (void) const noexcept
 

Constructor & Destructor Documentation

◆ RasterImage() [1/2]

template<typename PixelType >
RasterImage< PixelType >::RasterImage ( ImageCoordDim  w,
ImageCoordDim  h 
)
inline

Constructor: image of certain size; content not set, just stored.

Throw if the size does not match exactly the tesselation.

Definition at line 442 of file ColorImages.h.

◆ RasterImage() [2/2]

template<typename PixelType >
RasterImage< PixelType >::RasterImage ( RasterImage< PixelType > &&  oth)
inline

Definition at line 449 of file ColorImages.h.

Member Function Documentation

◆ operator=()

template<typename PixelType >
RasterImage & RasterImage< PixelType >::operator= ( RasterImage< PixelType > &&  oth)
inline

Definition at line 451 of file ColorImages.h.

◆ empty()

template<typename PixelType >
bool RasterImage< PixelType >::empty ( void  ) const
inlinenoexcept

Definition at line 457 of file ColorImages.h.

◆ width()

template<typename PixelType >
ImageCoordDim RasterImage< PixelType >::width ( void  ) const
inlinenoexcept

Definition at line 458 of file ColorImages.h.

◆ height()

template<typename PixelType >
ImageCoordDim RasterImage< PixelType >::height ( void  ) const
inlinenoexcept

Definition at line 459 of file ColorImages.h.

◆ numPixels()

template<typename PixelType >
size_t RasterImage< PixelType >::numPixels ( void  ) const
inlinenoexcept

Definition at line 460 of file ColorImages.h.

◆ makeCursor()

template<typename PixelType >
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
RasterCursor< CELLW, CELLH > RasterImage< PixelType >::makeCursor ( void  ) const
inline

Definition at line 463 of file ColorImages.h.

◆ pixel() [1/2]

template<typename PixelType >
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
PixelType & RasterImage< PixelType >::pixel ( const RasterCursor< CELLW, CELLH > &  cursor)
inline

Definition at line 467 of file ColorImages.h.

◆ pixel() [2/2]

template<typename PixelType >
template<ImageCoordDim CELLW = 1, ImageCoordDim CELLH = 1>
const PixelType & RasterImage< PixelType >::pixel ( const RasterCursor< CELLW, CELLH > &  cursor) const
inline

Definition at line 471 of file ColorImages.h.

◆ contigContent() [1/2]

template<typename PixelType >
PixelType * RasterImage< PixelType >::contigContent ( void  )
inlinenoexcept

Definition at line 474 of file ColorImages.h.

◆ contigContent() [2/2]

template<typename PixelType >
const PixelType * RasterImage< PixelType >::contigContent ( void  ) const
inlinenoexcept

Definition at line 476 of file ColorImages.h.

◆ PalettizedImage

class PalettizedImage
template<typename ColorIndex>
class PalettizedImage< ColorIndex >

An image that stores pixel colors contiguously as palette indexes.

Those indexes must be enough to store any palette color, but do not have to coincide with the RGBPalette::Index type, which is intended for managing palettes, not to store images efficiently. A PalettizedImage can be created empty and becomes empty if moved to another one; empty palettized images throw in operations.

Definition at line 529 of file ColorImages.h.

Inheritance diagram for PalettizedImage< ColorIndex >:
Collaboration diagram for PalettizedImage< ColorIndex >:

Public Types

using Base = RasterImage< ColorIndex >
 

Public Member Functions

 PalettizedImage (void)=default
 Default constructor: emptied palettized image.
 
 PalettizedImage (const RGBPalette &pal, unsigned w, unsigned h)
 Create storage for an image with the given palette and dimensions. More...
 
 PalettizedImage (const RGBPalette &pal, const RGBImage &img)
 Build a palettized version of RGBIMG. More...
 
 PalettizedImage (const PalettizedImage &)=delete
 Copies forbidden; moves leave the original without content.
 
 PalettizedImage (PalettizedImage &&oth)
 
PalettizedImageoperator= (const PalettizedImage &)=delete
 
PalettizedImageoperator= (PalettizedImage &&oth)
 
const RGBPalettepalette (void) const noexcept
 
RGBImage toRGBImg (void) const
 Create and return a new RGBImage with the content of this image. More...
 
- Public Member Functions inherited from RasterImage< ColorIndex >
 RasterImage (void)=default
 Default constructor: undefined content.
 
 RasterImage (ImageCoordDim w, ImageCoordDim h)
 Constructor: image of certain size; content not set, just stored. More...
 
 RasterImage (const RasterImage &)=delete
 Copies forbidden; moves leave the original without content.
 
 RasterImage (RasterImage &&oth)
 
RasterImageoperator= (const RasterImage &)=delete
 
RasterImageoperator= (RasterImage &&oth)
 
bool empty (void) const noexcept
 
ImageCoordDim width (void) const noexcept
 
ImageCoordDim height (void) const noexcept
 
size_t numPixels (void) const noexcept
 
RasterCursor< CELLW, CELLH > makeCursor (void) const
 
ColorIndex & pixel (const RasterCursor< CELLW, CELLH > &cursor)
 
const ColorIndex & pixel (const RasterCursor< CELLW, CELLH > &cursor) const
 
ColorIndex * contigContent (void) noexcept
 
const ColorIndex * contigContent (void) const noexcept
 

Member Typedef Documentation

◆ Base

template<typename ColorIndex >
using PalettizedImage< ColorIndex >::Base = RasterImage<ColorIndex>

Definition at line 533 of file ColorImages.h.

Constructor & Destructor Documentation

◆ PalettizedImage() [1/3]

template<typename ColorIndex >
PalettizedImage< ColorIndex >::PalettizedImage ( const RGBPalette pal,
unsigned  w,
unsigned  h 
)
inline

Create storage for an image with the given palette and dimensions.

Throw if PAL is not compatible with ColorIndex. PAL must outlive this object since a pointer is internally kept.

Definition at line 541 of file ColorImages.h.

◆ PalettizedImage() [2/3]

template<typename ColorIndex >
PalettizedImage< ColorIndex >::PalettizedImage ( const RGBPalette pal,
const RGBImage img 
)
inline

Build a palettized version of RGBIMG.

Definition at line 549 of file ColorImages.h.

◆ PalettizedImage() [3/3]

template<typename ColorIndex >
PalettizedImage< ColorIndex >::PalettizedImage ( PalettizedImage< ColorIndex > &&  oth)
inline

Definition at line 564 of file ColorImages.h.

Member Function Documentation

◆ operator=()

template<typename ColorIndex >
PalettizedImage & PalettizedImage< ColorIndex >::operator= ( PalettizedImage< ColorIndex > &&  oth)
inline

Definition at line 566 of file ColorImages.h.

◆ palette()

template<typename ColorIndex >
const RGBPalette & PalettizedImage< ColorIndex >::palette ( void  ) const
inlinenoexcept

Definition at line 572 of file ColorImages.h.

◆ toRGBImg()

template<typename ColorIndex >
RGBImage PalettizedImage< ColorIndex >::toRGBImg ( void  ) const
inline

Create and return a new RGBImage with the content of this image.

Definition at line 576 of file ColorImages.h.

Typedef Documentation

◆ ImageCoordDim

using ImageCoordDim = unsigned

#include <ColorImages.h>

Type for coordinates and dimensions of images.

Definition at line 210 of file ColorImages.h.

◆ ThreeBytes

using ThreeBytes = uint8_t[3]

#include <ColorImages.h>

Auxiliary type needed for RGBImage.

[0] -> red, [1] -> green, [2] -> blue

Definition at line 505 of file ColorImages.h.

◆ RGBImage

#include <ColorImages.h>

An image that stores pixel colors contiguously in R-G-B format, 1 byteperpix.

Accessing each r-g-b pixel is done as: auto * pix = rgimg.contigContent(); pix[<pixel offset>][0] = 2; pix[<pixel offset>][1] = 3; pix[<pixel offset>][2] = 4;

Definition at line 513 of file ColorImages.h.