Beatmup
Beatmup::BitmapProcessing Namespace Reference

Contains templates calling elementary image processing routines depending on pixel formats of their arguments. More...

Classes

class  ProcessingActionNotImplemented
 Exception thrown in a situation when a processing action is not implemented for pixel formats of specific arguments. More...
 

Functions

template<template< class > class Func, class Bitmap , typename... Args>
void read (Bitmap &bitmap, Args &&... args)
 Calls a Func< ReaderClass >::process(access, params), where. More...
 
template<template< class > class Func, class Bitmap , typename... Args>
void write (Bitmap &bitmap, Args &&... args)
 Calls a Func< WriterClass >::process(access, params) that writes to a bitmap of any kind, where. More...
 
template<template< class > class Func, class Bitmap , typename... Args>
void writeToMask (Bitmap &bitmap, Args &&... args)
 Calls a Func< WriterClass >::process(access, params) that writes to a mask bitmap where. More...
 
template<template< class, class > class Func, class InputBitmap , class OutputBitmap , typename... Args>
void pipeline (InputBitmap &in, OutputBitmap &out, Args &&... args)
 
template<template< class, class > class Func, class InputBitmap , class OutputBitmap , typename... Args>
void pipelineWithMaskOutput (InputBitmap &in, OutputBitmap &out, Args &&... args)
 

Detailed Description

Contains templates calling elementary image processing routines depending on pixel formats of their arguments.

An elementary routine is a class template having a public function process() performing a specific processing action. The template arguments of this class are readers of / writers to bitmaps specialized for given pixel formats.

Function Documentation

◆ read()

template<template< class > class Func, class Bitmap , typename... Args>
void Beatmup::BitmapProcessing::read ( Bitmap &  bitmap,
Args &&...  args 
)
inline

Calls a Func< ReaderClass >::process(access, params), where.

  • access is an instance of a proper ReaderClass to read bitmap starting from pixel (x0, y0),
  • params are additional arguments.

Definition at line 49 of file processing.h.

49  {
50  switch (bitmap.getPixelFormat()) {
51  case SingleByte:
52  Func<SingleByteBitmapReader>::process(bitmap, args...);
53  break;
54  case TripleByte:
55  Func<TripleByteBitmapReader>::process(bitmap, args...);
56  break;
57  case QuadByte:
58  Func<QuadByteBitmapReader>::process(bitmap, args...);
59  break;
60  case SingleFloat:
61  Func<SingleFloatBitmapReader>::process(bitmap, args...);
62  break;
63  case TripleFloat:
64  Func<TripleFloatBitmapReader>::process(bitmap, args...);
65  break;
66  case QuadFloat:
67  Func<QuadFloatBitmapReader>::process(bitmap, args...);
68  break;
69  case BinaryMask:
70  Func<BinaryMaskReader>::process(bitmap, args...);
71  break;
72  case QuaternaryMask:
73  Func<QuaternaryMaskReader>::process(bitmap, args...);
74  break;
75  case HexMask:
76  Func<HexMaskReader>::process(bitmap, args...);
77  break;
78  default:
79  throw ProcessingActionNotImplemented(bitmap.getPixelFormat());
80  }
81  }
const PixelFormat getPixelFormat() const
Pixel format of the bitmap.
@ 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

◆ write()

template<template< class > class Func, class Bitmap , typename... Args>
void Beatmup::BitmapProcessing::write ( Bitmap &  bitmap,
Args &&...  args 
)
inline

Calls a Func< WriterClass >::process(access, params) that writes to a bitmap of any kind, where.

  • access is an instance of a proper WriterClass to write to bitmap starting from pixel (x0, y0),
  • params are additional arguments.

Definition at line 90 of file processing.h.

90  {
91  switch (bitmap.getPixelFormat()) {
92  case SingleByte:
93  Func<SingleByteBitmapWriter>::process(bitmap, args...);
94  break;
95  case TripleByte:
96  Func<TripleByteBitmapWriter>::process(bitmap, args...);
97  break;
98  case QuadByte:
99  Func<QuadByteBitmapWriter>::process(bitmap, args...);
100  break;
101  case SingleFloat:
102  Func<SingleFloatBitmapWriter>::process(bitmap, args...);
103  break;
104  case TripleFloat:
105  Func<TripleFloatBitmapWriter>::process(bitmap, args...);
106  break;
107  case QuadFloat:
108  Func<QuadFloatBitmapWriter>::process(bitmap, args...);
109  break;
110  case BinaryMask:
111  Func<BinaryMaskWriter>::process(bitmap, args...);
112  break;
113  case QuaternaryMask:
114  Func<QuaternaryMaskWriter>::process(bitmap, args...);
115  break;
116  case HexMask:
117  Func<HexMaskWriter>::process(bitmap, args...);
118  break;
119  default:
120  throw ProcessingActionNotImplemented(bitmap.getPixelFormat());
121  }
122  }

◆ writeToMask()

template<template< class > class Func, class Bitmap , typename... Args>
void Beatmup::BitmapProcessing::writeToMask ( Bitmap &  bitmap,
Args &&...  args 
)
inline

Calls a Func< WriterClass >::process(access, params) that writes to a mask bitmap where.

  • access is an instance of a proper WriterClass to write to mask starting from pixel (x0, y0),
  • params are additional arguments.

Definition at line 131 of file processing.h.

