コード例 #1
0
        public CGRect[] GetRectArray(NSRange glyphRange, NSRange selectedGlyphRange, NSTextContainer textContainer)
        {
            if (textContainer == null)
                throw new ArgumentNullException ("textContainer");

            nuint rectCount;
            var retHandle = GetRectArray (glyphRange, selectedGlyphRange, textContainer.Handle, out rectCount);
            var returnArray = new CGRect [rectCount];

            unsafe {
                float *ptr = (float*) retHandle;
                for (nuint i = 0; i < rectCount; ++i) {
                    returnArray [i] = new CGRect (ptr [0], ptr [1], ptr [2], ptr [3]);
                    ptr += 4;
                }
            }
            return returnArray;
        }
コード例 #2
0
        public CGRect [] GetRectArray(NSRange glyphRange, NSRange selectedGlyphRange, NSTextContainer textContainer)
        {
            if (textContainer == null)
            {
                throw new ArgumentNullException("textContainer");
            }

            nuint rectCount;
            var   retHandle   = GetRectArray(glyphRange, selectedGlyphRange, textContainer.Handle, out rectCount);
            var   returnArray = new CGRect [rectCount];

            unsafe {
                float *ptr = (float *)retHandle;
                for (nuint i = 0; i < rectCount; ++i)
                {
                    returnArray [i] = new CGRect(ptr [0], ptr [1], ptr [2], ptr [3]);
                    ptr            += 4;
                }
            }
            return(returnArray);
        }