Ejemplo n.º 1
0
        static int OnGetColor(int serialNumber, Point3d uvw, Vector3d duvwdx, Vector3d duvwdy, ref Display.Color4f color)
        {
            int rc = 0;
            TextureEvaluator eval = FromSerialNumber(serialNumber);

            if (eval != null)
            {
                Display.Color4f c = eval.GetColor(uvw, duvwdx, duvwdy);
                if (c != Display.Color4f.Empty)
                {
                    color = c;
                    rc    = 1;
                }
            }
            return(rc);
        }
Ejemplo n.º 2
0
        public virtual Display.Color4f GetColor(Point3d uvw, Vector3d duvwdx, Vector3d duvwdy)
        {
            if (m_runtime_serial_number > 0)
            {
                return(Display.Color4f.Empty);
            }
            IntPtr pConstThis = ConstPointer();

            Display.Color4f rc = new Display.Color4f();

            if (!UnsafeNativeMethods.Rdk_TextureEvaluator_GetColor(pConstThis, uvw, duvwdx, duvwdy, ref rc))
            {
                return(Display.Color4f.Empty);
            }
            return(rc);
        }
Ejemplo n.º 3
0
            /// <summary>
            /// Displays the standard modal color picker dialog for floating point colors.
            /// </summary>
            /// <param name="parent">Parent window for this dialog, should always pass this if calling from a form or user control.</param>
            /// <param name="color">The initial color to set the picker to and also accepts the user's choice.</param>
            /// <param name="allowAlpha">Specifies if the color picker should allow changes to the alpha channel or not.</param>
            /// <returns>true if a color was picked, false if the user canceled the picker dialog.</returns>
            public static bool ShowColorDialog(System.Windows.Forms.IWin32Window parent, ref Display.Color4f color, bool allowAlpha)
            {
                if (null == parent)
                {
                    parent = RhinoApp.MainWindow();
                }

                IntPtr handle_parent = IntPtr.Zero;

                if (null != parent)
                {
                    handle_parent = parent.Handle;
                }

                Display.Color4f c = Display.Color4f.Empty;

                bool rc = (1 == UnsafeNativeMethods.Rdk_Globals_ShowColorPicker(handle_parent, color, allowAlpha, ref c));

                if (rc)
                {
                    color = c;
                }
                return(rc);
            }
Ejemplo n.º 4
0
    public virtual Display.Color4f GetColor(Point3d uvw, Vector3d duvwdx, Vector3d duvwdy)
    {
      if (m_runtime_serial_number > 0)
        return Display.Color4f.Empty;
      IntPtr pConstThis = ConstPointer();
      Display.Color4f rc = new Display.Color4f();

      if (!UnsafeNativeMethods.Rdk_TextureEvaluator_GetColor(pConstThis, uvw, duvwdx, duvwdy, ref rc))
        return Display.Color4f.Empty;
      return rc;
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Displays the standard modal color picker dialog for floating point colors.
 /// </summary>
 /// <param name="color">The initial color to set the picker to and also accepts the user's choice.</param>
 /// <param name="allowAlpha">Specifies if the color picker should allow changes to the alpha channel or not.</param>
 /// <returns>true if a color was picked, false if the user canceled the picker dialog.</returns>
 public static bool ShowColorDialog(ref Display.Color4f color, bool allowAlpha)
 {
     return(ShowColorDialog(null, ref color, allowAlpha));
 }