1094 getLogicalPixelSizeY |
1094 getLogicalPixelSizeY |
1095 ^ printerInfo printQuality ? 600 |
1095 ^ printerInfo printQuality ? 600 |
1096 ! |
1096 ! |
1097 |
1097 |
1098 numberOfColorBitsPerPixel |
1098 numberOfColorBitsPerPixel |
1099 ^ OperatingSystem getDeviceCaps:gcId index:12 "Bitspixel" |
1099 ^ OperatingSystem getDeviceCaps:self gcId index:12 "Bitspixel" |
1100 |
1100 |
1101 "Created: / 03-08-2006 / 09:58:18 / fm" |
1101 "Created: / 03-08-2006 / 09:58:18 / fm" |
1102 "Modified: / 10-10-2006 / 18:15:40 / cg" |
1102 "Modified: / 10-10-2006 / 18:15:40 / cg" |
1103 ! |
1103 ! |
1104 |
1104 |
1105 physicalOffsetX |
1105 physicalOffsetX |
1106 ^ OperatingSystem getDeviceCaps:gcId index:112 "PhysicalOffsetX" |
1106 ^ OperatingSystem getDeviceCaps:self gcId index:112 "PhysicalOffsetX" |
1107 |
1107 |
1108 "Created: / 01-08-2006 / 16:28:34 / fm" |
1108 "Created: / 01-08-2006 / 16:28:34 / fm" |
1109 "Modified: / 16-04-2007 / 12:52:06 / cg" |
1109 "Modified: / 16-04-2007 / 12:52:06 / cg" |
1110 ! |
1110 ! |
1111 |
1111 |
1112 physicalOffsetY |
1112 physicalOffsetY |
1113 ^ OperatingSystem getDeviceCaps:gcId index:113 "PhysicalOffsetY" |
1113 ^ OperatingSystem getDeviceCaps:self gcId index:113 "PhysicalOffsetY" |
1114 |
1114 |
1115 "Created: / 01-08-2006 / 16:28:34 / fm" |
1115 "Created: / 01-08-2006 / 16:28:34 / fm" |
1116 "Modified: / 16-04-2007 / 12:52:01 / cg" |
1116 "Modified: / 16-04-2007 / 12:52:01 / cg" |
1117 ! |
1117 ! |
1118 |
1118 |
1119 pixelsPerInchOfScreenHeight |
1119 pixelsPerInchOfScreenHeight |
1120 ^ OperatingSystem getDeviceCaps:gcId index:90 "Logpixelsy" |
1120 ^ OperatingSystem getDeviceCaps:self gcId index:90 "Logpixelsy" |
1121 |
1121 |
1122 "Created: / 01-08-2006 / 16:29:16 / fm" |
1122 "Created: / 01-08-2006 / 16:29:16 / fm" |
1123 ! |
1123 ! |
1124 |
1124 |
1125 pixelsPerInchOfScreenWidth |
1125 pixelsPerInchOfScreenWidth |
1126 ^ OperatingSystem getDeviceCaps:gcId index:88 "Logpixelsx" |
1126 ^ OperatingSystem getDeviceCaps:self gcId index:88 "Logpixelsx" |
1127 |
1127 |
1128 "Created: / 01-08-2006 / 16:28:34 / fm" |
1128 "Created: / 01-08-2006 / 16:28:34 / fm" |
1129 ! |
1129 ! |
1130 |
1130 |
1131 printerHeightArea |
1131 printerHeightArea |
1132 ^ (OperatingSystem getDeviceCaps:gcId index:10) |
1132 ^ (OperatingSystem getDeviceCaps:self gcId index:10) |
1133 |
1133 |
1134 "Modified: / 10-10-2006 / 18:18:31 / cg" |
1134 "Modified: / 10-10-2006 / 18:18:31 / cg" |
1135 ! |
1135 ! |
1136 |
1136 |
1137 printerPhysicalHeight |
1137 printerPhysicalHeight |
1138 ^ OperatingSystem getDeviceCaps:gcId "deviceContext" index:111 "PhysicalHeight" |
1138 ^ OperatingSystem getDeviceCaps:self gcId "deviceContext" index:111 "PhysicalHeight" |
1139 |
1139 |
1140 "Created: / 01-08-2006 / 16:14:08 / fm" |
1140 "Created: / 01-08-2006 / 16:14:08 / fm" |
1141 ! |
1141 ! |
1142 |
1142 |
1143 printerPhysicalWidth |
1143 printerPhysicalWidth |
1144 ^ OperatingSystem getDeviceCaps:gcId "deviceContext" index:110 "PhysicalWidth" |
1144 ^ OperatingSystem getDeviceCaps:self gcId "deviceContext" index:110 "PhysicalWidth" |
1145 |
1145 |
1146 "Created: / 01-08-2006 / 16:14:08 / fm" |
1146 "Created: / 01-08-2006 / 16:14:08 / fm" |
1147 ! |
1147 ! |
1148 |
1148 |
1149 printerWidthArea |
1149 printerWidthArea |
1150 ^ OperatingSystem getDeviceCaps:gcId "deviceContext" index:8 "Horzres" |
1150 ^ OperatingSystem getDeviceCaps:self gcId "deviceContext" index:8 "Horzres" |
1151 |
1151 |
1152 "Created: / 01-08-2006 / 16:14:08 / fm" |
1152 "Created: / 01-08-2006 / 16:14:08 / fm" |
1153 ! |
1153 ! |
1154 |
1154 |
1155 supportedImageFormats |
1155 supportedImageFormats |
1322 !WinPrinterContext methodsFor:'context stuff'! |
1322 !WinPrinterContext methodsFor:'context stuff'! |
1323 |
1323 |
1324 getPenFor:aDC |
1324 getPenFor:aDC |
1325 "set line attributes" |
1325 "set line attributes" |
1326 |
1326 |
|
1327 | lineWidthObj lineStyleObj capStyleObj joinStyleObj | |
|
1328 |
|
1329 lineWidthObj := self lineWidth. |
|
1330 lineStyleObj := self lineStyle. |
|
1331 capStyleObj := self capStyle. |
|
1332 joinStyleObj := self joinStyle. |
|
1333 |
1327 %{ /* NOCONTEXT */ |
1334 %{ /* NOCONTEXT */ |
1328 |
1335 |
1329 if (__isExternalAddressLike(aDC) |
1336 if (__isExternalAddressLike(aDC) |
1330 && __isSmallInteger(__INST(lineWidth))) { |
1337 && __isSmallInteger(lineWidthObj)) { |
1331 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1338 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1332 COLORREF fgColor; |
1339 COLORREF fgColor; |
1333 HANDLE hPen, prevPen; |
1340 HANDLE hPen, prevPen; |
1334 int lineStyleInt, capStyleInt, joinStyleInt, lineWidth; |
1341 int lineStyleInt, capStyleInt, joinStyleInt, lineWidth; |
1335 |
1342 |
1336 lineWidth= __intVal(__INST(lineWidth)); |
1343 lineWidth= __intVal(lineWidthObj); |
1337 |
1344 |
1338 if (__INST(lineStyle) == @symbol(solid)) { |
1345 if (lineStyleObj == @symbol(solid)) { |
1339 lineStyleInt= PS_SOLID; |
1346 lineStyleInt= PS_SOLID; |
1340 } else if (__INST(lineStyle) == @symbol(dashed)) { |
1347 } else if (lineStyleObj == @symbol(dashed)) { |
1341 lineStyleInt= PS_DASH; |
1348 lineStyleInt= PS_DASH; |
1342 } else if (__INST(lineStyle) == @symbol(dotted)) { |
1349 } else if (lineStyleObj == @symbol(dotted)) { |
1343 lineStyleInt= PS_DOT; |
1350 lineStyleInt= PS_DOT; |
1344 } else if (__INST(lineStyle) == @symbol(dashDot)) { |
1351 } else if (lineStyleObj == @symbol(dashDot)) { |
1345 lineStyleInt= PS_DASHDOT; |
1352 lineStyleInt= PS_DASHDOT; |
1346 } else if (__INST(lineStyle) == @symbol(dashDotDot)) { |
1353 } else if (lineStyleObj == @symbol(dashDotDot)) { |
1347 lineStyleInt= PS_DASHDOTDOT; |
1354 lineStyleInt= PS_DASHDOTDOT; |
1348 } else |
1355 } else |
1349 lineStyleInt= PS_SOLID; |
1356 lineStyleInt= PS_SOLID; |
1350 |
1357 |
1351 if (__INST(capStyle) == @symbol(round)) { |
1358 if (capStyleObj == @symbol(round)) { |
1352 capStyleInt= PS_ENDCAP_ROUND; |
1359 capStyleInt= PS_ENDCAP_ROUND; |
1353 } else if (__INST(capStyle) == @symbol(square)) { |
1360 } else if (capStyleObj == @symbol(square)) { |
1354 capStyleInt= PS_ENDCAP_SQUARE; |
1361 capStyleInt= PS_ENDCAP_SQUARE; |
1355 } else if (__INST(capStyle) == @symbol(flat)) { |
1362 } else if (capStyleObj == @symbol(flat)) { |
1356 capStyleInt= PS_ENDCAP_FLAT; |
1363 capStyleInt= PS_ENDCAP_FLAT; |
1357 } else |
1364 } else |
1358 capStyleInt= PS_ENDCAP_FLAT; |
1365 capStyleInt= PS_ENDCAP_FLAT; |
1359 |
1366 |
1360 if (__INST(joinStyle) == @symbol(bevel)) { |
1367 if (joinStyleObj == @symbol(bevel)) { |
1361 joinStyleInt= PS_JOIN_BEVEL; |
1368 joinStyleInt= PS_JOIN_BEVEL; |
1362 } else if (__INST(joinStyle) == @symbol(miter)) { |
1369 } else if (joinStyleObj== @symbol(miter)) { |
1363 joinStyleInt= PS_JOIN_MITER; |
1370 joinStyleInt= PS_JOIN_MITER; |
1364 } else if (__INST(joinStyle) == @symbol(round)) { |
1371 } else if (joinStyleObj == @symbol(round)) { |
1365 joinStyleInt= PS_JOIN_ROUND; |
1372 joinStyleInt= PS_JOIN_ROUND; |
1366 } else |
1373 } else |
1367 joinStyleInt= PS_JOIN_MITER; |
1374 joinStyleInt= PS_JOIN_MITER; |
1368 |
1375 |
1369 |
1376 |
1380 ! |
1387 ! |
1381 |
1388 |
1382 getPenForContext |
1389 getPenForContext |
1383 "set line attributes" |
1390 "set line attributes" |
1384 |
1391 |
|
1392 | gcId lineWidthObj lineStyleObj capStyleObj joinStyleObj | |
|
1393 |
|
1394 gcId := self gcId. |
|
1395 lineWidthObj := self lineWidth. |
|
1396 lineStyleObj := self lineStyle. |
|
1397 capStyleObj := self capStyle. |
|
1398 joinStyleObj := self joinStyle. |
|
1399 |
1385 %{ /* NOCONTEXT */ |
1400 %{ /* NOCONTEXT */ |
1386 |
1401 |
1387 if (__isExternalAddressLike(__INST(gcId)) |
1402 if (__isExternalAddressLike(gcId) |
1388 && __isSmallInteger(__INST(lineWidth))) { |
1403 && __isSmallInteger(lineWidthObj) ) { |
1389 HANDLE hDC = (HANDLE)(__externalAddressVal(__INST(gcId))); |
1404 HANDLE hDC = (HANDLE)(__externalAddressVal(gcId)); |
1390 COLORREF fgColor; |
1405 COLORREF fgColor; |
1391 HANDLE hPen; |
1406 HANDLE hPen; |
1392 int lineStyleInt, capStyleInt, joinStyleInt, lineWidth; |
1407 int lineStyleInt, capStyleInt, joinStyleInt, lineWidth; |
1393 |
1408 |
1394 lineWidth= __INST(lineWidth); |
1409 lineWidth= lineWidthObj; |
1395 |
1410 |
1396 if (__INST(lineStyle) == @symbol(solid)) { |
1411 if (lineStyleObj == @symbol(solid)) { |
1397 lineStyleInt= PS_SOLID; |
1412 lineStyleInt= PS_SOLID; |
1398 } else if (__INST(lineStyle) == @symbol(dashed)) { |
1413 } else if (lineStyleObj == @symbol(dashed)) { |
1399 lineStyleInt= PS_DASH; |
1414 lineStyleInt= PS_DASH; |
1400 } else if (__INST(lineStyle) == @symbol(dotted)) { |
1415 } else if (lineStyleObj == @symbol(dotted)) { |
1401 lineStyleInt= PS_DOT; |
1416 lineStyleInt= PS_DOT; |
1402 } else if (__INST(lineStyle) == @symbol(dashDot)) { |
1417 } else if (lineStyleObj == @symbol(dashDot)) { |
1403 lineStyleInt= PS_DASHDOT; |
1418 lineStyleInt= PS_DASHDOT; |
1404 } else if (__INST(lineStyle) == @symbol(dashDotDot)) { |
1419 } else if (lineStyleObj == @symbol(dashDotDot)) { |
1405 lineStyleInt= PS_DASHDOTDOT; |
1420 lineStyleInt= PS_DASHDOTDOT; |
1406 } else |
1421 } else |
1407 lineStyleInt= PS_SOLID; |
1422 lineStyleInt= PS_SOLID; |
1408 |
1423 |
1409 if (__INST(capStyle) == @symbol(round)) { |
1424 if (capStyleObj == @symbol(round)) { |
1410 capStyleInt= PS_ENDCAP_ROUND; |
1425 capStyleInt= PS_ENDCAP_ROUND; |
1411 } else if (__INST(capStyle) == @symbol(square)) { |
1426 } else if (capStyleObj == @symbol(square)) { |
1412 capStyleInt= PS_ENDCAP_SQUARE; |
1427 capStyleInt= PS_ENDCAP_SQUARE; |
1413 } else if (__INST(capStyle) == @symbol(flat)) { |
1428 } else if (capStyleObj == @symbol(flat)) { |
1414 capStyleInt= PS_ENDCAP_FLAT; |
1429 capStyleInt= PS_ENDCAP_FLAT; |
1415 } else |
1430 } else |
1416 capStyleInt= PS_ENDCAP_FLAT; |
1431 capStyleInt= PS_ENDCAP_FLAT; |
1417 |
1432 |
1418 if (__INST(joinStyle) == @symbol(bevel)) { |
1433 if (joinStyleObj == @symbol(bevel)) { |
1419 joinStyleInt= PS_JOIN_BEVEL; |
1434 joinStyleInt= PS_JOIN_BEVEL; |
1420 } else if (__INST(joinStyle) == @symbol(miter)) { |
1435 } else if (joinStyleObj == @symbol(miter)) { |
1421 joinStyleInt= PS_JOIN_MITER; |
1436 joinStyleInt= PS_JOIN_MITER; |
1422 } else if (__INST(joinStyle) == @symbol(round)) { |
1437 } else if (joinStyleObj== @symbol(round)) { |
1423 joinStyleInt= PS_JOIN_ROUND; |
1438 joinStyleInt= PS_JOIN_ROUND; |
1424 } else |
1439 } else |
1425 joinStyleInt= PS_JOIN_MITER; |
1440 joinStyleInt= PS_JOIN_MITER; |
1426 |
1441 |
1427 |
1442 |
1663 |
1678 |
1664 displayArcX:x y:y width:width height:height from:startAngle angle:angle in:ignoredDrawableId with:aDC |
1679 displayArcX:x y:y width:width height:height from:startAngle angle:angle in:ignoredDrawableId with:aDC |
1665 "draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
1680 "draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
1666 The angles may be floats or integer - they are given in degrees." |
1681 The angles may be floats or integer - they are given in degrees." |
1667 |
1682 |
|
1683 | lineWidthObj lineStyleObj | |
|
1684 |
|
1685 lineWidthObj := self lineWidth. |
|
1686 lineStyleObj := self lineStyle. |
1668 %{ |
1687 %{ |
1669 int __x, __y, w, h; |
1688 int __x, __y, w, h; |
1670 float angle1, angle2; |
1689 float angle1, angle2; |
1671 double f; |
1690 double f; |
1672 |
1691 |
1781 ! |
1800 ! |
1782 |
1801 |
1783 displayLineFromX:x0 y:y0 toX:x1 y:y1 in:ignoredDrawableId with:aDC |
1802 displayLineFromX:x0 y:y0 toX:x1 y:y1 in:ignoredDrawableId with:aDC |
1784 "draw a line. If the coordinates are not integers, an error is triggered." |
1803 "draw a line. If the coordinates are not integers, an error is triggered." |
1785 |
1804 |
1786 %{ /* NOCONTEXT */ |
1805 | lineWidthObj lineStyleObj | |
|
1806 |
|
1807 lineWidthObj := self lineWidth. |
|
1808 lineStyleObj := self lineStyle. |
|
1809 |
|
1810 %{ |
1787 if (__isExternalAddressLike(aDC) |
1811 if (__isExternalAddressLike(aDC) |
1788 && __bothSmallInteger(x0, y0) |
1812 && __bothSmallInteger(x0, y0) |
1789 && __bothSmallInteger(x1, y1)) { |
1813 && __bothSmallInteger(x1, y1)) { |
1790 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1814 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1791 COLORREF fgColor; |
1815 COLORREF fgColor; |
1798 /* DPRINTF(("displayLine: %d/%d -> %d/%d\n", |
1822 /* DPRINTF(("displayLine: %d/%d -> %d/%d\n", |
1799 __intVal(x0), __intVal(y0), |
1823 __intVal(x0), __intVal(y0), |
1800 __x1, __y1)); |
1824 __x1, __y1)); |
1801 */ |
1825 */ |
1802 |
1826 |
1803 lw= __intVal(__INST(lineWidth)); |
1827 lw= __intVal(lineWidthObj); |
1804 lStyleSymbol= __INST(lineStyle); |
1828 lStyleSymbol= lineStyleObj; |
1805 |
1829 |
1806 /* PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT |
1830 /* PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT |
1807 only works with lineWidth = 1 */ |
1831 only works with lineWidth = 1 */ |
1808 |
1832 |
1809 if (lStyleSymbol == @symbol(solid)) { |
1833 if (lStyleSymbol == @symbol(solid)) { |
1862 displayPolygon:aPolygon in:aDrawableId with:aDC |
1886 displayPolygon:aPolygon in:aDrawableId with:aDC |
1863 "draw a polygon, the argument aPolygon is a Collection of individual points, |
1887 "draw a polygon, the argument aPolygon is a Collection of individual points, |
1864 which define the polygon. |
1888 which define the polygon. |
1865 If any coordinate is not integer, an error is triggered." |
1889 If any coordinate is not integer, an error is triggered." |
1866 |
1890 |
1867 |numberOfPoints| |
1891 | numberOfPoints lineWidthObj lineStyleObj | |
|
1892 |
|
1893 lineWidthObj := self lineWidth. |
|
1894 lineStyleObj := self lineStyle. |
1868 |
1895 |
1869 numberOfPoints := aPolygon size. |
1896 numberOfPoints := aPolygon size. |
1870 %{ |
1897 %{ |
1871 OBJ point, px, py; |
1898 OBJ point, px, py; |
1872 int i, num; |
1899 int i, num; |
1955 "Created: / 07-08-2006 / 14:46:55 / fm" |
1982 "Created: / 07-08-2006 / 14:46:55 / fm" |
1956 ! |
1983 ! |
1957 |
1984 |
1958 displayPolylines:arrayOfPoints |
1985 displayPolylines:arrayOfPoints |
1959 |
1986 |
1960 device displayPolylines:arrayOfPoints in:nil with:gcId |
1987 self device displayPolylines:arrayOfPoints in:nil with:self gcId |
1961 ! |
1988 ! |
1962 |
1989 |
1963 displayPolylines:aPolyline in:ignoredDrawableId with:aDC |
1990 displayPolylines:aPolyline in:ignoredDrawableId with:aDC |
1964 "draw a polyline, the argument aPolyline is a collection of individual points, |
1991 "draw a polyline, the argument aPolyline is a collection of individual points, |
1965 which define the lines (p1/p2 pairs); must be even in size. |
1992 which define the lines (p1/p2 pairs); must be even in size. |
1966 If any coordinate is not integer, an error is triggered." |
1993 If any coordinate is not integer, an error is triggered." |
1967 |
1994 |
1968 |numberOfPoints| |
1995 |numberOfPoints lineWidthObj lineStyleObj capStyleObj joinStyleObj | |
1969 |
1996 |
1970 numberOfPoints := aPolyline size. |
1997 numberOfPoints := aPolyline size. |
1971 |
1998 |
|
1999 lineWidthObj := self lineWidth. |
|
2000 lineStyleObj := self lineStyle. |
|
2001 |
1972 %{ |
2002 %{ |
1973 OBJ point, px, py; |
2003 OBJ point, px, py; |
1974 int i, num; |
2004 int i, num; |
1975 |
2005 |
1976 if (__isExternalAddressLike(aDC) |
2006 if (__isExternalAddressLike(aDC) |
2754 (aString isString not |
2790 (aString isString not |
2755 or:[aString isText]) ifTrue:[ |
2791 or:[aString isText]) ifTrue:[ |
2756 ^ aString displayOn:self x:x y:y |
2792 ^ aString displayOn:self x:x y:y |
2757 ]. |
2793 ]. |
2758 |
2794 |
2759 gcId isNil ifTrue:[ |
2795 self gcId isNil ifTrue:[ |
2760 self initGC |
2796 self initGC |
2761 ]. |
2797 ]. |
2762 |
2798 |
2763 fontUsed := font. |
2799 fontUsed := self font. |
2764 transformation notNil ifTrue:[ |
2800 self transformation notNil ifTrue:[ |
2765 pX := transformation applyToX:x. |
2801 pX := self transformation applyToX:x. |
2766 pY := transformation applyToY:y. |
2802 pY := self transformation applyToY:y. |
2767 transformation noScale ifFalse:[ |
2803 self transformation noScale ifFalse:[ |
2768 sz := font size. |
2804 sz := self font size. |
2769 sz isNil ifTrue:[ |
2805 sz isNil ifTrue:[ |
2770 "/ oops - not a real font; use original font |
2806 "/ oops - not a real font; use original font |
2771 fontUsed := font |
2807 fontUsed := self font. |
2772 ] ifFalse:[ |yS| |
2808 ] ifFalse:[ |yS| |
2773 yS := self pixelsPerInchOfScreenHeight / Screen current verticalPixelPerInch. |
2809 yS := self pixelsPerInchOfScreenHeight / Screen current verticalPixelPerInch. |
2774 yS := self scale y / yS. |
2810 yS := self scale y / yS. |
2775 fontUsed := font size:(sz * yS) rounded. |
2811 fontUsed := self font size:(sz * yS) rounded. |
2776 ] |
2812 ] |
2777 ] |
2813 ] |
2778 ] ifFalse:[ |
2814 ] ifFalse:[ |
2779 pX := x. |
2815 pX := x. |
2780 pY := y. |
2816 pY := y. |
2781 ]. |
2817 ]. |
2782 pX := pX rounded. |
2818 pX := pX rounded. |
2783 pY := pY rounded. |
2819 pY := pY rounded. |
2784 |
2820 |
2785 s := aString. |
2821 s := aString. |
2786 fontUsed := fontUsed onDevice:device. |
2822 fontUsed := fontUsed onDevice:self device. |
2787 fontsEncoding := fontUsed encoding. |
2823 fontsEncoding := fontUsed encoding. |
2788 (characterEncoding ~~ fontsEncoding) ifTrue:[ |
2824 (self characterEncoding ~~ fontsEncoding) ifTrue:[ |
2789 [ |
2825 [ |
2790 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
2826 s := CharacterEncoder encodeString:s from:self characterEncoding into:fontsEncoding. |
2791 ] on:CharacterEncoderError do:[:ex| |
2827 ] on:CharacterEncoderError do:[:ex| |
2792 "substitute a default value for codes that cannot be represented |
2828 "substitute a default value for codes that cannot be represented |
2793 in the new character set" |
2829 in the new character set" |
2794 ex proceedWith:ex defaultValue. |
2830 ex proceedWith:ex defaultValue. |
2795 ]. |
2831 ]. |
2798 id := fontUsed fontId. |
2834 id := fontUsed fontId. |
2799 id isNil ifTrue:[ |
2835 id isNil ifTrue:[ |
2800 "hook for alien fonts" |
2836 "hook for alien fonts" |
2801 fontUsed displayString:s x:x y:y in:self |
2837 fontUsed displayString:s x:x y:y in:self |
2802 ] ifFalse:[ |
2838 ] ifFalse:[ |
2803 deviceFont ~~ fontUsed ifTrue:[ |
2839 self deviceFont ~~ fontUsed ifTrue:[ |
2804 device setFont:id in:gcId. |
2840 self device setFont:id in:self gcId. |
2805 deviceFont := fontUsed |
2841 self deviceFont: fontUsed |
2806 ]. |
2842 ]. |
2807 device displayString:s x:pX y:pY in:drawableId with:gcId |
2843 self device displayString:s x:pX y:pY in:self drawableId with:self gcId |
2808 ] |
2844 ] |
2809 |
2845 |
2810 "Modified: 1.7.1997 / 17:08:35 / cg" |
2846 "Modified: 1.7.1997 / 17:08:35 / cg" |
2811 ! ! |
2847 ! ! |
2812 |
2848 |
2955 int src_fg, src_bg, dst_fg, dst_bg; |
2995 int src_fg, src_bg, dst_fg, dst_bg; |
2956 char buf[5]; |
2996 char buf[5]; |
2957 |
2997 |
2958 // fun = dstGcData->bitbltrop2; |
2998 // fun = dstGcData->bitbltrop2; |
2959 |
2999 |
2960 aFunctionSymbol= __INST(function); |
3000 aFunctionSymbol= function; |
2961 |
3001 |
2962 if (aFunctionSymbol == @symbol(copy)) { |
3002 if (aFunctionSymbol == @symbol(copy)) { |
2963 fun = SRCCOPY /* R2_COPYPEN */ ; |
3003 fun = SRCCOPY /* R2_COPYPEN */ ; |
2964 /* bfun = BITBLT_COPY; */ |
3004 /* bfun = BITBLT_COPY; */ |
2965 } else if (aFunctionSymbol == @symbol(copyInverted)) { |
3005 } else if (aFunctionSymbol == @symbol(copyInverted)) { |
4695 |
4746 |
4696 "Created: / 04-08-2006 / 12:32:53 / fm" |
4747 "Created: / 04-08-2006 / 12:32:53 / fm" |
4697 ! |
4748 ! |
4698 |
4749 |
4699 widthOf:aString from:index1 to:index2 inFont:aFontId |
4750 widthOf:aString from:index1 to:index2 inFont:aFontId |
|
4751 | gcId | |
|
4752 |
|
4753 gcId :=self gcId. |
4700 |
4754 |
4701 %{ /* NOCONTEXT */ |
4755 %{ /* NOCONTEXT */ |
4702 unsigned char *cp; |
4756 unsigned char *cp; |
4703 int len, n, i1, i2, l; |
4757 int len, n, i1, i2, l; |
4704 OBJ cls; |
4758 OBJ cls; |
4705 int nInstBytes; |
4759 int nInstBytes; |
4706 |
4760 |
4707 if (__bothSmallInteger(index1, index2) |
4761 if (__bothSmallInteger(index1, index2) |
4708 && __isExternalAddress(aFontId) |
4762 && __isExternalAddress(aFontId) |
4709 && __isExternalAddressLike(__INST(gcId)) |
4763 && __isExternalAddressLike(gcId) |
4710 && __isNonNilObject(aString)) { |
4764 && __isNonNilObject(aString)) { |
4711 HGDIOBJ hFont,prevFont; |
4765 HGDIOBJ hFont,prevFont; |
4712 HANDLE hDC; |
4766 HANDLE hDC; |
4713 SIZE tsize; |
4767 SIZE tsize; |
4714 |
4768 |
4811 !WinPrinterContext methodsFor:'initialization & release'! |
4865 !WinPrinterContext methodsFor:'initialization & release'! |
4812 |
4866 |
4813 createDC |
4867 createDC |
4814 "Private - Create a device context for the receiver" |
4868 "Private - Create a device context for the receiver" |
4815 |
4869 |
4816 gcId := printerInfo createDC |
4870 self gcId: printerInfo createDC |
4817 |
4871 |
4818 "Created: / 27-07-2006 / 10:21:05 / fm" |
4872 "Created: / 27-07-2006 / 10:21:05 / fm" |
4819 "Modified: / 02-08-2006 / 17:30:47 / fm" |
4873 "Modified: / 02-08-2006 / 17:30:47 / fm" |
4820 "Modified: / 10-10-2006 / 18:14:28 / cg" |
4874 "Modified: / 10-10-2006 / 18:14:28 / cg" |
4821 ! |
4875 ! |
4822 |
4876 |
4823 deleteDC |
4877 deleteDC |
4824 "Private - Delete a device context for the receiver" |
4878 "Private - Delete a device context for the receiver" |
4825 |
4879 |
4826 OperatingSystem deletePrinterDC: gcId. |
4880 OperatingSystem deletePrinterDC: self gcId. |
4827 ! |
4881 ! |
4828 |
4882 |
4829 destroy |
4883 destroy |
4830 "Destroy the GC." |
4884 "Destroy the GC." |
4831 |
4885 |
4832 |id| |
4886 |id| |
4833 |
4887 |
4834 id := gcId. |
4888 id := self gcId. |
4835 id notNil ifTrue:[ |
4889 id notNil ifTrue:[ |
4836 gcId := nil. |
4890 self gcId: nil. |
4837 self deleteDC. |
4891 self deleteDC. |
4838 ]. |
4892 ]. |
4839 "/ Lobby unregister:self. |
4893 "/ Lobby unregister:self. |
4840 ! |
4894 ! |
4841 |
4895 |
4907 true "self font isNil" ifTrue:[ |
4961 true "self font isNil" ifTrue:[ |
4908 "if font not set yet, calculate based on default font" |
4962 "if font not set yet, calculate based on default font" |
4909 "/ extString := str asExternalString. |
4963 "/ extString := str asExternalString. |
4910 size := Win32OperatingSystem::WinPointStructure new. |
4964 size := Win32OperatingSystem::WinPointStructure new. |
4911 (OperatingSystem |
4965 (OperatingSystem |
4912 getTextExtentPoint:gcId |
4966 getTextExtentPoint:self gcId |
4913 string:str |
4967 string:str |
4914 size:size) ifFalse:[ ^ self error ]. |
4968 size:size) ifFalse:[ ^ self error ]. |
4915 answer := size x. |
4969 answer := size x. |
4916 "/ Transcript showCR: 'FROM PRIM ******* ', str, ' ', answer printString. |
4970 "/ Transcript showCR: 'FROM PRIM ******* ', str, ' ', answer printString. |
4917 "/ Transcript showCR: 'FROM DEVICE ***** ', str, ' ',(self font widthOf:str on:self device) printString. |
4971 "/ Transcript showCR: 'FROM DEVICE ***** ', str, ' ',(self font widthOf:str on:self device) printString. |
4942 displayAdvanceLineFromX:x0 y:y0 toX:x1 y:y1 |
4996 displayAdvanceLineFromX:x0 y:y0 toX:x1 y:y1 |
4943 "draw a line (with current paint-color); apply transformation if nonNil" |
4997 "draw a line (with current paint-color); apply transformation if nonNil" |
4944 |
4998 |
4945 |pX0 pY0 pX1 pY1 easy fgId bgId| |
4999 |pX0 pY0 pX1 pY1 easy fgId bgId| |
4946 |
5000 |
4947 gcId isNil ifTrue:[ |
5001 self gcId isNil ifTrue:[ |
4948 self initGC |
5002 self initGC |
4949 ]. |
5003 ]. |
4950 |
5004 |
4951 lineStyle == #doubleDashed ifTrue:[ |
5005 self lineStyle == #doubleDashed ifTrue:[ |
4952 " |
5006 " |
4953 if bgPaint or paint is not a real color, we have to do it the hard way ... |
5007 if bgPaint or paint is not a real color, we have to do it the hard way ... |
4954 " |
5008 " |
4955 easy := true. |
5009 easy := true. |
4956 paint isColor ifFalse:[ |
5010 self paint isColor ifFalse:[ |
4957 easy := false |
5011 easy := false |
4958 ] ifTrue:[ |
5012 ] ifTrue:[ |
4959 fgId := paint colorId. |
5013 fgId := self paint colorId. |
4960 fgId isNil ifTrue:[ |
5014 fgId isNil ifTrue:[ |
4961 easy := false |
5015 easy := false |
4962 ] |
5016 ] |
4963 ]. |
5017 ]. |
4964 bgPaint isColor ifFalse:[ |
5018 self bgPaint isColor ifFalse:[ |
4965 easy := false |
5019 easy := false |
4966 ] ifTrue:[ |
5020 ] ifTrue:[ |
4967 bgId := bgPaint colorId. |
5021 bgId := self bgPaint colorId. |
4968 bgId isNil ifTrue:[ |
5022 bgId isNil ifTrue:[ |
4969 easy := false |
5023 easy := false |
4970 ] |
5024 ] |
4971 ]. |
5025 ]. |
4972 |
5026 |
4973 easy ifTrue:[ |
5027 easy ifTrue:[ |
4974 ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[ |
5028 ((self foreground ~~ self paint) or:[self background ~~ self bgPaint]) ifTrue:[ |
4975 device setForeground:fgId background:bgId in:gcId. |
5029 self device setForeground:fgId background:bgId in:self gcId. |
4976 foreground := paint. |
5030 self foreground: self paint. |
4977 background := bgPaint. |
5031 self background: self bgPaint. |
4978 ]. |
5032 ]. |
4979 ] ifFalse:[ |
5033 ] ifFalse:[ |
4980 'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR |
5034 'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR |
4981 ]. |
5035 ]. |
4982 ]. |
5036 ]. |
4983 |
5037 |
4984 transformation notNil ifTrue:[ |
5038 self transformation notNil ifTrue:[ |
4985 pX0 := transformation applyToX:x0. |
5039 pX0 := self transformation applyToX:x0. |
4986 pY0 := transformation applyToY:y0. |
5040 pY0 := self transformation applyToY:y0. |
4987 pX1 := transformation applyToX:x1. |
5041 pX1 := self transformation applyToX:x1. |
4988 pY1 := transformation applyToY:y1. |
5042 pY1 := self transformation applyToY:y1. |
4989 ] ifFalse:[ |
5043 ] ifFalse:[ |
4990 pX0 := x0. |
5044 pX0 := x0. |
4991 pY0 := y0. |
5045 pY0 := y0. |
4992 pX1 := x1. |
5046 pX1 := x1. |
4993 pY1 := y1 |
5047 pY1 := y1 |
5096 ! |
5150 ! |
5097 |
5151 |
5098 getPenForMyContext |
5152 getPenForMyContext |
5099 "Get a pen for my context" |
5153 "Get a pen for my context" |
5100 |
5154 |
5101 |maskOriginX maskOriginY| |
5155 |maskOriginX maskOriginY gcId lineWidthObj lineStyleObj capStyleObj joinStyleObj maskObj | |
|
5156 |
5102 |
5157 |
5103 self maskOrigin isNil ifFalse:[ |
5158 self maskOrigin isNil ifFalse:[ |
5104 maskOriginX := self maskOrigin x. |
5159 maskOriginX := self maskOrigin x. |
5105 maskOriginY := self maskOrigin y. |
5160 maskOriginY := self maskOrigin y. |
5106 ]. |
5161 ]. |
|
5162 |
|
5163 gcId := self gcId. |
|
5164 lineWidthObj := self lineWidth. |
|
5165 lineStyleObj := self lineStyle. |
|
5166 capStyleObj := self capStyle. |
|
5167 joinStyleObj := self joinStyle. |
|
5168 maskObj := self mask. |
5107 |
5169 |
5108 %{ |
5170 %{ |
5109 HPEN hPen = 0; |
5171 HPEN hPen = 0; |
5110 HPEN prevPen; |
5172 HPEN prevPen; |
5111 LOGBRUSH Brush; |
5173 LOGBRUSH Brush; |
5112 COLORREF fgColor; |
5174 COLORREF fgColor; |
5113 HANDLE hDC = (HANDLE)(__externalAddressVal(__INST(gcId))); |
5175 HANDLE hDC = (HANDLE)(__externalAddressVal(gcId)); |
5114 int lStyle, bkMode, hMask, maskOrgX, maskOrgY; |
5176 int lStyle, bkMode, hMask, maskOrgX, maskOrgY; |
5115 OBJ lineStyle, capStyle, joinStyle; |
5177 OBJ lineStyle, capStyle, joinStyle; |
5116 int style; |
5178 int style; |
5117 int lw; |
5179 int lw; |
5118 int BK_TRANSPARENT; |
5180 int BK_TRANSPARENT; |
5119 |
5181 |
5120 BK_TRANSPARENT = 1; |
5182 BK_TRANSPARENT = 1; |
5121 |
5183 |
5122 lw= __intVal(__INST(lineWidth)); |
5184 lw= __intVal(lineWidthObj); |
5123 /* fgColor = __intVal(__INST(foreground)) & 0xffffff; */ |
5185 /* fgColor = __intVal(__INST(foreground)) & 0xffffff; */ |
5124 |
5186 |
5125 fgColor = GetTextColor(hDC); |
5187 fgColor = GetTextColor(hDC); |
5126 lineStyle=__INST(lineStyle); |
5188 lineStyle=lineStyleObj; |
5127 capStyle=__INST(capStyle); |
5189 capStyle=capStyleObj; |
5128 joinStyle=__INST(joinStyle); |
5190 joinStyle=joinStyleObj; |
5129 hMask= __intVal(__INST(mask)); |
5191 hMask= __intVal(maskObj); |
5130 maskOrgX=__intVal(maskOriginX); |
5192 maskOrgX=__intVal(maskOriginX); |
5131 maskOrgY=__intVal(maskOriginY); |
5193 maskOrgY=__intVal(maskOriginY); |
5132 |
5194 |
5133 if (lineStyle == @symbol(solid)) { |
5195 if (lineStyle == @symbol(solid)) { |
5134 style = PS_SOLID; |
5196 style = PS_SOLID; |
5829 |
5891 |
5830 |tscale fscale yFont xFont| |
5892 |tscale fscale yFont xFont| |
5831 |
5893 |
5832 index2 < index1 ifTrue:[^ self]. |
5894 index2 < index1 ifTrue:[^ self]. |
5833 |
5895 |
5834 transformation isNil ifTrue:[ |
5896 self transformation isNil ifTrue:[ |
5835 self initTransformation. |
5897 self initTransformation. |
5836 ]. |
5898 ]. |
5837 tscale := transformation scale. |
5899 tscale := self transformation scale. |
5838 fscale := tscale / fontScale. |
5900 fscale := tscale / fontScale. |
5839 |
5901 |
5840 xFont := x * fontScale x. |
5902 xFont := x * fontScale x. |
5841 yFont := (y - font ascent) * fontScale y. "/ MM_TEXT - Ursprung liegt oben links |
5903 yFont := (y - self font ascent) * fontScale y. "/ MM_TEXT - Ursprung liegt oben links |
5842 |
5904 |
5843 transformation scale:fscale. |
5905 self transformation scale:fscale. |
5844 |
5906 |
5845 super displayString:aString from:index1 to:index2 |
5907 super displayString:aString from:index1 to:index2 |
5846 x:xFont truncated |
5908 x:xFont truncated |
5847 y:yFont truncated. |
5909 y:yFont truncated. |
5848 |
5910 |
5849 transformation scale:tscale. |
5911 self transformation scale:tscale. |
5850 ! |
5912 ! |
5851 |
5913 |
5852 displayString:aString x:x y:y |
5914 displayString:aString x:x y:y |
5853 |end| |
5915 |end| |
5854 |
5916 |