Beatmup
Beatmup::Filters::Sepia Class Reference

Sepia filter. More...

#include <sepia.h>

Inheritance diagram for Beatmup::Filters::Sepia:
Beatmup::Filters::PixelwiseFilter Beatmup::AbstractTask Beatmup::BitmapContentLock Beatmup::Object

Protected Member Functions

virtual void apply (int x, int y, msize nPix, TaskThread &thread)
 Applies filtering to given pixel data. More...
 
virtual std::string getGlslSourceCode () const
 Provides GLSL source code of the filter. More...
 
- Protected Member Functions inherited from Beatmup::Filters::PixelwiseFilter
virtual std::string getGlslDeclarations () const
 Provides GLSL declarations used in the GLSL code. More...
 
virtual void setup (bool useGpu)
 A callback run every time before the filter is applied to the image. More...
 
virtual bool process (TaskThread &thread) final
 Executes the task on CPU within a given thread. More...
 
virtual bool processOnGPU (GraphicPipeline &gpu, TaskThread &thread) final
 Executes the task on GPU. More...
 
virtual void beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
 Instruction called before the task is executed. More...
 
virtual void afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted)
 Instruction called after the task is executed. More...
 
virtual TaskDeviceRequirement getUsedDevices () const final
 Communicates devices (CPU and/or GPU) the task is run on. More...
 
 PixelwiseFilter ()
 

Additional Inherited Members

- Public Types inherited from Beatmup::AbstractTask
enum class  TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY }
 Specifies which device (CPU and/or GPU) is used to run the task. More...
 
- Public Member Functions inherited from Beatmup::Filters::PixelwiseFilter
virtual ~PixelwiseFilter ()
 
virtual void setInput (AbstractBitmap *input)
 
virtual void setOutput (AbstractBitmap *output)
 
AbstractBitmapgetInput ()
 
AbstractBitmapgetOutput ()
 
ThreadIndex getMaxThreads () const
 Gives the upper limint on the number of threads the task may be performed by. More...
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 
- Static Public Member Functions inherited from Beatmup::AbstractTask
static ThreadIndex validThreadCount (int number)
 Valid thread count from a given integer value. More...
 
- Protected Attributes inherited from Beatmup::Filters::PixelwiseFilter
AbstractBitmapinputBitmap
 
AbstractBitmapoutputBitmap
 
ImageShadershader
 
- Static Protected Attributes inherited from Beatmup::Filters::PixelwiseFilter
static const std::string GLSL_RGBA_INPUT
 

Detailed Description

Sepia filter.

An example of PixelwiseFilter implementation.

Definition at line 29 of file sepia.h.

Member Function Documentation

◆ apply()

void Filters::Sepia::apply ( int  x,
int  y,
msize  nPix,
TaskThread thread 
)
protectedvirtual

Applies filtering to given pixel data.

Parameters
xHorizontal position of the first pixel in image
yVertical position of the first pixel in image
nPixNumber of pixels to process
threadCalling thread descriptor

Implements Beatmup::Filters::PixelwiseFilter.

Definition at line 56 of file sepia.cpp.

56  {
57  BitmapProcessing::pipeline<Kernels::ApplySepia>(*inputBitmap, *outputBitmap, x, y, nPix);
58 }
jobject jlong jint jint y
jobject jlong jint x

◆ getGlslSourceCode()

std::string Filters::Sepia::getGlslSourceCode ( ) const
protectedvirtual

Provides GLSL source code of the filter.

Implements Beatmup::Filters::PixelwiseFilter.

Definition at line 61 of file sepia.cpp.

61  {
62  return
63  "gl_FragColor = vec4(dot(vec3(100.0/255.0, 196.0/255.0, 48.0/255.0), " + GLSL_RGBA_INPUT + ".rgb)," +
64  "dot(vec3( 89.0/255.0, 175.0/255.0, 43.0/255.0), " + GLSL_RGBA_INPUT + ".rgb)," +
65  "dot(vec3( 69.0/255.0, 138.0/255.0, 33.0/255.0), " + GLSL_RGBA_INPUT + ".rgb)," +
66  GLSL_RGBA_INPUT + ".a);";
67 }
static const std::string GLSL_RGBA_INPUT

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