1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0028441: Coding Rules - move out nested Image_PixMap::ImgFormat enumeration to dedicated enum Image_Format

Enumeration Image_PixMap::ImgFormat, previously declared as nested
enumeration within class *Image_PixMap*,
has been moved to global namespace as Image_Format following OCCT coding rules.

The enumeration values have suffix Image_Format_ and preserve
previous name scheme for easy renaming of old values.
E.g. Image_PixMap::ImgGray become Image_Format_Gray.
Old definitions are preserved as depreacated aliases to the new ones.
This commit is contained in:
kgv 2017-02-05 13:47:27 +03:00 committed by bugmaster
parent e6afb53983
commit dc858f4c5a
25 changed files with 307 additions and 274 deletions

View File

@ -2,6 +2,7 @@
BRepExtrema_OverlappedSubShapes BRepExtrema_MapOfIntegerPackedMapOfInteger
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d Convert_CompBezierCurves2dToBSplineCurve2d
ShapeConstruct_CompBezierCurves2dToBSplineCurve Convert_CompBezierCurves2dToBSplineCurve
Image_PixMap::Img Image_Format_
[tcollection]
AdvApp2Var_SequenceOfNode

View File

@ -1218,8 +1218,10 @@ The following Grid management methods within class V3d_Viewer do not implicitly
@subsection upgrade_720_changes_methods Other changes
* Class GeomPlate_BuildPlateSurface accepts base class Adaptor3d_HCurve (instead of inherited Adaptor3d_HCurveOnSurface accepted earlier).
* Types GeomPlate_Array1OfHCurveOnSurface and GeomPlate_HArray1OfHCurveOnSurface have been replaced with GeomPlate_Array1OfHCurve and GeomPlate_HArray1OfHCurve correspondingly (accept base class Adaptor3d_HCurve instead of Adaptor3d_HCurveOnSurface).
* Enumeration *Image_PixMap::ImgFormat*, previously declared as nested enumeration within class *Image_PixMap*, has been moved to global namespace as *Image_Format* following OCCT coding rules.
The enumeration values have suffix Image_Format_ and preserve previous name scheme for easy renaming of old values - e.g. Image_PixMap::ImgGray become Image_Format_Gray.
Old definitions are preserved as depreacated aliases to the new ones.
@subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices

View File

