Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:48

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 
0032   //! Creates a new custom hatch style with the given pattern and unique style id
0033   //! @warning Raises a program error if given pattern image is not a valid 32*32 bitmap
0034   Standard_EXPORT Graphic3d_HatchStyle (const Handle(Image_PixMap)& thePattern);
0035 
0036   //! Creates a new predefined hatch style with the given id in Aspect_HatchStyle enum.
0037   //! GPU memory for the pattern will not be allocated.
0038   Graphic3d_HatchStyle (const Aspect_HatchStyle theType)
0039   : myHatchType (theType) {}
0040 
0041   //! Returns the pattern of custom hatch style
0042   Standard_EXPORT const Standard_Byte* Pattern() const;
0043 
0044   //! In case if predefined OCCT style is used, returns
0045   //! index in Aspect_HatchStyle enumeration. If the style
0046   //! is custom, returns unique index of the style
0047   Standard_Integer HatchType() const
0048   {
0049     return myHatchType;
0050   }
0051 
0052   //! Dumps the content of me into the stream
0053   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0054 
0055 private:
0056 
0057   Handle(NCollection_Buffer) myPattern;   //!< Image bitmap with custom hatch pattern
0058   Standard_Integer           myHatchType; //!< Index of used style
0059 };
0060 
0061 DEFINE_STANDARD_HANDLE (Graphic3d_HatchStyle, Standard_Transient)
0062 
0063 #endif // _Graphic3d_HatchStyle_HeaderFile