1 -- Created on: 2010-09-16
3 -- Copyright (c) 2010-2012 OPEN CASCADE SAS
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.
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.
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.
21 class PixMap from Image
25 ---Purpose: This class defines a system-independent bitmap
27 ---Keywords: Bitmap, Pixmap
34 TypeOfImage from Image,
35 HPrivateImage from Image,
36 CRawBufferData from Image,
38 Parameter from Quantity
41 PixmapDefinitionError from Aspect,
42 PixmapError from Aspect
46 Create ( theWidth, theHeight : Integer from Standard;
47 theType : TypeOfImage from Image )
48 returns mutable PixMap from Image
49 raises PixmapDefinitionError from Aspect;
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).
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;
69 -- Create a bitmap by copying an existing buffer.
71 ---------------------------------------------------
72 -- Category: Methods to modify the class definition
73 ---------------------------------------------------
75 Destroy ( me : mutable )
78 -- Destroies the Bitmap
80 ---Trigger: Raises if Bitmap is not defined properly
81 raises PixmapError from Aspect is virtual;
84 theFilename : CString from Standard;
85 theGammaCorr : Real from Standard = 1.0 )
86 returns Boolean from Standard
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;
94 ----------------------------
95 -- Category: Inquire methods
96 ----------------------------
98 PixmapID ( me ) returns Handle from Aspect is virtual;
101 -- Returns NULL handle
102 ---Category: Inquire methods
104 ----------------------------
105 -- Category: Access methods
106 ----------------------------
108 AccessBuffer ( me : in;
109 theBufferInfo : in out CRawBufferData from Image )
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.
122 PixelColor ( me : in;
123 theX, theY : in Integer from Standard )
124 returns Color from Quantity
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
133 PixelColor ( me : in;
134 theX, theY : in Integer from Standard;
135 theAlpha : out Parameter from Quantity )
136 returns Color from Quantity;
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
146 myImage : HPrivateImage from Image is protected;