• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Octree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Octree的典型用法代码示例。如果您正苦于以下问题:C# Octree类的具体用法?C# Octree怎么用?C# Octree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Octree类属于命名空间,在下文中一共展示了Octree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

        public static void Main(string[] arguments)
        {
            if (arguments.Length != 1)
            {
                Console.WriteLine("Expected 1 parameter: path to the file with test case data.");
                return;
            }

            using (var scenarioReader = new ScenarioReader(new StreamReader(arguments[0])))
            {
                foreach (var scenario in scenarioReader.EnumerateScenarios())
                {
                    Utilities.EnsureAllPositionsAreValid(scenario.BombPositions, SpaceSize);

                    var octree = new Octree(SpaceSize);
                    var furthestOctant = octree.GetFurthestOctant(scenario.BombPositions);

                    /*
                    var safestPoint = furthestOctant.Item1.Center;

                    Console.WriteLine("Safest point: ({0}, {1}, {2}), distance to closest bomb: {3}.",
                        Math.Round(safestPoint.X),
                        Math.Round(safestPoint.Y),
                        Math.Round(safestPoint.Z),
                        Math.Round(furthestOctant.Item2));
                    */

                    // Requirement:
                    // Output T integers, one per test case each on its own line, representing the square of distance to the
                    // nearest bomb from the safest point in the cube.
                    Console.WriteLine(Math.Round(furthestOctant.Item2 * furthestOctant.Item2));
                }
            }
        }
开发者ID:krabicezpapundeklu,项目名称:Exercises,代码行数:34,代码来源:Program.cs


示例2: World

 public World(GameObject scene, float size, Vector3 center, int maxLevel, float normalExtension, bool progressive = true, Graph.GraphType type = Graph.GraphType.CENTER) {
     space = progressive ? new ProgressiveOctree(size, center - Vector3.one * size / 2, maxLevel) : new Octree(size, center - Vector3.one * size / 2, maxLevel);
     space.BuildFromGameObject(scene, normalExtension);
     spaceGraph = 
         type == Graph.GraphType.CENTER ? space.ToCenterGraph() :
         type == Graph.GraphType.CORNER ? space.ToCornerGraph() : space.ToCrossedGraph();
 }
开发者ID:supercontact,项目名称:PathFindingEnhanced,代码行数:7,代码来源:World.cs


