Depth24Image.st
changeset 7527 388a8f3f5c84
parent 7512 f094e73e5bf8
child 7528 c48cbbe547e6
equal deleted inserted replaced
7526:d0199171a370 7527:388a8f3f5c84
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1993 by Claus Gittinger
     4  COPYRIGHT (c) 1993 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
  2678         srcIndex := srcIndex + 3.
  2680         srcIndex := srcIndex + 3.
  2679         aBlock value:x value:(((r bitShift:16) bitOr:(g bitShift:8)) bitOr:b)
  2681         aBlock value:x value:(((r bitShift:16) bitOr:(g bitShift:8)) bitOr:b)
  2680     ]
  2682     ]
  2681 
  2683 
  2682     "Created: 7.6.1996 / 19:09:40 / cg"
  2684     "Created: 7.6.1996 / 19:09:40 / cg"
       
  2685 !
       
  2686 
       
  2687 valuesFromX:xStart y:yStart toX:xEnd y:yEnd do:aBlock
       
  2688     "perform aBlock for each pixel in the rectangle
       
  2689      yStart..yEnd / xStart..xEnd.
       
  2690      The block is passed the pixelValue at each pixel.
       
  2691      This method allows slighly faster processing of an
       
  2692      image than using individual valueAtX:y: accesses,
       
  2693      since some processing can be avoided when going from pixel to pixel..
       
  2694      However, for real high performance image processing, specialized methods
       
  2695      should be written which know how to deal with specific photometric interpretations."
       
  2696 
       
  2697     |srcIndex    "{ Class: SmallInteger }"
       
  2698      srcNext     "{ Class: SmallInteger }"
       
  2699      bytesPerRow "{ Class: SmallInteger }"
       
  2700      value    "{ Class: SmallInteger }"
       
  2701      x1       "{ Class: SmallInteger }"
       
  2702      x2       "{ Class: SmallInteger }"
       
  2703      y1       "{ Class: SmallInteger }"
       
  2704      y2       "{ Class: SmallInteger }"
       
  2705      bytes|
       
  2706 
       
  2707     x1 := xStart.
       
  2708     x2 := xEnd.
       
  2709     y1 := yStart.
       
  2710     y2 := yEnd.
       
  2711 
       
  2712     srcIndex := (width * 3 * y1) + (x1 * 3) + 1 .
       
  2713     bytesPerRow := self bytesPerRow.
       
  2714     bytes := self bits.
       
  2715 
       
  2716     y1 to:y2 do:[:y |
       
  2717         srcNext := srcIndex + bytesPerRow.
       
  2718         x1 to:x2 do:[:x |
       
  2719             value := bytes at:srcIndex.
       
  2720             value := (value bitShift:8) + (bytes at:srcIndex+1).
       
  2721             value := (value bitShift:8) + (bytes at:srcIndex+2).
       
  2722             srcIndex := srcIndex + 3.
       
  2723 
       
  2724             aBlock value:x value:y value:value
       
  2725         ].
       
  2726         srcIndex := srcNext.
       
  2727     ].
       
  2728 
       
  2729     "Modified: 11.7.1996 / 20:06:47 / cg"
       
  2730     "Created: 11.7.1996 / 20:08:11 / cg"
  2683 ! !
  2731 ! !
  2684 
  2732 
  2685 !Depth24Image methodsFor:'image manipulations'!
  2733 !Depth24Image methodsFor:'image manipulations'!
  2686 
  2734 
  2687 negative
  2735 negative