|
Krita Source Code Documentation
|
#include <kis_fixed_paint_device.h>
Inheritance diagram for KisFixedPaintDevice:Private Attributes | |
| QRect | m_bounds |
| const KoColorSpace * | m_colorSpace |
| KisOptimizedByteArray | m_data |
Additional Inherited Members | |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
A fixed paint device is a simple paint device that consists of an array of bytes and a rectangle. It cannot grow, it cannot shrink, all you can do is fill the paint device with the right bytes and use it as an argument to KisPainter or use the bytes as an argument to KoColorSpace functions.
Definition at line 27 of file kis_fixed_paint_device.h.
| KisFixedPaintDevice::KisFixedPaintDevice | ( | const KoColorSpace * | colorSpace, |
| KisOptimizedByteArray::MemoryAllocatorSP | allocator = KisOptimizedByteArray::MemoryAllocatorSP() ) |
Definition at line 14 of file kis_fixed_paint_device.cpp.
|
virtual |
Definition at line 20 of file kis_fixed_paint_device.cpp.
| KisFixedPaintDevice::KisFixedPaintDevice | ( | const KisFixedPaintDevice & | rhs | ) |
Deep copy the fixed paint device, including the data.
Definition at line 24 of file kis_fixed_paint_device.cpp.
References m_bounds, m_colorSpace, and m_data.
| int KisFixedPaintDevice::allocatedPixels | ( | ) | const |
Definition at line 65 of file kis_fixed_paint_device.cpp.
References m_colorSpace, m_data, KoColorSpace::pixelSize(), and KisOptimizedByteArray::size().
| QRect KisFixedPaintDevice::bounds | ( | ) | const |
Definition at line 59 of file kis_fixed_paint_device.cpp.
References m_bounds.
| void KisFixedPaintDevice::clear | ( | const QRect & | rc | ) |
Clear the given rectangle to transparent black.
XXX: this will not (yet) expand the paint device to contain the specified rect but if the paintdevice has not been initialized, it will be.
Definition at line 227 of file kis_fixed_paint_device.cpp.
References KoColor::data(), fill(), m_colorSpace, OPACITY_TRANSPARENT_U8, pixelSize(), KoColorSpace::pixelSize(), and KoColorSpace::setOpacity().
|
inline |
Definition at line 79 of file kis_fixed_paint_device.h.
| const quint8 * KisFixedPaintDevice::constData | ( | ) | const |
Definition at line 106 of file kis_fixed_paint_device.cpp.
References KisOptimizedByteArray::constData(), and m_data.
|
virtual |
Fill this paint device with the data from image
| image | the image |
| srcProfileName | name of the RGB profile to interpret the image as. 0 is interpreted as sRGB |
Definition at line 154 of file kis_fixed_paint_device.cpp.
References colorSpace(), KoColorSpaceRegistry::colorSpace(), KoColorSpace::convertPixelsTo(), data(), KoID::id(), KoColorSpaceRegistry::instance(), Integer8BitsColorDepthID, KoColorConversionTransformation::internalConversionFlags(), KoColorConversionTransformation::internalRenderingIntent(), lazyGrowBufferWithoutInitialization(), RGBAColorModelID, and setRect().
| void KisFixedPaintDevice::convertTo | ( | const KoColorSpace * | dstColorSpace = 0, |
| KoColorConversionTransformation::Intent | renderingIntent = KoColorConversionTransformation::internalRenderingIntent(), | ||
| KoColorConversionTransformation::ConversionFlags | conversionFlags = KoColorConversionTransformation::internalConversionFlags() ) |
Converts the paint device to a different colorspace
Definition at line 116 of file kis_fixed_paint_device.cpp.
References constData(), KoColorSpace::convertPixelsTo(), KisOptimizedByteArray::customMemoryAllocator(), KisOptimizedByteArray::data(), m_bounds, m_colorSpace, m_data, KoColorSpace::pixelSize(), and KisOptimizedByteArray::resize().
|
virtual |
Create an RGBA QImage from a rectangle in the paint device. The rectangle is defined by the parent image's bounds.
| dstProfile | RGB profile to use in conversion. May be 0, in which case it's up to the color strategy to choose a profile (most like sRGB). |
| renderingIntent | The rendering intent of conversion. |
| conversionFlags | The conversion flags. |
Definition at line 176 of file kis_fixed_paint_device.cpp.
References convertToQImage(), and m_bounds.
|
virtual |
Create an RGBA QImage from a rectangle in the paint device.
| dstProfile | RGB profile to use in conversion. May be 0, in which case it's up to the color strategy to choose a profile (most like sRGB). |
| x | Left coordinate of the rectangle |
| y | Top coordinate of the rectangle |
| w | Width of the rectangle in pixels |
| h | Height of the rectangle in pixels |
| renderingIntent | Rendering intent |
| conversionFlags | Conversion flags |
Definition at line 191 of file kis_fixed_paint_device.cpp.
References colorSpace(), constData(), KoColorSpace::convertToQImage(), m_bounds, and pixelSize().
| quint8 * KisFixedPaintDevice::data | ( | ) |
Definition at line 101 of file kis_fixed_paint_device.cpp.
References KisOptimizedByteArray::data(), and m_data.
| quint8 * KisFixedPaintDevice::data | ( | ) | const |
Definition at line 111 of file kis_fixed_paint_device.cpp.
References KisOptimizedByteArray::constData(), and m_data.
Definition at line 237 of file kis_fixed_paint_device.cpp.
References colorSpace(), KoColor::convertTo(), KoColor::data(), and fill().
| void KisFixedPaintDevice::fill | ( | qint32 | x, |
| qint32 | y, | ||
| qint32 | w, | ||
| qint32 | h, | ||
| const quint8 * | fillPixel ) |
Fill the given rectangle with the given pixel. This does not take the selection into account.
XXX: this will not (yet) expand the paint device to contain the specified rect but if the paintdevice has not been initialized, it will be.
Definition at line 244 of file kis_fixed_paint_device.cpp.
References bounds(), data(), KisOptimizedByteArray::isEmpty(), m_bounds, m_colorSpace, m_data, pixelSize(), KoColorSpace::pixelSize(), reallocateBufferWithoutInitialization(), and setRect().
| bool KisFixedPaintDevice::initialize | ( | quint8 | defaultValue = 0 | ) |
initializes the paint device.
| defaultValue | the default byte with which all pixels will be filled. |
Definition at line 76 of file kis_fixed_paint_device.cpp.
References KisOptimizedByteArray::fill(), m_bounds, m_data, and pixelSize().
| void KisFixedPaintDevice::lazyGrowBufferWithoutInitialization | ( | ) |
If the size of the internal buffer is smaller than the one needed to accommodate bounds(), resize the buffer. Otherwise, do nothing. The allocated data is neither copying or initialized!
Definition at line 92 of file kis_fixed_paint_device.cpp.
References m_bounds, m_data, pixelSize(), KisOptimizedByteArray::resize(), and KisOptimizedByteArray::size().
| void KisFixedPaintDevice::mirror | ( | bool | horizontal, |
| bool | vertical ) |
Mirrors the device.
Definition at line 305 of file kis_fixed_paint_device.cpp.
References data(), m_bounds, m_colorSpace, mirror(), pixelSize(), and KoColorSpace::pixelSize().
| KisFixedPaintDevice & KisFixedPaintDevice::operator= | ( | const KisFixedPaintDevice & | rhs | ) |
Deep copy the fixed paint device, including the data.
Definition at line 32 of file kis_fixed_paint_device.cpp.
References KisOptimizedByteArray::constData(), KisOptimizedByteArray::data(), m_bounds, m_colorSpace, m_data, pixelSize(), and KisOptimizedByteArray::size().
| quint32 KisFixedPaintDevice::pixelSize | ( | ) | const |
Definition at line 71 of file kis_fixed_paint_device.cpp.
References m_colorSpace, and KoColorSpace::pixelSize().
| void KisFixedPaintDevice::readBytes | ( | quint8 * | dstData, |
| qint32 | x, | ||
| qint32 | y, | ||
| qint32 | w, | ||
| qint32 | h ) const |
Read the bytes representing the rectangle described by x, y, w, h into data. If data is not big enough, Krita will gladly overwrite the rest of your precious memory.
Since this is a copy, you need to make sure you have enough memory.
The reading is done only if the rectangular area x,y,w,h is inside the bounds of the device and the device is not empty
Definition at line 278 of file kis_fixed_paint_device.cpp.
References bounds(), constData(), KisOptimizedByteArray::isEmpty(), m_bounds, m_colorSpace, m_data, pixelSize(), and KoColorSpace::pixelSize().
| void KisFixedPaintDevice::reallocateBufferWithoutInitialization | ( | ) |
Changed the size of the internal buffer to accommodate the exact number of bytes needed to store area bounds(). The allocated data is not initialized!
Definition at line 83 of file kis_fixed_paint_device.cpp.
References m_bounds, m_data, pixelSize(), KisOptimizedByteArray::resize(), and KisOptimizedByteArray::size().
| void KisFixedPaintDevice::setColorSpace | ( | const KoColorSpace * | cs | ) |
setColorSpace reassigns the color space of the paint device without converting or reallocating the buffer. One needs to update the buffer manually after that.
Definition at line 54 of file kis_fixed_paint_device.cpp.
References m_colorSpace.
| void KisFixedPaintDevice::setProfile | ( | const KoColorProfile * | profile | ) |
Set color profile for the device without converting actual pixel data
Definition at line 139 of file kis_fixed_paint_device.cpp.
References colorSpace(), KoColorSpaceRegistry::colorSpace(), KoColorSpaceRegistry::instance(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_colorSpace.
| void KisFixedPaintDevice::setRect | ( | const QRect & | rc | ) |
setRect sets the rect of the fixed paint device to rect. This will not create the associated data area.
| rc | the bounds in pixels. The x,y of the rect represent the origin of the fixed paint device. |
Definition at line 49 of file kis_fixed_paint_device.cpp.
References m_bounds.
|
private |
Definition at line 204 of file kis_fixed_paint_device.h.
|
private |
Definition at line 203 of file kis_fixed_paint_device.h.
|
private |
Definition at line 205 of file kis_fixed_paint_device.h.