示例3: Quantize

 public override QuantizedImage Quantize(ImageBase image, int maxColors)
 {
     colors = NumUtils.Clamp(maxColors, 1, 255);
     if (octree == null){
         octree = new Octree(GetBitsNeededForColorDepth(maxColors));
     }
     return base.Quantize(image, maxColors);
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:8,代码来源:OctreeQuantizer.cs


示例4: Add

 public void Add(Octree<Volume> octree)
 {
     List<Volume> list = octree.toList();
     foreach (Volume volume in list)
     {
         if( volume.Visible ) Add(volume);
     }
 }
开发者ID:asarudick,项目名称:Soapvox,代码行数:8,代码来源:World.cs


示例5: OctreeCuller

 /// <summary>
 /// Initializes a new instance of the <see cref="OctreeCuller"/> class.
 /// </summary>
 /// <param name="worldSize">Size of the world.</param>
 /// <param name="loose">The loose.</param>
 /// <param name="maxDepth">The max depth.</param>
 /// <param name="center">The center.</param>
 /// <param name="DebugDrawer">The debug drawer. We strong recomend you to DONT JUST this DebugDrawer for nothing anymore, if you need, create another</param>
 public OctreeCuller(float worldSize, float loose, int maxDepth, Vector3 center, DebugShapesDrawer DebugDrawer = null)
 {
     oct = new Octree<IObject>(worldSize, loose, maxDepth, center);
     if (DebugDrawer != null)
     {
         DebugDrawer.DrawAllShapesEachFrame = false;
         oct.DebugDraw = DebugDrawer;                
     }            
 }        
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:17,代码来源:OctreeCuller.cs


示例6: setData

 public void setData(Octree tree, int count, Vector3[] voxMins, uint[] voxMats, Octree.GPUVOX[] voxs, Vector3 min, int octreeSize)
 {
     i_Tree = tree;
     i_Count = count;
     i_VoxMins = voxMins;
     i_VoxMaterials = voxMats;
     i_Voxs = voxs;
     i_Min = min;
     i_Size = octreeSize;
 }
开发者ID:Colt-Zero,项目名称:DualContouringGPU,代码行数:10,代码来源:ThreadedChunkLoading.cs


示例7: OctreeQuantizer

        /// <summary>
        /// Construct the octree quantizer
        /// </summary>
        /// <remarks>
        /// The Octree quantizer is a two pass algorithm. The initial pass sets up the octree,
        /// the second pass quantizes a color based on the nodes in the tree
        /// </remarks>
        public OctreeQuantizer(BitDepth pBitDepth)
            : base(false)
        {
            var maxColors = GetMaxColors(pBitDepth);
            var maxColorBits = GetMaxColorBits(pBitDepth);

            _octree = new Octree(maxColorBits);

            _maxColors = maxColors;
        }
开发者ID:akmurray,项目名称:aaronkmurray-blog-tools,代码行数:17,代码来源:OctreeQuantizer.cs


示例8: OctreeQuantizer

		/// <summary>
		/// Construct the octree quantizer
		/// </summary>
		/// <remarks>
		/// The Octree quantizer is a two pass algorithm. The initial pass sets up the octree,
		/// the second pass quantizes a color based on the nodes in the tree
		/// </remarks>
		/// <param name="maxColors">The maximum number of colors to return</param>
		/// <param name="maxColorBits">The number of significant bits</param>
		public OctreeQuantizer ( int maxColors , int maxColorBits ) : base ( false )
		{
			if ( maxColors > 255 )
				throw new ArgumentOutOfRangeException ( "maxColors" , maxColors , "The number of colors should be less than 256" ) ;

			if ( ( maxColorBits < 1 ) | ( maxColorBits > 8 ) )
				throw new ArgumentOutOfRangeException ( "maxColorBits" , maxColorBits , "This should be between 1 and 8" ) ;

			// Construct the octree
			_octree = new Octree ( maxColorBits  ) ;
			_maxColors = maxColors ;
		}
开发者ID:roman-yagodin,项目名称:R7.ImageHandler,代码行数:21,代码来源:OctreeQuantizer.cs


示例9: Main

        static void Main(string[] args)
        {

            var root = OctreeNode<object>.Filled(Vect3.Zero, 5, 0, new object());
            
            var tree = new Octree<object>(root.Split());

            using (var win = new Window<object>(tree, node => Color.Blue))
            {
                win.Run();
                Console.ReadLine();
            }
        }
开发者ID:EngrIO,项目名称:Engr.Octree,代码行数:13,代码来源:Program.cs


示例10: Generate

        public static Octree<Volume> Generate( int width, int depth )
        {
            Octree<Volume> octree = new Octree<Volume>(new Volume(new Vector3(0,0,0), new Vector3(width, 64, depth), new Color()), Volume.AddHandler, Volume.RemoveHandler, Volume.SearchHandler, Volume.SetRootHandler, Volume.RemoveAllHandler);

            List<Vector3> coords = new List<Vector3>();
            int hills = rand.Next(10);
            int height = 0;
            for (int i = 0; i < hills; i++)
            {
                coords.Add( new Vector3( rand.Next(width), 0, rand.Next(depth)));
            }
            System.Drawing.Color c = System.Drawing.Color.LawnGreen;
            int r, g, b;
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < depth; j++)
                {
                    octree.Add(
                                new Volume(
                                new Vector3(i, 0, j),
                                new Vector3(1, 1, 1),
                                new Color(c.R, c.G, c.B))
                                );
                }
            }
            foreach (Vector3 coord in coords)
            {
                for (int x = -10; x < 10; x++)
                {
                    for (int z = -10; z < 10; z++)
                    {
                        c = System.Drawing.Color.LawnGreen;
                        r = (int)(0.1f * (float)height * (int)c.R);
                        g = (int)c.G;
                        b = (int)(0.1f * (float)height * (int)c.B);

                        if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255;
                        height = Math.Min(20 - Math.Abs(z), 20 - Math.Abs(x));
                        c = System.Drawing.Color.FromArgb(r, g, b);
                        octree.Add(
                            new Volume(
                            new Vector3(coord.X + x, height, coord.Z + z),
                            new Vector3(1, 1, 1),
                            new Color(c.R, c.G, c.B))
                            );
                    }
                }
            }

            return octree;
        }
