31 template<
class in_t,
class out_t>
class Cropping {
51 memcpy(*
out, *in, lineSizeBytes);
82 BEATMUP_DEBUG_E(
"Crop rectangle does not fit to bitmaps: ((%d,%d),(%d,%d)) from %d x %d to put at (%d,%d) in %d x %d.",
87 throw RuntimeError(
"Crop rectangle does not fit to bitmaps");
133 if (
out->getSize().numPixels() != clipRect.
getArea())
A very basic class for any image.
static const unsigned char BITS_PER_PIXEL[NUM_PIXEL_FORMATS]
number of bits per pixel for each pixel format
Context & getContext() const
virtual const PixelFormat getPixelFormat() const =0
Pixel format of the bitmap.
const ImageResolution getSize() const
Returns the bitmap resolution within ImageResolution object.
void unlock(AbstractBitmap *bitmap)
Drops a lock to the bitmap.
float performTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Performs a given task.
A task to clip images on CPU.
virtual bool process(TaskThread &)
Executes the task on CPU within a given thread.
IntRectangle cropRect
clip rect on input bitmap
void setOutput(AbstractBitmap *output)
virtual void afterProcessing(ThreadIndex, GraphicPipeline *, bool)
Instruction called after the task is executed.
static AbstractBitmap * run(AbstractBitmap &bitmap, IntRectangle clipRect)
Copies out a specified rect of a bitmap into another bitmap.
IntPoint outOrigin
origin on output bitmap
void setOutputOrigin(IntPoint)
Sets top-left position of the clip rectangle in output bitmap.
bool isFit() const
Checks if everything is fitted to make cropping.
virtual void beforeProcessing(ThreadIndex, ProcessingTarget target, GraphicPipeline *)
Instruction called before the task is executed.
void setCropRect(IntRectangle)
Sets crop rectangle in input bitmap.
AbstractBitmap * output
input and output bitmaps
void setInput(AbstractBitmap *input)
numeric getArea() const
Computes the rectangle area.
bool isInside(const CustomPoint< numeric > &point) const
Test if a point is inside the rectangle (or on its the border)
void normalize()
Flips corners coordinates guaranteeing that it has a non negative area, i.e.
virtual const int getHeight() const =0
Height of the texture in pixels.
virtual const int getWidth() const =0
Width of the texture in pixels.
Internal low-level GPU control API.
IntRectangle closedRectangle() const
Bitmap whose memory is managed by the Beatmup engine.
const PixelFormat getPixelFormat() const
Pixel format of the bitmap.
static void process(AbstractBitmap &input, AbstractBitmap &output, const IntRectangle &rect, const IntPoint &outOrigin)
#define BEATMUP_DEBUG_E(...)
uint32_t msize
memory size
unsigned char ThreadIndex
number of threads / thread index
jobject jlong jint jint y
Beatmup::InternalBitmap * bitmap
Beatmup::IntPoint outOrigin(left, top)
Beatmup::IntRectangle rect(x1, y1, x2, y2)