20 #include "../exception.h"
31 namespace BitmapProcessing {
38 Exception(
"Processing action is not implemented for given pixel format: '%s'",
AbstractBitmap::PIXEL_FORMAT_NAMES[fmt])
48 template<
template<
class>
class Func,
class Bitmap,
typename... Args>
52 Func<SingleByteBitmapReader>::process(
bitmap, args...);
55 Func<TripleByteBitmapReader>::process(
bitmap, args...);
58 Func<QuadByteBitmapReader>::process(
bitmap, args...);
61 Func<SingleFloatBitmapReader>::process(
bitmap, args...);
64 Func<TripleFloatBitmapReader>::process(
bitmap, args...);
67 Func<QuadFloatBitmapReader>::process(
bitmap, args...);
70 Func<BinaryMaskReader>::process(
bitmap, args...);
73 Func<QuaternaryMaskReader>::process(
bitmap, args...);
76 Func<HexMaskReader>::process(
bitmap, args...);
89 template<
template<
class>
class Func,
class Bitmap,
typename... Args>
93 Func<SingleByteBitmapWriter>::process(
bitmap, args...);
96 Func<TripleByteBitmapWriter>::process(
bitmap, args...);
99 Func<QuadByteBitmapWriter>::process(
bitmap, args...);
102 Func<SingleFloatBitmapWriter>::process(
bitmap, args...);
105 Func<TripleFloatBitmapWriter>::process(
bitmap, args...);
108 Func<QuadFloatBitmapWriter>::process(
bitmap, args...);
111 Func<BinaryMaskWriter>::process(
bitmap, args...);
114 Func<QuaternaryMaskWriter>::process(
bitmap, args...);
117 Func<HexMaskWriter>::process(
bitmap, args...);
130 template<
template<
class>
class Func,
class Bitmap,
typename... Args>
134 Func<BinaryMaskWriter>::process(
bitmap, args...);
137 Func<QuaternaryMaskWriter>::process(
bitmap, args...);
140 Func<HexMaskWriter>::process(
bitmap, args...);
143 Func<SingleByteMaskWriter>::process(
bitmap, args...);
151 template<
template<
class,
class>
class Func,
class InputBitmap,
class OutputBitmap,
typename... Args>
152 inline void pipeline(InputBitmap& in, OutputBitmap&
out, Args&&... args) {
154 #define WRITING(IN_R) \
155 switch (out.getPixelFormat()) { \
157 Func<IN_R, SingleByteBitmapWriter>::process(in, out, args...); \
160 Func<IN_R, TripleByteBitmapWriter>::process(in, out, args...); \
163 Func<IN_R, QuadByteBitmapWriter>::process(in, out, args...); \
166 Func<IN_R, SingleFloatBitmapWriter>::process(in, out, args...); \
169 Func<IN_R, TripleFloatBitmapWriter>::process(in, out, args...); \
172 Func<IN_R, QuadFloatBitmapWriter>::process(in, out, args...); \
175 Func<IN_R, BinaryMaskWriter>::process(in, out, args...); \
177 case QuaternaryMask: \
178 Func<IN_R, QuaternaryMaskWriter>::process(in, out, args...); \
181 Func<IN_R, HexMaskWriter>::process(in, out, args...); \
183 default: throw ProcessingActionNotImplemented(out.getPixelFormat()); \
186 switch (in.getPixelFormat()) {
221 template<
template<
class,
class>
class Func,
class InputBitmap,
class OutputBitmap,
typename... Args>
224 #define WRITING(IN_R) \
225 switch (out.getPixelFormat()) { \
227 Func<IN_R, BinaryMaskWriter>::process(in, out, args...); \
229 case QuaternaryMask: \
230 Func<IN_R, QuaternaryMaskWriter>::process(in, out, args...); \
233 Func<IN_R, HexMaskWriter>::process(in, out, args...); \
236 Func<IN_R, SingleByteMaskWriter>::process(in, out, args...); \
238 default: throw ProcessingActionNotImplemented(out.getPixelFormat()); \
241 switch (in.getPixelFormat()) {
A very basic class for any image.
Exception thrown in a situation when a processing action is not implemented for pixel formats of spec...
ProcessingActionNotImplemented(PixelFormat fmt)
Base class for all exceptions.
const PixelFormat getPixelFormat() const
Pixel format of the bitmap.
A generic to access sub-byte mask bitmap data.
Quad float bitmap reader.
Single byte bitmap reader.
Single float bitmap reader.
Triple byte bitmap reader.
Triple float bitmap reader.
void pipelineWithMaskOutput(InputBitmap &in, OutputBitmap &out, Args &&... args)
void pipeline(InputBitmap &in, OutputBitmap &out, Args &&... args)
void writeToMask(Bitmap &bitmap, Args &&... args)
Calls a Func< WriterClass >::process(access, params) that writes to a mask bitmap where.
void write(Bitmap &bitmap, Args &&... args)
Calls a Func< WriterClass >::process(access, params) that writes to a bitmap of any kind,...
void read(Bitmap &bitmap, Args &&... args)
Calls a Func< ReaderClass >::process(access, params), where.
@ SingleByte
single channel of 8 bits per pixel (like grayscale), unsigned integer values
@ SingleFloat
single channel of 32 bits per pixel (like grayscale), single precision floating point values
@ QuaternaryMask
2 bits per pixel
@ QuadFloat
4 channels of 32 bits per pixel, single precision floating point values,
@ TripleFloat
3 channels of 32 bits per pixel, single precision floating point values
@ QuadByte
4 channels of 8 bits per pixel (like RGBA), unsigned integer values
@ TripleByte
3 channels of 8 bits per pixel (like RGB), unsigned integer values
@ BinaryMask
1 bit per pixel
@ HexMask
4 bits per pixel
Beatmup::InternalBitmap * bitmap