You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `stroke` and `fill` messages will use the source color specified and apply it to your path.
289
378
290
379
Figure *@colorpaint@* presents a full example with all color possibilities.
291
380
@@ -301,8 +390,37 @@ destination, by manipulating the transformation matrix.
301
390
*`rotateByRadians:` modifies the current transformation matrix by rotating the user-space axes by angle radians.
302
391
*`setIdentityMatrix` resets the current transformation matrix by setting it equal to the identity matrix.
303
392
393
+
### composition operator
394
+
395
+
Normally, you will be using Alexandrie to draw objects on top of each other. But Alexandrie can do differently, if you need it! In fact, you can use all the compositing operators.
396
+
397
+
In the example below, we'll have two rectangle, one red and one blue, on top
398
+
of each other. Depending of the compositing operator used, the result will be
399
+
completely different.
400
+
401
+
This is the code for the **clear** operator. You can change it to all other operator
402
+
available. Some are directly available at the context level, but for the majority
403
+
of them, you need to specify the context operator.
Copy file name to clipboardExpand all lines: Chapters/Attic/BlocForPharoByExample13Book.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,7 @@ All of the objects that you see on the screen when you run Pharo are
11
11
12
12
The class `BlElement` itself is a large class with many methods; this makes it
13
13
possible for subclasses to implement interesting behavior with little code. You
14
-
can also customize an element directly. Contrary to the old Morphic environment,
15
-
Bloc favors much more object composition over inheritance.
14
+
can also customize an element directly. Unlike the old Morphic environment, Bloc strongly favors object composition over inheritance.
16
15
17
16
To create a BlElement to represent a string object, execute the following code in a Playground.
18
17
@@ -46,8 +45,8 @@ object in Pharo: by sending messages, we can change their
46
45
properties, create new subclasses of Morph, and so on.
47
46
48
47
Every bloc element, when opened on the screen has a position and a
49
-
size. If they are irregularly shaped, their position and size are
50
-
those its *bounds*.
48
+
size. If it is irregularly shaped, its position and size are
49
+
determine by its *bounds*.
51
50
52
51
- The `position` method returns a `Point` that describes the location of the bloc element upper-left corner of its bounding box. The origin of the coordinate system is the parent's upper left corner, with *y* coordinates increasing *down* the screen and *x* coordinates increasing to the right.
53
52
- The `extent` method also returns a point, but this point specifies the width and height of the bloc element rather than a location.
@@ -135,7 +134,7 @@ some mouse interaction.
135
134
136
135
To build live user interfaces using bloc elements, we need to be able to
137
136
interact with them using the mouse and keyboard.
138
-
Moreover, the element needs to be able to respond to user input by changing their appearance and position -- that is, by animating themselves.
137
+
Moreover, the elements need to be able to respond to user input by changing their appearance and position -- that is, by animating themselves.
139
138
140
139
Let's extend our cross element to handle mouse events. Suppose that when we
141
140
enter on the cross, we want to change the color of the cross to red, and when
@@ -328,8 +327,7 @@ cross requestFocus.
328
327
329
328
### Drag-and-drop
330
329
331
-
Bloc has also basic support for drag-and-drop which needs to be further
332
-
improved. In the coming example, if you change the order of appearance of the
330
+
Bloc has also basic support for drag-and-drop which requires further improvement. In the coming example, if you change the order of appearance of the
333
331
elements, drag&drop may not work - element will not catch the appropriate event.
334
332
This example will however show all events used with a working example.
0 commit comments