131  {
132  switch (bitmap.getPixelFormat()) {
133  case BinaryMask:
134  Func<BinaryMaskWriter>::process(bitmap, args...);
135  break;
136  case QuaternaryMask:
137  Func<QuaternaryMaskWriter>::process(bitmap, args...);
138  break;
139  case HexMask:
140  Func<HexMaskWriter>::process(bitmap, args...);
141  break;
142  case SingleByte:
143  Func<SingleByteMaskWriter>::process(bitmap, args...);
144  break;
145  default:
146  throw ProcessingActionNotImplemented(bitmap.getPixelFormat());
147  }
148  }

◆ pipeline()

template<template< class, class > class Func, class InputBitmap , class OutputBitmap , typename... Args>
void Beatmup::BitmapProcessing::pipeline ( InputBitmap &  in,
OutputBitmap &  out,
Args &&...  args 
)
inline

Definition at line 152 of file processing.h.

152  {
153 
154 #define WRITING(IN_R) \
155  switch (out.getPixelFormat()) { \
156  case SingleByte: \
157  Func<IN_R, SingleByteBitmapWriter>::process(in, out, args...); \
158  break; \
159  case TripleByte: \
160  Func<IN_R, TripleByteBitmapWriter>::process(in, out, args...); \
161  break; \
162  case QuadByte: \
163  Func<IN_R, QuadByteBitmapWriter>::process(in, out, args...); \
164  break; \
165  case SingleFloat: \
166  Func<IN_R, SingleFloatBitmapWriter>::process(in, out, args...); \
167  break; \
168  case TripleFloat: \
169  Func<IN_R, TripleFloatBitmapWriter>::process(in, out, args...); \
170  break; \
171  case QuadFloat: \
172  Func<IN_R, QuadFloatBitmapWriter>::process(in, out, args...); \
173  break; \
174  case BinaryMask: \
175  Func<IN_R, BinaryMaskWriter>::process(in, out, args...); \
176  break; \
177  case QuaternaryMask: \
178  Func<IN_R, QuaternaryMaskWriter>::process(in, out, args...); \
179  break; \
180  case HexMask: \
181  Func<IN_R, HexMaskWriter>::process(in, out, args...); \
182  break; \
183  default: throw ProcessingActionNotImplemented(out.getPixelFormat()); \
184  }
185 
186  switch (in.getPixelFormat()) {
187  case SingleByte:
188  WRITING(SingleByteBitmapReader);
189  break;
190  case TripleByte:
191  WRITING(TripleByteBitmapReader);
192  break;
193  case QuadByte:
194  WRITING(QuadByteBitmapReader);
195  break;
196  case SingleFloat:
197  WRITING(SingleFloatBitmapReader);
198  break;
199  case TripleFloat:
200  WRITING(TripleFloatBitmapReader);
201  break;
202  case QuadFloat:
203  WRITING(QuadFloatBitmapReader);
204  break;
205  case BinaryMask:
207  break;
208  case QuaternaryMask:
210  break;
211  case HexMask:
213  break;
214  default:
215  throw ProcessingActionNotImplemented(in.getPixelFormat());
216  }
217 #undef WRITING
218  }
#define WRITING(IN_R)
LookupMaskScanner< 2, MASK_LUT_2_BITS > QuaternaryMaskReader
LookupMaskScanner< 1, MASK_LUT_1_BIT > BinaryMaskReader
LookupMaskScanner< 4, MASK_LUT_4_BITS > HexMaskReader

◆ pipelineWithMaskOutput()

template<template< class, class > class Func, class InputBitmap , class OutputBitmap , typename... Args>
void Beatmup::BitmapProcessing::pipelineWithMaskOutput ( InputBitmap &  in,
OutputBitmap &  out,
Args &&...  args 
)
inline

Definition at line 222 of file processing.h.

222  {
223 
224 #define WRITING(IN_R) \
225  switch (out.getPixelFormat()) { \
226  case BinaryMask: \
227  Func<IN_R, BinaryMaskWriter>::process(in, out, args...); \
228  break; \
229  case QuaternaryMask: \
230  Func<IN_R, QuaternaryMaskWriter>::process(in, out, args...); \
231  break; \
232  case HexMask: \
233  Func<IN_R, HexMaskWriter>::process(in, out, args...); \
234  break; \
235  case SingleByte: \
236  Func<IN_R, SingleByteMaskWriter>::process(in, out, args...); \
237  break; \
238  default: throw ProcessingActionNotImplemented(out.getPixelFormat()); \
239  }
240 
241  switch (in.getPixelFormat()) {
242  case SingleByte:
243  WRITING(SingleByteBitmapReader);
244  break;
245  case TripleByte:
246  WRITING(TripleByteBitmapReader);
247  break;
248  case QuadByte:
249  WRITING(QuadByteBitmapReader);
250  break;
251  case SingleFloat:
252  WRITING(SingleFloatBitmapReader);
253  break;
254  case TripleFloat:
255  WRITING(TripleFloatBitmapReader);
256  break;
257  case QuadFloat:
258  WRITING(QuadFloatBitmapReader);
259  break;
260  case BinaryMask:
262  break;
263  case QuaternaryMask:
265  break;
266  case HexMask:
268  break;
269  default:
270  throw ProcessingActionNotImplemented(in.getPixelFormat());
271  }
272 #undef WRITING
273  }