GraphicsContext.st
changeset 4930 d464ba6aea9b
parent 4911 aa37e3fa329e
child 4940 cbac16cbe259
equal deleted inserted replaced
4929:28ffe3cdf691 4930:d464ba6aea9b
  1709 
  1709 
  1710     "Modified: 13.4.1996 / 20:58:31 / cg"
  1710     "Modified: 13.4.1996 / 20:58:31 / cg"
  1711 !
  1711 !
  1712 
  1712 
  1713 displayRoundRectangleX:left y:top width:width height:height wCorner:wCorn hCorner:hCorn
  1713 displayRoundRectangleX:left y:top width:width height:height wCorner:wCorn hCorner:hCorn
  1714     |right bottom wC hC wHalf hHalf|
  1714     |right bottom wC hC wHalf hHalf isWin32|
  1715 
  1715 
  1716     "/ BIG KLUDGE WARNING HERE: the code below looks "good" on windows displays;
  1716     "/ BIG KLUDGE WARNING HERE: the code below looks "good" on windows displays;
  1717     "/ (if you change anything under Unix, make it X-platform specific.
  1717     "/ (if you change anything under Unix, make it X-platform specific.
  1718     "/ (there seem to be drawing incompatibilities between Win- and XWorkstation)
  1718     "/ (there seem to be drawing incompatibilities between Win- and XWorkstation)
       
  1719 
       
  1720     isWin32 := device platformName = 'WIN32'.
  1719 
  1721 
  1720     right := left + width-1.
  1722     right := left + width-1.
  1721     bottom := top + height-1.
  1723     bottom := top + height-1.
  1722 
  1724 
  1723     wC := wCorn.
  1725     wC := wCorn.
  1736 
  1738 
  1737     "top right arc"
  1739     "top right arc"
  1738     self displayArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
  1740     self displayArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
  1739 
  1741 
  1740     "bottom right arc"
  1742     "bottom right arc"
  1741     self scale = 1 ifTrue:[
  1743     (isWin32 and:[self scale = 1]) ifTrue:[
  1742         self displayArcX:(right - wC+1) y:(bottom - hC+1) width:wC height:hC from:270 angle:90.
  1744         self displayArcX:(right - wC+1) y:(bottom - hC+1) width:wC height:hC from:270 angle:90.
  1743     ] ifFalse:[
  1745     ] ifFalse:[
  1744         self displayArcX:(right - wC) y:(bottom - hC) width:wC height:hC from:270 angle:90.
  1746         self displayArcX:(right - wC) y:(bottom - hC) width:wC height:hC from:270 angle:90.
  1745     ].
  1747     ].
  1746 
  1748 
  2010         self paint:p.
  2012         self paint:p.
  2011     ].
  2013     ].
  2012     self displayForm:tempImage x:xN y:yN.
  2014     self displayForm:tempImage x:xN y:yN.
  2013 
  2015 
  2014     "Modified: / 29.1.1998 / 13:23:23 / cg"
  2016     "Modified: / 29.1.1998 / 13:23:23 / cg"
  2015 !
       
  2016 
       
  2017 fillArcX:x y:y w:w h:h from:startAngle angle:angle
       
  2018     "draw a filled arc; apply transformation if nonNil"
       
  2019 
       
  2020     <resource:#obsolete>
       
  2021 
       
  2022     self obsoleteMethodWarning:'use #fillArcX:y:width:height:from:angle:'.
       
  2023     self fillArcX:x y:y width:w height:h from:startAngle angle:angle
       
  2024 
       
  2025     "Modified: 8.5.1996 / 08:47:52 / cg"
       
  2026 ! !
  2017 ! !
  2027 
  2018 
  2028 !GraphicsContext methodsFor:'drawing in device coordinates'!
  2019 !GraphicsContext methodsFor:'drawing in device coordinates'!
  2029 
  2020 
  2030 displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
  2021 displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
  2247 
  2238 
  2248     "Created: 13.4.1996 / 20:56:56 / cg"
  2239     "Created: 13.4.1996 / 20:56:56 / cg"
  2249     "Modified: 8.5.1996 / 08:42:23 / cg"
  2240     "Modified: 8.5.1996 / 08:42:23 / cg"
  2250 !
  2241 !
  2251 
  2242 
       
  2243 fillArcX:x y:y w:w h:h from:startAngle angle:angle
       
  2244     "draw a filled arc; apply transformation if nonNil"
       
  2245 
       
  2246     <resource:#obsolete>
       
  2247 
       
  2248     self obsoleteMethodWarning:'use #fillArcX:y:width:height:from:angle:'.
       
  2249     self fillArcX:x y:y width:w height:h from:startAngle angle:angle
       
  2250 
       
  2251     "Modified: 8.5.1996 / 08:47:52 / cg"
       
  2252 !
       
  2253 
  2252 fillArcX:x y:y width:w height:h from:startAngle to:endAngle
  2254 fillArcX:x y:y width:w height:h from:startAngle to:endAngle
  2253     "draw a filled arc in a box, given startAngle and endAngle."
  2255     "draw a filled arc in a box, given startAngle and endAngle."
  2254 
  2256 
  2255     self 
  2257     self 
  2256 	fillArcX:x 
  2258 	fillArcX:x 
  2347     hC := hCorn.
  2349     hC := hCorn.
  2348 
  2350 
  2349     wHalf := wC / 2.
  2351     wHalf := wC / 2.
  2350     hHalf := hC / 2.
  2352     hHalf := hC / 2.
  2351 
  2353 
  2352     device platformName = 'WIN32' ifTrue:[
  2354     device platformName = #WIN32 ifTrue:[
  2353         "/ bug workaround
  2355         "/ bug workaround
  2354         "top left arc"
  2356         "top left arc"
  2355         self fillArcX:left y:top width:wC height:hC from:90 angle:90.
  2357         self fillArcX:left y:top width:wC height:hC from:90 angle:90.
  2356         "top right arc"
  2358         "top right arc"
  2357         self fillArcX:(right - wC - 1) y:top width:wC height:hC from:0 angle:90.
  2359         self fillArcX:(right - wC - 1) y:top width:wC height:hC from:0 angle:90.
  2372         "top right arc"
  2374         "top right arc"
  2373         self fillArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
  2375         self fillArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
  2374         "bottom right arc"
  2376         "bottom right arc"
  2375         self fillArcX:(right - wC - 1) y:(bottom - hC) width:wC height:hC from:270 angle:90.
  2377         self fillArcX:(right - wC - 1) y:(bottom - hC) width:wC height:hC from:270 angle:90.
  2376         "bottom left arc"
  2378         "bottom left arc"
  2377         self fillArcX:left y:(bottom - hC + 1) width:wC height:hC from:180 angle:90.
  2379         self fillArcX:left y:(bottom - hC) width:wC height:hC from:180 angle:90.
  2378 
  2380 
  2379         "center rectangle"
  2381         "center rectangle"
  2380         self fillRectangleX:(left + wHalf) y:top width:(width - wHalf - wHalf+1) height:height.
  2382         self fillRectangleX:(left + wHalf) y:top width:(width - wHalf - wHalf+1) height:height.
  2381         "left partial rectangle"
  2383         "left partial rectangle"
  2382         self fillRectangleX:left y:top+hHalf width:wHalf height:(height-hHalf-hHalf).
  2384         self fillRectangleX:left y:top+hHalf width:wHalf height:(height-hHalf-hHalf).
  2432 ! !
  2434 ! !
  2433 
  2435 
  2434 !GraphicsContext class methodsFor:'documentation'!
  2436 !GraphicsContext class methodsFor:'documentation'!
  2435 
  2437 
  2436 version
  2438 version
  2437     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.117 2008-02-14 15:05:29 cg Exp $'
  2439     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.118 2008-03-27 17:45:05 stefan Exp $'
  2438 ! !
  2440 ! !
  2439 
  2441 
  2440 GraphicsContext initialize!
  2442 GraphicsContext initialize!