Flip image according to ROWORDER
This commit is contained in:
@@ -658,6 +658,15 @@ std::pair<float, float> RawImage::unitScale() const
|
||||
return {1.0f, 0.0f};
|
||||
}
|
||||
|
||||
void RawImage::flip()
|
||||
{
|
||||
std::unique_ptr<PixelType[]> tmp = std::move(m_pixels);
|
||||
allocate(m_width, m_height, m_channels, m_type);
|
||||
uint32_t rowSize = m_width * m_ch * typeSize(m_type);
|
||||
for(uint32_t i=0; i<m_height; i++)
|
||||
std::memcpy(m_pixels.get() + rowSize * (m_height - i - 1), tmp.get() + rowSize * i, rowSize);
|
||||
}
|
||||
|
||||
std::shared_ptr<RawImage> RawImage::fromPlanar(const RawImage &img)
|
||||
{
|
||||
return RawImage::fromPlanar(img.data(), img.width(), img.height(), img.channels(), img.type());
|
||||
|
||||
Reference in New Issue
Block a user