Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:20:00

0001 // Created on: 2016-11-14
0002 // Created by: Varvara POSKONINA
0003 // Copyright (c) 2016 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Graphic3d_HatchStyle_HeaderFile
0017 #define _Graphic3d_HatchStyle_HeaderFile
0018 
0019 #include <Aspect_HatchStyle.hxx>
0020 #include <Image_PixMap.hxx>
0021 #include <NCollection_Buffer.hxx>
0022 
0023 //! A class that provides an API to use standard OCCT hatch styles
0024 //! defined in Aspect_HatchStyle enum or to create custom styles
0025 //! from a user-defined bitmap
0026 class Graphic3d_HatchStyle : public Standard_Transient
0027 {
0028   DEFINE_STANDARD_RTTIEXT(Graphic3d_HatchStyle, Standard_Transient) // Type definition
0029 
0030 public:
0031   //! Creates a new custom hatch style with the given pattern and unique style id
0032   //! @warning Raises a program error if given pattern image is not a valid 32*32 bitmap
0033   Standard_EXPORT Graphic3d_HatchStyle(const occ::handle<Image_PixMap>& thePattern);
0034 
0035   //! Creates a new predefined hatch style with the given id in Aspect_HatchStyle enum.
0036   //! GPU memory for the pattern will not be allocated.
0037   Graphic3d_HatchStyle(const Aspect_HatchStyle theType)
0038       : myHatchType(theType)
0039   {
0040   }
0041 
0042   //! Returns the pattern of custom hatch style
0043   Standard_EXPORT const uint8_t* Pattern() const;
0044 
0045   //! In case if predefined OCCT style is used, returns
0046   //! index in Aspect_HatchStyle enumeration. If the style
0047   //! is custom, returns unique index of the style
0048   int HatchType() const { return myHatchType; }
0049 
0050   //! Dumps the content of me into the stream
0051   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0052 
0053 private:
0054   occ::handle<NCollection_Buffer> myPattern;   //!< Image bitmap with custom hatch pattern
0055   int                             myHatchType; //!< Index of used style
0056 };
0057 
0058 #endif // _Graphic3d_HatchStyle_HeaderFile