1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00
Files
occt/src/Graphic3d/Graphic3d_MarkerImage.hxx
abv c04c30b3ee 0024023: Revamp the OCCT Handle -- general
Missing headers added; includes of headers "Handle_...hxx" removed.

Misuses of macro Handle() and its use in typedefs corrected.

Alias classes Profile and Option are removed from IFSelect; ones defined in MoniTool are used directly.

Removed header files defining only Handle classes (except Image_PixMap_Handle.hxx)

Classes SelectMgr_BaseFrustum and now inherit Standard_Transient and can be manipulated by Handle (not NCollection_Handle)

Fixed reference-type local variable pointing to temporary object

Use of handle in conditional expressions and comparisons to NULL are replaced by call to method IsNull()
2015-07-11 12:08:02 +03:00

88 lines
4.1 KiB
C++
Executable File

// Created on: 2013-06-25
// Created by: Dmitry BOBYLEV
// Copyright (c) 2013-2014 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 _Graphic3d_MarkerImage_H__
#define _Graphic3d_MarkerImage_H__
#include <TColStd_HArray1OfByte.hxx>
#include <Quantity_Parameter.hxx>
#include <TCollection_AsciiString.hxx>
class Image_PixMap;
//! This class is used to store bitmaps and images for markers rendering.
//! It can convert bitmap texture stored in TColStd_HArray1OfByte to Image_PixMap and vice versa.
class Graphic3d_MarkerImage : public Standard_Transient
{
public:
//! @param theImage - source image
Standard_EXPORT Graphic3d_MarkerImage (const Handle(Image_PixMap)& theImage);
//! Creates marker image from array of bytes
//! (method for compatibility with old markers definition).
//! @param theBitMap - source bitmap stored as array of bytes
//! @param theWidth - number of bits in a row
//! @param theHeight - number of bits in a column
Standard_EXPORT Graphic3d_MarkerImage (const Handle(TColStd_HArray1OfByte)& theBitMap,
const Standard_Integer& theWidth,
const Standard_Integer& theHeight);
//! @param theAlphaValue pixels in the image that have alpha value greater than
//! or equal to this parameter will be stored in bitmap as "1",
//! others will be stored as "0"
//! @return marker image as array of bytes. If an instance of the class has been
//! initialized with image, it will be converted to bitmap based on the parameter theAlphaValue.
Standard_EXPORT Handle(TColStd_HArray1OfByte) GetBitMapArray (const Standard_Real& theAlphaValue = 0.5) const;
//! @return marker image. If an instance of the class has been initialized with a bitmap, it will be
//! converted to image.
Standard_EXPORT const Handle(Image_PixMap)& GetImage();
//! @return image alpha as grayscale image. Note that if an instance of the class has been initialized
//! with a bitmap or with grayscale image this method will return exactly the same image as GetImage()
Standard_EXPORT const Handle(Image_PixMap)& GetImageAlpha();
//! @return an unique ID. This ID will be used to manage resource in graphic driver.
Standard_EXPORT const TCollection_AsciiString& GetImageId() const;
//! @return an unique ID. This ID will be used to manage resource in graphic driver.
Standard_EXPORT const TCollection_AsciiString& GetImageAlphaId() const;
//! @return texture size
Standard_EXPORT void GetTextureSize (Standard_Integer& theWidth,
Standard_Integer& theHeight) const;
private:
TCollection_AsciiString myImageId; //!< resource identifier
TCollection_AsciiString myImageAlphaId; //!< resource identifier
Handle(TColStd_HArray1OfByte) myBitMap; //!< bytes array with bitmap definition (for compatibility with old code)
Handle(Image_PixMap) myImage; //!< full-color marker definition
Handle(Image_PixMap) myImageAlpha; //!< alpha-color marker definition (for dynamic hi-lighting)
Standard_Integer myMargin; //!< extra margin from boundaries for bitmap -> point sprite conversion, 1 px by default
Standard_Integer myWidth; //!< marker width
Standard_Integer myHeight; //!< marker height
public:
DEFINE_STANDARD_RTTI(Graphic3d_MarkerImage, Standard_Transient) // Type definition
};
DEFINE_STANDARD_HANDLE (Graphic3d_MarkerImage, Standard_Transient)
#endif // _Graphic3d_MarkerImage_H__