开发者ID:asarudick,项目名称:Soapvox,代码行数:51,代码来源:TerrainGenerator.cs


示例11: World

 public World( int size )
 {
     RemoveQueue = Queue.Synchronized(new Queue());
     AddQueue = Queue.Synchronized(new Queue());
     faceBatch = new FaceBatch<VertexPositionNormalColor>();
     octree = new Octree<WorldVolume>(new WorldVolume(new Vector3(-(int)Math.Pow(2.0f, size) / 2, -(int)Math.Pow(2.0f, size) / 2, -(int)Math.Pow(2.0f, size) / 2),
                                             new Vector3((int)Math.Pow(2.0f, size), (int)Math.Pow(2.0f, size), (int)Math.Pow(2.0f, size)),
                                             new Color()),
                                             WorldVolume.AddHandler,
                                             WorldVolume.RemoveHandler,
                                             WorldVolume.SearchHandler,
                                             WorldVolume.SetRootHandler, WorldVolume.RemoveAllHandler);
     thread = new Thread(new ThreadStart(Do));
 }
开发者ID:asarudick,项目名称:Soapvox,代码行数:14,代码来源:World.cs


示例12: firstPass

        private void firstPass(Octree tree, BitmapData data, int width, int height)
        {
            byte* srcRow = (byte*)data.Scan0.ToPointer();
            Int32* srcPxl;

            for (int row = 0; row < height; ++row)
            {
                srcPxl = (Int32*)srcRow;
                for (int col = 0; col < width; ++col, ++srcPxl)
                    tree.addColor((Color32*)srcPxl);

                srcRow += data.Stride;
            }
        }
开发者ID:Leonscape,项目名称:ESWCtrls,代码行数:14,代码来源:ReduceColor.cs


