static unsafe IntPtr CreateFromSettings(CTParagraphStyleSettings s)
        {
            var handle = IntPtr.Zero;

            var specifiers = s.GetSpecifiers();

            var settings = new CTParagraphStyleSetting [specifiers.Count];
            var values   = new CTParagraphStyleSettingValue [specifiers.Count];

            int i = 0;

            foreach (var e in specifiers)
            {
                e.WriteValue(values, i);
                settings [i].spec      = e.Spec;
                settings [i].valueSize = (uint)e.ValueSize;
                ++i;
            }

            fixed(CTParagraphStyleSettingValue *pv = values)
            {
                for (i = 0; i < settings.Length; ++i)
                {
                    // TODO: is this safe on the ARM?
                    byte *p = &pv[i].int8;
                    settings[i].value = (IntPtr)p;
                }
                handle = CTParagraphStyleCreate(settings, settings.Length);
            }

            i = 0;
            foreach (var e in specifiers)
            {
                e.Dispose(values, i);
            }

            return(handle);
        }
示例#2
0
		static unsafe IntPtr CreateFromSettings (CTParagraphStyleSettings s)
		{
			var handle = IntPtr.Zero;

			var specifiers = s.GetSpecifiers ();

			var settings  = new CTParagraphStyleSetting [specifiers.Count];
			var values    = new CTParagraphStyleSettingValue [specifiers.Count];

			int i = 0;
			foreach (var e in specifiers) {
				e.WriteValue (values, i);
				settings [i].spec       = e.Spec;
				settings [i].valueSize  = (uint) e.ValueSize;
				++i;
			}

			fixed (CTParagraphStyleSettingValue* pv = values) {
				for (i = 0; i < settings.Length; ++i) {
					// TODO: is this safe on the ARM?
					byte* p = &pv[i].int8;
					settings[i].value = (IntPtr) p;
				}
				handle = CTParagraphStyleCreate (settings, settings.Length);
			}

			i = 0;
			foreach (var e in specifiers) {
				e.Dispose (values, i);
			}

			return handle;
		}
示例#3
0
		public override void Dispose (CTParagraphStyleSettingValue[] values, int index)
		{
			values [index].pointer = IntPtr.Zero;
			value.Dispose ();
			value = null;
		}
示例#4
0
		internal override void WriteValue (CTParagraphStyleSettingValue[] values, int index)
		{
			values [index].pointer = value.Handle;
		}
示例#5
0
		internal override void WriteValue (CTParagraphStyleSettingValue[] values, int index)
		{
			values [index].single = value;
		}
示例#6
0
		public virtual void Dispose (CTParagraphStyleSettingValue[] values, int index)
		{
		}
示例#7
0
		internal abstract void WriteValue (CTParagraphStyleSettingValue[] values, int index);