Exemplo n.º 1
0
        /// <summary>
        /// When TransformToOrthogProjection is enabled, we need to get the current orthogonal transformation,
        /// the font scale, and ensure that the projection is actually orthogonal
        /// </summary>
        /// <param name="fontScale"></param>
        /// <param name="viewportTransform"></param>
        private static TransformViewport OrthogonalTransform(out float fontScale)
        {
            bool  isOrthog;
            float left, right, bottom, top;

            ProjectionStack.GetCurrentOrthogProjection(out isOrthog, out left, out right, out bottom, out top);

            if (!isOrthog)
            {
                throw new ArgumentOutOfRangeException("Current projection matrix was not Orthogonal. Please ensure that you have set an orthogonal projection before attempting to create a font with the TransformToOrthogProjection flag set to true.");
            }

            var viewportTransform = new TransformViewport(left, top, right - left, bottom - top);

            fontScale = Math.Abs((float)ProjectionStack.CurrentViewport.Value.Height / viewportTransform.Height);
            return(viewportTransform);
        }
Exemplo n.º 2
0
        /// <summary>
        /// When TransformToOrthogProjection is enabled, we need to get the current orthogonal transformation,
        /// the font scale, and ensure that the projection is actually orthogonal
        /// </summary>
        /// <param name="fontScale"></param>
        /// <param name="viewportTransform"></param>
        private static TransformViewport OrthogonalTransform(out float fontScale)
        {
            bool isOrthog;
            float left,right,bottom,top;
            ProjectionStack.GetCurrentOrthogProjection(out isOrthog,out left,out right,out bottom,out top);

            if (!isOrthog)
                throw new ArgumentOutOfRangeException("Current projection matrix was not Orthogonal. Please ensure that you have set an orthogonal projection before attempting to create a font with the TransformToOrthogProjection flag set to true.");

            var viewportTransform = new TransformViewport(left, top, right - left, bottom - top);
            fontScale = Math.Abs((float)ProjectionStack.CurrentViewport.Value.Height / viewportTransform.Height);
            return viewportTransform;
        }
Exemplo n.º 3
0
		/// <summary>
		/// When TransformToOrthogProjection is enabled, we need to get the current orthogonal transformation,
		/// the font scale, and ensure that the projection is actually orthogonal
		/// </summary>
		/// <param name="fontScale"></param>
		public static TransformViewport OrthogonalTransform(out float fontScale)
		{
			bool isOrthog;
			float left,right,bottom,top;
			ProjectionStack.GetCurrentOrthogProjection(out isOrthog,out left,out right,out bottom,out top);

			if (!isOrthog)
				throw new ArgumentOutOfRangeException(ORTHOGONAL_ERROR);

			var viewportTransform = new TransformViewport(left, top, right - left, bottom - top);
			fontScale = Math.Abs((float)ProjectionStack.CurrentViewport.Value.Height / viewportTransform.Height);
			return viewportTransform;
		}     
Exemplo n.º 4
0
		private static TransformViewport OrthogonalTransform(Matrix4 transform, float height, out float fontScale)
		{
			bool isOrthog;
			float left,right,bottom,top;
			Helper.IsMatrixOrthogonal(out isOrthog,out left,out right,out bottom,out top, transform);

			if (!isOrthog)
				throw new ArgumentOutOfRangeException(ORTHOGONAL_ERROR);

			var viewportTransform = new TransformViewport(left, top, right - left, bottom - top);
			fontScale = Math.Abs(height / viewportTransform.Height);
			return viewportTransform;
		}