0023156: Image_PixMap::PixelColor() extended to return alpha value
[occt.git] / src / Image / Image_PixMap.cdl
1 -- Created on: 2010-09-16
2 -- Created by: KGV
3 -- Copyright (c) 2010-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
21 class PixMap from Image
22
23         ---Version:
24
25         ---Purpose: This class defines a system-independent bitmap
26
27         ---Keywords: Bitmap, Pixmap
28
29 inherits
30     PixMap         from Aspect
31
32 uses
33     Handle         from Aspect,
34     TypeOfImage    from Image,
35     HPrivateImage  from Image,
36     CRawBufferData from Image,
37     Color          from Quantity,
38     Parameter      from Quantity
39
40 raises
41     PixmapDefinitionError  from Aspect,
42     PixmapError            from Aspect
43
44 is
45
46     Create ( theWidth, theHeight : Integer from Standard;
47              theType             : TypeOfImage from Image )
48     returns mutable PixMap from Image
49     raises PixmapDefinitionError from Aspect;
50     ---Level: Public
51     ---Purpose:
52     -- Allocate the bitmap with requested dimensions.
53     -- Allowed image types:
54     --  - Image_TOI_RGB (color image, 1 byte per component);
55     --  - Image_TOI_RGBA (color image with alpha channel);
56     --  - Image_TOI_RGBF (color image, 1 float per component);
57     --  - Image_TOI_RGBAF (color image with alpha channel);
58     --  - Image_TOI_FLOAT (grey image, 1 float per pixel).
59
60     Create ( theDataPtr          : PByte from Standard;
61              theWidth, theHeight : Integer from Standard;
62              thePitch            : Integer from Standard;
63              theBitsPerPixel     : Integer from Standard;
64              theIsTopDown        : Boolean from Standard )
65     returns mutable PixMap from Image
66     raises PixmapDefinitionError from Aspect;
67     ---Level: Public
68     ---Purpose:
69     -- Create a bitmap by copying an existing buffer.
70
71     ---------------------------------------------------
72     -- Category: Methods to modify the class definition
73     ---------------------------------------------------
74
75     Destroy ( me : mutable )
76     ---Level: Advanced
77     ---Purpose:
78     -- Destroies the Bitmap
79     ---C++: alias ~
80     ---Trigger: Raises if Bitmap is not defined properly
81     raises PixmapError from Aspect is virtual;
82
83     Dump ( me;
84            theFilename  : CString from Standard;
85            theGammaCorr : Real from Standard = 1.0 )
86     returns Boolean from Standard
87     ---Level: Advanced
88     ---Purpose:
89     -- Dumps the Bitmap to an image file with
90     -- an optional gamma correction value
91     -- and returns TRUE if the dump occurs normaly.
92     raises PixmapError from Aspect is virtual;
93
94     ----------------------------
95     -- Category: Inquire methods
96     ----------------------------
97
98     PixmapID ( me ) returns Handle from Aspect is virtual;
99     ---Level: Advanced
100     ---Purpose:
101     -- Returns NULL handle
102     ---Category: Inquire methods
103
104     ----------------------------
105     -- Category: Access methods
106     ----------------------------
107
108     AccessBuffer ( me            : in;
109                    theBufferInfo : in out CRawBufferData from Image )
110     is static;
111     ---Purpose:
112     -- Fill the structure for low-level access to the bitmap data.
113     -- It is up to you to interpret these bytes correctly!
114     -- Important notice: image stored upside-down in the memory,
115     --                   first image row is an last scanline in
116     --                   the memory buffer.
117     -- If image was created with type Image_TOI_FLOAT buffer
118     -- format will be set to TDepthComponent. You can override
119     -- this field with another one-channel buffer format because
120     -- it useless for bitmap definition.
121
122     PixelColor ( me         : in;
123                  theX, theY : in Integer from Standard )
124     returns Color from Quantity
125     is virtual;
126     ---Purpose:
127     -- Returns the pixel color. This function is relatively slow,
128     -- use AccessBuffer() instead for stream operations.
129     -- Note that this function convert input theY coordinate
130     -- to count off from top of an image (while in memory it stored
131     -- upside-down).
132
133     PixelColor ( me         : in;
134                  theX, theY : in  Integer   from Standard;
135                  theAlpha   : out Parameter from Quantity )
136     returns Color from Quantity;
137     ---Purpose:
138     -- Returns the pixel color. This function is relatively slow,
139     -- use AccessBuffer() instead for stream operations.
140     -- theAlpha argument is set to color intensity (0 - transparent, 1 - opaque)
141     -- Note that this function convert input theY coordinate
142     -- to count off from top of an image (while in memory it stored
143     -- upside-down).
144
145 fields
146     myImage : HPrivateImage from Image is protected;
147 end PixMap;