0024157: Parallelization of assembly part of BO
[occt.git] / src / Image / Image_AlienPixMap.hxx
CommitLineData
692613e5 1// Created on: 2012-07-18
2// Created by: Kirill GAVRILOV
3// Copyright (c) 2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
20#ifndef _Image_AlienPixMap_H__
21#define _Image_AlienPixMap_H__
22
23#include <Image_PixMap.hxx>
692613e5 24
25class TCollection_AsciiString;
26struct FIBITMAP;
27
28//! Image class that support file reading/writing operations using auxiliary image library.
3994ec41 29//! Supported image formats:
30//! - *.bmp - bitmap image, lossless format without compression.
31//! - *.ppm - PPM (Portable Pixmap Format), lossless format without compression.
32//! - *.png - PNG (Portable Network Graphics) lossless format with compression.
33//! - *.jpg, *.jpe, *.jpeg - JPEG/JIFF (Joint Photographic Experts Group) lossy format (compressed with quality losses). YUV color space used (automatically converted from/to RGB).
34//! - *.tif, *.tiff - TIFF (Tagged Image File Format).
35//! - *.tga - TGA (Truevision Targa Graphic), lossless format.
36//! - *.gif - GIF (Graphical Interchange Format), lossy format. Color stored using pallete (up to 256 distinct colors).
37//! - *.exr - OpenEXR high dynamic-range format (supports float pixel formats).
692613e5 38class Image_AlienPixMap : public Image_PixMap
39{
40
41public:
42
43 //! Empty constructor.
44 Standard_EXPORT Image_AlienPixMap();
45
46 //! Destructor
47 Standard_EXPORT virtual ~Image_AlienPixMap();
48
49 //! Read image data from file.
50 Standard_EXPORT bool Load (const TCollection_AsciiString& theFileName);
51
52 //! Write image data to file using file extension to determine compression format.
53 Standard_EXPORT bool Save (const TCollection_AsciiString& theFileName);
54
55 //! Initialize image plane with required dimensions.
56 //! thePixelFormat - if specified pixel format doesn't supported by image library
57 //! than nearest supported will be used instead!
58 //! theSizeRowBytes - may be ignored by this class and required alignemnt will be used instead!
59 Standard_EXPORT virtual bool InitTrash (ImgFormat thePixelFormat,
60 const Standard_Size theSizeX,
61 const Standard_Size theSizeY,
62 const Standard_Size theSizeRowBytes = 0);
63
64 //! Initialize by copying data.
65 Standard_EXPORT virtual bool InitCopy (const Image_PixMap& theCopy);
66
67 //! Method correctly deallocate internal buffer.
68 Standard_EXPORT virtual void Clear (ImgFormat thePixelFormat = ImgGray);
69
70 //! Performs gamma correction on image.
71 //! theGamma - gamma value to use; a value of 1.0 leaves the image alone
72 Standard_EXPORT bool AdjustGamma (const Standard_Real theGammaCorr);
73
74private:
75
76 FIBITMAP* myLibImage;
77
78private:
79
80 //! Copying allowed only within Handles
81 Image_AlienPixMap (const Image_AlienPixMap& );
82 Image_AlienPixMap& operator= (const Image_AlienPixMap& );
83
84 //! Wrapper initialization is disallowed for this class (will return false in any case)!
85 //! Use only copying and allocation initializers.
86 Standard_EXPORT virtual bool InitWrapper (ImgFormat thePixelFormat,
87 Standard_Byte* theDataPtr,
88 const Standard_Size theSizeX,
89 const Standard_Size theSizeY,
90 const Standard_Size theSizeRowBytes);
91
92 //! Built-in PPM export
93 Standard_EXPORT bool savePPM (const TCollection_AsciiString& theFileName) const;
94
95public:
96
97 DEFINE_STANDARD_RTTI(Image_AlienPixMap) // Type definition
98
99};
100
101DEFINE_STANDARD_HANDLE(Image_AlienPixMap, Image_PixMap)
102
103#endif // _Image_AlienPixMap_H__