public void SetAttributes(NSDictionary attributes, NSRange range) { if (attributes == null) throw new ArgumentNullException ("attributes"); LowLevelSetAttributes (attributes.Handle, range); }
public unsafe nuint[] GetIndexes(NSRange range) { var ret = new nuint [range.Length]; fixed (nuint *ptr = ret) _GetIndexes ((IntPtr) ptr, range); return ret; }
public unsafe CLLocationCoordinate2D[] GetCoordinates(int first, int count) { var range = new NSRange (first, count); var target = new CLLocationCoordinate2D [count]; fixed (CLLocationCoordinate2D *firstE = &target [0]){ GetCoords ((IntPtr) firstE, range); } return target; }
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; }
public unsafe nuint GetGlyphs ( NSRange glyphRange, short[] /* CGGlyph* = CGFontIndex* = unsigned short* */ glyphBuffer, NSGlyphProperty[] /* NSGlyphProperty* = nint* */ props, nuint[] /* NSUInteger */ charIndexBuffer, byte[] /* (unsigned char *) */ bidiLevelBuffer) { if (glyphBuffer != null && glyphBuffer.Length < glyphRange.Length) throw new ArgumentOutOfRangeException (string.Format ("glyphBuffer must have at least {0} elements", glyphRange.Length)); if (props != null && props.Length < glyphRange.Length) throw new ArgumentOutOfRangeException (string.Format ("props must have at least {0} elements", glyphRange.Length)); if (charIndexBuffer != null && charIndexBuffer.Length < glyphRange.Length) throw new ArgumentOutOfRangeException (string.Format ("props must have at least {0} elements", glyphRange.Length)); if (bidiLevelBuffer != null && bidiLevelBuffer.Length < glyphRange.Length) throw new ArgumentOutOfRangeException (string.Format ("bidiLevelBuffer must have at least {0} elements", glyphRange.Length)); fixed (short* glyphs = glyphBuffer) { nuint rv; #if XAMCORE_2_0 && ARCH_32 // Unified/32: the output array is not the correct size, it needs to be int[], and it's an array of NSGlyphProperty (which is long) var tmpArray = new nint [props.Length]; fixed (nint *properties = tmpArray) { #else // Unified/64 + Classic: the input array is the correct size fixed (NSGlyphProperty *properties = props) { #endif fixed (nuint* charIBuffer = charIndexBuffer) { fixed (byte* bidi = bidiLevelBuffer) { rv = GetGlyphsInternal (glyphRange, (IntPtr) glyphs, (IntPtr) properties, (IntPtr) charIBuffer, (IntPtr) bidi); } } } #if XAMCORE_2_0 && ARCH_32 // Marshal back from the tmpArray. for (int i = 0; i < props.Length; i++) props [i] = (NSGlyphProperty) (long) tmpArray [i]; #endif return rv; } }
public void GetLineOrigins(NSRange range, CGPoint[] origins) { if (origins == null) throw new ArgumentNullException ("origins"); if (range.Length != 0 && origins.Length < range.Length) throw new ArgumentException ("origins must contain at least range.Length elements.", "origins"); else if (origins.Length < CFArray.GetCount (CTFrameGetLines (handle))) throw new ArgumentException ("origins must contain at least GetLines().Length elements.", "origins"); CTFrameGetLineOrigins (handle, range, origins); }
public CTFrame GetFrame(NSRange stringRange, CGPath path, CTFrameAttributes frameAttributes) { if (path == null) throw new ArgumentNullException ("path"); var frame = CTFramesetterCreateFrame (handle, stringRange, path.Handle, frameAttributes == null ? IntPtr.Zero : frameAttributes.Dictionary.Handle); if (frame == IntPtr.Zero) return null; return new CTFrame (frame, true); }
static extern CGSize CTFramesetterSuggestFrameSizeWithConstraints( IntPtr framesetter, NSRange stringRange, IntPtr frameAttributes, CGSize constraints, out NSRange fitRange);
static extern IntPtr CTFramesetterCreateFrame(IntPtr framesetter, NSRange stringRange, IntPtr path, IntPtr frameAttributes);
public UIStringAttributes GetUIKitAttributes(nint location, out NSRange effectiveRange) { var attr = GetAttributes (location, out effectiveRange); return attr == null ? null : new UIStringAttributes (attr); }
public CTStringAttributes GetCoreTextAttributes(nint location, out NSRange effectiveRange) { var attr = GetAttributes (location, out effectiveRange); return attr == null ? null : new CTStringAttributes (attr); }
public static extern void void_objc_msgSend_stret_rnsrange(ref NSRange stret, IntPtr receiver, IntPtr selector);
public bool ApplyTransform(NSStringTransform transform, bool reverse, NSRange range, out NSRange resultingRange) { return ApplyTransform (NSString.NSStringTransformToCode (transform), reverse, range, out resultingRange); }
public void SetAttributes(CTStringAttributes attrs, NSRange range) { SetAttributes (attrs == null ? null : attrs.Dictionary, range); }
public void InsertCompletionforPartialWord(string word, NSRange charRange, int movement, bool isFinal) { InsertCompletion (word, charRange, movement, isFinal); }
public void SetAlignmentrange(NSTextAlignment alignment, NSRange range) { SetAlignmentRange (alignment, range); }
public bool ShouldChangeTextInRangereplacementString(NSRange affectedCharRange, string replacementString) { return ShouldChangeText (affectedCharRange, replacementString); }
public void SetSpellingStaterange(int value, NSRange charRange) { SetSpellingState (value, charRange); }
public void SetSelectedRangeaffinitystillSelecting(NSRange charRange, NSSelectionAffinity affinity, bool stillSelectingFlag) { SetSelectedRange (charRange, affinity, stillSelectingFlag); }
public void SetBaseWritingDirectionrange(NSWritingDirection writingDirection, NSRange range) { SetBaseWritingDirection (writingDirection, range); }
public static extern void void_objc_msgSend_nsrange(IntPtr receiver, IntPtr selector, NSRange arg1);
static extern void CTFrameGetLineOrigins(IntPtr handle, NSRange range, [Out] CGPoint[] origins);
public void AddAttributes(UIStringAttributes attrs, NSRange range) { AddAttributes (attrs == null ? null : attrs.Dictionary, range); }
public CTLine GetLine(NSRange stringRange) { var h = CTTypesetterCreateLine (handle, stringRange); if (h == IntPtr.Zero) return null; return new CTLine (h, true); }
// check helpers to avoid native exceptions void Check(NSRange range) { if (range.Location + range.Length > Length) throw new ArgumentOutOfRangeException ("range"); }
static extern IntPtr CTTypesetterCreateLine(IntPtr typesetter, NSRange stringRange);
public NSDictionary GetAttributes(nint location, out NSRange effectiveRange) { return Runtime.GetNSObject<NSDictionary> (LowLevelGetAttributes (location, out effectiveRange)); }
static extern IntPtr CTTypesetterCreateLineWithOffset(IntPtr typesetter, NSRange stringRange, double offset);
public CTStringAttributes GetCoreTextAttributes(nint location, out NSRange longestEffectiveRange, NSRange rangeLimit) { var attr = GetAttributes (location, out longestEffectiveRange, rangeLimit); return attr == null ? null : new CTStringAttributes (attr); }
public CGSize SuggestFrameSize(NSRange stringRange, CTFrameAttributes frameAttributes, CGSize constraints, out NSRange fitRange) { return CTFramesetterSuggestFrameSizeWithConstraints ( handle, stringRange, frameAttributes == null ? IntPtr.Zero : frameAttributes.Dictionary.Handle, constraints, out fitRange); }