1646 |
1646 |
1647 %{ /* NOCONTEXT */ |
1647 %{ /* NOCONTEXT */ |
1648 if (__isExternalAddressLike(aDC) |
1648 if (__isExternalAddressLike(aDC) |
1649 && __bothSmallInteger(x0, y0) |
1649 && __bothSmallInteger(x0, y0) |
1650 && __bothSmallInteger(x1, y1)) { |
1650 && __bothSmallInteger(x1, y1)) { |
1651 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1651 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1652 COLORREF fgColor; |
1652 COLORREF fgColor; |
1653 HANDLE prevPen, hPen; |
1653 HANDLE prevPen, hPen; |
1654 int __x1 = __intVal(x1), __y1 = __intVal(y1); |
1654 int __x1 = __intVal(x1), __y1 = __intVal(y1); |
1655 int lStyleSymbol, lStyleInt; |
1655 int lStyleSymbol, lStyleInt; |
1656 int lw; |
1656 int lw; |
1657 |
1657 |
1658 /* DPRINTF(("displayLine: %d/%d -> %d/%d\n", |
1658 /* DPRINTF(("displayLine: %d/%d -> %d/%d\n", |
1659 __intVal(x0), __intVal(y0), |
1659 __intVal(x0), __intVal(y0), |
1660 __x1, __y1)); |
1660 __x1, __y1)); |
1661 */ |
1661 */ |
1662 |
1662 |
1663 lw= __intVal(__INST(lineWidth)); |
1663 lw= __intVal(__INST(lineWidth)); |
1664 lStyleSymbol= __INST(lineStyle); |
1664 lStyleSymbol= __INST(lineStyle); |
1665 |
1665 |
1666 /* PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT |
1666 /* PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT |
1667 only works with lineWidth = 1 */ |
1667 only works with lineWidth = 1 */ |
1668 |
1668 |
1669 if (lStyleSymbol == @symbol(solid)) { |
1669 if (lStyleSymbol == @symbol(solid)) { |
1670 lStyleInt= PS_SOLID; |
1670 lStyleInt= PS_SOLID; |
1671 } else if (lStyleSymbol == @symbol(dashed)) { |
1671 } else if (lStyleSymbol == @symbol(dashed)) { |
1672 lStyleInt= PS_DASH; |
1672 lStyleInt= PS_DASH; |
1673 } else if (lStyleSymbol == @symbol(dotted)) { |
1673 } else if (lStyleSymbol == @symbol(dotted)) { |
1674 lStyleInt= PS_DOT; |
1674 lStyleInt= PS_DOT; |
1675 } else if (lStyleSymbol == @symbol(dashDot)) { |
1675 } else if (lStyleSymbol == @symbol(dashDot)) { |
1676 lStyleInt= PS_DASHDOT; |
1676 lStyleInt= PS_DASHDOT; |
1677 } else if (lStyleSymbol == @symbol(dashDotDot)) { |
1677 } else if (lStyleSymbol == @symbol(dashDotDot)) { |
1678 lStyleInt= PS_DASHDOTDOT; |
1678 lStyleInt= PS_DASHDOTDOT; |
1679 } else if (lStyleSymbol == @symbol(insideFrame)) { |
1679 } else if (lStyleSymbol == @symbol(insideFrame)) { |
1680 lStyleInt= PS_INSIDEFRAME; |
1680 lStyleInt= PS_INSIDEFRAME; |
1681 } else |
1681 } else |
1682 lStyleInt= PS_SOLID; |
1682 lStyleInt= PS_SOLID; |
1683 |
1683 |
1684 fgColor = GetTextColor(hDC); |
1684 fgColor = GetTextColor(hDC); |
1685 hPen = CreatePen(lStyleInt, lw, fgColor); |
1685 hPen = CreatePen(lStyleInt, lw, fgColor); |
1686 |
1686 |
1687 prevPen = SelectObject(hDC, hPen); |
1687 prevPen = SelectObject(hDC, hPen); |
1688 |
1688 |
1689 MoveToEx(hDC, __intVal(x0), __intVal(y0), NULL); |
1689 MoveToEx(hDC, __intVal(x0), __intVal(y0), NULL); |
1690 |
1690 |
1691 LineTo(hDC, __x1, __y1); |
1691 LineTo(hDC, __x1, __y1); |
1692 |
1692 |
1693 /* |
1693 /* |
1694 * end-point ... |
1694 * end-point ... |
1695 */ |
1695 */ |
1696 LineTo(hDC, __x1+1, __y1); |
1696 // LineTo(hDC, __x1+1, __y1); |
1697 |
1697 |
1698 SelectObject(hDC, prevPen); |
1698 SelectObject(hDC, prevPen); |
1699 DeleteObject(hPen); |
1699 DeleteObject(hPen); |
1700 |
1700 |
1701 RETURN ( self ); |
1701 RETURN ( self ); |
1702 } |
1702 } |
1703 %} |
1703 %} |
1704 ! |
1704 ! |
1705 |
1705 |
1706 displayPointX:px y:py in:ignoredDrawableId with:aDC |
1706 displayPointX:px y:py in:ignoredDrawableId with:aDC |
1920 int xL, yT; |
1920 int xL, yT; |
1921 if (__isExternalAddressLike(aDC) |
1921 if (__isExternalAddressLike(aDC) |
1922 && __bothSmallInteger(x, y) |
1922 && __bothSmallInteger(x, y) |
1923 && __bothSmallInteger(width, height)) { |
1923 && __bothSmallInteger(width, height)) { |
1924 |
1924 |
1925 xL = __intVal(x); |
1925 xL = __intVal(x); |
1926 yT = __intVal(y); |
1926 yT = __intVal(y); |
1927 w = __intVal(width); |
1927 w = __intVal(width); |
1928 h = __intVal(height); |
1928 h = __intVal(height); |
1929 |
1929 |
1930 DPRINTF(("displayRectangle: %d/%d -> %d/%d\n", xL, yT, w, h)); |
1930 DPRINTF(("displayRectangle: %d/%d -> %d/%d\n", xL, yT, w, h)); |
1931 |
1931 |
1932 if ((w >= 0) && (h >= 0)) { |
1932 if ((w >= 0) && (h >= 0)) { |
1933 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1933 HANDLE hDC = (HANDLE)(__externalAddressVal(aDC)); |
1934 COLORREF fgColor; |
1934 COLORREF fgColor; |
1935 HANDLE prevPen, hPen; |
1935 HANDLE prevPen, hPen; |
1936 int lStyleSymbol, lStyleInt; |
1936 int lStyleSymbol, lStyleInt; |
1937 |
1937 |
1938 int lw; |
1938 int lw; |
1939 |
1939 |
1940 lw= __intVal(__INST(lineWidth)); |
1940 lw= __intVal(__INST(lineWidth)); |
1941 lStyleSymbol= __INST(lineStyle); |
1941 lStyleSymbol= __INST(lineStyle); |
1942 |
1942 |
1943 /* PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT |
1943 /* PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT |
1944 only works with lineWidth = 1 */ |
1944 only works with lineWidth = 1 */ |
1945 |
1945 |
1946 if (lStyleSymbol == @symbol(solid)) { |
1946 if (lStyleSymbol == @symbol(solid)) { |
1947 lStyleInt= PS_SOLID; |
1947 lStyleInt= PS_SOLID; |
1948 } else if (lStyleSymbol == @symbol(dashed)) { |
1948 } else if (lStyleSymbol == @symbol(dashed)) { |
1949 lStyleInt= PS_DASH; |
1949 lStyleInt= PS_DASH; |
1950 } else if (lStyleSymbol == @symbol(dotted)) { |
1950 } else if (lStyleSymbol == @symbol(dotted)) { |
1951 lStyleInt= PS_DOT; |
1951 lStyleInt= PS_DOT; |
1952 } else if (lStyleSymbol == @symbol(dashDot)) { |
1952 } else if (lStyleSymbol == @symbol(dashDot)) { |
1953 lStyleInt= PS_DASHDOT; |
1953 lStyleInt= PS_DASHDOT; |
1954 } else if (lStyleSymbol == @symbol(dashDotDot)) { |
1954 } else if (lStyleSymbol == @symbol(dashDotDot)) { |
1955 lStyleInt= PS_DASHDOTDOT; |
1955 lStyleInt= PS_DASHDOTDOT; |
1956 } else if (lStyleSymbol == @symbol(insideFrame)) { |
1956 } else if (lStyleSymbol == @symbol(insideFrame)) { |
1957 lStyleInt= PS_INSIDEFRAME; |
1957 lStyleInt= PS_INSIDEFRAME; |
1958 } else |
1958 } else |
1959 lStyleInt= PS_SOLID; |
1959 lStyleInt= PS_SOLID; |
1960 |
1960 |
1961 fgColor = GetTextColor(hDC); |
1961 fgColor = GetTextColor(hDC); |
1962 hPen = CreatePen(lStyleInt, lw, fgColor); |
1962 hPen = CreatePen(lStyleInt, lw, fgColor); |
1963 |
1963 |
1964 prevPen = SelectObject(hDC, hPen); |
1964 prevPen = SelectObject(hDC, hPen); |
1965 MoveToEx(hDC, xL, yT, NULL); |
1965 MoveToEx(hDC, xL, yT, NULL); |
1966 LineTo(hDC, xL+w, yT); // to top-right |
1966 LineTo(hDC, xL+w, yT); // to top-right |
1967 LineTo(hDC, xL+w, yT+h); // to bot-right |
1967 LineTo(hDC, xL+w, yT+h); // to bot-right |
1968 MoveToEx(hDC, xL, yT, NULL); // back to top-left |
1968 MoveToEx(hDC, xL, yT, NULL); // back to top-left |
1969 LineTo(hDC, xL, yT+h); // to bot-left |
1969 LineTo(hDC, xL, yT+h); // to bot-left |
1970 LineTo(hDC, xL+w+1, yT+h); // move pen one pixel more |
1970 // LineTo(hDC, xL+w+1, yT+h); // move pen one pixel more |
1971 |
1971 LineTo(hDC, xL+w, yT+h); // move pen one pixel more |
1972 SelectObject(hDC, prevPen); |
1972 |
1973 DeleteObject(hPen); |
1973 SelectObject(hDC, prevPen); |
1974 |
1974 DeleteObject(hPen); |
1975 } |
1975 |
1976 RETURN ( self ); |
1976 } |
|
1977 RETURN ( self ); |
1977 } |
1978 } |
1978 %}. |
1979 %}. |
1979 self primitiveFailed |
1980 self primitiveFailed |
1980 |
1981 |
1981 "Created: / 28-07-2006 / 20:18:25 / fm" |
1982 "Created: / 28-07-2006 / 20:18:25 / fm" |
2438 hBrush = CreateSolidBrush(fgColor); |
2439 hBrush = CreateSolidBrush(fgColor); |
2439 } |
2440 } |
2440 |
2441 |
2441 rct.left = __intVal(x); |
2442 rct.left = __intVal(x); |
2442 rct.top = __intVal(y); |
2443 rct.top = __intVal(y); |
2443 rct.right = rct.left + w + 1; |
2444 rct.right = rct.left + w; // + 1; |
2444 rct.bottom = rct.top + h + 1; |
2445 rct.bottom = rct.top + h; // + 1; |
2445 |
2446 |
2446 prevBrush = SelectObject(hDC, hBrush); |
2447 prevBrush = SelectObject(hDC, hBrush); |
2447 FillRect(hDC, &rct, hBrush); |
2448 FillRect(hDC, &rct, hBrush); |
2448 SelectObject(hDC, prevBrush); |
2449 SelectObject(hDC, prevBrush); |
2449 DeleteObject(hBrush); |
2450 DeleteObject(hBrush); |
2961 " |
2962 " |
2962 sorry; I had to separate it into 2 methods, since XPutImage needs |
2963 sorry; I had to separate it into 2 methods, since XPutImage needs |
2963 an unlimited stack, and thus cannot send primitiveFailed |
2964 an unlimited stack, and thus cannot send primitiveFailed |
2964 " |
2965 " |
2965 (self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padd |
2966 (self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padd |
2966 width:imageWidth height:imageHeight |
2967 width:imageWidth height:imageHeight |
2967 x:srcx y:srcy |
2968 x:srcx y:srcy |
2968 into:ignoredDrawableId |
2969 into:ignoredDrawableId |
2969 x:dstx y:dsty |
2970 x:(dstx rounded) y:(dsty rounded) |
2970 width:w height:h |
2971 width:w height:h |
2971 with:aGCId) |
2972 with:aGCId) |
2972 ifFalse:[ |
2973 ifFalse:[ |
2973 " |
2974 " |
2974 also happens, if a segmentation violation occurs in the |
2975 also happens, if a segmentation violation occurs in the |
2975 XPutImage ... |
2976 XPutImage ... |
2976 " |
2977 " |
2977 self primitiveFailed |
2978 self primitiveFailed |
2978 ]. |
2979 ]. |
2979 ! |
2980 ! |
2980 |
2981 |
2981 drawBits:imageBits redVector:redVector greenVector:greenVector blueVector:blueVector bitsPerPixel:bitsPerPixel depth:imageDepth |
2982 drawBits:imageBits redVector:redVector greenVector:greenVector blueVector:blueVector bitsPerPixel:bitsPerPixel depth:imageDepth |
2982 width:imageWidth height:imageHeight |
2983 width:imageWidth height:imageHeight |