summaryrefslogtreecommitdiff
path: root/src/Graphic2d/Graphic2d_Image.cdl
blob: 380ed4380f70684ab9254cef05a53611398831e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

-- File:	Graphic2d_Image.cdl
-- Created:	Tue Jun 22 16:36:51 1993
-- Author:	Jean Louis FRENKEL, Gerard GRAS
--		<jlf@stylox>
-- Modified: TCL G002A, 28-11-00, new section "inquire methods"

---Copyright:	 Matra Datavision 1993

class Image from Graphic2d inherits Primitive from Graphic2d

	---Version:

	---Purpose: This class defines the primitive Image

	---Keywords: Primitive, Image
	---Warning:
	---References:

uses
	Drawer          from Graphic2d,
	Image		from Image,
	GraphicObject	from Graphic2d,
	Length          from Quantity,
	CardinalPoints  from Aspect, 
	FStream         from Aspect,
	IFStream	from Aspect


is
	-------------------------
	-- Category: Constructors
	-------------------------

	Create (aGraphicObject: GraphicObject from Graphic2d;
		anImage: Image from Image;
		X, Y: Length from Quantity;
		adx:  Length from Quantity = 0.0;
		ady:  Length from Quantity = 0.0;
		aTypeOfPlacement: CardinalPoints
				from Aspect = Aspect_CP_Center)
	returns mutable Image from Graphic2d;
	---Level: Public
	---Purpose: Defines an image with its center location;
	--	    <X>, <Y> defines the position in the space model.
	--	    <adx>, <ady> defines an offset in the device space.
	--	    The image will be placed at this offset
	--	    according to the type of placement.
	--
	--	    CardinalPoints values :
	--		- CP_North
	--		- CP_NorthEast
	--		- CP_East
	--		- CP_SouthEast
	--		- CP_South
	--		- CP_SouthWest
	--		- CP_West
	--		- CP_NorthWest
	--		- CP_Center
	---Category: Constructors

	--------------------------
	-- Category: Draw and Pick
	--------------------------

	Draw (me : mutable; aDrawer: Drawer from Graphic2d)
	is static protected;
	---Level: Internal
	---Purpose: Draws the image at the required center location
	--	    defined by the SetCenter method.

	Pick (me : mutable;
		X, Y: ShortReal from Standard;
		aPrecision: ShortReal from Standard;
		aDrawer: Drawer from Graphic2d)
	returns Boolean from Standard is static protected;
	---Purpose: Returns Standard_True if the image <me> is picked,
	--          Standard_False if not.

	---------------------------------------------------
	-- Category: Methods to modify the class definition
	---------------------------------------------------

	SetCenter (me: mutable;
		X, Y: Length from Quantity)
	is static;
	---Level: Public
	---Purpose: Modifies the center location of the image <me>.
	---Category: Methods to modify the class definition

	SetOffset (me: mutable;
		dx, dy: Length from Quantity)
	is static;
	---Level: Public
	---Purpose: Modifies the offset of the image <me>.
	---Category: Methods to modify the class definition

	SetPlacement (me: mutable; aPlacement: CardinalPoints from Aspect)
	is  static;
	---Level: Public
	---Purpose: Modifies the type of placement of the image <me>.
	--
	--	    CardinalPoints values :
	--		- CP_North
	--		- CP_NorthEast
	--		- CP_East
	--		- CP_SouthEast
	--		- CP_South
	--		- CP_SouthWest
	--		- CP_West
	--		- CP_NorthWest
	--		- CP_Center
	---Category: Methods to modify the class definition

	Translate (me: mutable;
	           DX, DY: Length from Quantity) is static;
	---Level: Public
	---Purpose: Modifies the center location of the image <me>
	--          by translating it.
	---Category: Methods to modify the class definition

	Clear (me: mutable) is static;
	---Level: Public
	---Purpose: Clear the reference to this image if something
	-- 	   inside have changed,Forced the reload of this at Draw()
	--	   time.
	---Category: Methods to modify the class definition

	-------------------------------------------------------
	-- Category: Methods to manage the filling of the image
	-------------------------------------------------------

	SetSmallSize (myclass; aSize: Integer from Standard);
	---Level: Internal
	---Purpose: Defines the limit between a large image and a
	--	    small image.
	--  Warning: A small image have Height*Width <= SmallSize ().
	--	    Default 4096 = 64*64
	---Category: Methods to manage the filling of the image

	SmallSize (myclass)
	returns Integer from Standard;
	---Level: Internal
	---Purpose: Returns the limit between a large image and a
	--	    small image.
	--  Warning: A small image have Height*Width <= SmallSize ().
	---Category: Methods to manage the filling of the image

    --------------------------------------
	-- Category: Inquire methods
	--------------------------------------

    Position( me; X, Y: out Length from Quantity );  
	---Level: Public
	---Purpose: returns the position in the space model
	
	Offset( me; aX, aY: out Length from Quantity );
	---Level: Public
	---Purpose: returns the offset in the device space
	
    Placement( me ) returns CardinalPoints from Aspect;
	---Level: Public
	---Purpose: returns the type of placement
	
	Image( me ) returns Image from Image;
	---Level: Public
	---Purpose: returns the image
	
	----------------------------
	-- Category: Private methods
	----------------------------

	FillAndDraw (me; aDrawer: Drawer from Graphic2d)
	is static private;
	---Level: Internal
	---Purpose: Fills the image <me> in the drawer <aDrawer>.
	---Category: Private methods

	ComputeCenter (me;
		aDrawer: Drawer from Graphic2d;
		cx, cy: out ShortReal from  Standard)
	is static private;
	---Level: Internal
	---Purpose: Evaluates the center of the image in the device space.
	--	    Called by the methods Graphic2d_Image::Draw,
	--	    Graphic2d_Image::Pick and Graphic2d_Image::FillAndDraw.
	---Category: Private methods

	----------------------------------------------------------------------

	Save( me; aFStream: in out FStream from Aspect ) is virtual;
--	Retrieve( me; aIFStream: in out IFStream from AIS2D ) is virtual;

fields

	myImage:	  Image from Image;
	myX, myY:	  ShortReal from Standard;
	mydx, mydy:	  ShortReal from Standard;
	myPlacement:  CardinalPoints from Aspect;
	myIsModified: Boolean from Standard;

end Image from Graphic2d;