1 // Created on: 2016-11-14
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2016 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Graphic3d_HatchStyle_HeaderFile
17 #define _Graphic3d_HatchStyle_HeaderFile
19 #include <Aspect_HatchStyle.hxx>
20 #include <Image_PixMap.hxx>
21 #include <NCollection_Buffer.hxx>
23 //! A class that provides an API to use standard OCCT hatch styles
24 //! defined in Aspect_HatchStyle enum or to create custom styles
25 //! from a user-defined bitmap
26 class Graphic3d_HatchStyle : public Standard_Transient
28 DEFINE_STANDARD_RTTIEXT (Graphic3d_HatchStyle, Standard_Transient) // Type definition
32 //! Creates a new custom hatch style with the given pattern and unique style id
33 //! @warning Raises a program error if given pattern image is not a valid 32*32 bitmap
34 Standard_EXPORT Graphic3d_HatchStyle (const Handle(Image_PixMap)& thePattern);
36 //! Creates a new predefined hatch style with the given id in Aspect_HatchStyle enum.
37 //! GPU memory for the pattern will not be allocated.
38 Graphic3d_HatchStyle (const Aspect_HatchStyle theType)
39 : myHatchType (theType) {}
41 //! Returns the pattern of custom hatch style
42 Standard_EXPORT const Standard_Byte* Pattern() const;
44 //! In case if predefined OCCT style is used, returns
45 //! index in Aspect_HatchStyle enumeration. If the style
46 //! is custom, returns unique index of the style
47 Standard_Integer HatchType() const
54 Handle(NCollection_Buffer) myPattern; //!< Image bitmap with custom hatch pattern
55 Standard_Integer myHatchType; //!< Index of used style
58 DEFINE_STANDARD_HANDLE (Graphic3d_HatchStyle, Standard_Transient)
60 #endif // _Graphic3d_HatchStyle_HeaderFile