Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Pnm Class Reference

#include <pnm.hh>

Inheritance diagram for Pnm:
Inheritance graph
Collaboration diagram for Pnm:
Collaboration graph

Public Types

using Ptr = std::shared_ptr< Pnm >
 
- Public Types inherited from PluginInformationInterface
using Ptr = std::shared_ptr< PluginInformationInterface >
 
- Public Types inherited from Scroom::TiledBitmap::OpenTiledBitmapInterface
using Ptr = std::shared_ptr< OpenTiledBitmapInterface >
 

Public Member Functions

std::string getPluginName () override
 
std::string getPluginVersion () override
 
void registerCapabilities (ScroomPluginInterface::Ptr host) override
 
std::list< GtkFileFilter * > getFilters () override
 
std::tuple< Scroom::TiledBitmap::BitmapMetaData, Layer::Ptr, Scroom::TiledBitmap::ReloadFunctionopen (const std::string &fileName) override
 
- Public Member Functions inherited from PluginInformationInterface
 PluginInformationInterface ()=default
 
- Public Member Functions inherited from Scroom::Utils::Base
 Base ()=default
 
 Base (const Base &)=delete
 
 Base (Base &&)=delete
 
Baseoperator= (const Base &)=delete
 
Baseoperator= (Base &&)=delete
 
virtual ~Base ()=default
 
template<typename R >
std::shared_ptr< R > shared_from_this ()
 
template<typename R >
std::shared_ptr< R const > shared_from_this () const
 

Static Public Member Functions

static Ptr create ()
 

Private Member Functions

 Pnm ()=default
 

Private Attributes

Scroom::Logger m_logger
 

Additional Inherited Members

- Public Attributes inherited from PluginInformationInterface
const int pluginApiVersion {PLUGIN_API_VERSION}
 

Member Typedef Documentation

◆ Ptr

using Pnm::Ptr = std::shared_ptr<Pnm>

Constructor & Destructor Documentation

◆ Pnm()

Pnm::Pnm ( )
privatedefault

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ create()

Pnm::Ptr Pnm::create ( )
static
19{ return Ptr(new Pnm()); }
Pnm()=default
std::shared_ptr< Pnm > Ptr
Definition pnm.hh:28

Referenced by getPluginInformation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFilters()

std::list< GtkFileFilter * > Pnm::getFilters ( )
overridevirtual

Implements Scroom::TiledBitmap::OpenTiledBitmapInterface.

39{
40 std::list<GtkFileFilter*> result;
41
42 GtkFileFilter* filter = gtk_file_filter_new();
43 gtk_file_filter_set_name(filter, "Pnm files");
44 gtk_file_filter_add_pattern(filter, "*.pnm");
45 gtk_file_filter_add_pattern(filter, "*.pgm");
46 gtk_file_filter_add_pattern(filter, "*.ppm");
47 gtk_file_filter_add_pattern(filter, "*.pbm");
48 result.push_back(filter);
49
50 return result;
51}
SampleIterator< const uint8_t > result
Definition sampleiterator-tests.cc:94

◆ getPluginName()

std::string Pnm::getPluginName ( )
overridevirtual

Implements PluginInformationInterface.

25{ return "Pnm"; }

◆ getPluginVersion()

std::string Pnm::getPluginVersion ( )
overridevirtual

Implements PluginInformationInterface.

27{ return PACKAGE_VERSION; }

◆ open()

std::tuple< BitmapMetaData, Layer::Ptr, ReloadFunction > Pnm::open ( const std::string &  fileName)
overridevirtual

Implements Scroom::TiledBitmap::OpenTiledBitmapInterface.

54{
55 auto r = Scroom::Pnm::open(m_logger, fileName);
56 if(r)
57 {
58 auto [bitmapMetaData, pnm, sourceType] = std::move(*r);
59
60 auto layer = Layer::create(
61 bitmapMetaData.rect.getWidth(),
62 bitmapMetaData.rect.getHeight(),
63 bitmapMetaData.bitsPerSample * bitmapMetaData.samplesPerPixel
64 );
65
66 Scroom::Pnm::Source::Ptr sourcePresentation;
67 if(sourceType == Scroom::Pnm::SourceType::Ascii)
68 {
69 sourcePresentation = Scroom::Pnm::AsciiSource::create(fileName, std::move(pnm), bitmapMetaData);
70 }
71 else if(sourceType == Scroom::Pnm::SourceType::Ascii1bpp)
72 {
73 sourcePresentation = Scroom::Pnm::AsciiSource1bpp::create(fileName, std::move(pnm), bitmapMetaData);
74 }
75 else
76 {
77 sourcePresentation = Scroom::Pnm::BinarySource::create(fileName, std::move(pnm), bitmapMetaData);
78 }
79
80 auto load = [sourcePresentation, layer](const ProgressInterface::Ptr& progressInterface)
81 {
82 return sourcePresentation->resetPresentation() ? scheduleLoadingBitmap(sourcePresentation, layer, progressInterface)
83 : Empty();
84 };
85
86 return {bitmapMetaData, layer, load};
87 }
88 return {{}, {}, {}};
89}
static Ptr create(int depth, int layerWidth, int layerHeight, int bpp, Scroom::MemoryBlobs::PageProvider::Ptr provider)
Definition layer.cc:101
Scroom::Logger m_logger
Definition pnm.hh:32
std::shared_ptr< ProgressInterface > Ptr
Definition progressinterface.hh:20
static Ptr create(std::string fileName, std::ifstream pnm, BitmapMetaData bmd)
Definition pnmsource.cc:285
static Ptr create(std::string fileName, std::ifstream pnm, BitmapMetaData bmd)
Definition pnmsource.cc:235
static Ptr create(std::string fileName, std::ifstream pnm, BitmapMetaData bmd)
Definition pnmsource.cc:191
std::shared_ptr< Source > Ptr
Definition pnmsource.hh:36
void load(GtkFileFilterInfo const &info)
Definition loader.cc:235
boost::optional< std::tuple< Scroom::TiledBitmap::BitmapMetaData, std::ifstream, SourceType > > open(const Scroom::Logger &logger, const std::string &fileName)
Definition pnmsource.cc:55
Scroom::Utils::Stuff scheduleLoadingBitmap(const SourcePresentation::Ptr &sp, const Layer::Ptr &layer, const ProgressInterface::Ptr &progress)
Definition tiled-bitmap.cc:33
Stuff Empty()
Definition stuff.hh:21
Scroom::Utils::Rectangle< double > const r
Definition transformpresentation_test.cc:65
Here is the call graph for this function:

◆ registerCapabilities()

void Pnm::registerCapabilities ( ScroomPluginInterface::Ptr  host)
overridevirtual

Implements PluginInformationInterface.

30{
31 host->registerOpenTiledBitmapInterface("Pnm viewer", shared_from_this<Pnm>());
32}

Member Data Documentation

◆ m_logger

Scroom::Logger Pnm::m_logger
private

Referenced by open().


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