Form.st
changeset 89 ea2bf46eb669
parent 86 032006651226
child 98 cd6af625d477
equal deleted inserted replaced
88:8f9c629a4245 89:ea2bf46eb669
    24 
    24 
    25 Form comment:'
    25 Form comment:'
    26 COPYRIGHT (c) 1989 by Claus Gittinger
    26 COPYRIGHT (c) 1989 by Claus Gittinger
    27 	      All Rights Reserved
    27 	      All Rights Reserved
    28 
    28 
    29 $Header: /cvs/stx/stx/libview/Form.st,v 1.14 1994-11-28 21:00:51 claus Exp $
    29 $Header: /cvs/stx/stx/libview/Form.st,v 1.15 1995-02-06 00:36:22 claus Exp $
    30 '!
    30 '!
    31 
    31 
    32 !Form class methodsFor:'documentation'!
    32 !Form class methodsFor:'documentation'!
    33 
    33 
    34 copyright
    34 copyright
    45 "
    45 "
    46 !
    46 !
    47 
    47 
    48 version
    48 version
    49 "
    49 "
    50 $Header: /cvs/stx/stx/libview/Form.st,v 1.14 1994-11-28 21:00:51 claus Exp $
    50 $Header: /cvs/stx/stx/libview/Form.st,v 1.15 1995-02-06 00:36:22 claus Exp $
    51 "
    51 "
    52 !
    52 !
    53 
    53 
    54 documentation
    54 documentation
    55 "
    55 "
   285 
   285 
   286 reverse
   286 reverse
   287     "return a constant usable as bitblt-combinationrule"
   287     "return a constant usable as bitblt-combinationrule"
   288 
   288 
   289     ^ #xor
   289     ^ #xor
       
   290 !
       
   291 
       
   292 and
       
   293     "return a constant usable as bitblt-combinationrule"
       
   294 
       
   295     ^ #and
   290 ! !
   296 ! !
   291 
   297 
   292 !Form class methodsFor:'instance creation'!
   298 !Form class methodsFor:'instance creation'!
   293 
   299 
   294 extent:ext
   300 extent:ext
   299 
   305 
   300     newForm := self width:(ext x) height:(ext y).
   306     newForm := self width:(ext x) height:(ext y).
   301     newForm fill:(Color colorId:0).
   307     newForm fill:(Color colorId:0).
   302     newForm paint:(Color colorId:1).
   308     newForm paint:(Color colorId:1).
   303     ^ newForm
   309     ^ newForm
       
   310 !
       
   311 
       
   312 extent:ext offset:anOffset
       
   313     "create a new, cleared form, take dimensions from ext.
       
   314      Smalltalk-80 compatibility"
       
   315 
       
   316     ^ (self extent:ext) offset:anOffset.
   304 !
   317 !
   305 
   318 
   306 extent:ext fromArray:data offset:offs
   319 extent:ext fromArray:data offset:offs
   307     "create a new form, take dimensions from ext, bits from data.
   320     "create a new form, take dimensions from ext, bits from data.
   308      Smalltalk-80 compatibility."
   321      Smalltalk-80 compatibility."
  1597      Smalltalk-80 compatibility"
  1610      Smalltalk-80 compatibility"
  1598 
  1611 
  1599     ^ offset
  1612     ^ offset
  1600 !
  1613 !
  1601 
  1614 
       
  1615 displayOn:aGC rule:rule
       
  1616     "draw in aGC.
       
  1617      Smalltalk-80 (2.x) compatibility"
       
  1618 
       
  1619     ^ self displayOn:aGC at:0@0 rule:rule
       
  1620 !
       
  1621 
       
  1622 displayOn:aGC at:aPoint rule:rule
       
  1623     "draw in aGC.
       
  1624      Smalltalk-80 (2.x) compatibility"
       
  1625 
       
  1626     |f|
       
  1627 
       
  1628     f := aGC function.
       
  1629     aGC function:rule.
       
  1630     aGC displayOpaqueForm:self x:aPoint x y:aPoint y.
       
  1631     aGC function:f.
       
  1632 !
       
  1633 
  1602 displayOn:aGC at:aPoint
  1634 displayOn:aGC at:aPoint
  1603     "draw in aGC.
  1635     "draw in aGC.
  1604      Smalltalk-80 compatibility"
  1636      Smalltalk-80 (2.x) compatibility"
  1605 
  1637 
  1606     aGC displayOpaqueForm:self x:aPoint x y:aPoint y
  1638     ^ self displayOn:aGC at:aPoint rule:#copy 
  1607 ! !
  1639 ! !
  1608 
  1640 
  1609 !Form methodsFor:'accessing'!
  1641 !Form methodsFor:'accessing'!
  1610 
  1642 
  1611 colorMap
  1643 colorMap
  1807     ^ newForm
  1839     ^ newForm
  1808 
  1840 
  1809     "ScrollBar scrollUpButtonForm magnifyBy:(2 @ 2)"
  1841     "ScrollBar scrollUpButtonForm magnifyBy:(2 @ 2)"
  1810 !
  1842 !
  1811 
  1843 
       
  1844 hardMagnifyBy:extent
       
  1845     "return a new form magnified by extent, aPoint.
       
  1846      This method handles non-integral factors."
       
  1847 
       
  1848     "
       
  1849      since Form will be replaced by Image in the long run,
       
  1850      and this operation is slow anyway, use the implementation
       
  1851      in Image for this."
       
  1852 
       
  1853     ^ ((Image fromForm:self) magnifyBy:extent) asFormOn:device.
       
  1854 
       
  1855     "
       
  1856      (Form fromFile:'OutputOn.64') magnifyBy:0.5@0.5
       
  1857      (Form fromFile:'OutputOn.64') magnifyBy:1.5@1.5
       
  1858     "
       
  1859 !
       
  1860 
  1812 flipVertical
  1861 flipVertical
  1813     "return a new form flipped vertically"
  1862     "return a new form flipped vertically"
  1814 
  1863 
  1815     |dstX newForm|
  1864     |dstX newForm|
  1816     newForm := ((self class) on:device)
  1865     newForm := ((self class) on:device)