0030483: Visualization, Path Tracing - make Tile Size configurable
[occt.git] / src / Image / Image_AlienPixMap.hxx
CommitLineData
6aca4d39 1// Created on: 2012-07-18
692613e5 2// Created by: Kirill GAVRILOV
6aca4d39 3// Copyright (c) 2012-2014 OPEN CASCADE SAS
692613e5 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
692613e5 6//
d5f74e42 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
973c2be1 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.
692613e5 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
692613e5 15
16#ifndef _Image_AlienPixMap_H__
17#define _Image_AlienPixMap_H__
18
19#include <Image_PixMap.hxx>
692613e5 20
21class TCollection_AsciiString;
22struct FIBITMAP;
23
24//! Image class that support file reading/writing operations using auxiliary image library.
3994ec41 25//! Supported image formats:
26//! - *.bmp - bitmap image, lossless format without compression.
27//! - *.ppm - PPM (Portable Pixmap Format), lossless format without compression.
28//! - *.png - PNG (Portable Network Graphics) lossless format with compression.
29//! - *.jpg, *.jpe, *.jpeg - JPEG/JIFF (Joint Photographic Experts Group) lossy format (compressed with quality losses). YUV color space used (automatically converted from/to RGB).
30//! - *.tif, *.tiff - TIFF (Tagged Image File Format).
31//! - *.tga - TGA (Truevision Targa Graphic), lossless format.
dc858f4c 32//! - *.gif - GIF (Graphical Interchange Format), lossy format. Color stored using palette (up to 256 distinct colors).
3994ec41 33//! - *.exr - OpenEXR high dynamic-range format (supports float pixel formats).
692613e5 34class Image_AlienPixMap : public Image_PixMap
35{
dc858f4c 36 DEFINE_STANDARD_RTTIEXT(Image_AlienPixMap, Image_PixMap)
692613e5 37public:
38
39 //! Empty constructor.
40 Standard_EXPORT Image_AlienPixMap();
41
42 //! Destructor
43 Standard_EXPORT virtual ~Image_AlienPixMap();
44
45 //! Read image data from file.
46 Standard_EXPORT bool Load (const TCollection_AsciiString& theFileName);
47
48 //! Write image data to file using file extension to determine compression format.
49 Standard_EXPORT bool Save (const TCollection_AsciiString& theFileName);
50
51 //! Initialize image plane with required dimensions.
52 //! thePixelFormat - if specified pixel format doesn't supported by image library
53 //! than nearest supported will be used instead!
54 //! theSizeRowBytes - may be ignored by this class and required alignemnt will be used instead!
dc858f4c 55 Standard_EXPORT virtual bool InitTrash (Image_Format thePixelFormat,
692613e5 56 const Standard_Size theSizeX,
57 const Standard_Size theSizeY,
79104795 58 const Standard_Size theSizeRowBytes = 0) Standard_OVERRIDE;
692613e5 59
60 //! Initialize by copying data.
79104795 61 Standard_EXPORT virtual bool InitCopy (const Image_PixMap& theCopy) Standard_OVERRIDE;
692613e5 62
63 //! Method correctly deallocate internal buffer.
79104795 64 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
692613e5 65
66 //! Performs gamma correction on image.
67 //! theGamma - gamma value to use; a value of 1.0 leaves the image alone
68 Standard_EXPORT bool AdjustGamma (const Standard_Real theGammaCorr);
69
70private:
71
72 FIBITMAP* myLibImage;
73
74private:
75
76 //! Copying allowed only within Handles
77 Image_AlienPixMap (const Image_AlienPixMap& );
78 Image_AlienPixMap& operator= (const Image_AlienPixMap& );
79
80 //! Wrapper initialization is disallowed for this class (will return false in any case)!
81 //! Use only copying and allocation initializers.
dc858f4c 82 Standard_EXPORT virtual bool InitWrapper (Image_Format thePixelFormat,
692613e5 83 Standard_Byte* theDataPtr,
84 const Standard_Size theSizeX,
85 const Standard_Size theSizeY,
79104795 86 const Standard_Size theSizeRowBytes) Standard_OVERRIDE;
692613e5 87
88 //! Built-in PPM export
89 Standard_EXPORT bool savePPM (const TCollection_AsciiString& theFileName) const;
90
692613e5 91};
92
93DEFINE_STANDARD_HANDLE(Image_AlienPixMap, Image_PixMap)
94
95#endif // _Image_AlienPixMap_H__