@ -757,7 +757,7 @@ Standard_Boolean Draw_Window::Save (const char* theFileName) const
Image_AlienPixMap anImage;
bool isBigEndian = Image_PixMap::IsBigEndianHost();
const Standard_Size aSizeRowBytes = Standard_Size(winAttr.width) * 4;
if (!anImage.InitTrash (isBigEndian ? Image_PixMap::ImgRGB32 : Image_PixMap::ImgBGR32,
if (!anImage.InitTrash (isBigEndian ? Image_Format_RGB32 : Image_Format_BGR32,
Standard_Size(winAttr.width), Standard_Size(winAttr.height), aSizeRowBytes))
{
return Standard_False;
@ -1796,7 +1796,7 @@ static Standard_Boolean SaveBitmap (HBITMAP theHBitmap,
Image_AlienPixMap anImage;
const Standard_Size aSizeRowBytes = Standard_Size(aBitmap.bmWidth) * 4;
if (!anImage.InitTrash (Image_PixMap::ImgBGR32, Standard_Size(aBitmap.bmWidth), Standard_Size(aBitmap.bmHeight), aSizeRowBytes))
if (!anImage.InitTrash (Image_Format_BGR32, Standard_Size(aBitmap.bmWidth), Standard_Size(aBitmap.bmHeight), aSizeRowBytes))
{
return Standard_False;
}

View File

@ -166,7 +166,7 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
{
return false;
}
if (!myGlyphImg.InitWrapper (Image_PixMap::ImgAlpha, aBitmap.buffer,
if (!myGlyphImg.InitWrapper (Image_Format_Alpha, aBitmap.buffer,
aBitmap.width, aBitmap.rows, Abs (aBitmap.pitch)))
{
return false;

View File

@ -492,8 +492,8 @@ Graphic3d_HatchStyle::Graphic3d_HatchStyle (const Handle(Image_PixMap)& thePatte
{
Standard_ProgramError_Raise_if (thePattern.IsNull(), "Null pointer to a hatch pattern image");
Standard_ProgramError_Raise_if (
thePattern->SizeX() != 32 || thePattern->SizeY() != 32 || thePattern->Format() != Image_PixMap::ImgGray,
"Hatch pattern must be a 32*32 bitmap (Image_PixMap::ImgGray format)");
thePattern->SizeX() != 32 || thePattern->SizeY() != 32 || thePattern->Format() != Image_Format_Gray,
"Hatch pattern must be a 32*32 bitmap (Image_Format_Gray format)");
const Standard_Size aByteSize = thePattern->SizeBytes();
Handle(NCollection_AlignedAllocator) anAllocator = new NCollection_AlignedAllocator (16);

View File

@ -94,11 +94,11 @@ Handle(TColStd_HArray1OfByte) Graphic3d_MarkerImage::GetBitMapArray (const Stand
Quantity_Color aColor = myImage->PixelColor (aColumn, aRow, anAlphaValue);
Standard_Boolean aBitOn = Standard_False;
if (myImage->Format() == Image_PixMap::ImgAlpha)
if (myImage->Format() == Image_Format_Alpha)
{
aBitOn = anAlphaValue > theAlphaValue;
}
else if (myImage->Format() == Image_PixMap::ImgGray)
else if (myImage->Format() == Image_Format_Gray)
{
aBitOn = aColor.Red() > theAlphaValue;
}
@ -142,7 +142,7 @@ const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImage()
const Standard_Integer aLowerIndex = myBitMap->Lower();
myImage = new Image_PixMap();
myImage->InitZero (Image_PixMap::ImgAlpha, aSize + myMargin * 2, aSize + myMargin * 2);
myImage->InitZero (Image_Format_Alpha, aSize + myMargin * 2, aSize + myMargin * 2);
for (Standard_Integer aRowIter = 0; aRowIter < myHeight; aRowIter++)
{
Standard_Byte* anImageRow = myImage->ChangeRow (aRowIter + aRowOffset);
@ -169,15 +169,15 @@ const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImageAlpha()
if (!myImage.IsNull())
{
if (myImage->Format() == Image_PixMap::ImgGray
|| myImage->Format() == Image_PixMap::ImgAlpha)
if (myImage->Format() == Image_Format_Gray
|| myImage->Format() == Image_Format_Alpha)
{
myImageAlpha = myImage;
}
else
{
myImageAlpha = new Image_PixMap();
myImageAlpha->InitZero (Image_PixMap::ImgAlpha, myImage->Width(), myImage->Height());
myImageAlpha->InitZero (Image_Format_Alpha, myImage->Width(), myImage->Height());
myImageAlpha->SetTopDown (Standard_False);
Quantity_Parameter anAlpha;
for (Standard_Size aRowIter = 0; aRowIter < myImage->Height(); aRowIter++)

View File

@ -57,7 +57,7 @@ public:
//!
//! Default implementation generates unique ID although inheritors may re-initialize it.
//!
//! Multiple Graphic3d_TextureRoot instancies with same ID
//! Multiple Graphic3d_TextureRoot instances with same ID
//! will be treated as single texture with different parameters
//! to optimize memory usage though this will be more natural
//! to use same instance of Graphic3d_TextureRoot when possible.
@ -73,7 +73,7 @@ public:
Standard_Size Revision() const { return myRevision; }
//! Update image revision.
//! Can be used for signalling changes in the texture source (e.g. file update, pixmap update)
//! Can be used for signaling changes in the texture source (e.g. file update, pixmap update)
//! without re-creating texture source itself (e.g. preserving the unique id).
void UpdateRevision() { ++myRevision; }
@ -110,7 +110,7 @@ protected:
TCollection_AsciiString myTexId; //!< unique identifier of this resource (for sharing)
Handle(Image_PixMap) myPixMap; //!< image pixmap - as one of the ways for defining the texture source
OSD_Path myPath; //!< image file path - as one of the ways for defining the texture source
Standard_Size myRevision; //!< image revision - for signalling changes in the texture source (e.g. file update, pixmap update)
Standard_Size myRevision; //!< image revision - for signaling changes in the texture source (e.g. file update, pixmap update)
Graphic3d_TypeOfTexture myType; //!< texture type
};

View File

@ -3,6 +3,7 @@ Image_AlienPixMap.hxx
Image_Color.hxx
Image_Diff.cxx
Image_Diff.hxx
Image_Format.hxx
Image_PixMap.cxx
Image_PixMap.hxx
Image_PixMapData.hxx

View File

@ -36,66 +36,66 @@ IMPLEMENT_STANDARD_RTTIEXT(Image_AlienPixMap,Image_PixMap)
#ifdef HAVE_FREEIMAGE
namespace
{
static Image_PixMap::ImgFormat convertFromFreeFormat (FREE_IMAGE_TYPE theFormatFI,
FREE_IMAGE_COLOR_TYPE theColorTypeFI,
unsigned theBitsPerPixel)
static Image_Format convertFromFreeFormat (FREE_IMAGE_TYPE theFormatFI,
FREE_IMAGE_COLOR_TYPE theColorTypeFI,
unsigned theBitsPerPixel)
{
switch (theFormatFI)
{
case FIT_RGBF: return Image_PixMap::ImgRGBF;
case FIT_RGBAF: return Image_PixMap::ImgRGBAF;
case FIT_FLOAT: return Image_PixMap::ImgGrayF;
case FIT_RGBF: return Image_Format_RGBF;
case FIT_RGBAF: return Image_Format_RGBAF;
case FIT_FLOAT: return Image_Format_GrayF;
case FIT_BITMAP:
{
switch (theColorTypeFI)
{
case FIC_MINISBLACK:
{
return Image_PixMap::ImgGray;
return Image_Format_Gray;
}
case FIC_RGB:
{
if (Image_PixMap::IsBigEndianHost())
{
return (theBitsPerPixel == 32) ? Image_PixMap::ImgRGB32 : Image_PixMap::ImgRGB;
return (theBitsPerPixel == 32) ? Image_Format_RGB32 : Image_Format_RGB;
}
else
{
return (theBitsPerPixel == 32) ? Image_PixMap::ImgBGR32 : Image_PixMap::ImgBGR;
return (theBitsPerPixel == 32) ? Image_Format_BGR32 : Image_Format_BGR;
}
}
case FIC_RGBALPHA:
{
return Image_PixMap::IsBigEndianHost() ? Image_PixMap::ImgRGBA : Image_PixMap::ImgBGRA;
return Image_PixMap::IsBigEndianHost() ? Image_Format_RGBA : Image_Format_BGRA;
}
default:
return Image_PixMap::ImgUNKNOWN;
return Image_Format_UNKNOWN;
}
}
default:
return Image_PixMap::ImgUNKNOWN;
return Image_Format_UNKNOWN;
}
}
static FREE_IMAGE_TYPE convertToFreeFormat (Image_PixMap::ImgFormat theFormat)
static FREE_IMAGE_TYPE convertToFreeFormat (Image_Format theFormat)
{
switch (theFormat)
{
case Image_PixMap::ImgGrayF:
case Image_PixMap::ImgAlphaF:
case Image_Format_GrayF:
case Image_Format_AlphaF:
return FIT_FLOAT;
case Image_PixMap::ImgRGBAF:
case Image_Format_RGBAF:
return FIT_RGBAF;
case Image_PixMap::ImgRGBF:
case Image_Format_RGBF:
return FIT_RGBF;
case Image_PixMap::ImgRGBA:
case Image_PixMap::ImgBGRA:
case Image_PixMap::ImgRGB32:
case Image_PixMap::ImgBGR32:
case Image_PixMap::ImgRGB:
case Image_PixMap::ImgBGR:
case Image_PixMap::ImgGray:
case Image_PixMap::ImgAlpha:
case Image_Format_RGBA:
case Image_Format_BGRA:
case Image_Format_RGB32:
case Image_Format_BGR32:
case Image_Format_RGB:
case Image_Format_BGR:
case Image_Format_Gray:
case Image_Format_Alpha:
return FIT_BITMAP;
default:
return FIT_UNKNOWN;
@ -128,7 +128,7 @@ Image_AlienPixMap::~Image_AlienPixMap()
// function : InitWrapper
// purpose :
// =======================================================================
bool Image_AlienPixMap::InitWrapper (ImgFormat,
bool Image_AlienPixMap::InitWrapper (Image_Format,
Standard_Byte*,
const Standard_Size,
const Standard_Size,
@ -143,7 +143,7 @@ bool Image_AlienPixMap::InitWrapper (ImgFormat,
// purpose :
// =======================================================================
#ifdef HAVE_FREEIMAGE
bool Image_AlienPixMap::InitTrash (ImgFormat thePixelFormat,
bool Image_AlienPixMap::InitTrash (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size /*theSizeRowBytes*/)
@ -158,14 +158,14 @@ bool Image_AlienPixMap::InitTrash (ImgFormat thePixelFormat,
}
FIBITMAP* anImage = FreeImage_AllocateT (aFormatFI, (int )theSizeX, (int )theSizeY, aBitsPerPixel);
Image_PixMap::ImgFormat aFormat = convertFromFreeFormat (FreeImage_GetImageType (anImage),
FreeImage_GetColorType (anImage),
FreeImage_GetBPP (anImage));
if (thePixelFormat == Image_PixMap::ImgBGR32
|| thePixelFormat == Image_PixMap::ImgRGB32)
Image_Format aFormat = convertFromFreeFormat (FreeImage_GetImageType(anImage),
FreeImage_GetColorType(anImage),
FreeImage_GetBPP (anImage));
if (thePixelFormat == Image_Format_BGR32
|| thePixelFormat == Image_Format_RGB32)
{
//FreeImage_SetTransparent (anImage, FALSE);
aFormat = (aFormat == Image_PixMap::ImgBGRA) ? Image_PixMap::ImgBGR32 : Image_PixMap::ImgRGB32;
aFormat = (aFormat == Image_Format_BGRA) ? Image_Format_BGR32 : Image_Format_RGB32;
}
Image_PixMap::InitWrapper (aFormat, FreeImage_GetBits (anImage),
@ -177,7 +177,7 @@ bool Image_AlienPixMap::InitTrash (ImgFormat thePixelFormat,
return true;
}
#else
bool Image_AlienPixMap::InitTrash (ImgFormat thePixelFormat,
bool Image_AlienPixMap::InitTrash (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes)
@ -297,10 +297,10 @@ bool Image_AlienPixMap::Load (const TCollection_AsciiString& theImagePath)
return false;
}
Image_PixMap::ImgFormat aFormat = convertFromFreeFormat (FreeImage_GetImageType (anImage),
FreeImage_GetColorType (anImage),
FreeImage_GetBPP (anImage));
if (aFormat == Image_PixMap::ImgUNKNOWN)
Image_Format aFormat = convertFromFreeFormat (FreeImage_GetImageType(anImage),
FreeImage_GetColorType(anImage),
FreeImage_GetBPP (anImage));
if (aFormat == Image_Format_UNKNOWN)
{
//anImage = FreeImage_ConvertTo24Bits (anImage);
TCollection_AsciiString aMessage = "Error: image file '";
@ -401,16 +401,16 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
SetTopDown (false);
}
// FreeImage doesn't provide flexible format convertion API
// so we should perform multiple convertions in some cases!
// FreeImage doesn't provide flexible format conversion API
// so we should perform multiple conversions in some cases!
FIBITMAP* anImageToDump = myLibImage;
switch (anImageFormat)
{
case FIF_PNG:
case FIF_BMP:
{
if (Format() == Image_PixMap::ImgBGR32
|| Format() == Image_PixMap::ImgRGB32)
if (Format() == Image_Format_BGR32
|| Format() == Image_Format_RGB32)
{
// stupid FreeImage treats reserved byte as alpha if some bytes not set to 0xFF
for (Standard_Size aRow = 0; aRow < SizeY(); ++aRow)
@ -453,7 +453,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
aTmpBitmap = aTmpBitmap24;
}
// need convertion to image with pallete (requires 24bit bitmap)
// need conversion to image with palette (requires 24bit bitmap)
anImageToDump = FreeImage_ColorQuantize (aTmpBitmap, FIQ_NNQUANT);
if (aTmpBitmap != myLibImage)
{
@ -463,13 +463,13 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
}
case FIF_EXR:
{
if (Format() == Image_PixMap::ImgGray
|| Format() == Image_PixMap::ImgAlpha)
if (Format() == Image_Format_Gray
|| Format() == Image_Format_Alpha)
{
anImageToDump = FreeImage_ConvertToType (myLibImage, FIT_FLOAT);
}
else if (Format() == Image_PixMap::ImgRGBA
|| Format() == Image_PixMap::ImgBGRA)
else if (Format() == Image_Format_RGBA
|| Format() == Image_Format_BGRA)
{
anImageToDump = FreeImage_ConvertToType (myLibImage, FIT_RGBAF);
}

View File

@ -29,11 +29,11 @@ struct FIBITMAP;
//! - *.jpg, *.jpe, *.jpeg - JPEG/JIFF (Joint Photographic Experts Group) lossy format (compressed with quality losses). YUV color space used (automatically converted from/to RGB).
//! - *.tif, *.tiff - TIFF (Tagged Image File Format).
//! - *.tga - TGA (Truevision Targa Graphic), lossless format.
//! - *.gif - GIF (Graphical Interchange Format), lossy format. Color stored using pallete (up to 256 distinct colors).
//! - *.gif - GIF (Graphical Interchange Format), lossy format. Color stored using palette (up to 256 distinct colors).
//! - *.exr - OpenEXR high dynamic-range format (supports float pixel formats).
class Image_AlienPixMap : public Image_PixMap
{
DEFINE_STANDARD_RTTIEXT(Image_AlienPixMap, Image_PixMap)
public:
//! Empty constructor.
@ -52,7 +52,7 @@ public:
//! thePixelFormat - if specified pixel format doesn't supported by image library
//! than nearest supported will be used instead!
//! theSizeRowBytes - may be ignored by this class and required alignemnt will be used instead!
Standard_EXPORT virtual bool InitTrash (ImgFormat thePixelFormat,
Standard_EXPORT virtual bool InitTrash (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes = 0) Standard_OVERRIDE;
@ -79,7 +79,7 @@ private:
//! Wrapper initialization is disallowed for this class (will return false in any case)!
//! Use only copying and allocation initializers.
Standard_EXPORT virtual bool InitWrapper (ImgFormat thePixelFormat,
Standard_EXPORT virtual bool InitWrapper (Image_Format thePixelFormat,
Standard_Byte* theDataPtr,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
@ -88,10 +88,6 @@ private:
//! Built-in PPM export
Standard_EXPORT bool savePPM (const TCollection_AsciiString& theFileName) const;
public:
DEFINE_STANDARD_RTTIEXT(Image_AlienPixMap,Image_PixMap) // Type definition
};
DEFINE_STANDARD_HANDLE(Image_AlienPixMap, Image_PixMap)

View File

@ -117,14 +117,14 @@ namespace
{ 1, -1}, { 1, 0}, { 1, 1}
};
static bool isSupportedFormat (const Image_PixMap::ImgFormat theFormat)
static bool isSupportedFormat (const Image_Format theFormat)
{
return theFormat == Image_PixMap::ImgRGB
|| theFormat == Image_PixMap::ImgBGR
|| theFormat == Image_PixMap::ImgRGB32
|| theFormat == Image_PixMap::ImgBGR32
|| theFormat == Image_PixMap::ImgRGBA
|| theFormat == Image_PixMap::ImgBGRA;
return theFormat == Image_Format_RGB
|| theFormat == Image_Format_BGR
|| theFormat == Image_Format_RGB32
|| theFormat == Image_Format_BGR32
|| theFormat == Image_Format_RGBA
|| theFormat == Image_Format_BGRA;
}
} // anonymous namespace
@ -344,7 +344,7 @@ Standard_Boolean Image_Diff::SaveDiffImage (Image_PixMap& theDiffImage) const
|| theDiffImage.SizeY() != myImageRef->SizeY()
|| !isSupportedFormat (theDiffImage.Format()))
{
if (!theDiffImage.InitTrash (Image_PixMap::ImgRGB, myImageRef->SizeX(), myImageRef->SizeY()))
if (!theDiffImage.InitTrash (Image_Format_RGB, myImageRef->SizeX(), myImageRef->SizeY()))
{
return Standard_False;
}
@ -404,7 +404,7 @@ Standard_Boolean Image_Diff::SaveDiffImage (const TCollection_AsciiString& theDi
}
Image_AlienPixMap aDiff;
if (!aDiff.InitTrash (Image_PixMap::ImgRGB, myImageRef->SizeX(), myImageRef->SizeY())
if (!aDiff.InitTrash (Image_Format_RGB, myImageRef->SizeX(), myImageRef->SizeY())
|| !SaveDiffImage (aDiff))
{
return Standard_False;

View File

@ -0,0 +1,37 @@
// Copyright (c) 2012-2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Image_Format_HeaderFile
#define _Image_Format_HeaderFile
//! This enumeration defines packed image plane formats
enum Image_Format
{
Image_Format_UNKNOWN = 0, //!< unsupported or unknown format
Image_Format_Gray = 1, //!< 1 byte per pixel, intensity of the color
Image_Format_Alpha, //!< 1 byte per pixel, transparency
Image_Format_RGB, //!< 3 bytes packed RGB image plane
Image_Format_BGR, //!< same as RGB but with different components order
Image_Format_RGB32, //!< 4 bytes packed RGB image plane (1 extra byte for alignment, may have undefined value)
Image_Format_BGR32, //!< same as RGB but with different components order
Image_Format_RGBA, //!< 4 bytes packed RGBA image plane
Image_Format_BGRA, //!< same as RGBA but with different components order
Image_Format_GrayF, //!< 1 float (4-bytes) per pixel (1-component plane), intensity of the color
Image_Format_AlphaF, //!< 1 float (4-bytes) per pixel (1-component plane), transparency
Image_Format_RGBF, //!< 3 floats (12-bytes) RGB image plane
Image_Format_BGRF, //!< same as RGBF but with different components order
Image_Format_RGBAF, //!< 4 floats (16-bytes) RGBA image plane
Image_Format_BGRAF, //!< same as RGBAF but with different components order
};
#endif // _Image_Format_HeaderFile

View File

@ -26,7 +26,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Image_PixMap,Standard_Transient)
// purpose :
// =======================================================================
Image_PixMap::Image_PixMap()
: myImgFormat (Image_PixMap::ImgGray)
: myImgFormat (Image_Format_Gray)
{
//
}
@ -40,32 +40,32 @@ Image_PixMap::~Image_PixMap()
Clear();
}
Standard_Size Image_PixMap::SizePixelBytes (const Image_PixMap::ImgFormat thePixelFormat)
Standard_Size Image_PixMap::SizePixelBytes (const Image_Format thePixelFormat)
{
switch (thePixelFormat)
{
case ImgGrayF:
case ImgAlphaF:
case Image_Format_GrayF:
case Image_Format_AlphaF:
return sizeof(float);
case ImgRGBAF:
case ImgBGRAF:
case Image_Format_RGBAF:
case Image_Format_BGRAF:
return sizeof(float) * 4;
case ImgRGBF:
case ImgBGRF:
case Image_Format_RGBF:
case Image_Format_BGRF:
return sizeof(float) * 3;
case ImgRGBA:
case ImgBGRA:
case Image_Format_RGBA:
case Image_Format_BGRA:
return 4;
case ImgRGB32:
case ImgBGR32:
case Image_Format_RGB32:
case Image_Format_BGR32:
return 4;
case ImgRGB:
case ImgBGR:
case Image_Format_RGB:
case Image_Format_BGR:
return 3;
case ImgGray:
case ImgAlpha:
case Image_Format_Gray:
case Image_Format_Alpha:
return 1;
case ImgUNKNOWN:
case Image_Format_UNKNOWN:
return 1;
}
return 1;
@ -75,7 +75,7 @@ Standard_Size Image_PixMap::SizePixelBytes (const Image_PixMap::ImgFormat thePix
// function : SetFormat
// purpose :
// =======================================================================
void Image_PixMap::SetFormat (Image_PixMap::ImgFormat thePixelFormat)
void Image_PixMap::SetFormat (Image_Format thePixelFormat)
{
if (myImgFormat == thePixelFormat)
{
@ -96,11 +96,11 @@ void Image_PixMap::SetFormat (Image_PixMap::ImgFormat thePixelFormat)
// function : InitWrapper
// purpose :
// =======================================================================
bool Image_PixMap::InitWrapper (Image_PixMap::ImgFormat thePixelFormat,
Standard_Byte* theDataPtr,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes)
bool Image_PixMap::InitWrapper (Image_Format thePixelFormat,
Standard_Byte* theDataPtr,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes)
{
Clear();
myImgFormat = thePixelFormat;
@ -119,10 +119,10 @@ bool Image_PixMap::InitWrapper (Image_PixMap::ImgFormat thePixelFormat,
// function : InitTrash
// purpose :
// =======================================================================
bool Image_PixMap::InitTrash (Image_PixMap::ImgFormat thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes)
bool Image_PixMap::InitTrash (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes)
{
Clear();
myImgFormat = thePixelFormat;
@ -143,11 +143,11 @@ bool Image_PixMap::InitTrash (Image_PixMap::ImgFormat thePixelFormat,
// function : InitZero
// purpose :
// =======================================================================
bool Image_PixMap::InitZero (Image_PixMap::ImgFormat thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes,
const Standard_Byte theValue)
bool Image_PixMap::InitZero (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes,
const Standard_Byte theValue)
{
if (!InitTrash (thePixelFormat, theSizeX, theSizeY, theSizeRowBytes))
{
@ -205,7 +205,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
switch (myImgFormat)
{
case ImgGrayF:
case Image_Format_GrayF:
{
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
theAlpha = 1.0; // opaque
@ -214,13 +214,13 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel)),
Quantity_TOC_RGB);
}
case ImgAlphaF:
case Image_Format_AlphaF:
{
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
theAlpha = aPixel;
return Quantity_Color (1.0, 1.0, 1.0, Quantity_TOC_RGB);
}
case ImgRGBAF:
case Image_Format_RGBAF:
{
const Image_ColorRGBAF& aPixel = Value<Image_ColorRGBAF> (theY, theX);
theAlpha = aPixel.a();
@ -229,7 +229,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (aPixel.b()),
Quantity_TOC_RGB);
}
case ImgBGRAF:
case Image_Format_BGRAF:
{
const Image_ColorBGRAF& aPixel = Value<Image_ColorBGRAF> (theY, theX);
theAlpha = aPixel.a();
@ -238,7 +238,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (aPixel.b()),
Quantity_TOC_RGB);
}
case ImgRGBF:
case Image_Format_RGBF:
{
const Image_ColorRGBF& aPixel = Value<Image_ColorRGBF> (theY, theX);
theAlpha = 1.0; // opaque
@ -247,7 +247,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (aPixel.b()),
Quantity_TOC_RGB);
}
case ImgBGRF:
case Image_Format_BGRF:
{
const Image_ColorBGRF& aPixel = Value<Image_ColorBGRF> (theY, theX);
theAlpha = 1.0; // opaque
@ -256,7 +256,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (aPixel.b()),
Quantity_TOC_RGB);
}
case ImgRGBA:
case Image_Format_RGBA:
{
const Image_ColorRGBA& aPixel = Value<Image_ColorRGBA> (theY, theX);
theAlpha = Standard_Real (aPixel.a()) / 255.0;
@ -265,7 +265,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel.b()) / 255.0),
Quantity_TOC_RGB);
}
case ImgBGRA:
case Image_Format_BGRA:
{
const Image_ColorBGRA& aPixel = Value<Image_ColorBGRA> (theY, theX);
theAlpha = Standard_Real (aPixel.a()) / 255.0;
@ -274,7 +274,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel.b()) / 255.0),
Quantity_TOC_RGB);
}
case ImgRGB32:
case Image_Format_RGB32:
{
const Image_ColorRGB32& aPixel = Value<Image_ColorRGB32> (theY, theX);
theAlpha = 1.0; // opaque
@ -283,7 +283,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel.b()) / 255.0),
Quantity_TOC_RGB);
}
case ImgBGR32:
case Image_Format_BGR32:
{
const Image_ColorBGR32& aPixel = Value<Image_ColorBGR32> (theY, theX);
theAlpha = 1.0; // opaque
@ -292,7 +292,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel.b()) / 255.0),
Quantity_TOC_RGB);
}
case ImgRGB:
case Image_Format_RGB:
{
const Image_ColorRGB& aPixel = Value<Image_ColorRGB> (theY, theX);
theAlpha = 1.0; // opaque
@ -301,7 +301,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel.b()) / 255.0),
Quantity_TOC_RGB);
}
case ImgBGR:
case Image_Format_BGR:
{
const Image_ColorBGR& aPixel = Value<Image_ColorBGR> (theY, theX);
theAlpha = 1.0; // opaque
@ -310,7 +310,7 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel.b()) / 255.0),
Quantity_TOC_RGB);
}
case ImgGray:
case Image_Format_Gray:
{
const Standard_Byte& aPixel = Value<Standard_Byte> (theY, theX);
theAlpha = 1.0; // opaque
@ -319,13 +319,13 @@ Quantity_Color Image_PixMap::PixelColor (const Standard_Integer theX,
Quantity_Parameter (Standard_Real (aPixel) / 255.0),
Quantity_TOC_RGB);
}
case ImgAlpha:
case Image_Format_Alpha:
{
const Standard_Byte& aPixel = Value<Standard_Byte> (theY, theX);
theAlpha = Standard_Real (aPixel) / 255.0;
return Quantity_Color (1.0, 1.0, 1.0, Quantity_TOC_RGB);
}
case ImgUNKNOWN:
case Image_Format_UNKNOWN:
{
break;
}
@ -353,17 +353,17 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
switch (myImgFormat)
{
case ImgGrayF:
case Image_Format_GrayF:
{
ChangeValue<Standard_ShortReal> (theY, theX) = theColor.r();
return;
}
case ImgAlphaF:
case Image_Format_AlphaF:
{
ChangeValue<Standard_ShortReal> (theY, theX) = theColor.a();
return;
}
case ImgRGBAF:
case Image_Format_RGBAF:
{
Image_ColorRGBAF& aPixel = ChangeValue<Image_ColorRGBAF> (theY, theX);
aPixel.r() = theColor.r();
@ -372,7 +372,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.a() = theColor.a();
return;
}
case ImgBGRAF:
case Image_Format_BGRAF:
{
Image_ColorBGRAF& aPixel = ChangeValue<Image_ColorBGRAF> (theY, theX);
aPixel.r() = theColor.r();
@ -381,7 +381,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.a() = theColor.a();
return;
}
case ImgRGBF:
case Image_Format_RGBF:
{
Image_ColorRGBF& aPixel = ChangeValue<Image_ColorRGBF> (theY, theX);
aPixel.r() = theColor.r();
@ -389,7 +389,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.b() = theColor.b();
return;
}
case ImgBGRF:
case Image_Format_BGRF:
{
Image_ColorBGRF& aPixel = ChangeValue<Image_ColorBGRF> (theY, theX);
aPixel.r() = theColor.r();
@ -397,7 +397,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.b() = theColor.b();
return;
}
case ImgRGBA:
case Image_Format_RGBA:
{
Image_ColorRGBA& aPixel = ChangeValue<Image_ColorRGBA> (theY, theX);
aPixel.r() = Standard_Byte(theColor.r() * 255.0f);
@ -406,7 +406,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.a() = Standard_Byte(theColor.a() * 255.0f);
return;
}
case ImgBGRA:
case Image_Format_BGRA:
{
Image_ColorBGRA& aPixel = ChangeValue<Image_ColorBGRA> (theY, theX);
aPixel.r() = Standard_Byte(theColor.r() * 255.0f);
@ -415,7 +415,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.a() = Standard_Byte(theColor.a() * 255.0f);
return;
}
case ImgRGB32:
case Image_Format_RGB32:
{
Image_ColorRGB32& aPixel = ChangeValue<Image_ColorRGB32> (theY, theX);
aPixel.r() = Standard_Byte(theColor.r() * 255.0f);
@ -424,7 +424,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.a_() = 255;
return;
}
case ImgBGR32:
case Image_Format_BGR32:
{
Image_ColorBGR32& aPixel = ChangeValue<Image_ColorBGR32> (theY, theX);
aPixel.r() = Standard_Byte(theColor.r() * 255.0f);
@ -433,7 +433,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.a_() = 255;
return;
}
case ImgRGB:
case Image_Format_RGB:
{
Image_ColorRGB& aPixel = ChangeValue<Image_ColorRGB> (theY, theX);
aPixel.r() = Standard_Byte(theColor.r() * 255.0f);
@ -441,7 +441,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.b() = Standard_Byte(theColor.b() * 255.0f);
return;
}
case ImgBGR:
case Image_Format_BGR:
{
Image_ColorBGR& aPixel = ChangeValue<Image_ColorBGR> (theY, theX);
aPixel.r() = Standard_Byte(theColor.r() * 255.0f);
@ -449,17 +449,17 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
aPixel.b() = Standard_Byte(theColor.b() * 255.0f);
return;
}
case ImgGray:
case Image_Format_Gray:
{
ChangeValue<Standard_Byte> (theY, theX) = Standard_Byte(theColor.r() * 255.0f);
return;
}
case ImgAlpha:
case Image_Format_Alpha:
{
ChangeValue<Standard_Byte> (theY, theX) = Standard_Byte(theColor.a() * 255.0f);
return;
}
case ImgUNKNOWN:
case Image_Format_UNKNOWN:
{
return;
}
@ -474,13 +474,13 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
{
switch (theImage.Format())
{
case Image_PixMap::ImgBGR32:
case Image_PixMap::ImgRGB32:
case Image_PixMap::ImgBGRA:
case Image_PixMap::ImgRGBA:
case Image_Format_BGR32:
case Image_Format_RGB32:
case Image_Format_BGRA:
case Image_Format_RGBA:
{
const bool toResetAlpha = theImage.Format() == Image_PixMap::ImgBGR32
|| theImage.Format() == Image_PixMap::ImgRGB32;
const bool toResetAlpha = theImage.Format() == Image_Format_BGR32
|| theImage.Format() == Image_Format_RGB32;
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
{
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
@ -498,8 +498,8 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
}
return true;
}
case Image_PixMap::ImgBGR:
case Image_PixMap::ImgRGB:
case Image_Format_BGR:
case Image_Format_RGB:
{
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
{
@ -514,10 +514,10 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
}
return true;
}
case Image_PixMap::ImgBGRF:
case Image_PixMap::ImgRGBF:
case Image_PixMap::ImgBGRAF:
case Image_PixMap::ImgRGBAF:
case Image_Format_BGRF:
case Image_Format_RGBF:
case Image_Format_BGRAF:
case Image_Format_RGBAF:
{
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
{

View File

@ -16,6 +16,7 @@
#ifndef _Image_PixMap_H__
#define _Image_PixMap_H__
#include <Image_Format.hxx>
#include <Image_PixMapData.hxx>
#include <Standard_Transient.hxx>
#include <Quantity_ColorRGBA.hxx>
@ -23,28 +24,9 @@
//! Class represents packed image plane.
class Image_PixMap : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Image_PixMap, Standard_Transient)
public:
//! This enumeration define packed image plane formats
typedef enum tagFormat {
ImgUNKNOWN = 0, //!< unsupported or unknown format
ImgGray = 1, //!< 1 byte per pixel, intensity of the color
ImgAlpha, //!< 1 byte per pixel, transparency
ImgRGB, //!< 3 bytes packed RGB image plane
ImgBGR, //!< same as RGB but with different components order
ImgRGB32, //!< 4 bytes packed RGB image plane (1 extra byte for alignment, may have undefined value)
ImgBGR32, //!< same as RGB but with different components order
ImgRGBA, //!< 4 bytes packed RGBA image plane
ImgBGRA, //!< same as RGBA but with different components order
ImgGrayF, //!< 1 float (4-bytes) per pixel (1-component plane), intensity of the color
ImgAlphaF, //!< 1 float (4-bytes) per pixel (1-component plane), transparency
ImgRGBF, //!< 3 floats (12-bytes) RGB image plane
ImgBGRF, //!< same as RGBF but with different components order
ImgRGBAF, //!< 4 floats (16-bytes) RGBA image plane
ImgBGRAF, //!< same as RGBAF but with different components order
} ImgFormat;
//! Determine Big-Endian at runtime
static inline bool IsBigEndianHost()
{
@ -56,25 +38,22 @@ public:
//! Auxiliary method for swapping bytes between RGB and BGR formats.
//! This method modifies the image data but does not change pixel format!
//! Method will fail if pixel format is not one of the following:
//! - ImgRGB32 / ImgBGR32
//! - ImgRGBA / ImgBGRA
//! - ImgRGB / ImgBGR
//! - ImgRGBF / ImgBGRF
//! - ImgRGBAF / ImgBGRAF
//! - Image_Format_RGB32 / Image_Format_BGR32
//! - Image_Format_RGBA / Image_Format_BGRA
//! - Image_Format_RGB / Image_Format_BGR
//! - Image_Format_RGBF / Image_Format_BGRF
//! - Image_Format_RGBAF / Image_Format_BGRAF
Standard_EXPORT static bool SwapRgbaBgra (Image_PixMap& theImage);
public: // high-level API
inline ImgFormat Format() const
{
return myImgFormat;
}
Image_Format Format() const { return myImgFormat; }
//! Override pixel format specified by InitXXX() methods.
//! Will throw exception if pixel size of new format is not equal to currently initialized format.
//! Intended to switch formats indicating different interpretation of the same data
//! (e.g. ImgGray and ImgAlpha).
Standard_EXPORT void SetFormat (const ImgFormat thePixelFormat);
Standard_EXPORT void SetFormat (const Image_Format thePixelFormat);
//! @return image width in pixels
inline Standard_Size Width() const
@ -167,7 +146,7 @@ public: // high-level API
//! Data will not be copied! Notice that caller should ensure
//! that data pointer will not be released during this wrapper lifetime.
//! You may call InitCopy() to perform data copying.
Standard_EXPORT virtual bool InitWrapper (ImgFormat thePixelFormat,
Standard_EXPORT virtual bool InitWrapper (Image_Format thePixelFormat,
Standard_Byte* theDataPtr,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
@ -175,7 +154,7 @@ public: // high-level API
//! Initialize image plane with required dimensions.
//! Memory will be left uninitialized (performance trick).
Standard_EXPORT virtual bool InitTrash (ImgFormat thePixelFormat,
Standard_EXPORT virtual bool InitTrash (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes = 0);
@ -186,7 +165,7 @@ public: // high-level API
//! Initialize image plane with required dimensions.
//! Buffer will be zeroed (black color for most formats).
Standard_EXPORT bool InitZero (ImgFormat thePixelFormat,
Standard_EXPORT bool InitZero (Image_Format thePixelFormat,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
const Standard_Size theSizeRowBytes = 0,
@ -257,7 +236,7 @@ public: //! @name low-level API for batch-processing (pixels reading / compariso
}
//! @return bytes reserved for one pixel (may include extra bytes for alignment).
Standard_EXPORT static Standard_Size SizePixelBytes (const Image_PixMap::ImgFormat thePixelFormat);
Standard_EXPORT static Standard_Size SizePixelBytes (const Image_Format thePixelFormat);
//! @return bytes reserved per row.
//! Could be larger than needed to store packed row (extra bytes for alignment etc.).
@ -303,10 +282,30 @@ public: //! @name low-level API for batch-processing (pixels reading / compariso
return *reinterpret_cast<ColorType_t* >(myData.ChangeValue (theRow, theCol));
}
public:
Standard_DEPRECATED("This member is deprecated, use Image_Format enumeration instead")
typedef Image_Format ImgFormat;
static const Image_Format ImgUNKNOWN = Image_Format_UNKNOWN;
static const Image_Format ImgGray = Image_Format_Gray;
static const Image_Format ImgAlpha = Image_Format_Alpha;
static const Image_Format ImgRGB = Image_Format_RGB;
static const Image_Format ImgBGR = Image_Format_BGR;
static const Image_Format ImgRGB32 = Image_Format_RGB32;
static const Image_Format ImgBGR32 = Image_Format_BGR32;
static const Image_Format ImgRGBA = Image_Format_RGBA;
static const Image_Format ImgBGRA = Image_Format_BGRA;
static const Image_Format ImgGrayF = Image_Format_GrayF;
static const Image_Format ImgAlphaF = Image_Format_AlphaF;
static const Image_Format ImgRGBF = Image_Format_RGBF;
static const Image_Format ImgBGRF = Image_Format_BGRF;
static const Image_Format ImgRGBAF = Image_Format_RGBAF;
static const Image_Format ImgBGRAF = Image_Format_BGRAF;
protected:
Image_PixMapData myData; //!< data buffer
ImgFormat myImgFormat; //!< pixel format
Image_Format myImgFormat; //!< pixel format
private:
@ -314,10 +313,6 @@ private:
Image_PixMap (const Image_PixMap& );
Image_PixMap& operator= (const Image_PixMap& );
public:
DEFINE_STANDARD_RTTIEXT(Image_PixMap,Standard_Transient) // Type definition
};
DEFINE_STANDARD_HANDLE(Image_PixMap, Standard_Transient)

View File

@ -794,7 +794,7 @@ Handle(Graphic3d_Texture2D) MeshVS_NodalColorPrsBuilder::CreateTexture() const
// create and fill image with colors
Handle(Image_PixMap) anImage = new Image_PixMap();
if (!anImage->InitTrash (Image_PixMap::ImgRGBA, Standard_Size(getNearestPow2 (aColorsNb)), 2))
if (!anImage->InitTrash (Image_Format_RGBA, Standard_Size(getNearestPow2 (aColorsNb)), 2))
{
return NULL;
}

View File

@ -1420,7 +1420,7 @@ Handle(Image_PixMap) MergeImages (const Handle(Image_PixMap)& theImage1,
const Standard_Integer aMaxHeight = Max (aHeight1, aHeight2);
const Standard_Integer aSize = Max (aMaxWidth, aMaxHeight);
aResultImage->InitZero (Image_PixMap::ImgAlpha, aSize, aSize);
aResultImage->InitZero (Image_Format_Alpha, aSize, aSize);
if (!theImage1.IsNull())
{
@ -1714,8 +1714,8 @@ void OpenGl_AspectMarker::Resources::BuildSprites (const Handle(OpenGl_Context)&
const Standard_Integer aSize = Max (aWidth + 2, aHeight + 2); // includes extra margin
anImage = new Image_PixMap();
anImageA = new Image_PixMap();
anImage ->InitZero (Image_PixMap::ImgBGRA, aSize, aSize);
anImageA->InitZero (Image_PixMap::ImgAlpha, aSize, aSize);
anImage ->InitZero (Image_Format_BGRA, aSize, aSize);
anImageA->InitZero (Image_Format_Alpha, aSize, aSize);
// we draw a set of circles
Image_ColorBGRA aColor32;

View File

@ -133,11 +133,11 @@ bool OpenGl_Font::createTexture (const Handle(OpenGl_Context)& theCtx)
Handle(OpenGl_Texture)& aTexture = myTextures.ChangeLast();
Image_PixMap aBlackImg;
if (!aBlackImg.InitZero (Image_PixMap::ImgAlpha, Standard_Size(aTextureSizeX), Standard_Size(aTextureSizeY))
if (!aBlackImg.InitZero (Image_Format_Alpha, Standard_Size(aTextureSizeX), Standard_Size(aTextureSizeY))
|| !aTexture->Init (theCtx, aBlackImg, Graphic3d_TOT_2D)) // myTextureFormat
{
TCollection_ExtendedString aMsg;
aMsg += "New texture intialization of size ";
aMsg += "New texture initialization of size ";
aMsg += aTextureSizeX;
aMsg += "x";
aMsg += aTextureSizeY;

View File

@ -183,7 +183,7 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = 0;
switch (theData.Format())
{
case Image_PixMap::ImgGrayF:
case Image_Format_GrayF:
{
if (theCtx->core11 == NULL)
{
@ -198,7 +198,7 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_FLOAT;
return true;
}
case Image_PixMap::ImgAlphaF:
case Image_Format_AlphaF:
{
if (theCtx->core11 == NULL)
{
@ -213,14 +213,14 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_FLOAT;
return true;
}
case Image_PixMap::ImgRGBAF:
case Image_Format_RGBAF:
{
theTextFormat = GL_RGBA8; // GL_RGBA32F
thePixelFormat = GL_RGBA;
theDataType = GL_FLOAT;
return true;
}
case Image_PixMap::ImgBGRAF:
case Image_Format_BGRAF:
{
if (!theCtx->IsGlGreaterEqual (1, 2) && !theCtx->extBgra)
{
@ -231,14 +231,14 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_FLOAT;
return true;
}
case Image_PixMap::ImgRGBF:
case Image_Format_RGBF:
{
theTextFormat = GL_RGB8; // GL_RGB32F
thePixelFormat = GL_RGB;
theDataType = GL_FLOAT;
return true;
}
case Image_PixMap::ImgBGRF:
case Image_Format_BGRF:
{
#if !defined(GL_ES_VERSION_2_0)
theTextFormat = GL_RGB8; // GL_RGB32F
@ -249,14 +249,14 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
return false;
#endif
}
case Image_PixMap::ImgRGBA:
case Image_Format_RGBA:
{
theTextFormat = GL_RGBA8;
thePixelFormat = GL_RGBA;
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgBGRA:
case Image_Format_BGRA:
{
if (!theCtx->IsGlGreaterEqual (1, 2) && !theCtx->extBgra)
{
@ -267,14 +267,14 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgRGB32:
case Image_Format_RGB32:
{
theTextFormat = GL_RGB8;
thePixelFormat = GL_RGBA;
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgBGR32:
case Image_Format_BGR32:
{
if (!theCtx->IsGlGreaterEqual (1, 2) && !theCtx->extBgra)
{
@ -285,14 +285,14 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgRGB:
case Image_Format_RGB:
{
theTextFormat = GL_RGB8;
thePixelFormat = GL_RGB;
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgBGR:
case Image_Format_BGR:
{
#if !defined(GL_ES_VERSION_2_0)
if (!theCtx->IsGlGreaterEqual (1, 2) && !theCtx->extBgra)
@ -307,7 +307,7 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
return false;
#endif
}
case Image_PixMap::ImgGray:
case Image_Format_Gray:
{
if (theCtx->core11 == NULL)
{
@ -322,7 +322,7 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgAlpha:
case Image_Format_Alpha:
{
if (theCtx->core11 == NULL)
{
@ -337,7 +337,7 @@ bool OpenGl_Texture::GetDataFormat (const Handle(OpenGl_Context)& theCtx,
theDataType = GL_UNSIGNED_BYTE;
return true;
}
case Image_PixMap::ImgUNKNOWN:
case Image_Format_UNKNOWN:
{
return false;
}
@ -380,8 +380,8 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
if (theImage != NULL)
{
myIsAlpha = theImage->Format() == Image_PixMap::ImgAlpha
|| theImage->Format() == Image_PixMap::ImgAlphaF;
myIsAlpha = theImage->Format() == Image_Format_Alpha
|| theImage->Format() == Image_Format_AlphaF;
}
else
{

View File

@ -913,71 +913,71 @@ Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)&
switch (theImage.Format())
{
#if !defined(GL_ES_VERSION_2_0)
case Image_PixMap::ImgGray:
case Image_Format_Gray:
aFormat = GL_DEPTH_COMPONENT;
aType = GL_UNSIGNED_BYTE;
break;
case Image_PixMap::ImgGrayF:
case Image_Format_GrayF:
aFormat = GL_DEPTH_COMPONENT;
aType = GL_FLOAT;
break;
case Image_PixMap::ImgRGB:
case Image_Format_RGB:
aFormat = GL_RGB;
aType = GL_UNSIGNED_BYTE;
break;
case Image_PixMap::ImgBGR:
case Image_Format_BGR:
aFormat = GL_BGR;
aType = GL_UNSIGNED_BYTE;
break;
case Image_PixMap::ImgBGRA:
case Image_PixMap::ImgBGR32:
case Image_Format_BGRA:
case Image_Format_BGR32:
aFormat = GL_BGRA;
aType = GL_UNSIGNED_BYTE;
break;
case Image_PixMap::ImgBGRF:
case Image_Format_BGRF:
aFormat = GL_BGR;
aType = GL_FLOAT;
break;
case Image_PixMap::ImgBGRAF:
case Image_Format_BGRAF:
aFormat = GL_BGRA;
aType = GL_FLOAT;
break;
#else
case Image_PixMap::ImgGray:
case Image_PixMap::ImgGrayF:
case Image_PixMap::ImgBGRF:
case Image_PixMap::ImgBGRAF:
case Image_Format_Gray:
case Image_Format_GrayF:
case Image_Format_BGRF:
case Image_Format_BGRAF:
return Standard_False;
case Image_PixMap::ImgBGRA:
case Image_PixMap::ImgBGR32:
case Image_Format_BGRA:
case Image_Format_BGR32:
aFormat = GL_RGBA;
aType = GL_UNSIGNED_BYTE;
toSwapRgbaBgra = true;
break;
case Image_PixMap::ImgBGR:
case Image_PixMap::ImgRGB:
case Image_Format_BGR:
case Image_Format_RGB:
aFormat = GL_RGBA;
aType = GL_UNSIGNED_BYTE;
toConvRgba2Rgb = true;
break;
#endif
case Image_PixMap::ImgRGBA:
case Image_PixMap::ImgRGB32:
case Image_Format_RGBA:
case Image_Format_RGB32:
aFormat = GL_RGBA;
aType = GL_UNSIGNED_BYTE;
break;
case Image_PixMap::ImgRGBF:
case Image_Format_RGBF:
aFormat = GL_RGB;
aType = GL_FLOAT;
break;
case Image_PixMap::ImgRGBAF:
case Image_Format_RGBAF:
aFormat = GL_RGBA;
aType = GL_FLOAT;
break;
case Image_PixMap::ImgAlpha:
case Image_PixMap::ImgAlphaF:
case Image_Format_Alpha:
case Image_Format_AlphaF:
return Standard_False; // GL_ALPHA is no more supported in core context
case Image_PixMap::ImgUNKNOWN:
case Image_Format_UNKNOWN:
return Standard_False;
}
@ -1053,7 +1053,7 @@ Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)&
// while order in memory depends on the flag and processed by ChangeRow() method
glReadPixels (0, GLint(theImage.SizeY() - aRow - 1), GLsizei (theImage.SizeX()), 1, aFormat, aType, aRowBuffer.ChangeData());
const Image_ColorRGBA* aRowDataRgba = (const Image_ColorRGBA* )aRowBuffer.Data();
if (theImage.Format() == Image_PixMap::ImgBGR)
if (theImage.Format() == Image_Format_BGR)
{
convertRowFromRgba ((Image_ColorBGR* )theImage.ChangeRow (aRow), aRowDataRgba, theImage.SizeX());
}

View File

@ -1823,11 +1823,11 @@ static Standard_Integer OCC24622 (Draw_Interpretor& /*theDi*/, Standard_Integer
aTextureTypeArg.UpperCase();
if (aTextureTypeArg == "1D")
{
anImage->InitWrapper (Image_PixMap::ImgRGB, (Standard_Byte*)aBitmap, 8, 1);
anImage->InitWrapper (Image_Format_RGB, (Standard_Byte*)aBitmap, 8, 1);
}
else if (aTextureTypeArg == "2D")
{
anImage->InitTrash (Image_PixMap::ImgRGB, 8, 8);
anImage->InitTrash (Image_Format_RGB, 8, 8);
for (Standard_Integer aRow = 0; aRow < 8; ++aRow)
{
for (Standard_Integer aCol = 0; aCol < 8; ++aCol)

View File

@ -792,7 +792,7 @@ namespace
myDepthMax (-RealLast()),
myToInverse(theToInverse)
{
myUnnormImage.InitZero (Image_PixMap::ImgGrayF, thePixMap.SizeX(), thePixMap.SizeY());
myUnnormImage.InitZero (Image_Format_GrayF, thePixMap.SizeX(), thePixMap.SizeY());
}
//! Accumulate the data.

View File

@ -2828,12 +2828,12 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
|| theImage.SizeX() != Standard_Size(aTargetSize.x())
|| theImage.SizeY() != Standard_Size(aTargetSize.y()))
{
Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgUNKNOWN;
Image_Format aFormat = Image_Format_UNKNOWN;
switch (theParams.BufferType)
{
case Graphic3d_BT_RGB: aFormat = Image_PixMap::ImgRGB; break;
case Graphic3d_BT_RGBA: aFormat = Image_PixMap::ImgRGBA; break;
case Graphic3d_BT_Depth: aFormat = Image_PixMap::ImgGrayF; break;
case Graphic3d_BT_RGB: aFormat = Image_Format_RGB; break;
case Graphic3d_BT_RGBA: aFormat = Image_Format_RGBA; break;
case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break;
}
if (!theImage.InitZero (aFormat, Standard_Size(aTargetSize.x()), Standard_Size(aTargetSize.y())))

View File

@ -986,12 +986,12 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
}
Image_AlienPixMap aPixMap;
Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgUNKNOWN;
Image_Format aFormat = Image_Format_UNKNOWN;
switch (aParams.BufferType)
{
case Graphic3d_BT_RGB: aFormat = Image_PixMap::ImgRGB; break;
case Graphic3d_BT_RGBA: aFormat = Image_PixMap::ImgRGBA; break;
case Graphic3d_BT_Depth: aFormat = Image_PixMap::ImgGrayF; break;
case Graphic3d_BT_RGB: aFormat = Image_Format_RGB; break;
case Graphic3d_BT_RGBA: aFormat = Image_Format_RGBA; break;
case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break;
}
switch (aStereoPair)

View File

@ -4962,13 +4962,13 @@ static Standard_Integer VMarkersTest (Draw_Interpretor&,
std::cerr << "Could not load image from file '" << aFileName << "'!\n";
return 1;
}
if (anImage->Format() == Image_PixMap::ImgGray)
if (anImage->Format() == Image_Format_Gray)
{
anImage->SetFormat (Image_PixMap::ImgAlpha);
anImage->SetFormat (Image_Format_Alpha);
}
else if (anImage->Format() == Image_PixMap::ImgGrayF)
else if (anImage->Format() == Image_Format_GrayF)
{
anImage->SetFormat (Image_PixMap::ImgAlphaF);
anImage->SetFormat (Image_Format_AlphaF);
}
anAspect = new Graphic3d_AspectMarker3d (anImage);
}

View File

@ -5727,8 +5727,8 @@ static int VReadPixel (Draw_Interpretor& theDI,
return 1;
}
Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgRGBA;
Graphic3d_BufferType aBufferType = Graphic3d_BT_RGBA;
Image_Format aFormat = Image_Format_RGBA;
Graphic3d_BufferType aBufferType = Graphic3d_BT_RGBA;
Standard_Integer aWidth, aHeight;
aView->Window()->Size (aWidth, aHeight);
@ -5744,39 +5744,40 @@ static int VReadPixel (Draw_Interpretor& theDI,
Standard_Boolean toShowHls = Standard_False;
for (Standard_Integer anIter = 3; anIter < theArgNb; ++anIter)
{
const char* aParam = theArgVec[anIter];
if ( strcasecmp( aParam, "rgb" ) == 0 )
TCollection_AsciiString aParam (theArgVec[anIter]);
aParam.LowerCase();
if (aParam == "rgb")
{
aFormat = Image_PixMap::ImgRGB;
aFormat = Image_Format_RGB;
aBufferType = Graphic3d_BT_RGB;
}
else if ( strcasecmp( aParam, "hls" ) == 0 )
else if (aParam == "hls")
{
aFormat = Image_PixMap::ImgRGB;
aFormat = Image_Format_RGB;
aBufferType = Graphic3d_BT_RGB;
toShowHls = Standard_True;
}
else if ( strcasecmp( aParam, "rgbf" ) == 0 )
else if (aParam == "rgbf")
{
aFormat = Image_PixMap::ImgRGBF;
aFormat = Image_Format_RGBF;
aBufferType = Graphic3d_BT_RGB;
}
else if ( strcasecmp( aParam, "rgba" ) == 0 )
else if (aParam == "rgba")
{
aFormat = Image_PixMap::ImgRGBA;
aFormat = Image_Format_RGBA;
aBufferType = Graphic3d_BT_RGBA;
}
else if ( strcasecmp( aParam, "rgbaf" ) == 0 )
else if (aParam == "rgbaf")
{
aFormat = Image_PixMap::ImgRGBAF;
aFormat = Image_Format_RGBAF;
aBufferType = Graphic3d_BT_RGBA;
}
else if ( strcasecmp( aParam, "depth" ) == 0 )
else if (aParam == "depth")
{
aFormat = Image_PixMap::ImgGrayF;
aFormat = Image_Format_GrayF;
aBufferType = Graphic3d_BT_Depth;
}
else if ( strcasecmp( aParam, "name" ) == 0 )
else if (aParam == "name")
{
toShowName = Standard_True;
}
@ -10286,7 +10287,7 @@ static int VDumpSelectionImage (Draw_Interpretor& /*theDi*/,
TCollection_AsciiString aFile;
StdSelect_TypeOfSelectionImage aType = StdSelect_TypeOfSelectionImage_NormalizedDepth;
Image_PixMap::ImgFormat anImgFormat = Image_PixMap::ImgBGR;
Image_Format anImgFormat = Image_Format_BGR;
Standard_Integer aPickedIndex = 1;
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
{
@ -10307,7 +10308,7 @@ static int VDumpSelectionImage (Draw_Interpretor& /*theDi*/,
|| aValue == "normalizeddepth")
{
aType = StdSelect_TypeOfSelectionImage_NormalizedDepth;
anImgFormat = Image_PixMap::ImgGrayF;
anImgFormat = Image_Format_GrayF;
}
if (aValue == "depthinverted"
|| aValue == "normdepthinverted"
@ -10315,13 +10316,13 @@ static int VDumpSelectionImage (Draw_Interpretor& /*theDi*/,
|| aValue == "inverted")
{
aType = StdSelect_TypeOfSelectionImage_NormalizedDepthInverted;
anImgFormat = Image_PixMap::ImgGrayF;
anImgFormat = Image_Format_GrayF;
}
else if (aValue == "unnormdepth"
|| aValue == "unnormalizeddepth")
{
aType = StdSelect_TypeOfSelectionImage_UnnormalizedDepth;
anImgFormat = Image_PixMap::ImgGrayF;
anImgFormat = Image_Format_GrayF;
}
else if (aValue == "objectcolor"
|| aValue == "object"