CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
CaptureMoment::Core::Common Namespace Reference

Classes

struct  ImageRegion
 Represents a rectangular region of an image and its pixel data. More...
 

Concepts

concept  ImageLike
 A concept that constrains a type to behave like an image container.
 
concept  MutableImageLike
 Extends ImageLike to require read/write access.
 

Typedefs

using ImageDim = std::size_t
 Type for image dimensions (width, height).
 
using ImageChan = std::uint8_t
 Type for channel count.
 
using ImageCoord = std::int32_t
 Type for pixel coordinates (x, y).
 
using ImageSize = std::size_t
 Type for data size (element count).
 

Enumerations

enum class  PixelFormat : std::uint8_t { RGBA_F32 , RGB_F32 }
 Enumerates the supported pixel storage formats in memory. More...
 
enum class  MemoryType : std::uint8_t { CPU_RAM = 0 , GPU_MEMORY = 1 }
 Enum representing the memory type where image data is stored. More...
 

Functions

constexpr std::uint8_t getChannelCount (PixelFormat pf) noexcept
 Returns the number of channels for a given PixelFormat.
 
constexpr std::size_t getPixelSizeInBytes (PixelFormat fmt) noexcept
 Returns the size in bytes of a single pixel for a given PixelFormat.
 

Typedef Documentation

◆ ImageDim

Type for image dimensions (width, height).

Native word size, supports large images (64MP+).

Definition at line 20 of file image_types.h.

◆ ImageChan

Type for channel count.

Max 4 channels (RGBA), uint8_t sufficient.

Definition at line 26 of file image_types.h.

◆ ImageCoord

Type for pixel coordinates (x, y).

Signed for negative offsets in region calculations.

Definition at line 32 of file image_types.h.

◆ ImageSize

Type for data size (element count).

Large images require size_t.

Definition at line 38 of file image_types.h.

Enumeration Type Documentation

◆ PixelFormat

enum class CaptureMoment::Core::Common::PixelFormat : std::uint8_t
strong

Enumerates the supported pixel storage formats in memory.

This enum defines the layout and data type for individual pixels. It specifies both the number of channels (e.g., RGB vs. RGBA) and the data type used for each channel's value (e.g., float32 vs. uint8).

Note
The RGBA_F32 format is the recommended default for internal processing pipelines as it supports High Dynamic Range (HDR) data and preserves maximum precision during calculations.
See also
Common::ImageRegion::m_format
Enumerator
RGBA_F32 

4-channel format: Red, Green, Blue, Alpha in 32-bit float.

Each pixel is stored as 4 consecutive float values.

  • Size per pixel: 16 bytes (4 channels * 4 bytes per float)
  • Value range: Theoretically [-inf, +inf], but typically [0.0f, 1.0f] for normalized data. HDR values can exceed [0.0f, 1.0f].
  • Usage: Standard format for internal image processing pipelines where HDR support and high precision are required.
ImageRegion region;
region.channels = 4;
@ RGBA_F32
4-channel format: Red, Green, Blue, Alpha in 32-bit float.
Represents a rectangular region of an image and its pixel data.
constexpr ImageChan channels() const noexcept
constexpr PixelFormat format() const noexcept
RGB_F32 

3-channel format: Red, Green, Blue in 32-bit float.

Each pixel is stored as 3 consecutive float values.

  • Size per pixel: 12 bytes (3 channels * 4 bytes per float)
  • Value range: Typically [0.0f, 1.0f].
  • Usage: Common for image files that do not contain an alpha channel.

Definition at line 38 of file pixel_format.h.

◆ MemoryType

enum class CaptureMoment::Core::Common::MemoryType : std::uint8_t
strong

Enum representing the memory type where image data is stored.

Used by IWorkingImage and related classes to identify where the actual pixel data is located (in CPU RAM or GPU Memory).

Uses std::uint8_t as underlying type for memory efficiency.

Enumerator
CPU_RAM 

Data is stored in main CPU RAM.

GPU_MEMORY 

Data is stored in GPU memory.

Definition at line 24 of file memory_type.h.

Function Documentation

◆ getChannelCount()

std::uint8_t CaptureMoment::Core::Common::getChannelCount ( PixelFormat pf)
nodiscardconstexprnoexcept

Returns the number of channels for a given PixelFormat.

Parameters
pfThe pixel format.
Returns
The number of channels (e.g., 3 for RGB, 4 for RGBA). Returns 0 if the format is invalid.

Definition at line 74 of file pixel_format.h.

References RGB_F32, and RGBA_F32.

Referenced by getPixelSizeInBytes().

◆ getPixelSizeInBytes()

std::size_t CaptureMoment::Core::Common::getPixelSizeInBytes ( PixelFormat fmt)
nodiscardconstexprnoexcept

Returns the size in bytes of a single pixel for a given PixelFormat.

Parameters
fmtThe pixel format.
Returns
The size in bytes (e.g., 12 for RGB_F32, 16 for RGBA_F32). Returns 0 if the format is invalid.

Definition at line 92 of file pixel_format.h.

References getChannelCount().

CaptureMoment — footer