DeviceGraphicsContext.st
changeset 2016 bef5fe2ec2ca
parent 2013 d77c7dcbf840
child 2018 1ad552e97c67
equal deleted inserted replaced
2015:f53883507ed9 2016:bef5fe2ec2ca
   553 		    device setPixmapMask:id in:gcId
   553 		    device setPixmapMask:id in:gcId
   554 		]
   554 		]
   555 	    ]
   555 	    ]
   556 	]
   556 	]
   557     ]
   557     ]
       
   558 !
       
   559 
       
   560 maskOriginX:orgX y:orgY
       
   561     "set the origin of the pattern"
       
   562 
       
   563     |x y|
       
   564 
       
   565     transformation notNil ifTrue:[
       
   566         x := transformation applyToX:orgX.
       
   567         y := transformation applyToY:orgY.
       
   568     ] ifFalse:[
       
   569         x := orgX.
       
   570         y := orgY
       
   571     ].
       
   572     x := x rounded.
       
   573     y := y rounded.
       
   574 
       
   575     (maskOrigin isNil or:[
       
   576      ((x ~~ maskOrigin x) or:[y ~~ maskOrigin y]) ]) ifTrue:[
       
   577 
       
   578         maskOrigin := x @ y.
       
   579         gcId notNil ifTrue:[
       
   580             device setMaskOriginX:x y:y in:gcId
       
   581         ]
       
   582     ]
       
   583 
       
   584     "Created: / 26.1.1998 / 18:51:18 / cg"
   558 !
   585 !
   559 
   586 
   560 noClipByChildren
   587 noClipByChildren
   561     "drawing shall also be done into subviews"
   588     "drawing shall also be done into subviews"
   562 
   589 
   659      of graphics exposures"
   686      of graphics exposures"
   660 
   687 
   661     gcId notNil ifTrue:[
   688     gcId notNil ifTrue:[
   662 	device setGraphicsExposures:aBoolean in:gcId
   689 	device setGraphicsExposures:aBoolean in:gcId
   663     ]
   690     ]
   664 !
       
   665 
       
   666 setMaskOrigin:aPoint
       
   667     "set the origin of the fill pattern"
       
   668 
       
   669     (maskOrigin isNil or:[maskOrigin ~= aPoint]) ifTrue:[
       
   670 	transformation isNil ifTrue:[
       
   671 	    maskOrigin := aPoint.
       
   672 	] ifFalse:[
       
   673 	    maskOrigin := transformation applyTo:aPoint
       
   674 	].
       
   675 	gcId notNil ifTrue:[
       
   676 	    device setMaskOriginX:maskOrigin x rounded 
       
   677 				y:maskOrigin y rounded 
       
   678 			       in:gcId
       
   679 	]
       
   680     ]
       
   681 !
       
   682 
       
   683 setMaskOriginX:orgX y:orgY
       
   684     "set the origin of the pattern"
       
   685 
       
   686     |x y|
       
   687 
       
   688     transformation notNil ifTrue:[
       
   689 	x := transformation applyToX:orgX.
       
   690 	y := transformation applyToY:orgY.
       
   691     ] ifFalse:[
       
   692 	x := orgX.
       
   693 	y := orgY
       
   694     ].
       
   695     x := x rounded.
       
   696     y := y rounded.
       
   697 
       
   698     (maskOrigin isNil or:[
       
   699      ((x ~~ maskOrigin x) or:[y ~~ maskOrigin y]) ]) ifTrue:[
       
   700 
       
   701 	maskOrigin := x @ y.
       
   702 	gcId notNil ifTrue:[
       
   703 	    device setMaskOriginX:x y:y in:gcId
       
   704 	]
       
   705     ]
       
   706 ! !
   691 ! !
   707 
   692 
   708 !DeviceGraphicsContext methodsFor:'accessing-internals'!
   693 !DeviceGraphicsContext methodsFor:'accessing-internals'!
   709 
   694 
   710 background
   695 background
   873     "Modified: 28.5.1996 / 20:45:09 / cg"
   858     "Modified: 28.5.1996 / 20:45:09 / cg"
   874 ! !
   859 ! !
   875 
   860 
   876 !DeviceGraphicsContext methodsFor:'bit blitting'!
   861 !DeviceGraphicsContext methodsFor:'bit blitting'!
   877 
   862 
       
   863 copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
       
   864     "copy bits from a smalltalk byteArray.
       
   865      The bits found there are supposed to be in the devices native format (i.e.
       
   866      translated to allocated color indices on pseudoColor devices and padded as required.
       
   867      The byteOrder is MSB and will be converted as appropriate by the underlying devices 
       
   868      method to whatever the device needs."
       
   869 
       
   870     device
       
   871         drawBits:aByteArray
       
   872 	bitsPerPixel:bpp 
       
   873 	depth:depth  
       
   874 	padding:pad
       
   875         width:srcW height:srcH
       
   876         x:srcX y:srcY
       
   877         into:drawableId
       
   878         x:dstX y:dstY 
       
   879         width:(self width) height:(self height)
       
   880         with:gcId.
       
   881 !
       
   882 
   878 copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
   883 copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
   879     "copy bits from a smalltalk byteArray.
   884     "copy bits from a smalltalk byteArray.
   880      The bits found there are supposed to be in the devices native format (i.e.
   885      The bits found there are supposed to be in the devices native format (i.e.
   881      translated to allocated color indices on pseudoColor devices and padded as required.
   886      translated to allocated color indices on pseudoColor devices and padded as required.
   882      The byteOrder is MSB and will be converted as appropriate by the underlying devices 
   887      The byteOrder is MSB and will be converted as appropriate by the underlying devices 
   894 	x:dstX y:dstY 
   899 	x:dstX y:dstY 
   895 	width:(self width) height:(self height)
   900 	width:(self width) height:(self height)
   896 	with:gcId.
   901 	with:gcId.
   897 
   902 
   898     "Created: 21.10.1995 / 00:04:22 / cg"
   903     "Created: 21.10.1995 / 00:04:22 / cg"
   899 !
       
   900 
       
   901 copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
       
   902     "copy bits from a smalltalk byteArray.
       
   903      The bits found there are supposed to be in the devices native format (i.e.
       
   904      translated to allocated color indices on pseudoColor devices and padded as required.
       
   905      The byteOrder is MSB and will be converted as appropriate by the underlying devices 
       
   906      method to whatever the device needs."
       
   907 
       
   908     device
       
   909         drawBits:aByteArray
       
   910 	bitsPerPixel:bpp 
       
   911 	depth:depth  
       
   912 	padding:pad
       
   913         width:srcW height:srcH
       
   914         x:srcX y:srcY
       
   915         into:drawableId
       
   916         x:dstX y:dstY 
       
   917         width:(self width) height:(self height)
       
   918         with:gcId.
       
   919 !
   904 !
   920 
   905 
   921 copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
   906 copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
   922     "copy from aDrawable into the receiver;
   907     "copy from aDrawable into the receiver;
   923      the source may be the receiver as well - in this case its a scroll.
   908      the source may be the receiver as well - in this case its a scroll.
  3743 ! !
  3728 ! !
  3744 
  3729 
  3745 !DeviceGraphicsContext class methodsFor:'documentation'!
  3730 !DeviceGraphicsContext class methodsFor:'documentation'!
  3746 
  3731 
  3747 version
  3732 version
  3748     ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.51 1998-01-25 14:11:43 cg Exp $'
  3733     ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.52 1998-01-26 17:58:15 cg Exp $'
  3749 ! !
  3734 ! !
  3750 DeviceGraphicsContext initialize!
  3735 DeviceGraphicsContext initialize!