Beatmup
|
A task to clip images on CPU. More...
#include <crop.h>
Public Member Functions | |
Crop () | |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
void | setInput (AbstractBitmap *input) |
void | setOutput (AbstractBitmap *output) |
void | setCropRect (IntRectangle) |
Sets crop rectangle in input bitmap. More... | |
void | setOutputOrigin (IntPoint) |
Sets top-left position of the clip rectangle in output bitmap. More... | |
bool | isFit () const |
Checks if everything is fitted to make cropping. More... | |
Public Member Functions inherited from Beatmup::AbstractTask | |
virtual bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) |
Executes the task on GPU. More... | |
virtual TaskDeviceRequirement | getUsedDevices () const |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Static Public Member Functions | |
static AbstractBitmap * | run (AbstractBitmap &bitmap, IntRectangle clipRect) |
Copies out a specified rect of a bitmap into another bitmap. More... | |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Protected Member Functions | |
virtual bool | process (TaskThread &) |
Executes the task on CPU within a given thread. More... | |
virtual void | beforeProcessing (ThreadIndex, ProcessingTarget target, GraphicPipeline *) |
Instruction called before the task is executed. More... | |
virtual void | afterProcessing (ThreadIndex, GraphicPipeline *, bool) |
Instruction called after the task is executed. More... | |
Private Attributes | |
AbstractBitmap * | input |
AbstractBitmap * | output |
input and output bitmaps More... | |
IntPoint | outOrigin |
origin on output bitmap More... | |
IntRectangle | cropRect |
clip rect on input bitmap More... | |
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... | |
Private Member Functions inherited from Beatmup::BitmapContentLock | |
BitmapContentLock () | |
~BitmapContentLock () | |
void | readLock (GraphicPipeline *gpu, AbstractBitmap *bitmap, ProcessingTarget target) |
Locks content of a bitmap for reading using a specific processing target device. More... | |
void | writeLock (GraphicPipeline *gpu, AbstractBitmap *bitmap, ProcessingTarget target) |
Locks content of a bitmap for writing using a specific processing target device. More... | |
void | unlock (AbstractBitmap *bitmap) |
Drops a lock to the bitmap. More... | |
void | unlockAll () |
Unlocks all the locked bitmaps unconditionally. More... | |
template<const ProcessingTarget target> | |
void | lock (GraphicPipeline *gpu, AbstractBitmap *input, AbstractBitmap *output) |
void | lock (GraphicPipeline *gpu, ProcessingTarget target, AbstractBitmap *input, AbstractBitmap *output) |
template<const ProcessingTarget target> | |
void | lock (GraphicPipeline *gpu, std::initializer_list< AbstractBitmap * > read, std::initializer_list< AbstractBitmap * > write) |
template<typename ... Args> | |
void | unlock (AbstractBitmap *first, Args ... others) |
|
protectedvirtual |
Executes the task on CPU within a given thread.
Generally called by multiple threads.
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Implements Beatmup::AbstractTask.
Definition at line 71 of file crop.cpp.
|
protectedvirtual |
Instruction called before the task is executed.
threadCount | Number of threads used to perform the task |
target | Device used to perform the task |
gpu | A graphic pipeline instance; may be null. |
Reimplemented from Beatmup::AbstractTask.
Definition at line 77 of file crop.cpp.
|
protectedvirtual |
Instruction called after the task is executed.
threadCount | Number of threads used to perform the task |
gpu | GPU to be used to execute the task; may be null. |
aborted | true if the task was aborted |
Reimplemented from Beatmup::AbstractTask.
Definition at line 93 of file crop.cpp.
|
inlinevirtual |
Gives the upper limint on the number of threads the task may be performed by.
The actual number of threads running a specific task may be less or equal to the returned value, depending on the number of workers in ThreadPool running the task.
Reimplemented from Beatmup::AbstractTask.
void Crop::setInput | ( | AbstractBitmap * | input | ) |
void Crop::setOutput | ( | AbstractBitmap * | output | ) |
void Crop::setCropRect | ( | IntRectangle | rect | ) |
void Crop::setOutputOrigin | ( | IntPoint | pos | ) |
bool Crop::isFit | ( | ) | const |
Checks if everything is fitted to make cropping.
Definition at line 118 of file crop.cpp.
|
static |
Copies out a specified rect of a bitmap into another bitmap.
Definition at line 130 of file crop.cpp.
|
private |
|
private |
|
private |
|
private |