Depth2Image.st
changeset 8118 44f2377b84af
parent 7818 290d8c548544
child 8140 cf317c6af373
equal deleted inserted replaced
8117:8f10ae244f9c 8118:44f2377b84af
   694     "Created: 7.6.1996 / 19:12:31 / cg"
   694     "Created: 7.6.1996 / 19:12:31 / cg"
   695     "Modified: 10.6.1996 / 10:32:47 / cg"
   695     "Modified: 10.6.1996 / 10:32:47 / cg"
   696 !
   696 !
   697 
   697 
   698 valuesAtY:y from:xLow to:xHigh do:aBlock
   698 valuesAtY:y from:xLow to:xHigh do:aBlock
   699     "perform aBlock for each pixelValue from x1 to x2 in row y.
   699     "WARNING: this enumerates pixel values which need photometric interpretation
       
   700      Do not confuse with #rgbValuesAtY:from:to:do:
       
   701 
       
   702      Perform aBlock for each pixelValue from x1 to x2 in row y.
       
   703 
       
   704      Notice the difference between rgbValue and pixelValue: rgbValues are always
       
   705      the rgb bytes; pixelvalues depend on the photometric interpretation, and may be
       
   706      indices into a colormap or be non-byte-sized rgb values.
       
   707 
   700      The block is passed the x coordinate and the pixelValue at each pixel.
   708      The block is passed the x coordinate and the pixelValue at each pixel.
   701      This method allows slighly faster processing of an
   709      This method allows slighly faster processing of an
   702      image than using valueAtX:y:, since some processing can be
   710      image than using valueAtX:y:, since some processing can be
   703      avoided when going from pixel to pixel. However, for
   711      avoided when going from pixel to pixel. However, for
   704      real image processing, specialized methods should be written."
   712      real image processing, specialized methods should be written."
   722     srcIndex := srcIndex + (x1 // 4).
   730     srcIndex := srcIndex + (x1 // 4).
   723     shift := #(-6 -4 -2 0) at:((x1 \\ 4) + 1).
   731     shift := #(-6 -4 -2 0) at:((x1 \\ 4) + 1).
   724 
   732 
   725     byte := bytes at:srcIndex.
   733     byte := bytes at:srcIndex.
   726     x1 to:x2 do:[:x |
   734     x1 to:x2 do:[:x |
   727 	value := (byte bitShift:shift) bitAnd:3.
   735         value := (byte bitShift:shift) bitAnd:3.
   728 
   736 
   729 	aBlock value:x value:value.
   737         aBlock value:x value:value.
   730 
   738 
   731 	shift == 0 ifTrue:[
   739         shift == 0 ifTrue:[
   732 	    shift := -6.
   740             shift := -6.
   733 	    srcIndex := srcIndex + 1.
   741             srcIndex := srcIndex + 1.
   734 	    x < x2 ifTrue:[
   742             x < x2 ifTrue:[
   735 		byte := bytes at:srcIndex.
   743                 byte := bytes at:srcIndex.
   736 	    ]
   744             ]
   737 	] ifFalse:[
   745         ] ifFalse:[
   738 	    shift := shift + 2.
   746             shift := shift + 2.
   739 	]
   747         ]
   740     ].
   748     ].
   741 
   749 
   742     "Created: 7.6.1996 / 19:09:42 / cg"
   750     "Created: / 07-06-1996 / 19:09:42 / cg"
   743     "Modified: 8.6.1996 / 13:36:28 / cg"
   751     "Modified: / 08-06-1996 / 13:36:28 / cg"
       
   752     "Modified (comment): / 29-08-2017 / 14:53:09 / cg"
   744 ! !
   753 ! !
   745 
   754 
   746 !Depth2Image methodsFor:'magnification'!
   755 !Depth2Image methodsFor:'magnification'!
   747 
   756 
   748 magnifyRowFrom:srcBytes offset:srcStart
   757 magnifyRowFrom:srcBytes offset:srcStart