#include <pxl_image.h>

Public Types | |
| enum | RenderingMode { rmDefault = 0, rmPreview = 1 } |
Public Member Functions | |
| virtual const u8 * | read (ssize_t *outRowStride, const Rect &inRect, RenderingMode inRenderMode=rmDefault)=0 |
| virtual void | read (const Rect &inRect, void *inFirstLinePtr, ssize_t inRowStride, RenderingMode inRenderMode=rmDefault)=0 |
Definition at line 119 of file pxl_image.h.
This enumeration controls the quality and the speed of image rendering.
| rmDefault |
This directs read function to render the image in the normal way.
|
| rmPreview |
This directs the image to use faster rendering mode. It does not care about the quality of the image.
|
Definition at line 127 of file pxl_image.h.
| virtual const u8* Celartem::ImageLock::read | ( | ssize_t * | outRowStride, | |
| const Rect & | inRect, | |||
| RenderingMode | inRenderMode = rmDefault | |||
| ) | [pure virtual] |
This function returns pointer to the raw data of the specified portion. The buffer returned by this function is valid until the next read call.
| outRowStride | Pointer to the buffer that receives the row stride. Although row stride is usually calculated by [Bytes per pixel] * [Number of pixels], sometimes it may contain padding bytes. The padding bytes depend on the implementation and you should not assume certain padding bytes. In some condition, it may be a negative value and it means that the image is stored as bottom-up image. In this case, you could not block copy the buffer by the code like the following: // This code may work incorrectly if rowStride is negative ssize_t rowStride; const u8 *raw = image->read(&rowStride, SomeRect); std::memcpy(someBuffer, raw, rowStride * SomeRect.height); // This code always works fine ssize_t rowStride; const u8 *raw = image->read(&rowStride, SomeRect); size_t bytesPerLine = (size_t)(rowStride > 0 ? rowStride : -rowStride); for(size_t y = 0; y < SomeRect.height) { std::memcpy(someBuffer, raw, bytesPerLine); someBuffer += bytesPerLine; raw += rowStride; } | |
| inRect | This parameter specifies a portion to read. | |
| inRenderMode | This parameter specifies how the image is rendered. This should be one of the RenderingMode enumeration. |
| virtual void Celartem::ImageLock::read | ( | const Rect & | inRect, | |
| void * | inFirstLinePtr, | |||
| ssize_t | inRowStride, | |||
| RenderingMode | inRenderMode = rmDefault | |||
| ) | [pure virtual] |
This function loads the raw image onto the specified buffer.
| inRect | This parameter specifies a portion to read. | |
| inFirstLinePtr | Pointer to the first line of the image data. For bottom-up images, it is not identical to the pointer to the memory block. See Accessing to Raster Image Data for more information. | |
| inRowStride | The number of bytes to be skipped to go to the next line. It could be a negative value and then the image is regarded as bottom-upped. By definition, the address of the scanline y should be calculated by the following formula: As you've already found, with bottom-up image, inBufStart should point the last line of the image. For more information about row-stride, see Accessing to Raster Image Data. | |
| inRenderMode | This parameter specifies how the image is rendered. This should be one of the RenderingMode enumeration. |