Esempio n. 1
0
        private static float BaselineInternal(
            IntPtr unmanagedNodePtr,
            float width,
            float height)
        {
            var node = YGNodeHandle.GetManaged(unmanagedNodePtr);

            if (node == null || node._baselineFunction == null)
            {
                throw new InvalidOperationException("Baseline function is not defined.");
            }
            return(node._baselineFunction(node, width, height));
        }
Esempio n. 2
0
        private static YogaSize MeasureInternal(
            IntPtr unmanagedNodePtr,
            float width,
            YogaMeasureMode widthMode,
            float height,
            YogaMeasureMode heightMode)
        {
            var node = YGNodeHandle.GetManaged(unmanagedNodePtr);

            if (node == null || node._measureFunction == null)
            {
                throw new InvalidOperationException("Measure function is not defined.");
            }
            return(node._measureFunction(node, width, widthMode, height, heightMode));
        }
Esempio n. 3
0
        private static void LoggerInternal(
            IntPtr unmanagedConfigPtr,
            IntPtr unmanagedNodePtr,
            YogaLogLevel level,
            string message)
        {
            var config = YGConfigHandle.GetManaged(unmanagedConfigPtr);

            if (config == null || config._logger == null)
            {
                // Default logger
                System.Diagnostics.Debug.WriteLine(message);
            }
            else
            {
                var node = YGNodeHandle.GetManaged(unmanagedNodePtr);
                config._logger(config, node, level, message);
            }

            if (level == YogaLogLevel.Error || level == YogaLogLevel.Fatal)
            {
                throw new InvalidOperationException(message);
            }
        }