Beispiel #1
0
        private void setLineSegment(Pos2 pos, int length, List <YanagisawaPicLineSegment> segments)
        {
            System.Diagnostics.Debug.Assert(this.colorCurrent.Length == 4);
            int index = (this.width * this.getYExtracted(pos.y) + pos.x) * 4;
            // int index = pos.x * 4;
            var enumerator = segments.GetEnumerator();
            YanagisawaPicLineSegment segmentCurrent = enumerator.MoveNext() ? enumerator.Current : null;

            while (segmentCurrent != null && segmentCurrent.x < pos.x)
            {
                this.colorCurrent = segmentCurrent.color;
                segmentCurrent    = enumerator.MoveNext() ? enumerator.Current : null;
            }
            for (var indexPixel = 0; indexPixel < length; indexPixel++)
            {
                if (segmentCurrent != null && segmentCurrent.x <= pos.x + indexPixel)
                {
                    this.colorCurrent = segmentCurrent.color;
                    segmentCurrent    = enumerator.MoveNext() ? enumerator.Current : null;
                }
                for (var indexByte = 0; indexByte < this.colorCurrent.Length; indexByte++)
                {
                    this.bytesImageExtracted[index + indexByte] = this.colorCurrent[indexByte];
                }
                index += 4;
            }
        }
Beispiel #2
0
 static public int compareLessThan(YanagisawaPicLineSegment seg0, YanagisawaPicLineSegment seg1)
 {
     return((seg0.x == seg1.x) ? 0 : ((seg0.x < seg1.x) ? -1 : 1));
 }