1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0031705: Visualization - move out construction of predefined markers from OpenGl_AspectsSprite to Graphic3d_MarkerImage

Built-in markers definition has been moved from OpenGl_AspectsSprite to Graphic3d_MarkerImage and generalized.
RGBA8 pixel format is now preferred over BGRA8.
Fallback OpenGL 1.1 rendering code now supports drawing of colored markers using glDrawPixels().

Added function Image_PixMap::FlipY() flipping image rows.
This commit is contained in:
mkrylova
2020-11-20 15:10:23 +03:00
committed by bugmaster
parent a8d3a0b102
commit 59500bb229
10 changed files with 1761 additions and 1745 deletions

View File

@@ -662,3 +662,36 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
}
}
}
// =======================================================================
// function : InitCopy
// purpose :
// =======================================================================
bool Image_PixMap::FlipY (Image_PixMap& theImage)
{
if (theImage.IsEmpty()
|| theImage.SizeX() == 0
|| theImage.SizeY() == 0)
{
return false;
}
NCollection_Buffer aTmp (NCollection_BaseAllocator::CommonBaseAllocator());
const size_t aRowSize = theImage.SizeRowBytes();
if (!aTmp.Allocate (aRowSize))
{
return false;
}
// for odd height middle row should be left as is
Standard_Size aNbRowsHalf = theImage.SizeY() / 2;
for (Standard_Size aRowT = 0, aRowB = theImage.SizeY() - 1; aRowT < aNbRowsHalf; ++aRowT, --aRowB)
{
Standard_Byte* aTop = theImage.ChangeRow (aRowT);
Standard_Byte* aBot = theImage.ChangeRow (aRowB);
memcpy (aTmp.ChangeData(), aTop, aRowSize);
memcpy (aTop, aBot, aRowSize);
memcpy (aBot, aTmp.Data(), aRowSize);
}
return true;
}

View File

@@ -48,6 +48,9 @@ public:
//! Convert image to Black/White.
Standard_EXPORT static void ToBlackWhite (Image_PixMap& theImage);
//! Reverse line order as it draws it from bottom to top.
Standard_EXPORT static bool FlipY (Image_PixMap& theImage);
//! Return default image data allocator.
Standard_EXPORT static const Handle(NCollection_BaseAllocator)& DefaultAllocator();