コード例 #1
0
        private void doFilter(System.IntPtr Scan0, int stride)
        {
            int height = this.b.Height;
            int steps  = computeHeightSteps(height);

            // anzahl der threads die mehr als die min elemente berechnen
            int sectorThreshold = height % thHandler.getThreads();


            for (int i = 0; i < thHandler.getThreads(); i++)
            {
                int    startIndex = i * steps + Math.Min(i, sectorThreshold);
                int    stopIndex  = startIndex + steps + (i < sectorThreshold ? 1 : 0);
                Thread thread     = null;

                switch (this.filter)
                {
                case ImageManipulaterType.Name.INVERT:
                    Invert f = new Invert(this.b, Scan0, stride, startIndex, stopIndex, this.thHandler);
                    thread = new Thread(f.perform);
                    break;
                }

                // Thread starten
                thread.Start();
                // Thread registrieren, um später abzufragen ob thread läuft oder nicht
                this.thHandler.register(thread);
            }
        }
コード例 #2
0
        private void doFilter( System.IntPtr Scan0, int stride)
        {
            int height = this.b.Height;
            int steps = computeHeightSteps(height);

            // anzahl der threads die mehr als die min elemente berechnen
            int sectorThreshold = height % thHandler.getThreads();

            for (int i = 0; i < thHandler.getThreads(); i++)
            {
                int startIndex = i * steps + Math.Min(i, sectorThreshold);
                int stopIndex = startIndex + steps + (i < sectorThreshold ? 1 : 0);
                Thread thread = null;

                switch (this.filter)
                {
                    case ImageManipulaterType.Name.INVERT:
                        Invert f = new Invert(this.b, Scan0, stride, startIndex, stopIndex, this.thHandler);
                        thread = new Thread( f.perform );
                        break;
                }

                    // Thread starten
                thread.Start();
                    // Thread registrieren, um später abzufragen ob thread läuft oder nicht
                this.thHandler.register(thread);

            }
        }