Exemplo n.º 1
0
        /// <summary>
        /// Return true if rhs has the same transform, antialiasing,
        /// and fractional metrics values as this. </summary>
        /// <param name="rhs"> the <code>FontRenderContext</code> to test for equality </param>
        /// <returns> <code>true</code> if <code>rhs</code> is equal to
        ///         this <code>FontRenderContext</code>; <code>false</code>
        ///         otherwise.
        /// @since 1.4 </returns>
        public virtual bool Equals(FontRenderContext rhs)
        {
            if (this == rhs)
            {
                return(true);
            }
            if (rhs == null)
            {
                return(false);
            }

            /* if neither instance is a subclass, reference values directly. */
            if (!rhs.Defaulting && !Defaulting)
            {
                if (rhs.AaHintValue == AaHintValue && rhs.FmHintValue == FmHintValue)
                {
                    return(Tx == null ? rhs.Tx == null : Tx.Equals(rhs.Tx));
                }
                return(false);
            }
            else
            {
                return(rhs.AntiAliasingHint == AntiAliasingHint && rhs.FractionalMetricsHint == FractionalMetricsHint && rhs.Transform.Equals(Transform));
            }
        }
        private void ProcessAspectRatioPositionAndCompare(String alignValue, AffineTransform cmpTransform)
        {
            SvgDrawContext context = new SvgDrawContext(null, null);

            // topmost viewport has default page size values for bounding rectangle
            context.AddViewPort(VIEWPORT_VALUE);
            float[] viewboxValues = VIEWBOX_VALUES;
            float   scaleWidth    = 1.0f;
            float   scaleHeight   = 1.0f;
            AbstractBranchSvgNodeRenderer renderer            = new SvgTagSvgNodeRenderer();
            IDictionary <String, String>  attributesAndStyles = new Dictionary <String, String>();

            renderer.SetAttributesAndStyles(attributesAndStyles);
            AffineTransform outTransform = renderer.ProcessAspectRatioPosition(context, viewboxValues, alignValue, scaleWidth
                                                                               , scaleHeight);

            NUnit.Framework.Assert.IsTrue(cmpTransform.Equals(outTransform));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns <code>true</code> if rhs is a <code>TransformAttribute</code>
 /// whose transform is equal to this <code>TransformAttribute</code>'s
 /// transform. </summary>
 /// <param name="rhs"> the object to compare to </param>
 /// <returns> <code>true</code> if the argument is a <code>TransformAttribute</code>
 /// whose transform is equal to this <code>TransformAttribute</code>'s
 /// transform.
 /// @since 1.6 </returns>
 public override bool Equals(Object rhs)
 {
     if (rhs != null)
     {
         try
         {
             TransformAttribute that = (TransformAttribute)rhs;
             if (Transform_Renamed == null)
             {
                 return(that.Transform_Renamed == null);
             }
             return(Transform_Renamed.Equals(that.Transform_Renamed));
         }
         catch (ClassCastException)
         {
         }
     }
     return(false);
 }