当前位置: 首页>>代码示例>>C#>>正文


C# PointF.Aspect方法代码示例

本文整理汇总了C#中System.Drawing.PointF.Aspect方法的典型用法代码示例。如果您正苦于以下问题:C# PointF.Aspect方法的具体用法?C# PointF.Aspect怎么用?C# PointF.Aspect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.PointF的用法示例。


在下文中一共展示了PointF.Aspect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UI_OnTextureSelectionChanged

        private void UI_OnTextureSelectionChanged(bool newdraw)
        {
            FetchTexture tex = CurrentTexture;

            // reset high-water mark
            m_HighWaterStatusLength = 0;

            if (tex == null) return;

            bool newtex = (m_TexDisplay.texid != tex.ID);

            // save settings for this current texture
            if (m_Core.Config.TextureViewer_PerTexSettings)
            {
                if (!m_TextureSettings.ContainsKey(m_TexDisplay.texid))
                    m_TextureSettings.Add(m_TexDisplay.texid, new TexSettings());

                m_TextureSettings[m_TexDisplay.texid].r = customRed.Checked;
                m_TextureSettings[m_TexDisplay.texid].g = customGreen.Checked;
                m_TextureSettings[m_TexDisplay.texid].b = customBlue.Checked;
                m_TextureSettings[m_TexDisplay.texid].a = customAlpha.Checked;

                m_TextureSettings[m_TexDisplay.texid].displayType = channels.SelectedIndex;
                m_TextureSettings[m_TexDisplay.texid].customShader = customShader.Text;

                m_TextureSettings[m_TexDisplay.texid].depth = depthDisplay.Checked;
                m_TextureSettings[m_TexDisplay.texid].stencil = stencilDisplay.Checked;

                m_TextureSettings[m_TexDisplay.texid].mip = mipLevel.SelectedIndex;
                m_TextureSettings[m_TexDisplay.texid].slice = sliceFace.SelectedIndex;

                m_TextureSettings[m_TexDisplay.texid].minrange = rangeHistogram.BlackPoint;
                m_TextureSettings[m_TexDisplay.texid].maxrange = rangeHistogram.WhitePoint;

                m_TextureSettings[m_TexDisplay.texid].typeHint = m_Following.GetTypeHint(m_Core);
            }

            m_TexDisplay.texid = tex.ID;

            // interpret the texture according to the currently following type.
            if(!CurrentTextureIsLocked)
                m_TexDisplay.typeHint = m_Following.GetTypeHint(m_Core);
            else
                m_TexDisplay.typeHint = FormatComponentType.None;

            // if there is no such type or it isn't being followed, use the last seen interpretation
            if (m_TexDisplay.typeHint == FormatComponentType.None && m_TextureSettings.ContainsKey(m_TexDisplay.texid))
                m_TexDisplay.typeHint = m_TextureSettings[m_TexDisplay.texid].typeHint;

            // try to maintain the pan in the new texture. If the new texture
            // is approx an integer multiple of the old texture, just changing
            // the scale will keep everything the same. This is useful for
            // downsample chains and things where you're flipping back and forth
            // between overlapping textures, but even in the non-integer case
            // pan will be kept approximately the same.
            PointF curSize = new PointF((float)CurrentTexture.width, (float)CurrentTexture.height);
            float curArea = curSize.Area();
            float prevArea = m_PrevSize.Area();

            if (prevArea > 0.0f)
            {
                float prevX = m_TexDisplay.offx;
                float prevY = m_TexDisplay.offy;
                float prevScale = m_TexDisplay.scale;

                // allow slight difference in aspect ratio for rounding errors
                // in downscales (e.g. 1680x1050 -> 840x525 -> 420x262 in the
                // last downscale the ratios are 1.6 and 1.603053435).
                if (Math.Abs(curSize.Aspect() - m_PrevSize.Aspect()) < 0.01f)
                {
                    m_TexDisplay.scale *= m_PrevSize.X / curSize.X;
                    CurrentZoomValue = m_TexDisplay.scale;
                }
                else
                {
                    // this scale factor is arbitrary really, only intention is to have
                    // integer scales come out precisely, other 'similar' sizes will be
                    // similar ish
                    float scaleFactor = (float)(Math.Sqrt(curArea) / Math.Sqrt(prevArea));

                    m_TexDisplay.offx = prevX * scaleFactor;
                    m_TexDisplay.offy = prevY * scaleFactor;
                }
            }

            m_PrevSize = curSize;

            // refresh scroll position
            ScrollPosition = ScrollPosition;

            UI_UpdateStatusText();

            mipLevel.Items.Clear();

            m_TexDisplay.mip = 0;
            m_TexDisplay.sliceFace = 0;

            bool usemipsettings = true;
            bool useslicesettings = true;

//.........这里部分代码省略.........
开发者ID:Anteru,项目名称:renderdoc,代码行数:101,代码来源:TextureViewer.cs


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