示例#1
0
        internal IntPtr NonConstPointer()
        {
            if (m_ptr_attributes != IntPtr.Zero)
            {
                return(m_ptr_attributes);
            }

            // Check pipeline_parent first since this is typically time critical
            // code when this is used.
            DisplayPipeline pipeline_parent = m_parent as DisplayPipeline;

            if (pipeline_parent != null)
            {
                // We can cheat and use a const pointer for the non-const version. This is
                // because when a pipeline is associated with attributes, it typically
                // happens when conduits are involved. When conduits are being called, the
                // attributes are exposed as a non const pointer.
                return(pipeline_parent.DisplayAttributeConstPointer());
            }

            DisplayModeDescription parent = m_parent as DisplayModeDescription;

            if (parent != null)
            {
                return(parent.DisplayAttributeNonConstPointer());
            }
            return(IntPtr.Zero);
        }
示例#2
0
 /// <summary>
 /// Exports a DisplayModeDescription to a Windows-style .ini file.
 /// </summary>
 /// <param name="displayMode">The DisplayModeDescription to export.</param>
 /// <param name="filename">The name of the file to create.</param>
 /// <returns></returns>
 /// <since>6.0</since>
 public static bool ExportToFile(DisplayModeDescription displayMode, string filename)
 {
     if (null == displayMode || string.IsNullOrEmpty(filename))
     {
         return(false);
     }
     return(UnsafeNativeMethods.RHC_RhExportDisplayAttrsMgrListDesc(displayMode.Id, filename));
 }
示例#3
0
        /// <summary>
        /// Gets all display mode descriptions that Rhino currently knows about.
        /// </summary>
        /// <returns>
        /// Copies of all of the display mode descriptions. If you want to modify
        /// these descriptions, you must call UpdateDisplayMode or AddDisplayMode.
        /// </returns>
        /// <example>
        /// <code source='examples\vbnet\ex_advanceddisplay.vb' lang='vbnet'/>
        /// <code source='examples\cs\ex_advanceddisplay.cs' lang='cs'/>
        /// <code source='examples\py\ex_advanceddisplay.py' lang='py'/>
        /// </example>
        /// <since>5.0</since>
        public static DisplayModeDescription[] GetDisplayModes()
        {
            IntPtr pDisplayAttrsMgrList = UnsafeNativeMethods.DisplayAttrsMgrList_New();
            int    count = UnsafeNativeMethods.CRhinoDisplayAttrsMgr_GetDisplayAttrsList(pDisplayAttrsMgrList);

            if (count < 1)
            {
                return(new DisplayModeDescription[0]);
            }
            DisplayModeDescription[] rc = new DisplayModeDescription[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr pDisplayMode = UnsafeNativeMethods.DisplayAttrsMgrListDesc_NewFromList(pDisplayAttrsMgrList, i);
                if (pDisplayMode != IntPtr.Zero)
                {
                    rc[i] = new DisplayModeDescription(pDisplayMode);
                }
            }
            UnsafeNativeMethods.DisplayAttrsMgrList_Delete(pDisplayAttrsMgrList);
            return(rc);
        }
示例#4
0
        internal IntPtr ConstPointer()
        {
            if (m_ptr_attributes != IntPtr.Zero)
            {
                return(m_ptr_attributes);
            }

            // Check pipeline_parent first since this is typically time critical
            // code when this is used.
            DisplayPipeline pipeline_parent = m_parent as DisplayPipeline;

            if (pipeline_parent != null)
            {
                return(pipeline_parent.DisplayAttributeConstPointer());
            }

            DisplayModeDescription parent = m_parent as DisplayModeDescription;

            if (parent != null)
            {
                return(parent.DisplayAttributeConstPointer());
            }
            return(IntPtr.Zero);
        }
示例#5
0
 /// <summary>
 /// Capture View contents to a bitmap using a display mode description to define
 /// how drawing is performed.
 /// </summary>
 /// <param name="mode">The display mode.</param>
 /// <returns>A new bitmap.</returns>
 /// <since>5.0</since>
 public System.Drawing.Bitmap CaptureToBitmap(DisplayModeDescription mode)
 {
     return(CaptureToBitmap(ClientRectangle.Size, mode));
 }
示例#6
0
        /// <summary>
        /// Capture View contents to a bitmap using a display mode description to define
        /// how drawing is performed.
        /// </summary>
        /// <param name="size">The width and height of the returned bitmap.</param>
        /// <param name="mode">The display mode.</param>
        /// <returns>A new bitmap.</returns>
        /// <since>5.0</since>
        public System.Drawing.Bitmap CaptureToBitmap(System.Drawing.Size size, DisplayModeDescription mode)
        {
            var attr = new DisplayPipelineAttributes(mode);

            return(CaptureToBitmap(size, attr));
        }
示例#7
0
 internal DisplayPipelineAttributes(DisplayModeDescription parent)
 {
     m_parent = parent;
 }
示例#8
0
        /// <example>
        /// <code source='examples\vbnet\ex_advanceddisplay.vb' lang='vbnet'/>
        /// <code source='examples\cs\ex_advanceddisplay.cs' lang='cs'/>
        /// <code source='examples\py\ex_advanceddisplay.py' lang='py'/>
        /// </example>
        /// <since>5.0</since>
        public static bool UpdateDisplayMode(DisplayModeDescription displayMode)
        {
            IntPtr pConstDisplayMode = displayMode.ConstPointer();

            return(UnsafeNativeMethods.CRhinoDisplayAttrsMgr_Update(pConstDisplayMode));
        }
示例#9
0
        /// <since>5.0</since>
        public static Guid AddDisplayMode(DisplayModeDescription displayMode)
        {
            IntPtr pDisplayMode = displayMode.NonConstPointer();

            return(UnsafeNativeMethods.CRhinoDisplayAttrsMgr_Add(pDisplayMode));
        }