MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::IO::ImageReader Class Reference

File reader for image formats (PNG, JPG, BMP, TGA, etc.) More...

#include <ImageReader.hpp>

+ Inheritance diagram for MayaFlux::IO::ImageReader:
+ Collaboration diagram for MayaFlux::IO::ImageReader:

Public Member Functions

bool can_read (const std::string &filepath) const override
 Check if a file can be read by this reader.
 
void close () override
 Close the currently open file.
 
std::shared_ptr< Kakshya::SignalSourceContainercreate_container () override
 Create and initialize a container from the file.
 
std::shared_ptr< Buffers::TextureBuffercreate_texture_buffer ()
 Create a VKBuffer containing the loaded image pixel data.
 
std::type_index get_container_type () const override
 Get the container type this reader creates.
 
std::type_index get_data_type () const override
 Get the data type this reader produces.
 
std::vector< uint64_t > get_dimension_sizes () const override
 Get size of each dimension in the file data.
 
std::optional< ImageDataget_image_data () const
 Get the loaded image data.
 
std::string get_last_error () const override
 Get the last error message.
 
std::optional< FileMetadataget_metadata () const override
 Get metadata from the open file.
 
size_t get_num_dimensions () const override
 Get the dimensionality of the file data.
 
uint64_t get_preferred_chunk_size () const override
 Get the preferred chunk size for streaming.
 
std::vector< uint64_t > get_read_position () const override
 Get current read position in primary dimension.
 
std::vector< FileRegionget_regions () const override
 Get semantic regions from the file.
 
std::vector< std::string > get_supported_extensions () const override
 Get supported file extensions for this reader.
 
 ImageReader ()
 
bool is_open () const override
 Check if a file is currently open.
 
bool load_into_buffer (const std::shared_ptr< Buffers::VKBuffer > &buffer)
 Load image directly into an existing VKBuffer.
 
bool load_into_container (std::shared_ptr< Kakshya::SignalSourceContainer > container) override
 Load file data into an existing container.
 
bool open (const std::string &filepath, FileReadOptions options=FileReadOptions::ALL) override
 Open a file for reading.
 
std::vector< Kakshya::DataVariantread_all () override
 Read all data from the file into memory.
 
std::vector< Kakshya::DataVariantread_region (const FileRegion &region) override
 Read a specific region of data.
 
bool seek (const std::vector< uint64_t > &position) override
 Seek to a specific position in the file.
 
bool supports_streaming () const override
 Check if streaming is supported for the current file.
 
 ~ImageReader () override
 
- Public Member Functions inherited from MayaFlux::IO::FileReader
virtual ~FileReader ()=default
 

Static Public Member Functions

static std::optional< ImageDataload (const std::filesystem::path &path, int desired_channels=4)
 Load image from file (static utility)
 
static std::optional< ImageDataload (const std::string &path, int desired_channels=4)
 Load image from file (static utility)
 
static std::optional< ImageDataload_from_memory (const void *data, size_t size)
 Load image from memory (static utility)
 
static std::shared_ptr< Core::VKImageload_texture (const std::string &path)
 Load image directly into GPU texture (static utility)
 
- Static Public Member Functions inherited from MayaFlux::IO::FileReader
static std::string resolve_path (const std::string &filepath)
 Resolve a filepath against the project source root if not found as-is.
 

Private Attributes

std::string m_filepath
 
std::optional< ImageDatam_image_data
 
bool m_is_open
 
std::string m_last_error
 

Additional Inherited Members

- Static Protected Member Functions inherited from MayaFlux::IO::FileReader
static std::unordered_map< std::string, Kakshya::RegionGroupregions_to_groups (const std::vector< FileRegion > &regions)
 Convert file regions to region groups.
 

Detailed Description

File reader for image formats (PNG, JPG, BMP, TGA, etc.)

Uses STB Image library for decoding. Supports:

  • PNG, JPG, BMP, TGA, PSD, GIF, HDR, PIC, PNM
  • Automatic format detection
  • Channel conversion (force RGBA, etc.)
  • Direct GPU texture creation

Implements the FileReader interface for consistency with other readers.

Definition at line 100 of file ImageReader.hpp.


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