299 |
299 |
300 widthOfString:aString |
300 widthOfString:aString |
301 "given a string, return its width in pixels if |
301 "given a string, return its width in pixels if |
302 drawn on the receivers device." |
302 drawn on the receivers device." |
303 |
303 |
304 gc == self ifTrue:[ |
|
305 ^ super widthOfString:aString. |
|
306 ]. |
|
307 ^ gc widthOfString:aString. |
304 ^ gc widthOfString:aString. |
308 |
305 |
309 "Modified: 28.5.1996 / 20:22:22 / cg" |
306 "Modified: 28.5.1996 / 20:22:22 / cg" |
310 ! |
307 ! |
311 |
308 |
312 widthOfString:aString from:start to:stop |
309 widthOfString:aString from:start to:stop |
313 "given a string, return the width in pixels if |
310 "given a string, return the width in pixels if |
314 a substring is drawn on the receivers device." |
311 a substring is drawn on the receivers device." |
315 |
312 |
316 gc == self ifTrue:[ |
|
317 ^ super widthOfString:aString from:start to:stop. |
|
318 ]. |
|
319 ^ gc widthOfString:aString from:start to:stop. |
313 ^ gc widthOfString:aString from:start to:stop. |
320 |
314 |
321 "Modified: 28.5.1996 / 20:22:18 / cg" |
315 "Modified: 28.5.1996 / 20:22:18 / cg" |
322 ! ! |
316 ! ! |
323 |
317 |
511 ! |
497 ! |
512 |
498 |
513 atX:x y:y |
499 atX:x y:y |
514 "return the pixel at the coordinate given by x/y" |
500 "return the pixel at the coordinate given by x/y" |
515 |
501 |
516 gc == self ifTrue:[ |
|
517 ^ super atX:x y:y |
|
518 ]. |
|
519 ^ gc atX:x y:y |
502 ^ gc atX:x y:y |
520 ! |
503 ! |
521 |
504 |
522 atX:x y:y put:aPixelColor |
505 atX:x y:y put:aPixelColor |
523 "set a pixel" |
506 "set a pixel" |
524 |
507 |
525 gc == self ifTrue:[ |
|
526 super atX:x y:y put:aPixelColor. |
|
527 ^ self. |
|
528 ]. |
|
529 gc atX:x y:y put:aPixelColor. |
508 gc atX:x y:y put:aPixelColor. |
530 ! |
509 ! |
531 |
510 |
532 backgroundPaint |
511 backgroundPaint |
533 "return the background paint color. |
512 "return the background paint color. |
534 (used for opaqueForms and opaqueStrings)" |
513 (used for opaqueForms and opaqueStrings)" |
535 |
514 |
536 gc == self ifTrue:[ |
|
537 ^ super backgroundPaint. |
|
538 ]. |
|
539 ^ gc backgroundPaint |
515 ^ gc backgroundPaint |
540 ! |
516 ! |
541 |
517 |
542 backgroundPaint:aColor |
518 backgroundPaint:aColor |
543 "set the background-paint color; this is used in opaque-draw |
519 "set the background-paint color; this is used in opaque-draw |
544 operations" |
520 operations" |
545 |
521 |
546 gc == self ifTrue:[ |
|
547 super backgroundPaint:aColor. |
|
548 ^ self. |
|
549 ]. |
|
550 gc backgroundPaint:aColor |
522 gc backgroundPaint:aColor |
551 ! |
523 ! |
552 |
524 |
553 basicFont |
525 basicFont |
554 "return the font for drawing" |
526 "return the font for drawing" |
555 |
527 |
556 gc == self ifTrue:[ |
|
557 ^ super basicFont. |
|
558 ]. |
|
559 ^ gc basicFont |
528 ^ gc basicFont |
560 ! |
529 ! |
561 |
530 |
562 basicFont:aFont |
531 basicFont:aFont |
563 "set the font for drawing if it has changed. |
532 "set the font for drawing if it has changed. |
564 This is a low level entry, which is not to be redefined |
533 This is a low level entry, which is not to be redefined |
565 (i.e. it must not imply a redraw operation)" |
534 (i.e. it must not imply a redraw operation)" |
566 |
535 |
567 gc == self ifTrue:[ |
|
568 super basicFont:aFont. |
|
569 ^ self. |
|
570 ]. |
|
571 gc basicFont:aFont |
536 gc basicFont:aFont |
572 ! |
537 ! |
573 |
538 |
574 blackColor |
539 blackColor |
575 gc isNil ifTrue:[ |
540 gc isNil ifTrue:[ |
576 ^ Color black. |
541 ^ Color black. |
577 ]. |
542 ]. |
578 gc == self ifTrue:[ |
543 ^ gc blackColor |
579 ^ super device blackColor. |
|
580 ]. |
|
581 ^ gc device blackColor |
|
582 ! |
544 ! |
583 |
545 |
584 bottomCenter |
546 bottomCenter |
585 "return the topCenter point" |
547 "return the topCenter point" |
586 |
548 |
699 If on, a superview may draw 'over' its children. |
647 If on, a superview may draw 'over' its children. |
700 If off (the default), drawing is 'under' its children. |
648 If off (the default), drawing is 'under' its children. |
701 Only useful for the rootView, to draw over any visible views. |
649 Only useful for the rootView, to draw over any visible views. |
702 (for example, when dragging a rubber-line)" |
650 (for example, when dragging a rubber-line)" |
703 |
651 |
704 gc == self ifTrue:[ |
|
705 super clippedByChildren:aBoolean. |
|
706 ^ self. |
|
707 ]. |
|
708 gc clippedByChildren:aBoolean. |
652 gc clippedByChildren:aBoolean. |
709 |
653 |
710 "Created: 17.7.1996 / 13:25:16 / cg" |
654 "Created: 17.7.1996 / 13:25:16 / cg" |
711 "Modified: 29.4.1997 / 15:33:55 / dq" |
655 "Modified: 29.4.1997 / 15:33:55 / dq" |
712 ! |
656 ! |
713 |
657 |
714 clippingBounds |
658 clippingBounds |
715 "return the clipping rectangle for drawing, nil if there is none." |
659 "return the clipping rectangle for drawing, nil if there is none." |
716 |
660 |
717 gc == self ifTrue:[ |
|
718 ^ super clippingBounds. |
|
719 ]. |
|
720 ^ gc clippingBounds |
661 ^ gc clippingBounds |
721 ! |
662 ! |
722 |
663 |
723 clippingBounds:aRectangleOrNil |
664 clippingBounds:aRectangleOrNil |
724 "set the clipping rectangle for drawing (in logical coordinates); |
665 "set the clipping rectangle for drawing (in logical coordinates); |
725 a nil argument turn off clipping (i.e. whole view is drawable)" |
666 a nil argument turn off clipping (i.e. whole view is drawable)" |
726 |
667 |
727 gc == self ifTrue:[ |
|
728 super clippingBounds:aRectangleOrNil. |
|
729 ^ self. |
|
730 ]. |
|
731 gc clippingBounds:aRectangleOrNil |
668 gc clippingBounds:aRectangleOrNil |
732 ! |
669 ! |
733 |
670 |
734 clippingBoundsOrNil |
671 clippingBoundsOrNil |
735 "return the clipping rectangle for drawing, nil if there is none." |
672 "return the clipping rectangle for drawing, nil if there is none." |
736 |
673 |
737 gc == self ifTrue:[ |
|
738 ^ super clippingBoundsOrNil. |
|
739 ]. |
|
740 ^ gc clippingBoundsOrNil |
674 ^ gc clippingBoundsOrNil |
741 ! |
675 ! |
742 |
676 |
743 clippingRectangle:aRectangleOrNil |
677 clippingRectangle:aRectangleOrNil |
744 "set the clipping rectangle for drawing (in logical coordinates); |
678 "set the clipping rectangle for drawing (in logical coordinates); |
999 lineStyle |
892 lineStyle |
1000 "return the current line-drawing-style. |
893 "return the current line-drawing-style. |
1001 possible styles are: #solid, #dashed, #doubleDashed, |
894 possible styles are: #solid, #dashed, #doubleDashed, |
1002 #dotted, #dashDot or #dashDotDot." |
895 #dotted, #dashDot or #dashDotDot." |
1003 |
896 |
1004 gc == self ifTrue:[ |
|
1005 ^ super lineStyle. |
|
1006 ]. |
|
1007 ^ gc lineStyle |
897 ^ gc lineStyle |
1008 ! |
898 ! |
1009 |
899 |
1010 lineStyle:aStyleSymbol |
900 lineStyle:aStyleSymbol |
1011 "set the line-drawing-style; |
901 "set the line-drawing-style; |
1012 possible styles are: #solid, #dashed, #doubleDashed, |
902 possible styles are: #solid, #dashed, #doubleDashed, |
1013 #dotted, #dashDot or #dashDotDot." |
903 #dotted, #dashDot or #dashDotDot." |
1014 |
904 |
1015 gc == self ifTrue:[ |
|
1016 super lineStyle:aStyleSymbol. |
|
1017 ^ self. |
|
1018 ]. |
|
1019 gc lineStyle:aStyleSymbol |
905 gc lineStyle:aStyleSymbol |
1020 ! |
906 ! |
1021 |
907 |
1022 lineWidth |
908 lineWidth |
1023 "return the current drawing linewidth" |
909 "return the current drawing linewidth" |
1024 |
910 |
1025 gc == self ifTrue:[ |
|
1026 ^ super lineWidth. |
|
1027 ]. |
|
1028 ^ gc lineWidth |
911 ^ gc lineWidth |
1029 ! |
912 ! |
1030 |
913 |
1031 lineWidth:aNumber |
914 lineWidth:aNumber |
1032 "set the line drawing width in pixels" |
915 "set the line drawing width in pixels" |
1033 |
916 |
1034 gc == self ifTrue:[ |
|
1035 super lineWidth:aNumber. |
|
1036 ^ self. |
|
1037 ]. |
|
1038 gc lineWidth:aNumber |
917 gc lineWidth:aNumber |
1039 ! |
918 ! |
1040 |
919 |
1041 mask |
920 mask |
1042 "return the current drawing mask" |
921 "return the current drawing mask" |
1043 |
922 |
1044 gc == self ifTrue:[ |
|
1045 ^ super mask. |
|
1046 ]. |
|
1047 ^ gc mask |
923 ^ gc mask |
1048 ! |
924 ! |
1049 |
925 |
1050 mask:aForm |
926 mask:aForm |
1051 "set the drawing mask" |
927 "set the drawing mask" |
1052 |
928 |
1053 gc == self ifTrue:[ |
|
1054 super mask:aForm. |
|
1055 ^ self. |
|
1056 ]. |
|
1057 gc mask:aForm |
929 gc mask:aForm |
1058 ! |
930 ! |
1059 |
931 |
1060 maskOrigin |
932 maskOrigin |
1061 "return the origin within the mask (used to draw with patterns). |
933 "return the origin within the mask (used to draw with patterns). |
1062 Should be redefined in classes which support it. |
934 Should be redefined in classes which support it. |
1063 This is an alias for ST-80's #phase" |
935 This is an alias for ST-80's #phase" |
1064 |
936 |
1065 gc == self ifTrue:[ |
|
1066 ^ super maskOrigin. |
|
1067 ]. |
|
1068 ^ gc maskOrigin |
937 ^ gc maskOrigin |
1069 ! |
938 ! |
1070 |
939 |
1071 maskOrigin:aPoint |
940 maskOrigin:aPoint |
1072 "set the origin within the mask (used to draw with patterns). |
941 "set the origin within the mask (used to draw with patterns). |
1073 Should be redefined in classes which support it. |
942 Should be redefined in classes which support it. |
1074 This is an alias for ST-80's #phase:" |
943 This is an alias for ST-80's #phase:" |
1075 |
944 |
1076 gc == self ifTrue:[ |
|
1077 super maskOrigin:aPoint. |
|
1078 ^ self. |
|
1079 ]. |
|
1080 gc maskOrigin:aPoint |
945 gc maskOrigin:aPoint |
1081 ! |
946 ! |
1082 |
947 |
1083 maskOriginX:x y:y |
948 maskOriginX:x y:y |
1084 "set the origin within the mask (used to draw with patterns). |
949 "set the origin within the mask (used to draw with patterns). |
1285 background |
1125 background |
1286 <resource: #obsolete> |
1126 <resource: #obsolete> |
1287 "return the current background drawing color. |
1127 "return the current background drawing color. |
1288 OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:" |
1128 OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:" |
1289 |
1129 |
1290 gc == self ifTrue:[ |
|
1291 ^ super background. |
|
1292 ]. |
|
1293 ^ gc background |
1130 ^ gc background |
1294 |
1131 |
1295 "Modified: 12.5.1996 / 22:28:09 / cg" |
1132 "Modified: 12.5.1996 / 22:28:09 / cg" |
1296 ! |
1133 ! |
1297 |
1134 |
1298 background:aColor |
1135 background:aColor |
1299 <resource: #obsolete> |
1136 <resource: #obsolete> |
1300 "set the internal background color for drawing - aColor must be a real color. |
1137 "set the internal background color for drawing - aColor must be a real color. |
1301 OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:" |
1138 OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:" |
1302 |
1139 |
1303 gc == self ifTrue:[ |
|
1304 super background:aColor. |
|
1305 ^ self. |
|
1306 ]. |
|
1307 gc background:aColor |
1140 gc background:aColor |
1308 ! |
1141 ! |
1309 |
1142 |
1310 foreground |
1143 foreground |
1311 <resource: #obsolete> |
1144 <resource: #obsolete> |
1312 "return the current foreground drawing color. |
1145 "return the current foreground drawing color. |
1313 OBSOLETE: use #paint: / #paint:on:" |
1146 OBSOLETE: use #paint: / #paint:on:" |
1314 |
1147 |
1315 gc == self ifTrue:[ |
|
1316 ^ super foreground. |
|
1317 ]. |
|
1318 ^ gc foreground |
1148 ^ gc foreground |
1319 ! |
1149 ! |
1320 |
1150 |
1321 foreground:aColor |
1151 foreground:aColor |
1322 <resource: #obsolete> |
1152 <resource: #obsolete> |
1323 "set the internal foreground color for drawing - aColor must be a real color. |
1153 "set the internal foreground color for drawing - aColor must be a real color. |
1324 OBSOLETE: this method will vanish; use #paint: / #paint:on:" |
1154 OBSOLETE: this method will vanish; use #paint: / #paint:on:" |
1325 |
1155 |
1326 gc == self ifTrue:[ |
|
1327 super foreground:aColor. |
|
1328 ^ self. |
|
1329 ]. |
|
1330 gc foreground:aColor |
1156 gc foreground:aColor |
1331 ! |
1157 ! |
1332 |
1158 |
1333 foreground:fgColor background:bgColor |
1159 foreground:fgColor background:bgColor |
1334 <resource: #obsolete> |
1160 <resource: #obsolete> |
1335 "set both internal foreground and internal background colors |
1161 "set both internal foreground and internal background colors |
1336 - these must be real colors. |
1162 - these must be real colors. |
1337 OBSOLETE: this method will vanish; use #paint: / #paint:on:" |
1163 OBSOLETE: this method will vanish; use #paint: / #paint:on:" |
1338 |
1164 |
1339 gc == self ifTrue:[ |
|
1340 super foreground:fgColor background:bgColor. |
|
1341 ^ self. |
|
1342 ]. |
|
1343 gc foreground:fgColor background:bgColor |
1165 gc foreground:fgColor background:bgColor |
1344 ! |
1166 ! |
1345 |
1167 |
1346 foreground:fgColor background:bgColor function:fun |
1168 foreground:fgColor background:bgColor function:fun |
1347 <resource: #obsolete> |
1169 <resource: #obsolete> |
1377 !GraphicsMedium methodsFor:'accessing-transformation'! |
1195 !GraphicsMedium methodsFor:'accessing-transformation'! |
1378 |
1196 |
1379 scale |
1197 scale |
1380 "return the scale factor (as point) of the transformation" |
1198 "return the scale factor (as point) of the transformation" |
1381 |
1199 |
1382 gc == self ifTrue:[ |
|
1383 ^ super scale. |
|
1384 ]. |
|
1385 ^ gc scale |
1200 ^ gc scale |
1386 ! |
1201 ! |
1387 |
1202 |
1388 scale:aPoint |
1203 scale:aPoint |
1389 "set the scale factor of the transformation" |
1204 "set the scale factor of the transformation" |
1390 |
1205 |
1391 gc == self ifTrue:[ |
|
1392 super scale:aPoint. |
|
1393 ^ self. |
|
1394 ]. |
|
1395 ^ gc scale:aPoint |
1206 ^ gc scale:aPoint |
1396 ! |
1207 ! |
1397 |
1208 |
1398 transformation |
1209 transformation |
1399 "return the transformation" |
1210 "return the transformation" |
1400 |
1211 |
1401 gc == self ifTrue:[ |
|
1402 ^ super transformation. |
|
1403 ]. |
|
1404 ^ gc transformation |
1212 ^ gc transformation |
1405 ! |
1213 ! |
1406 |
1214 |
1407 transformation:aTransformation |
1215 transformation:aTransformation |
1408 "set the transformation" |
1216 "set the transformation" |
1409 |
1217 |
1410 gc == self ifTrue:[ |
|
1411 super transformation:aTransformation. |
|
1412 ^ self. |
|
1413 ]. |
|
1414 ^ gc transformation:aTransformation |
1218 ^ gc transformation:aTransformation |
1415 ! |
1219 ! |
1416 |
1220 |
1417 translateBy:aPoint |
1221 translateBy:aPoint |
1418 "add to the translation offset of the transformation" |
1222 "add to the translation offset of the transformation" |
1419 |
1223 |
1420 gc == self ifTrue:[ |
|
1421 super translateBy:aPoint. |
|
1422 ^ self. |
|
1423 ]. |
|
1424 ^ gc translateBy:aPoint |
1224 ^ gc translateBy:aPoint |
1425 ! |
1225 ! |
1426 |
1226 |
1427 translation |
1227 translation |
1428 "return the translation factor (as point) of the transformation" |
1228 "return the translation factor (as point) of the transformation" |
1429 |
1229 |
1430 gc == self ifTrue:[ |
|
1431 ^ super translation. |
|
1432 ]. |
|
1433 ^ gc translation |
1230 ^ gc translation |
1434 ! |
1231 ! |
1435 |
1232 |
1436 translation:aPoint |
1233 translation:aPoint |
1437 "set the translation offset of the transformation" |
1234 "set the translation offset of the transformation" |
1438 |
1235 |
1439 gc == self ifTrue:[ |
|
1440 super translation:aPoint. |
|
1441 ^ self. |
|
1442 ]. |
|
1443 ^ gc translation:aPoint |
1236 ^ gc translation:aPoint |
1444 ! ! |
1237 ! ! |
1445 |
1238 |
1446 !GraphicsMedium methodsFor:'basic drawing'! |
1239 !GraphicsMedium methodsFor:'basic drawing'! |
1447 |
1240 |
1448 displayArcX:x y:y width:width height:height from:startAngle angle:angle |
1241 displayArcX:x y:y width:width height:height from:startAngle angle:angle |
1449 "draw an arc in a box |
1242 "draw an arc in a box |
1450 - this could be recoded to draw using displayLine" |
1243 - this could be recoded to draw using displayLine" |
1451 |
1244 |
1452 gc == self ifTrue:[ |
|
1453 super displayArcX:x y:y width:width height:height from:startAngle angle:angle. |
|
1454 ^ self. |
|
1455 ]. |
|
1456 gc displayArcX:x y:y width:width height:height from:startAngle angle:angle |
1245 gc displayArcX:x y:y width:width height:height from:startAngle angle:angle |
1457 ! |
1246 ! |
1458 |
1247 |
1459 displayDottedRectangleX:x y:y width:w height:h |
1248 displayDottedRectangleX:x y:y width:w height:h |
1460 "draw a dotted-line rectangle |
1249 "draw a dotted-line rectangle |
1461 A general implementation is found here; deviceGC's |
1250 A general implementation is found here; deviceGC's |
1462 may reimplement this if directly supported by the device" |
1251 may reimplement this if directly supported by the device" |
1463 |
1252 |
1464 gc == self ifTrue:[ |
|
1465 super displayDottedRectangleX:x y:y width:w height:h. |
|
1466 ^ self. |
|
1467 ]. |
|
1468 gc displayDottedRectangleX:x y:y width:w height:h |
1253 gc displayDottedRectangleX:x y:y width:w height:h |
1469 ! |
1254 ! |
1470 |
1255 |
1471 displayHorizontalWavelineFromX:x0 y:y0 toX:x1 |
1256 displayHorizontalWavelineFromX:x0 y:y0 toX:x1 |
1472 "draw a horizontal wave-line from x0/y0 to x1/y0" |
1257 "draw a horizontal wave-line from x0/y0 to x1/y0" |
1473 |
1258 |
1474 gc == self ifTrue:[ |
|
1475 super displayHorizontalWavelineFromX:x0 y:y0 toX:x1. |
|
1476 ^ self. |
|
1477 ]. |
|
1478 gc displayHorizontalWavelineFromX:x0 y:y0 toX:x1 |
1259 gc displayHorizontalWavelineFromX:x0 y:y0 toX:x1 |
1479 ! |
1260 ! |
1480 |
1261 |
1481 displayLineFromX:x0 y:y0 toX:x1 y:y1 |
1262 displayLineFromX:x0 y:y0 toX:x1 y:y1 |
1482 "draw a line from x0/y0 to x1/y1" |
1263 "draw a line from x0/y0 to x1/y1" |
1483 |
1264 |
1484 gc == self ifTrue:[ |
|
1485 super displayLineFromX:x0 y:y0 toX:x1 y:y1. |
|
1486 ^ self. |
|
1487 ]. |
|
1488 gc displayLineFromX:x0 y:y0 toX:x1 y:y1 |
1265 gc displayLineFromX:x0 y:y0 toX:x1 y:y1 |
1489 ! |
1266 ! |
1490 |
1267 |
1491 displayOpaqueForm:aForm x:x y:y |
1268 displayOpaqueForm:aForm x:x y:y |
1492 "draw a form at x/y; if the form has depth 1, 1's in the form are |
1269 "draw a form at x/y; if the form has depth 1, 1's in the form are |
1493 drawn in current fg, 0's in current bg color. |
1270 drawn in current fg, 0's in current bg color. |
1494 If the form has depth ~~ 1, it is copied as is onto the receiver" |
1271 If the form has depth ~~ 1, it is copied as is onto the receiver" |
1495 |
1272 |
1496 gc == self ifTrue:[ |
|
1497 super displayOpaqueForm:aForm x:x y:y. |
|
1498 ^ self. |
|
1499 ]. |
|
1500 gc displayOpaqueForm:aForm x:x y:y |
1273 gc displayOpaqueForm:aForm x:x y:y |
1501 ! |
1274 ! |
1502 |
1275 |
1503 displayOpaqueString:aString from:index1 to:index2 x:x y:y |
1276 displayOpaqueString:aString from:index1 to:index2 x:x y:y |
1504 "draw part of a string with both fg and bg at x/y in current font" |
1277 "draw part of a string with both fg and bg at x/y in current font" |
1505 |
1278 |
1506 gc == self ifTrue:[ |
|
1507 super displayString:aString from:index1 to:index2 x:x y:y opaque:true maxWidth:self width. |
|
1508 ^ self. |
|
1509 ]. |
|
1510 gc displayString:aString from:index1 to:index2 x:x y:y opaque:true maxWidth:self width |
1279 gc displayString:aString from:index1 to:index2 x:x y:y opaque:true maxWidth:self width |
1511 ! |
1280 ! |
1512 |
1281 |
1513 displayPolygon:aPolygon |
1282 displayPolygon:aPolygon |
1514 "draw a polygon |
1283 "draw a polygon |
1515 - this could be recoded to draw using displayLine" |
1284 - this could be recoded to draw using displayLine" |
1516 |
1285 |
1517 gc == self ifTrue:[ |
|
1518 super displayPolygon:aPolygon. |
|
1519 ^ self. |
|
1520 ]. |
|
1521 gc displayPolygon:aPolygon |
1286 gc displayPolygon:aPolygon |
1522 ! |
1287 ! |
1523 |
1288 |
1524 displayRectangleX:x y:y width:w height:h |
1289 displayRectangleX:x y:y width:w height:h |
1525 "draw a rectangle |
1290 "draw a rectangle |
1526 - this could be recoded to draw using displayLine" |
1291 - this could be recoded to draw using displayLine" |
1527 |
1292 |
1528 gc == self ifTrue:[ |
|
1529 super displayRectangleX:x y:y width:w height:h. |
|
1530 ^ self. |
|
1531 ]. |
|
1532 gc displayRectangleX:x y:y width:w height:h |
1293 gc displayRectangleX:x y:y width:w height:h |
1533 ! |
1294 ! |
1534 |
1295 |
1535 displayString:aString from:index1 to:index2 x:x y:y |
1296 displayString:aString from:index1 to:index2 x:x y:y |
1536 "draw part of a string with fg at x/y in current font" |
1297 "draw part of a string with fg at x/y in current font" |
1545 ! |
1306 ! |
1546 |
1307 |
1547 displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth |
1308 displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth |
1548 "draw part of a string with both fg and bg at x/y in current font" |
1309 "draw part of a string with both fg and bg at x/y in current font" |
1549 |
1310 |
1550 gc == self ifTrue:[ |
|
1551 super displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth. |
|
1552 ^ self. |
|
1553 ]. |
|
1554 gc displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth |
1311 gc displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth |
1555 ! ! |
1312 ! ! |
1556 |
1313 |
1557 !GraphicsMedium methodsFor:'basic filling'! |
1314 !GraphicsMedium methodsFor:'basic filling'! |
1558 |
1315 |
1559 fillArcX:x y:y width:w height:h from:start angle:angle |
1316 fillArcX:x y:y width:w height:h from:start angle:angle |
1560 "fill an arc with current paint color" |
1317 "fill an arc with current paint color" |
1561 |
1318 |
1562 gc == self ifTrue:[ |
|
1563 super fillArcX:x y:y width:w height:h from:start angle:angle. |
|
1564 ^ self. |
|
1565 ]. |
|
1566 gc fillArcX:x y:y width:w height:h from:start angle:angle |
1319 gc fillArcX:x y:y width:w height:h from:start angle:angle |
1567 ! |
1320 ! |
1568 |
1321 |
1569 fillPolygon:points |
1322 fillPolygon:points |
1570 "fill a polygon with current paint color" |
1323 "fill a polygon with current paint color" |
1571 |
1324 |
1572 gc == self ifTrue:[ |
|
1573 super fillPolygon:points. |
|
1574 ^ self. |
|
1575 ]. |
|
1576 gc fillPolygon:points |
1325 gc fillPolygon:points |
1577 ! |
1326 ! |
1578 |
1327 |
1579 fillRectangleX:x y:y width:w height:h |
1328 fillRectangleX:x y:y width:w height:h |
1580 "fill a rectangle with current paint color" |
1329 "fill a rectangle with current paint color" |
1581 |
1330 |
1582 gc == self ifTrue:[ |
|
1583 super fillRectangleX:x y:y width:w height:h. |
|
1584 ^ self. |
|
1585 ]. |
|
1586 gc fillRectangleX:x y:y width:w height:h |
1331 gc fillRectangleX:x y:y width:w height:h |
1587 ! |
1332 ! |
1588 |
1333 |
1589 fillRectangleX:x y:y width:w height:h color:aColor |
1334 fillRectangleX:x y:y width:w height:h color:aColor |
1590 "fill a rectangle with given color" |
1335 "fill a rectangle with given color" |
1591 |
1336 |
1592 gc == self ifTrue:[ |
|
1593 super fillRectangleX:x y:y width:w height:h color:aColor. |
|
1594 ^ self. |
|
1595 ]. |
|
1596 gc fillRectangleX:x y:y width:w height:h color:aColor |
1337 gc fillRectangleX:x y:y width:w height:h color:aColor |
1597 ! ! |
1338 ! ! |
1598 |
1339 |
1599 !GraphicsMedium methodsFor:'bit blitting'! |
1340 !GraphicsMedium methodsFor:'bit blitting'! |
1600 |
1341 |
1618 translated to allocated color indices on pseudoColor devices and padded as required. |
1355 translated to allocated color indices on pseudoColor devices and padded as required. |
1619 The byteOrder is MSB and will be converted as appropriate by the underlying devices |
1356 The byteOrder is MSB and will be converted as appropriate by the underlying devices |
1620 method to whatever the device needs. |
1357 method to whatever the device needs. |
1621 Assumes the source bits are in ST/X's natural padding (i.e. 8-bit padded)" |
1358 Assumes the source bits are in ST/X's natural padding (i.e. 8-bit padded)" |
1622 |
1359 |
1623 gc == self ifTrue:[ |
|
1624 super copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY. |
|
1625 ^ self. |
|
1626 ]. |
|
1627 gc copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY |
1360 gc copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY |
1628 ! |
1361 ! |
1629 |
1362 |
1630 copyFrom:aGC toX:dstX y:dstY |
1363 copyFrom:aGC toX:dstX y:dstY |
1631 "copy from a drawable - maybe self" |
1364 "copy from a drawable - maybe self" |
1632 |
1365 |
1633 gc == self ifTrue:[ |
|
1634 super copyFrom:aGC toX:dstX y:dstY. |
|
1635 ^ self. |
|
1636 ]. |
|
1637 gc copyFrom:aGC toX:dstX y:dstY |
1366 gc copyFrom:aGC toX:dstX y:dstY |
1638 ! |
1367 ! |
1639 |
1368 |
1640 copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1369 copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1641 "copy from a drawable - maybe self" |
1370 "copy from a drawable - maybe self" |
1642 |
1371 |
1643 gc == self ifTrue:[ |
|
1644 super copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h. |
|
1645 ^ self. |
|
1646 ]. |
|
1647 gc copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1372 gc copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1648 ! |
1373 ! |
1649 |
1374 |
1650 copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async |
1375 copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async |
1651 "copy from aDrawable into the receiver; |
1376 "copy from aDrawable into the receiver; |
1654 If the receiver is a view AND async is true, the call returns immediately |
1379 If the receiver is a view AND async is true, the call returns immediately |
1655 - otherwise, it returns when the scroll operation is finished. |
1380 - otherwise, it returns when the scroll operation is finished. |
1656 (not all devices care for this). |
1381 (not all devices care for this). |
1657 If the receiver is a pixmap, the call always returns immediately." |
1382 If the receiver is a pixmap, the call always returns immediately." |
1658 |
1383 |
1659 |myDevice deviceDrawable asy| |
1384 |deviceDrawable asy| |
1660 |
1385 |
1661 myDevice := gc graphicsDevice. |
1386 ((aDrawable graphicsDevice ~~ device) |
1662 |
|
1663 ((aDrawable graphicsDevice ~~ myDevice) |
|
1664 or:[aDrawable isImage]) ifTrue:[ |
1387 or:[aDrawable isImage]) ifTrue:[ |
1665 deviceDrawable := aDrawable asFormOn:myDevice. |
1388 deviceDrawable := aDrawable asFormOn:device. |
1666 ] ifFalse:[ |
1389 ] ifFalse:[ |
1667 deviceDrawable := aDrawable |
1390 deviceDrawable := aDrawable |
1668 ]. |
1391 ]. |
1669 asy := async or:[self isView not]. |
1392 asy := async or:[self isView not]. |
1670 asy ifFalse:[ |
1393 asy ifFalse:[ |
1671 self catchExpose |
1394 self catchExpose |
1672 ]. |
1395 ]. |
1673 gc == self ifTrue:[ |
1396 gc copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async. |
1674 super copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async. |
|
1675 ] ifFalse:[ |
|
1676 gc copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async. |
|
1677 ]. |
|
1678 asy ifFalse:[ |
1397 asy ifFalse:[ |
1679 myDevice flush. |
1398 device flush. |
1680 self waitForExpose |
1399 self waitForExpose |
1681 ] |
1400 ] |
1682 ! |
1401 ! |
1683 |
1402 |
1684 copyFrom:aGC x:dstX y:dstY width:w height:h |
1403 copyFrom:aGC x:dstX y:dstY width:w height:h |
1685 "copy from a drawable - maybe self" |
1404 "copy from a drawable - maybe self" |
1686 |
1405 |
1687 gc == self ifTrue:[ |
|
1688 super copyFrom:aGC x:dstX y:dstY width:w height:h. |
|
1689 ^ self. |
|
1690 ]. |
|
1691 gc copyFrom:aGC x:dstX y:dstY width:w height:h |
1406 gc copyFrom:aGC x:dstX y:dstY width:w height:h |
1692 ! |
1407 ! |
1693 |
1408 |
1694 copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1409 copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1695 "copy one plane from aDrawable into the receiver. 0's are drawn in |
1410 "copy one plane from aDrawable into the receiver. 0's are drawn in |
1696 background, while 1's are drawn with foreground color. |
1411 background, while 1's are drawn with foreground color. |
1697 The depth of aDrawable must (should) be 1. |
1412 The depth of aDrawable must (should) be 1. |
1698 The drawable must have been allocated on the same device. |
1413 The drawable must have been allocated on the same device. |
1699 All coordinates are in device coordinates." |
1414 All coordinates are in device coordinates." |
1700 |
1415 |
1701 gc == self ifTrue:[ |
|
1702 super copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h. |
|
1703 ^ self. |
|
1704 ]. |
|
1705 gc copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1416 gc copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h |
1706 ! ! |
1417 ! ! |
1707 |
1418 |
1708 !GraphicsMedium methodsFor:'copying'! |
1419 !GraphicsMedium methodsFor:'copying'! |
1709 |
1420 |
1873 displayImage:aFormOrImage |
1568 displayImage:aFormOrImage |
1874 "draw an image (or form). |
1569 "draw an image (or form). |
1875 Provided for ST-80 compatibilty; |
1570 Provided for ST-80 compatibilty; |
1876 in ST/X, images are also handled by #displayForm:" |
1571 in ST/X, images are also handled by #displayForm:" |
1877 |
1572 |
1878 gc == self ifTrue:[ |
|
1879 super displayForm:aFormOrImage x:0 y:0. |
|
1880 ^ self. |
|
1881 ]. |
|
1882 gc displayForm:aFormOrImage x:0 y:0 |
1573 gc displayForm:aFormOrImage x:0 y:0 |
1883 ! |
1574 ! |
1884 |
1575 |
1885 displayImage:aFormOrImage at:aPoint |
1576 displayImage:aFormOrImage at:aPoint |
1886 "draw an image (or form). |
1577 "draw an image (or form). |
1887 Provided for ST-80 compatibilty; |
1578 Provided for ST-80 compatibilty; |
1888 in ST/X, images are also handled by #displayForm:" |
1579 in ST/X, images are also handled by #displayForm:" |
1889 |
1580 |
1890 gc == self ifTrue:[ |
|
1891 super displayForm:aFormOrImage x:(aPoint x) y:(aPoint y). |
|
1892 ^ self. |
|
1893 ]. |
|
1894 gc displayForm:aFormOrImage x:(aPoint x) y:(aPoint y) |
1581 gc displayForm:aFormOrImage x:(aPoint x) y:(aPoint y) |
1895 |
1582 |
1896 "Modified: 24.4.1997 / 16:02:43 / cg" |
1583 "Modified: 24.4.1997 / 16:02:43 / cg" |
1897 ! |
1584 ! |
1898 |
1585 |
1899 displayImage:aFormOrImage x:x y:y |
1586 displayImage:aFormOrImage x:x y:y |
1900 "draw an image (or form). |
1587 "draw an image (or form). |
1901 Provided for ST-80 compatibilty; |
1588 Provided for ST-80 compatibilty; |
1902 in ST/X, images are also handled by #displayForm:" |
1589 in ST/X, images are also handled by #displayForm:" |
1903 |
1590 |
1904 gc == self ifTrue:[ |
|
1905 super displayForm:aFormOrImage x:x y:y. |
|
1906 ^ self. |
|
1907 ]. |
|
1908 gc displayForm:aFormOrImage x:x y:y |
1591 gc displayForm:aFormOrImage x:x y:y |
1909 |
1592 |
1910 "Created: 24.4.1997 / 16:03:03 / cg" |
1593 "Created: 24.4.1997 / 16:03:03 / cg" |
1911 ! |
1594 ! |
1912 |
1595 |
1913 displayLineFrom:point1 to:point2 |
1596 displayLineFrom:point1 to:point2 |
1914 "draw a line" |
1597 "draw a line" |
1915 |
1598 |
1916 gc == self ifTrue:[ |
|
1917 super displayLineFromX:(point1 x) y:(point1 y) |
|
1918 toX:(point2 x) y:(point2 y). |
|
1919 ^ self. |
|
1920 ]. |
|
1921 gc displayLineFromX:(point1 x) y:(point1 y) |
1599 gc displayLineFromX:(point1 x) y:(point1 y) |
1922 toX:(point2 x) y:(point2 y) |
1600 toX:(point2 x) y:(point2 y) |
1923 ! |
1601 ! |
1924 |
1602 |
1925 displayLineFromX:xStart y:yStart toX:xEnd y:yEnd brush:aForm |
1603 displayLineFromX:xStart y:yStart toX:xEnd y:yEnd brush:aForm |
1926 "draw a line using a brush. |
1604 "draw a line using a brush. |
1927 Here, a slow fallback is used, drawing into a |
1605 Here, a slow fallback is used, drawing into a |
2047 The angle is in degrees, clock-wise, starting with 0 for |
1717 The angle is in degrees, clock-wise, starting with 0 for |
2048 a horizontal draw. |
1718 a horizontal draw. |
2049 Drawing is done by first drawing the string into a temporary bitmap, |
1719 Drawing is done by first drawing the string into a temporary bitmap, |
2050 which is rotated and finally drawn as usual. |
1720 which is rotated and finally drawn as usual. |
2051 NOTICE: due to the rotation of the temporary bitmap, this is a slow |
1721 NOTICE: due to the rotation of the temporary bitmap, this is a slow |
2052 operation - not to be used with cillions of strings ..." |
1722 operation - not to be used with cillions of strings ..." |
2053 |
1723 |
2054 gc == self ifTrue:[ |
|
2055 super displayString:aString x:x y:y angle:drawAngle opaque:true. |
|
2056 ^ self. |
|
2057 ]. |
|
2058 gc displayString:aString x:x y:y angle:drawAngle opaque:true |
1724 gc displayString:aString x:x y:y angle:drawAngle opaque:true |
2059 |
1725 |
2060 " |
1726 " |
2061 |v| |
1727 |v| |
2062 |
1728 |
2063 v := View new. |
1729 v := View new. |
2064 v extent:300@200. |
1730 v extent:300@200. |
2065 v openAndWait. |
1731 v openAndWait. |
2066 0 to:360 by:45 do:[:a | |
1732 0 to:360 by:45 do:[:a | |
2067 v paint:Color black on:Color red. |
1733 v paint:Color black on:Color red. |
2068 v displayOpaqueString:'hello world' x:100 y:100 angle:a. |
1734 v displayOpaqueString:'hello world' x:100 y:100 angle:a. |
2069 ]. |
1735 ]. |
2070 " |
1736 " |
2071 |
1737 |
2072 "in contrast to non-opaque draw: |
1738 "in contrast to non-opaque draw: |
2073 |v| |
1739 |v| |
2074 |
1740 |
2075 v := View new. |
1741 v := View new. |
2076 v extent:300@200. |
1742 v extent:300@200. |
2077 v openAndWait. |
1743 v openAndWait. |
2078 0 to:360 by:45 do:[:a | |
1744 0 to:360 by:45 do:[:a | |
2079 v paint:Color black on:Color red. |
1745 v paint:Color black on:Color red. |
2080 v displayString:'hello world' x:100 y:100 angle:a. |
1746 v displayString:'hello world' x:100 y:100 angle:a. |
2081 ]. |
1747 ]. |
2082 " |
1748 " |
2083 |
1749 |
2084 "Modified: 23.4.1997 / 17:50:23 / cg" |
1750 "Modified: 23.4.1997 / 17:50:23 / cg" |
2085 ! |
1751 ! |
2086 |
1752 |
2087 displayPoint:aPoint |
1753 displayPoint:aPoint |
2088 "draw a pixel" |
1754 "draw a pixel" |
2089 |
1755 |
2090 gc == self ifTrue:[ |
|
2091 super displayPointX:(aPoint x) y:(aPoint y). |
|
2092 ^ self. |
|
2093 ]. |
|
2094 gc displayPointX:(aPoint x) y:(aPoint y) |
1756 gc displayPointX:(aPoint x) y:(aPoint y) |
2095 ! |
1757 ! |
2096 |
1758 |
2097 displayPointX:x y:y |
1759 displayPointX:x y:y |
2098 "draw a point (with current paint-color); apply transformation if nonNil" |
1760 "draw a point (with current paint-color); apply transformation if nonNil" |
2099 |
1761 |
2100 gc == self ifTrue:[ |
|
2101 super displayPointX:x y:y. |
|
2102 ^ self. |
|
2103 ]. |
|
2104 gc displayPointX:x y:y |
1762 gc displayPointX:x y:y |
2105 ! |
1763 ! |
2106 |
1764 |
2107 displayRectangle:aRectangle |
1765 displayRectangle:aRectangle |
2108 "draw a rectangle" |
1766 "draw a rectangle" |
2301 The angle is in degrees, clock-wise, starting with 0 for |
1959 The angle is in degrees, clock-wise, starting with 0 for |
2302 a horizontal draw. |
1960 a horizontal draw. |
2303 Drawing is done by first drawing the string into a temporary bitmap, |
1961 Drawing is done by first drawing the string into a temporary bitmap, |
2304 which is rotated and finally drawn as usual. |
1962 which is rotated and finally drawn as usual. |
2305 NOTICE: due to the rotation of the temporary bitmap, this is a slow |
1963 NOTICE: due to the rotation of the temporary bitmap, this is a slow |
2306 operation - not to be used with cillions of strings ... |
1964 operation - not to be used with cillions of strings ... |
2307 CAVEAT: if the string is not a real string (i.e. a LabelAndIcon), |
1965 CAVEAT: if the string is not a real string (i.e. a LabelAndIcon), |
2308 this can (currently) only be done opaque" |
1966 this can (currently) only be done opaque" |
2309 |
1967 |
2310 gc == self ifTrue:[ |
|
2311 super displayString:aString x:x y:y angle:drawAngle opaque:opaque. |
|
2312 ^ self. |
|
2313 ]. |
|
2314 gc displayString:aString x:x y:y angle:drawAngle opaque:opaque |
1968 gc displayString:aString x:x y:y angle:drawAngle opaque:opaque |
2315 ! |
1969 ! |
2316 |
1970 |
2317 displayUnscaledForm:formToDraw x:x y:y |
1971 displayUnscaledForm:formToDraw x:x y:y |
2318 "draw a form or image non opaque and unscaled; |
1972 "draw a form or image non opaque and unscaled; |
2341 current paint-color, 0 bits in background color. |
1991 current paint-color, 0 bits in background color. |
2342 If its a deep form (i.e. a pixmap) the current paint |
1992 If its a deep form (i.e. a pixmap) the current paint |
2343 settings are ignored and the form is drawn as-is (opaque). |
1993 settings are ignored and the form is drawn as-is (opaque). |
2344 The origins coordinate is transformed, but the image itself is unscaled." |
1994 The origins coordinate is transformed, but the image itself is unscaled." |
2345 |
1995 |
2346 gc == self ifTrue:[ |
|
2347 super displayUnscaledOpaqueForm:formToDraw x:x y:y. |
|
2348 ^ self. |
|
2349 ]. |
|
2350 gc displayUnscaledOpaqueForm:formToDraw x:x y:y |
1996 gc displayUnscaledOpaqueForm:formToDraw x:x y:y |
2351 ! |
1997 ! |
2352 |
1998 |
2353 displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y |
1999 displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y |
2354 "draw a substring at the transformed coordinate x/y but do not scale the font. |
2000 "draw a substring at the transformed coordinate x/y but do not scale the font. |
2355 Draw foreground pixels in paint-color, background pixels in bgPaint color." |
2001 Draw foreground pixels in paint-color, background pixels in bgPaint color." |
2356 |
2002 |
2357 gc == self ifTrue:[ |
|
2358 super displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y. |
|
2359 ^ self. |
|
2360 ]. |
|
2361 gc displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y |
2003 gc displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y |
2362 ! |
2004 ! |
2363 |
2005 |
2364 displayUnscaledOpaqueString:aString x:x y:y |
2006 displayUnscaledOpaqueString:aString x:x y:y |
2365 "draw a string at the transformed coordinate x/y but do not scale the font. |
2007 "draw a string at the transformed coordinate x/y but do not scale the font. |
2366 Draw foreground pixels in paint-color, background pixels in bgPaint color." |
2008 Draw foreground pixels in paint-color, background pixels in bgPaint color." |
2367 |
2009 |
2368 gc == self ifTrue:[ |
|
2369 super displayUnscaledOpaqueString:aString x:x y:y. |
|
2370 ^ self. |
|
2371 ]. |
|
2372 gc displayUnscaledOpaqueString:aString x:x y:y |
2010 gc displayUnscaledOpaqueString:aString x:x y:y |
2373 ! |
2011 ! |
2374 |
2012 |
2375 displayUnscaledString:aString from:index1 to:index2 x:x y:y |
2013 displayUnscaledString:aString from:index1 to:index2 x:x y:y |
2376 "draw a substring at the transformed coordinate x/y but do not scale the font. |
2014 "draw a substring at the transformed coordinate x/y but do not scale the font. |
2377 draw foreground-pixels only (in current paint-color), leaving background as-is." |
2015 draw foreground-pixels only (in current paint-color), leaving background as-is." |
2378 |
2016 |
2379 gc == self ifTrue:[ |
|
2380 super displayUnscaledString:aString from:index1 to:index2 x:x y:y. |
|
2381 ^ self. |
|
2382 ]. |
|
2383 gc displayUnscaledString:aString from:index1 to:index2 x:x y:y |
2017 gc displayUnscaledString:aString from:index1 to:index2 x:x y:y |
2384 ! |
2018 ! |
2385 |
2019 |
2386 displayUnscaledString:aString x:x y:y |
2020 displayUnscaledString:aString x:x y:y |
2387 "draw a string at the transformed coordinate x/y but do not scale the font. |
2021 "draw a string at the transformed coordinate x/y but do not scale the font. |
2388 draw foreground-pixels only (in current paint-color), leaving background as-is." |
2022 draw foreground-pixels only (in current paint-color), leaving background as-is." |
2389 |
2023 |
2390 gc == self ifTrue:[ |
|
2391 super displayUnscaledString:aString x:x y:y. |
|
2392 ^ self. |
|
2393 ]. |
|
2394 gc displayUnscaledString:aString x:x y:y |
2024 gc displayUnscaledString:aString x:x y:y |
2395 ! ! |
2025 ! ! |
2396 |
2026 |
2397 !GraphicsMedium methodsFor:'drawing in device coordinates'! |
2027 !GraphicsMedium methodsFor:'drawing in device coordinates'! |
2398 |
2028 |
2412 (by sending #on: to the color) before doing so. |
2042 (by sending #on: to the color) before doing so. |
2413 Using functions other than #copy only makes sense if you are |
2043 Using functions other than #copy only makes sense if you are |
2414 certain, that the colors are real colors (actually, only for |
2044 certain, that the colors are real colors (actually, only for |
2415 noColor or allColor)." |
2045 noColor or allColor)." |
2416 |
2046 |
2417 gc == self ifTrue:[ |
|
2418 super displayDeviceForm:aForm x:x y:y. |
|
2419 ^ self. |
|
2420 ]. |
|
2421 gc displayDeviceForm:aForm x:x y:y |
2047 gc displayDeviceForm:aForm x:x y:y |
2422 ! |
2048 ! |
2423 |
2049 |
2424 displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2 |
2050 displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2 |
2425 "draw a line in device coordinates" |
2051 "draw a line in device coordinates" |
2426 |
2052 |
2427 gc == self ifTrue:[ |
|
2428 super displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2429 ^ self. |
|
2430 ]. |
|
2431 gc displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2 |
2053 gc displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2 |
2432 ! |
2054 ! |
2433 |
2055 |
2434 displayDeviceOpaqueForm:aForm x:x y:y |
2056 displayDeviceOpaqueForm:aForm x:x y:y |
2435 "draw a form or image opaque (i.e. both fg and bg is drawn); |
2057 "draw a form or image opaque (i.e. both fg and bg is drawn); |
2471 ! |
2089 ! |
2472 |
2090 |
2473 displayDeviceRectangleX:x y:y width:w height:h |
2091 displayDeviceRectangleX:x y:y width:w height:h |
2474 "draw a rectangle in device coordinates" |
2092 "draw a rectangle in device coordinates" |
2475 |
2093 |
2476 gc == self ifTrue:[ |
|
2477 super displayDeviceRectangleX:x y:y width:w height:h. |
|
2478 ^ self. |
|
2479 ]. |
|
2480 gc displayDeviceRectangleX:x y:y width:w height:h |
2094 gc displayDeviceRectangleX:x y:y width:w height:h |
2481 ! |
2095 ! |
2482 |
2096 |
2483 displayDeviceString:aString from:index1 to:index2 in:font x:x y:y |
2097 displayDeviceString:aString from:index1 to:index2 in:font x:x y:y |
2484 "draw a substring at the coordinate x/y - |
2098 "draw a substring at the coordinate x/y - |
2485 draw foreground-pixels only (in current paint-color), leaving background as-is. |
2099 draw foreground-pixels only (in current paint-color), leaving background as-is. |
2486 No translation or scaling is done" |
2100 No translation or scaling is done" |
2487 |
2101 |
2488 gc == self ifTrue:[ |
|
2489 super displayDeviceString:aString from:index1 to:index2 in:font x:x y:y. |
|
2490 ^ self. |
|
2491 ]. |
|
2492 gc displayDeviceString:aString from:index1 to:index2 in:font x:x y:y |
2102 gc displayDeviceString:aString from:index1 to:index2 in:font x:x y:y |
2493 ! |
2103 ! |
2494 |
2104 |
2495 displayDeviceString:aString from:index1 to:index2 x:x y:y |
2105 displayDeviceString:aString from:index1 to:index2 x:x y:y |
2496 "draw a substring at the coordinate x/y - |
2106 "draw a substring at the coordinate x/y - |
2657 |
2263 |
2658 reverseDo:aBlock |
2264 reverseDo:aBlock |
2659 "evaluate aBlock with foreground and background interchanged. |
2265 "evaluate aBlock with foreground and background interchanged. |
2660 This can be reimplemented here in a faster way." |
2266 This can be reimplemented here in a faster way." |
2661 |
2267 |
2662 gc == self ifTrue:[ |
|
2663 super reverseDo:aBlock. |
|
2664 ^ self. |
|
2665 ]. |
|
2666 gc reverseDo:aBlock |
2268 gc reverseDo:aBlock |
2667 ! |
2269 ! |
2668 |
2270 |
2669 withBackground:fgColor do:aBlock |
2271 withBackground:fgColor do:aBlock |
2670 "evaluate aBlock with changed background." |
2272 "evaluate aBlock with changed background." |
2671 |
2273 |
2672 gc == self ifTrue:[ |
|
2673 super withBackground:fgColor do:aBlock. |
|
2674 ^ self. |
|
2675 ]. |
|
2676 gc withBackground:fgColor do:aBlock |
2274 gc withBackground:fgColor do:aBlock |
2677 ! |
2275 ! |
2678 |
2276 |
2679 withForeground:fgColor background:bgColor do:aBlock |
2277 withForeground:fgColor background:bgColor do:aBlock |
2680 "evaluate aBlock with changed foreground and background." |
2278 "evaluate aBlock with changed foreground and background." |
2681 |
2279 |
2682 gc == self ifTrue:[ |
|
2683 super withForeground:fgColor background:bgColor do:aBlock. |
|
2684 ^ self. |
|
2685 ]. |
|
2686 gc withForeground:fgColor background:bgColor do:aBlock |
2280 gc withForeground:fgColor background:bgColor do:aBlock |
2687 ! |
2281 ! |
2688 |
2282 |
2689 withForeground:fgColor background:bgColor function:aFunction do:aBlock |
2283 withForeground:fgColor background:bgColor function:aFunction do:aBlock |
2690 "evaluate aBlock with foreground, background and function" |
2284 "evaluate aBlock with foreground, background and function" |
2691 |
2285 |
2692 gc == self ifTrue:[ |
|
2693 super withForeground:fgColor background:bgColor function:aFunction do:aBlock. |
|
2694 ^ self. |
|
2695 ]. |
|
2696 gc withForeground:fgColor background:bgColor function:aFunction do:aBlock |
2286 gc withForeground:fgColor background:bgColor function:aFunction do:aBlock |
2697 ! |
2287 ! |
2698 |
2288 |
2699 withForeground:fgColor background:bgColor mask:aMask do:aBlock |
2289 withForeground:fgColor background:bgColor mask:aMask do:aBlock |
2700 "evaluate aBlock with foreground, background and mask" |
2290 "evaluate aBlock with foreground, background and mask" |
2701 |
2291 |
2702 gc == self ifTrue:[ |
|
2703 super withForeground:fgColor background:bgColor mask:aMask do:aBlock. |
|
2704 ^ self. |
|
2705 ]. |
|
2706 gc withForeground:fgColor background:bgColor mask:aMask do:aBlock |
2292 gc withForeground:fgColor background:bgColor mask:aMask do:aBlock |
2707 ! |
2293 ! |
2708 |
2294 |
2709 withForeground:fgColor do:aBlock |
2295 withForeground:fgColor do:aBlock |
2710 "evaluate aBlock with changed foreground." |
2296 "evaluate aBlock with changed foreground." |
2711 |
2297 |
2712 gc == self ifTrue:[ |
|
2713 super withForeground:fgColor do:aBlock. |
|
2714 ^ self. |
|
2715 ]. |
|
2716 gc withForeground:fgColor do:aBlock |
2298 gc withForeground:fgColor do:aBlock |
2717 ! |
2299 ! |
2718 |
2300 |
2719 withForeground:fgColor function:aFunction do:aBlock |
2301 withForeground:fgColor function:aFunction do:aBlock |
2720 "evaluate aBlock with changed foreground and function." |
2302 "evaluate aBlock with changed foreground and function." |
2721 |
2303 |
2722 gc == self ifTrue:[ |
|
2723 super withForeground:fgColor function:aFunction do:aBlock. |
|
2724 ^ self. |
|
2725 ]. |
|
2726 gc withForeground:fgColor function:aFunction do:aBlock |
2304 gc withForeground:fgColor function:aFunction do:aBlock |
2727 ! |
2305 ! |
2728 |
2306 |
2729 xoring:aBlock |
2307 xoring:aBlock |
2730 "evaluate aBlock with function xoring" |
2308 "evaluate aBlock with function xoring" |
2731 |
2309 |
2732 gc == self ifTrue:[ |
|
2733 super xoring:aBlock. |
|
2734 ^ self. |
|
2735 ]. |
|
2736 gc xoring:aBlock |
2310 gc xoring:aBlock |
2737 ! ! |
2311 ! ! |
2738 |
2312 |
2739 !GraphicsMedium methodsFor:'filling'! |
2313 !GraphicsMedium methodsFor:'filling'! |
2740 |
2314 |
3113 ! |
2672 ! |
3114 |
2673 |
3115 flush |
2674 flush |
3116 "send all buffered drawing to the device." |
2675 "send all buffered drawing to the device." |
3117 |
2676 |
3118 gc == self ifTrue:[ |
|
3119 super flush. |
|
3120 ^ self. |
|
3121 ]. |
|
3122 gc flush |
2677 gc flush |
3123 ! |
2678 ! |
3124 |
2679 |
3125 setDevice:aDevice id:aDrawbleId gcId:aGCId |
2680 setDevice:aDevice id:aDrawbleId gcId:aGCId |
3126 "private" |
2681 "private" |
3127 |
2682 |
3128 gc == self ifTrue:[ |
|
3129 super setDevice:aDevice id:aDrawbleId gcId:aGCId. |
|
3130 ^ self. |
|
3131 ]. |
|
3132 gc notNil ifTrue:[ |
2683 gc notNil ifTrue:[ |
3133 gc setDevice:aDevice id:aDrawbleId gcId:aGCId |
2684 gc setDevice:aDevice id:aDrawbleId gcId:aGCId |
3134 ]. |
2685 ]. |
3135 ! |
2686 ! |
3136 |
2687 |
3137 setId:aDrawableId |
2688 setId:aDrawableId |
3138 "private" |
2689 "private" |
3139 |
2690 |
3140 gc == self ifTrue:[ |
|
3141 super setId:aDrawableId. |
|
3142 ^ self. |
|
3143 ]. |
|
3144 gc setId:aDrawableId |
2691 gc setId:aDrawableId |
3145 ! |
2692 ! |
3146 |
2693 |
3147 setPaint:fgColor on:bgColor |
2694 setPaint:fgColor on:bgColor |
3148 "set the paint and background-paint color. |
2695 "set the paint and background-paint color. |
3149 The bg-paint is used in opaque-draw operations. |
2696 The bg-paint is used in opaque-draw operations. |
3150 Only set the variables, but do not send it to the device, |
2697 Only set the variables, but do not send it to the device, |
3151 Used on initialization." |
2698 Used on initialization." |
3152 |
2699 |
3153 gc == self ifTrue:[ |
|
3154 super setPaint:fgColor on:bgColor. |
|
3155 ^ self. |
|
3156 ]. |
|
3157 gc setPaint:fgColor on:bgColor |
2700 gc setPaint:fgColor on:bgColor |
3158 ! |
2701 ! |
3159 |
2702 |
3160 sync |
2703 sync |
3161 "send all buffered drawing to the device and wait until the device responds" |
2704 "send all buffered drawing to the device and wait until the device responds" |
3162 |
2705 |
3163 gc == self ifTrue:[ |
|
3164 super sync. |
|
3165 ^ self. |
|
3166 ]. |
|
3167 gc sync |
2706 gc sync |
3168 ! ! |
2707 ! ! |
3169 |
2708 |
3170 !GraphicsMedium methodsFor:'printing & storing'! |
2709 !GraphicsMedium methodsFor:'printing & storing'! |
3171 |
2710 |
3254 !GraphicsMedium methodsFor:'view creation'! |
2781 !GraphicsMedium methodsFor:'view creation'! |
3255 |
2782 |
3256 createBitmapFromArray:data width:width height:height |
2783 createBitmapFromArray:data width:width height:height |
3257 "create a bitmap from data and set the drawableId" |
2784 "create a bitmap from data and set the drawableId" |
3258 |
2785 |
3259 gc == self ifTrue:[ |
|
3260 super createBitmapFromArray:data width:width height:height. |
|
3261 ^ self. |
|
3262 ]. |
|
3263 gc createBitmapFromArray:data width:width height:height |
2786 gc createBitmapFromArray:data width:width height:height |
3264 ! |
2787 ! |
3265 |
2788 |
3266 createPixmapWidth:w height:h depth:d |
2789 createPixmapWidth:w height:h depth:d |
3267 "create a pixmap and set the drawableId" |
2790 "create a pixmap and set the drawableId" |
3268 |
2791 |
3269 gc == self ifTrue:[ |
|
3270 super createPixmapWidth:w height:h depth:d. |
|
3271 ^ self. |
|
3272 ]. |
|
3273 gc createPixmapWidth:w height:h depth:d |
2792 gc createPixmapWidth:w height:h depth:d |
3274 ! |
2793 ! |
3275 |
2794 |
3276 createRootWindow |
2795 createRootWindow |
3277 gc == self ifTrue:[ |
|
3278 super createRootWindowFor:self. |
|
3279 ^ self. |
|
3280 ]. |
|
3281 gc createRootWindowFor:self |
2796 gc createRootWindowFor:self |
3282 ! |
2797 ! |
3283 |
2798 |
3284 createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV |
2799 createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV |
3285 "create a window and set the drawableId" |
2800 "create a window and set the drawableId" |
3286 |
2801 |
3287 gc == self ifTrue:[ |
|
3288 super createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV. |
|
3289 ^ self. |
|
3290 ]. |
|
3291 gc createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV |
2802 gc createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV |
3292 ! ! |
2803 ! ! |
3293 |
2804 |
3294 !GraphicsMedium class methodsFor:'documentation'! |
2805 !GraphicsMedium class methodsFor:'documentation'! |
3295 |
2806 |