Flip image according to ROWORDER

This commit is contained in:
2024-01-22 21:30:39 +01:00
parent e5f425ff8d
commit 8c9c1d8d06
3 changed files with 19 additions and 0 deletions
+9
View File
@@ -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());