Table of Contents

Class DemoDiscreteRgb

Namespace
Sample.Disp
Assembly
Hi.Sample.Wpf.dll

Demonstrates the use of discrete RGB colors for rendering multiple objects. Shows how to apply different colors to similar geometric shapes using the GetDiscreteRGB_Env(double, double) method from ColorUtil class.

public class DemoDiscreteRgb : IDisplayee, IExpandToBox3d
Inheritance
DemoDiscreteRgb
Implements
Inherited Members

Remarks

Source Code

using Hi.Disp;
using Hi.Disp.Flag;
using Hi.Geom;
using Hi.Coloring;

namespace Sample.Disp
{
    /// <summary>
    /// Demonstrates the use of discrete RGB colors for rendering multiple objects.
    /// Shows how to apply different colors to similar geometric shapes using the 
    /// <see cref="ColorUtil.GetDiscreteRGB_Env"/> method from <see cref="ColorUtil"/> class.
    /// </summary>
    /// <remarks>
    /// ### Source Code
    /// [!code-csharp[SampleCode](~/../Hi.Sample.Wpf/Disp/DemoDiscreteRgb.cs)]
    /// </remarks>
    public class DemoDiscreteRgb : IDisplayee
    {
        /// <inheritdoc/>
        public void Display(Bind bind)
        {
            bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
            new Box3d(0, 0, 0, 1, 1, 1).ToDraw_Face().Display(bind);

            bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
            new Box3d(1, 0, 0, 2, 1, 1).ToDraw_Face().Display(bind);

            bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
            new Box3d(2, 0, 0, 3, 1, 1).ToDraw_Face().Display(bind);
        }
        /// <inheritdoc/>
        public void ExpandToBox3d(Box3d dst)
        {
            dst.Expand(new Vec3d(0, 0, 0));
            dst.Expand(new Vec3d(3, 1, 1));
        }

        static void Main()
        {
            DemoUtil.RunApplication("Demo Discrete I",
                new DispList(new CoordinateDrawing(), new DemoDiscreteRgb()));
        }

    }
}

Methods

Display(Bind)

Display function called in DispEngine rendering loop.

public void Display(Bind bind)

Parameters

bind Bind

Bind with DispEngine. See Bind.

ExpandToBox3d(Box3d)

Expands the destination box. This function is usually used to compute the bounding box of elements.

public void ExpandToBox3d(Box3d dst)

Parameters

dst Box3d

Destination box