public override TKChartData GetPoint(TKChart chart, nuint dataIndex, nuint seriesIndex) { TKChartDataPoint point = new TKChartDataPoint (); point.DataXValue = new NSNumber (dataIndex); point.DataYValue = new NSNumber(r.Next (100)); return point; }
public unsafe nuint[] GetIndexes(NSRange range) { var ret = new nuint [range.Length]; fixed (nuint *ptr = ret) _GetIndexes ((IntPtr) ptr, range); return ret; }
public unsafe nuint[] GetIndexes() { var ret = new nuint [Length]; fixed (nuint *ptr = ret) _GetIndexes ((IntPtr) ptr); return ret; }
public override void ViewDidLoad() { colors = NSArray.FromNSObjects (UIColor.Red, UIColor.Orange, UIColor.Yellow, UIColor.Green, UIColor.Blue, UIColor.Purple); View.BackgroundColor = colors.GetItem<UIColor> (colorIndex); colorIndex = (colorIndex + 1) % colors.Count; }
public unsafe nint Write(byte [] buffer, int offset, nuint len) { if (offset + (long) len > buffer.Length) throw new ArgumentException (); fixed (byte* ptr = &buffer[offset]) return objc_msgSend (Handle, Selector.GetHandle (selWriteMaxLength), (IntPtr) ptr, len); }
public unsafe nint Read(byte [] buffer, int offset, nuint len) { if (offset + (long) len > buffer.Length) throw new ArgumentException (); fixed (byte* ptr = &buffer[offset]) return Read ((IntPtr) ptr, len); }
public override void RequestTile(nuint x, nuint y, nuint zoom, ITileReceiver receiver) { _tileImageAsync((int)x, (int)y, (int)zoom).ContinueWith((Task<byte[]> task) => { var imgByte = task.Result; var image = new UIImage(NSData.FromArray(imgByte)); receiver.ReceiveTile(x, y, zoom, image); }); }
public override TKChartPointLabel LabelForDataPoint (TKChart chart, TKChartData dataPoint, string propertyName, TKChartSeries series, nuint dataIndex) { TKChartDataPoint point = (TKChartDataPoint)dataPoint; if (series.Index == (nuint)this.selectedSeriesIndex && dataIndex == (nuint)this.selectedDataPointIndex) { return new MyPointLabel (point, series, String.Format ("{0}", point.DataYValue)); } return new TKChartPointLabel (point, series, String.Format ("{0}", point.DataYValue)); }
public virtual nint Read(IntPtr buffer, nuint len) { if (buffer == IntPtr.Zero) throw new ArgumentNullException ("buffer"); if (IsDirectBinding) { return objc_msgSend (this.Handle, Selector.GetHandle (selReadMaxLength), buffer, len); } else { return objc_msgSendSuper (this.SuperHandle, Selector.GetHandle (selReadMaxLength), buffer, len); } }
public override CGRect CellFrameForTextContainer (NSTextContainer textContainer, CGRect lineFrag, CGPoint position, nuint charIndex) { var rect = base.CellFrameForTextContainer (textContainer, lineFrag, position, charIndex); return new CGRect ( rect.Location, new CGSize ( rect.Width + padding * 2, rect.Height + padding * 2 ) ); }
public override TKChartPaletteItem PaletteItemForPoint(TKChart chart, nuint index, TKChartSeries series) { if (series.Index == (nuint)this.selectedSeriesIndex && index == (nuint)this.selectedDataPointIndex) { return new TKChartPaletteItem (new TKStroke (UIColor.Black, (float)2.0), new TKSolidFill (UIColor.White)); } if (series.Index == 0) { return new TKChartPaletteItem (new TKSolidFill (new UIColor ((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0))); } return new TKChartPaletteItem (new TKSolidFill (new UIColor ((float)(241 / 255.0), (float)(140 / 255.0), (float)(133 / 255.0), (float)1.0))); }
public override TKChartSeries GetSeries(TKChart chart, nuint index) { TKChartSeries series = null; if (index == 2) { series = new TKChartSplineSeries (); } else { series = new TKChartLineSeries (); } series.SelectionMode = TKChartSeriesSelectionMode.Series; series.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new System.Drawing.SizeF (10, 10)); series.Title = string.Format ("Series: {0}", index + 1); return series; }
public unsafe void ShowCGGlyphs ( short[] /* const CGGlyph* = CGFontIndex* = unsigned short* */ glyphs, CGPoint[] /* const CGPoint* */ positions, nuint /* NSUInteger */ glyphCount, UIFont font, CGAffineTransform textMatrix, NSDictionary attributes, CGContext graphicsContext) { fixed (short* gl = glyphs) { fixed (CGPoint* pos = positions) { ShowCGGlyphsInternal ((IntPtr) gl, (IntPtr) pos, glyphCount, font, textMatrix, attributes, graphicsContext); } } }
public override nint Read (IntPtr buffer, nuint len) { int actual = Math.Min ((int) len, (int) (total_length - read_length)); byte [] bytes = new byte [actual]; for (int i = 0; i < actual; i++) bytes [i] = (byte) 'z'; read_length += actual; Marshal.Copy (bytes, 0, buffer, actual); if (actual == 0) Notify (CFStreamEventType.EndEncountered); return actual; }
public override TKChartPointLabel LabelForDataPoint (TKChartData dataPoint, TKChartSeries series, nuint dataIndex) { TKChartDataPoint point = (TKChartDataPoint)dataPoint; if (series.Index == (nuint)this.SelectedSeries && dataIndex == (nuint)this.SelectedDataPoint) { if (this.labelLayer == null) { this.labelLayer = new SelectedPointLabel (); } this.labelLayer.LabelStyle = series.Style.PointLabelStyle; this.labelLayer.Text = String.Format ("{0}", point.DataYValue); this.isSelectedPoint = true; return null; } this.isSelectedPoint = false; return new TKChartPointLabel (dataPoint, series, String.Format ("{0}", point.DataYValue)); }
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; } }
// Designated initializer public Quad (IMTLDevice device) { if (device == null) throw new Exception ("ERROR: Invalid device!"); vertexBuffer = device.CreateBuffer<Vector4> (quadVertices, MTLResourceOptions.CpuCacheModeDefault); if (vertexBuffer == null) Console.WriteLine ("ERROR: Failed creating a vertex buffer for a quad!"); vertexBuffer.Label = "quad vertices"; texCoordBuffer = device.CreateBuffer<Vector2> (quadTexCoords, MTLResourceOptions.CpuCacheModeDefault); if (texCoordBuffer == null) Console.WriteLine ("ERROR: Failed creating a 2d texture coordinate buffer!"); texCoordBuffer.Label = "quad texcoords"; vertexIndex = 0; texCoordIndex = 1; Aspect = 1f; scale = Vector2.One; }
public Renderer () { // initialize properties sampleCount = 1; depthPixelFormat = MTLPixelFormat.Depth32Float; stencilPixelFormat = MTLPixelFormat.Invalid; // find a usable Device device = MTLDevice.SystemDefault; // create a new command queue commandQueue = device.CreateCommandQueue (); NSError error; shaderLibrary = device.CreateLibrary ("default.metallib", out error); // if the shader libary isnt loading, nothing good will happen if (shaderLibrary == null) throw new Exception ("ERROR: Couldnt create a default shader library"); inflightSemaphore = new Semaphore (maxInflightBuffers, maxInflightBuffers); }
public override void DidDisplayPhoto (PhotoBrowser photoBrowser, nuint index) { Console.WriteLine ("Did start viewing photo at index {0}.", index); }
public override IPhoto GetPhoto (PhotoBrowser photoBrowser, nuint index) { return photos [(int)index]; }
public override bool IsPhotoSelected (PhotoBrowser photoBrowser, nuint index) { return _selections [index]; }
public HRESULT Set(GLOBALOPT_PROPERTIES dwProperty, [NativeTypeName("ULONG_PTR")] nuint dwValue) { return(((delegate * unmanaged <IGlobalOptions *, GLOBALOPT_PROPERTIES, nuint, int>)(lpVtbl[3]))((IGlobalOptions *)Unsafe.AsPointer(ref this), dwProperty, dwValue)); }
protected virtual NSObject GetTemporaryAttribute(NSString attributeName, nuint characterIndex, IntPtr effectiveRange) { throw new NotSupportedException(); }
public MTLSizeAndAlign(nuint size, nuint align) { Size = size; Align = align; }
public NSDictionary <NSString, NSObject> GetTemporaryAttributes(nuint characterIndex) { throw new NotSupportedException(); }
public int OnKeyUp([NativeTypeName("ITfContext *")] ITfContext *pic, [NativeTypeName("WPARAM")] nuint wParam, [NativeTypeName("LPARAM")] nint lParam, [NativeTypeName("BOOL *")] int *pfEaten) { return(((delegate * unmanaged <ITfKeyEventSink *, ITfContext *, nuint, nint, int *, int>)(lpVtbl[7]))((ITfKeyEventSink *)Unsafe.AsPointer(ref this), pic, wParam, lParam, pfEaten)); }
/// <summary>To be documented.</summary> public static unsafe void DebugReportMessage(this ExtDebugReport thisApi, [Count(Count = 0)] Instance instance, [Count(Count = 0)] DebugReportFlagsEXT flags, [Count(Count = 0)] DebugReportObjectTypeEXT objectType, [Count(Count = 0)] ulong @object, [Count(Count = 0)] nuint location, [Count(Count = 0)] int messageCode, [Flow(FlowDirection.In)] string pLayerPrefix, [Count(Count = 0), Flow(FlowDirection.In)] ReadOnlySpan <byte> pMessage) { // SpanOverloader thisApi.DebugReportMessage(instance, flags, objectType, @object, location, messageCode, pLayerPrefix, in pMessage.GetPinnableReference()); }
public NSDictionary <NSString, NSObject> GetTemporaryAttributes(nuint characterIndex, out NSRange longestEffectiveRange, NSRange rangeLimit) { throw new NotSupportedException(); }
static extern void UIGuidedAccessConfigureAccessibilityFeatures(/* UIGuidedAccessAccessibilityFeature */ nuint features, [MarshalAs(UnmanagedType.I1)] bool enabled, IntPtr completion);
protected virtual NSDictionary <NSString, NSObject> GetTemporaryAttributes(nuint characterIndex, IntPtr longestEffectiveRange, NSRange rangeLimit) { throw new NotSupportedException(); }
public NSDictionary <NSString, NSObject> GetTemporaryAttributes(nuint characterIndex, out NSRange effectiveCharacterRange) { throw new NotSupportedException(); }
protected virtual NSDictionary <NSString, NSObject> GetTemporaryAttributes(nuint characterIndex, IntPtr effectiveCharacterRange) { throw new NotSupportedException(); }
public partial void BufferAddressRange([Flow(FlowDirection.In)] NV pname, [Flow(FlowDirection.In)] uint index, [Flow(FlowDirection.In)] ulong address, [Flow(FlowDirection.In)] nuint length);
public static MTLRegion Create2D(nuint x, nuint y, nuint width, nuint height) { return(Create2D((nint)x, (nint)y, (nint)width, (nint)height)); }
extern static GLKVertexAttributeParameters FromVertexFormat_(nuint vertexFormat);
public static MTLRegion Create1D(nuint x, nuint width) { return(Create1D((nint)x, (nint)width)); }
public static MTLRegion Create3D(nuint x, nuint y, nuint z, nuint width, nuint height, nuint depth) { return(Create3D((nint)x, (nint)y, (nint)z, (nint)width, (nint)height, (nint)depth)); }
public NSObject GetTemporaryAttribute(NSString attributeName, nuint characterIndex, out NSRange longestEffectiveRange, NSRange rangeLimit) { throw new NotSupportedException(); }
private void OnPHFetchResultEnumerator(NSObject element, nuint elementIndex, out bool stop) { this.imagesResult.Add(element); stop = this.imagesResult.Count >= Common.CoreConstants.ImageCountLimit; }
public byte[] GetH264ParameterSet(nuint index, out nuint parameterSetCount, out int nalUnitHeaderLength, out CMFormatDescriptionError error) { if (Handle == IntPtr.Zero) throw new ObjectDisposedException ("VideoFormatDescription"); IntPtr ret; nuint parameterSetSizeOut; error = CMVideoFormatDescriptionGetH264ParameterSetAtIndex (Handle, index, out ret, out parameterSetSizeOut, out parameterSetCount, out nalUnitHeaderLength); if (error != CMFormatDescriptionError.None) return null; var arr = new byte[(int)parameterSetSizeOut]; Marshal.Copy (ret, arr, 0, (int)parameterSetSizeOut); return arr; }
public IMemoryOwner <T> Rent <T>(int size, nuint alignment, out nuint index, bool clear = false) where T : unmanaged => _NativeMemoryPool.Rent <T>(size, alignment, out index, clear);
public Renderer () { sampleCount = 4; depthPixelFormat = MTLPixelFormat.Depth32Float; stencilPixelFormat = MTLPixelFormat.Invalid; // find a usable Device device = MTLDevice.SystemDefault; // create a new command queue commandQueue = device.CreateCommandQueue (); NSError error; defaultLibrary = device.CreateLibrary ("default.metallib", out error); // if the shader libary isnt loading, nothing good will happen if (defaultLibrary == null) throw new Exception ("ERROR: Couldnt create a default shader library"); constantDataBufferIndex = 0; inflightSemaphore = new Semaphore (max_inflight_buffers, max_inflight_buffers); constantBuffer = new Uniforms[2]; constantBuffer [0].ambientColor = box1AmbientColor; constantBuffer [0].diffuseColor = box1DiffuseColor; constantBuffer [1].ambientColor = box2AmbientColor; constantBuffer [1].diffuseColor = box2DiffuseColor; multiplier = 1; }
public partial void BufferPageCommitmentMem([Flow(FlowDirection.In)] BufferStorageTarget target, [Flow(FlowDirection.In)] nint offset, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.In)] uint memory, [Flow(FlowDirection.In)] ulong memOffset, [Flow(FlowDirection.In)] bool commit);
public NSObject GetTemporaryAttribute(NSString attributeName, nuint characterIndex) { throw new NotSupportedException(); }
public static CMVideoFormatDescription FromH264ParameterSets(List<byte[]> parameterSets, int nalUnitHeaderLength, out CMFormatDescriptionError error) { if (parameterSets == null) throw new ArgumentNullException ("parameterSets"); if (parameterSets.Count < 2) throw new ArgumentException ("parameterSets must contain at least two elements"); if (nalUnitHeaderLength != 1 && nalUnitHeaderLength != 2 && nalUnitHeaderLength != 4) throw new ArgumentOutOfRangeException ("nalUnitHeaderLength", "must be 1, 2 or 4"); var handles = new GCHandle [parameterSets.Count]; try { var parameterSetSizes = new nuint [parameterSets.Count]; var parameterSetPtrs = new IntPtr [parameterSets.Count]; for (int i = 0; i < parameterSets.Count; i++) { handles [i] = GCHandle.Alloc (parameterSets [i], GCHandleType.Pinned); parameterSetPtrs [i] = handles [i].AddrOfPinnedObject (); parameterSetSizes [i] = (nuint)parameterSets [i].Length; } IntPtr desc; error = CMVideoFormatDescriptionCreateFromH264ParameterSets (IntPtr.Zero, (nuint)parameterSets.Count, parameterSetPtrs, parameterSetSizes, nalUnitHeaderLength, out desc); if (error != CMFormatDescriptionError.None) return null; return new CMVideoFormatDescription (desc, true); } finally { for (int i = 0; i < parameterSets.Count; i++) { if (handles [i].IsAllocated) handles [i].Free (); } } }
public partial void NamedBufferPageCommitmentMem([Flow(FlowDirection.In)] uint buffer, [Flow(FlowDirection.In)] nint offset, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.In)] uint memory, [Flow(FlowDirection.In)] ulong memOffset, [Flow(FlowDirection.In)] Boolean commit);
public override void GetTimelineEntriesBeforeDate(CLKComplication complication, NSDate beforeDate, nuint limit, Action<CLKComplicationTimelineEntry[]> entries) { Console.WriteLine ("GetTimelineEntriesBeforeDate"); entries (null); }
extern static /* OSStatus */ CMSampleBufferError CMSampleBufferCreateReady ( /* CFAllocatorRef */ IntPtr allocator, /* CMBlockBufferRef */ IntPtr dataBuffer, /* CMFormatDescriptionRef */ IntPtr formatDescription, // can be null /* CMItemCount */ nint numSamples, // can be 0 /* CMItemCount */ nint numSampleTimingEntries, // 0, 1 or numSamples CMSampleTimingInfo[] sampleTimingArray, // can be null /* CMItemCount */ nint numSampleSizeEntries, // 0, 1 or numSamples /* size_t* */ nuint[] sampleSizeArray, // can be null /* CMSampleBufferRef* */ out IntPtr sBufOut);
static extern /* MDLVertexFormat */ nuint MTKModelIOVertexFormatFromMetal(/* MTLVertexFormat */ nuint modelIODescriptor);
public static unsafe nint ImportMemory <T0>(this ArmImportMemory thisApi, [Flow(FlowDirection.In)] nint context, [Flow(FlowDirection.In)] ARM flags, [Flow(FlowDirection.In)] ReadOnlySpan <nint> properties, [Flow(FlowDirection.Out)] Span <T0> memory, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.Out)] Span <int> errcode_ret) where T0 : unmanaged { // SpanOverloader return(thisApi.ImportMemory(context, flags, in properties.GetPinnableReference(), out memory.GetPinnableReference(), size, out errcode_ret.GetPinnableReference())); }
void RenderBox (IMTLRenderCommandEncoder renderEncoder, GameView view, nuint offset, string name) { renderEncoder.PushDebugGroup (name); // set context state renderEncoder.SetRenderPipelineState (pipelineState); renderEncoder.SetVertexBuffer (vertexBuffer, 0, 0); renderEncoder.SetVertexBuffer (dynamicConstantBuffer [constantDataBufferIndex], offset, 1); // tell the render context we want to draw our primitives renderEncoder.DrawPrimitives (MTLPrimitiveType.Triangle, 0, 36, 1); renderEncoder.PopDebugGroup (); }
protected SafeBuffer(bool ownsHandle) : base(ownsHandle) { _numBytes = Uninitialized; }
public override IPhoto GetThumbnail (PhotoBrowser photoBrowser, nuint index) { return thumbs [(int)index]; }
public unsafe partial nint CreateBufferWithProperties([Flow(FlowDirection.In)] nint context, [Flow(FlowDirection.In)] INTEL *properties, [Flow(FlowDirection.In)] INTEL flags, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.Out)] void *host_ptr, [Flow(FlowDirection.Out)] out int errcode_ret);
public override void OnSelectedChanged (PhotoBrowser photoBrowser, nuint index, bool selected) { _selections [index] = selected; Console.WriteLine ("Photo at index {0} selected ? {1}.", index, selected); }
public unsafe partial nint CreateBufferWithProperties <T0>([Flow(FlowDirection.In)] nint context, [Flow(FlowDirection.In)] INTEL *properties, [Flow(FlowDirection.In)] INTEL flags, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.Out)] out T0 host_ptr, [Flow(FlowDirection.Out)] int *errcode_ret) where T0 : unmanaged;
public static unsafe nint ImportMemory(this ArmImportMemory thisApi, [Flow(FlowDirection.In)] nint context, [Flow(FlowDirection.In)] ARM flags, [Flow(FlowDirection.In)] nint *properties, [Flow(FlowDirection.Out)] void *memory, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.Out)] Span <int> errcode_ret) { // SpanOverloader return(thisApi.ImportMemory(context, flags, properties, memory, size, out errcode_ret.GetPinnableReference())); }
public static MDLVertexFormat ToModelVertexFormat(this MTLVertexFormat vertexFormat) { nuint mdlVertexFormat = MTKModelIOVertexFormatFromMetal((nuint)(ulong)vertexFormat); return((MDLVertexFormat)(ulong)mdlVertexFormat); }
public static CMSampleBuffer CreateReady (CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, int samplesCount, CMSampleTimingInfo[] sampleTimingArray, nuint[] sampleSizeArray, out CMSampleBufferError error) { if (dataBuffer == null) throw new ArgumentNullException ("dataBuffer"); if (samplesCount < 0) throw new ArgumentOutOfRangeException ("samplesCount"); IntPtr buffer; var fdh = formatDescription == null ? IntPtr.Zero : formatDescription.Handle; var timingCount = sampleTimingArray == null ? 0 : sampleTimingArray.Length; var sizeCount = sampleSizeArray == null ? 0 : sampleSizeArray.Length; error = CMSampleBufferCreateReady (IntPtr.Zero, dataBuffer.handle, fdh, samplesCount, timingCount, sampleTimingArray, sizeCount, sampleSizeArray, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
public static unsafe nint ImportMemory(this ArmImportMemory thisApi, [Flow(FlowDirection.In)] nint context, [Flow(FlowDirection.In)] ARM flags, [Flow(FlowDirection.In)] ReadOnlySpan <nint> properties, [Flow(FlowDirection.Out)] void *memory, [Flow(FlowDirection.In)] nuint size, [Flow(FlowDirection.Out)] int *errcode_ret) { // SpanOverloader return(thisApi.ImportMemory(context, flags, in properties.GetPinnableReference(), memory, size, errcode_ret)); }