示例13: Start

		protected override async void Start()
		{
			base.Start();
			Input.SubscribeToKeyDown(k => { if (k.Key == Key.Esc) Exit(); });
			Input.SubscribeToTouchEnd(OnTouched);

			// 3D scene with Octree
			var scene = new Scene(Context);
			octree = scene.CreateComponent<Octree>();

			// Camera
			var cameraNode = scene.CreateChild(name: "camera");
			cameraNode.Position = new Vector3(10, 14, 10);
			cameraNode.Rotation = new Quaternion(-0.121f, 0.878f, -0.305f, -0.35f);
			camera = cameraNode.CreateComponent<Camera>();

			// Light
			Node lightNode = cameraNode.CreateChild(name: "light");
			var light = lightNode.CreateComponent<Light>();
			light.LightType = LightType.Point;
			light.Range = 100;
			light.Brightness = 1.3f;

			// Viewport
			var viewport = new Viewport(Context, scene, camera, null);
			Renderer.SetViewport(0, viewport);
			viewport.SetClearColor(new Color(0.4f, 0.4f, 0.4f));

			plotNode = scene.CreateChild();
			var baseNode = plotNode.CreateChild().CreateChild();
			var plane = baseNode.CreateComponent<StaticModel>();
			plane.Model = ResourceCache.GetModel("Models/Plane.mdl");

			int size = 5;
			baseNode.Scale = new Vector3(size * 1.5f, 1, size * 1.5f);
			for (var i = 0f; i < size * 1.5f; i += 1.5f)
			{
				for (var j = 0f; j < size * 1.5f; j += 1.5f)
				{
					var boxNode = plotNode.CreateChild();
					boxNode.Position = new Vector3(size / 2f - i + 0.5f, 0, size / 2f - j + 0.5f);
					var box = new Bar(h => Math.Round(h, 1).ToString(), new Color(Sample.NextRandom(), Sample.NextRandom(), Sample.NextRandom(), 0.9f));
					boxNode.AddComponent(box);
					box.Value = (Math.Abs(i) + Math.Abs(j) + 1) / 2f;
				}
			}
			await plotNode.RunActionsAsync(new EaseBackOut(new RotateBy(2f, 0, 360, 0)));
			movementsEnabled = true;
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:49,代码来源:Charts.cs


示例14: Chunk

    public Chunk()
    {
        int primModCount = 300;
        primitiveMods = new DensityPrimitive[primModCount];

        //primitiveMods[0] = new DensityPrimitive(1, 0, new Vector3 (20, 20, 0), new Vector3(10, 10, 10));
        //primitiveMods[1] = new DensityPrimitive(0, 1, new Vector3 (20, 25, 0), new Vector3(5, 3, 5));

        vertices = new List<Vector3>();
        normals = new List<Vector3>();
        indices = new List<int>();

        tree = new Octree();
        meshObject = null;
        voxelMesh = null;
        meshObject = (GameObject) GameObject.Instantiate(Resources.Load("ChunkMesh"), Vector3.zero, Quaternion.identity);
    }
开发者ID:Colt-Zero,项目名称:DualContouringGPU,代码行数:17,代码来源:Chunk.cs


示例15: OctreeQuantizer

        /// <summary>
        /// Construct the octree quantizer
        /// </summary>
        /// <remarks>
        /// The Octree quantizer is a two pass algorithm. The initial pass sets up the octree,
        /// the second pass quantizes a color based on the nodes in the tree
        /// </remarks>
        /// <param name="maxColors">The maximum number of colors to return</param>
        /// <param name="maxColorBits">The number of significant bits</param>
        /// <param name="enableTransparency">If true, then one color slot in the palette will be reserved for transparency. 
        /// Any color passed through QuantizePixel which does not have an alpha of 255 will use this color slot.
        /// If false, then all colors should have an alpha of 255. Otherwise the results may be unpredictable.</param>
        public OctreeQuantizer(int maxColors, bool enableTransparency) 
            : base(false)
        {
            if (maxColors > 256)
            {
                throw new ArgumentOutOfRangeException("maxColors", maxColors, "The number of colors should be 256 or less");
            }

            if (maxColors < 2)
            {
                throw new ArgumentOutOfRangeException("maxColors", maxColors, "The number of colors must be 2 or more");
            }

            this.octree = new Octree(8); // 8-bits per color
            this.enableTransparency = enableTransparency;
            this.maxColors = maxColors - (this.enableTransparency ? 1 : 0); // subtract 1 if enableTransparency is true
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:29,代码来源:OctreeQuantizer.cs


示例16: OctreeQuantizer

        /// <summary>
        /// Construct the octree quantizer
        /// </summary>
        /// <remarks>
        /// The Octree quantizer is a two pass algorithm. The initial pass sets up the octree,
        /// the second pass quantizes a color based on the nodes in the tree
        /// </remarks>
        /// <param name="maxColors">The maximum number of colors to return</param>
        /// <param name="maxColorBits">The number of significant bits</param>
        public OctreeQuantizer(int maxColors, int maxColorBits)
            : base(false)
        {
            if (maxColors > 255)
            {
                throw new ArgumentOutOfRangeException("maxColors", maxColors, "The number of colors should be less than 256");
            }

            if (maxColors < 2)
            {
                throw new ArgumentOutOfRangeException("maxColors", maxColors, "The number of colors must be 2 or more");
            }

            if ((maxColorBits < 1) |(maxColorBits > 8))
            {
                throw new ArgumentOutOfRangeException("maxColorBits", maxColorBits, "This should be between 1 and 8");
            }

            _octree = new Octree(maxColorBits);
            _maxColors = maxColors;
        }
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:30,代码来源:OctreeQuantizer.cs


示例17: MakeShape

        protected override Shape MakeShape()
        {
            var mf = GetComponent<MeshFilter>();
            var mesh = mf.mesh;
            if (mesh == null) { Debug.Log("No Mesh found!"); return null; }

            if (IsTrigger || Convex)
            {
                Convex = IsTrigger;
                return new ConvexHullShape(GetComponent<MeshFilter>().mesh.vertices.Select(vert => vert.ConvertToJVector()).ToList());
            }
            var positions = new List<JVector>();
            var indices = new List<TriangleVertexIndices>();

            var vertices = mesh.vertices;
            var count = mesh.vertices.Length;
            var scale = transform.lossyScale;
            for (var i = 0; i < count; i++)
            {
                var v = vertices[i];
                v.x *= scale.x;
                v.y *= scale.y;
                v.z *= scale.z;

                positions.Add(new JVector(v.x, v.y, v.z));
            }

            count = mesh.triangles.Length;
            var triangles = mesh.triangles;
            for (var i = 0; i < count; i += 3)
            {
                indices.Add(new TriangleVertexIndices(triangles[i], triangles[i + 2], triangles[i + 1]));
            }

            var octree = new Octree(positions, indices);
            octree.BuildOctree();

            return new TriangleMeshShape(octree);
        }
开发者ID:BenjaminMoore,项目名称:JPhysics,代码行数:39,代码来源:JMesh.cs


示例18: ReduceColor

        /// <summary>
        /// Constructor takes the variables and processes the image
        /// </summary>
        /// <param name="image">The image to reduce</param>
        /// <param name="maxColors">The maximum number of colors to use value must be between 2 and 255</param>
        public ReduceColor(Bitmap image, int maxColors)
        {
            if (maxColors < 2 || maxColors > 255)
                throw new ArgumentOutOfRangeException("maxColors", maxColors, "The maximum number of colors should be between 2 and 255");

            int maxColorBits = 8;
            for (int i = 1, j = 2; i < 9; ++i, j *= 2)
            {
                if (maxColors <= j)
                {
                    maxColorBits = i;
                    break;
                }
            }

            Octree tree = new Octree(maxColorBits);
            Rectangle bounds = new Rectangle(0, 0, image.Width, image.Height);
            Bitmap copy = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppArgb);
            Bitmap output = new Bitmap(image.Width, image.Height, PixelFormat.Format8bppIndexed);

            using (Graphics g = Graphics.FromImage(copy))
            {
                g.PageUnit = GraphicsUnit.Pixel;
                g.DrawImageUnscaled(image, bounds);
            }

            BitmapData imgData = null;
            try
            {
                imgData = copy.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
                firstPass(tree, imgData, image.Width, image.Height);
                output.Palette = palette(tree, output.Palette, maxColors);
                secondPass(tree, imgData, output, image.Width, image.Height, bounds, maxColors);
            }
            finally { copy.UnlockBits(imgData); }

            _rst = output;
        }
开发者ID:Leonscape,项目名称:ESWCtrls,代码行数:43,代码来源:ReduceColor.cs


示例19: Window

        public Window()
            : base(1280, 720, new GraphicsMode(32, 0, 0, 4), "OpenCAD")
        {
            stl = new STL("Models/elephant.stl", Color.Green, STLType.Binary);

            var s1 = new Sphere {Center = Vect3.Zero, Radius = 4};
            var s2 = new Sphere {Center = new Vect3(0,5,0), Radius = 4};
            var t1 = new Octree<Voxel>(Vect3.Zero, 32.0);
            var t2 = new Octree<Voxel>(Vect3.Zero, 32.0);

            Test2(t1, node => s1.Intersects(node.AABB));
            Test(t2, stl.Elements);

            _tree = t1.Union(t2);

            //_tree.Test(node => sphere.Intersects(node.AABB),maxLevel);
            //Test2(t, node => sphere.Intersects(node.AABB));

            //t[0].Clear();
            //t[0].Clear();
            //Test(_tree,stl.Elements);
            //create from stl
            //foreach (var tri in stl.Elements)
            //{
            //    Intersect(_tree, tri);
            //}

            VSync = VSyncMode.On;

            _camera = new Camera();
            Mouse.WheelChanged += (sender, args) =>
                {
                    _camera.View = _camera.View * Mat4.Translate(0, 0, args.DeltaPrecise * -10.0);
                    //_camera.Eye += new Vect3(0, 0, args.DeltaPrecise * -10.0);
                    // Console.WriteLine(_camera.Eye);
                };
        }
开发者ID:veggielane,项目名称:OctreeTest,代码行数:37,代码来源:Window.cs


示例20: DoQuantize

        /// <summary>
        /// Does the quantize.
        /// </summary>
        /// <param name="bitmapSource">The bitmap source.</param>
        /// <param name="pixelFormat">The pixel format.</param>
        /// <param name="useDither">if set to <c>true</c> [use dither].</param>
        /// <returns>The quantized image with the recalculated color palette.</returns>
        private static Bitmap DoQuantize(Bitmap bitmapSource, PixelFormat pixelFormat, bool useDither)
        {
            // We use these values a lot
            int width = bitmapSource.Width;
            int height = bitmapSource.Height;
            Rectangle sourceRect = Rectangle.FromLTRB(0, 0, width, height);

            Bitmap bitmapOptimized = null;

            try
            {
                // Create a bitmap with the same dimensions and the desired format
                bitmapOptimized = new Bitmap(width, height, pixelFormat);

                // Lock the bits of the source image for reading.
                // we will need to write if we do the dither.
                BitmapData bitmapDataSource = bitmapSource.LockBits(
                    sourceRect,
                    ImageLockMode.ReadWrite,
                    PixelFormat.Format32bppArgb);

                try
                {
                    // Perform the first pass, which generates the octree data
                    // Create an Octree
                    Octree octree = new Octree(pixelFormat);

                    // Stride might be negative, indicating inverted row order.
                    // Allocate a managed buffer for the pixel data, and copy it from the unmanaged pointer.
                    int strideSource = Math.Abs(bitmapDataSource.Stride);
                    byte[] sourceDataBuffer = new byte[strideSource * height];
                    Marshal.Copy(bitmapDataSource.Scan0, sourceDataBuffer, 0, sourceDataBuffer.Length);

                    // We could skip every other row and/or every other column when sampling the colors
                    // of the source image, rather than hitting every other pixel. It doesn't seem to
                    // degrade the resulting image too much. But it doesn't really help the performance
                    // too much because the majority of the time seems to be spent in other places.

                    // For every row
                    int rowStartSource = 0;
                    for (int ndxRow = 0; ndxRow < height; ndxRow += 1)
                    {
                        // For each column
                        for (int ndxCol = 0; ndxCol < width; ndxCol += 1)
                        {
                            // Add the color (4 bytes per pixel - ARGB)
                            Pixel pixel = GetSourcePixel(sourceDataBuffer, rowStartSource, ndxCol);
                            octree.AddColor(pixel);
                        }

                        rowStartSource += strideSource;
                    }

                    // Get the optimized colors
                    Color[] colors = octree.GetPaletteColors();

                    // Set the palette from the octree
                    ColorPalette palette = bitmapOptimized.Palette;
                    for (var ndx = 0; ndx < palette.Entries.Length; ++ndx)
                    {
                        // Use the colors we calculated
                        // for the rest, just set to transparent
                        palette.Entries[ndx] = (ndx < colors.Length)
                            ? colors[ndx]
                            : Color.Transparent;
                    }

                    bitmapOptimized.Palette = palette;

                    // Lock the bits of the optimized bitmap for writing.
                    // we will also need to read if we are doing 1bpp or 4bpp
                    BitmapData bitmapDataOutput = bitmapOptimized.LockBits(sourceRect, ImageLockMode.ReadWrite, pixelFormat);
                    try
                    {
                        // Create a managed array for the destination bytes given the desired color depth
                        // and marshal the unmanaged data to the managed array
                        int strideOutput = Math.Abs(bitmapDataOutput.Stride);
                        byte[] bitmapOutputBuffer = new byte[strideOutput * height];

                        // For each source pixel, compute the appropriate color index
                        rowStartSource = 0;
                        int rowStartOutput = 0;

                        for (int ndxRow = 0; ndxRow < height; ++ndxRow)
                        {
                            // For each column
                            for (int ndxCol = 0; ndxCol < width; ++ndxCol)
                            {
                                // Get the source color
                                Pixel pixel = GetSourcePixel(sourceDataBuffer, rowStartSource, ndxCol);

                                // Get the closest palette index
                                int paletteIndex = octree.GetPaletteIndex(pixel);
//.........这里部分代码省略.........
开发者ID:jesperordrup,项目名称:ImageProcessor,代码行数:101,代码来源:ColorQuantizer.cs



注:本文中的Octree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OctreeNode类代码示例发布时间:2022-05-24
下一篇:
C# OctetString类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap