Documentation
¶
Overview ¶
Package ca provides access to Apple's Core Animation API (https://developer.apple.com/documentation/quartzcore).
This package is in very early stages of development. It's a minimal implementation with scope limited to supporting the movingtriangle example.
Index ¶
- type Layer
- type MetalDisplayLink
- func (m MetalDisplayLink) AddToRunLoop(runLoop cocoa.NSRunLoop, mode cocoa.NSRunLoopMode)
- func (m MetalDisplayLink) Release()
- func (m MetalDisplayLink) RemoveFromRunLoop(runLoop cocoa.NSRunLoop, mode cocoa.NSRunLoopMode)
- func (m MetalDisplayLink) SetDelegate(delegate objc.ID)
- func (m MetalDisplayLink) SetPaused(paused bool)
- type MetalDisplayLinkUpdate
- type MetalDrawable
- type MetalLayer
- func (ml MetalLayer) Layer() unsafe.Pointer
- func (ml MetalLayer) NextDrawable() (MetalDrawable, error)
- func (ml MetalLayer) PixelFormat() mtl.PixelFormat
- func (ml MetalLayer) PresentsWithTransaction() bool
- func (ml MetalLayer) SetDevice(device mtl.Device)
- func (ml MetalLayer) SetDisplaySyncEnabled(enabled bool)
- func (ml MetalLayer) SetDrawableSize(width, height int)
- func (ml MetalLayer) SetFramebufferOnly(framebufferOnly bool)
- func (ml MetalLayer) SetMaximumDrawableCount(count int)
- func (ml MetalLayer) SetOpaque(opaque bool)
- func (ml MetalLayer) SetPixelFormat(pf mtl.PixelFormat)
- func (ml MetalLayer) SetPresentsWithTransaction(presentsWithTransaction bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Layer ¶
Layer is an object that manages image-based content and allows you to perform animations on that content.
Reference: https://developer.apple.com/documentation/quartzcore/calayer?language=objc.
type MetalDisplayLink ¶ added in v2.9.0
MetalDisplayLink is a class your Metal app uses to register for callbacks to synchronize its animations for a display.
Reference: https://developer.apple.com/documentation/quartzcore/cametaldisplaylink?language=objc
func NewMetalDisplayLink ¶ added in v2.9.0
func NewMetalDisplayLink(metalLayer MetalLayer) MetalDisplayLink
NewMetalDisplayLink creates a display link for Metal from a Core Animation layer.
func (MetalDisplayLink) AddToRunLoop ¶ added in v2.9.0
func (m MetalDisplayLink) AddToRunLoop(runLoop cocoa.NSRunLoop, mode cocoa.NSRunLoopMode)
AddToRunLoop registers the display link with a run loop.
func (MetalDisplayLink) Release ¶ added in v2.9.0
func (m MetalDisplayLink) Release()
func (MetalDisplayLink) RemoveFromRunLoop ¶ added in v2.9.0
func (m MetalDisplayLink) RemoveFromRunLoop(runLoop cocoa.NSRunLoop, mode cocoa.NSRunLoopMode)
RemoveFromRunLoop removes a mode’s display link from a run loop.
func (MetalDisplayLink) SetDelegate ¶ added in v2.9.0
func (m MetalDisplayLink) SetDelegate(delegate objc.ID)
SetDelegate sets an instance of a type your app implements that responds to the system’s callbacks.
Reference: https://developer.apple.com/documentation/quartzcore/cametaldisplaylink/delegate?language=objc
func (MetalDisplayLink) SetPaused ¶ added in v2.9.0
func (m MetalDisplayLink) SetPaused(paused bool)
SetPaused sets a Boolean value that indicates whether the system suspends the display link’s notifications to the target.
https://developer.apple.com/documentation/quartzcore/cametaldisplaylink/ispaused?language=objc
type MetalDisplayLinkUpdate ¶ added in v2.9.0
MetalDisplayLinkUpdate stores information about a single update from a Metal display link instance.
Reference: https://developer.apple.com/documentation/quartzcore/cametaldisplaylink/update?language=objc
func (MetalDisplayLinkUpdate) Drawable ¶ added in v2.9.0
func (m MetalDisplayLinkUpdate) Drawable() MetalDrawable
Drawable returns the Metal drawable your app uses to render the next frame.
type MetalDrawable ¶
type MetalDrawable struct {
// contains filtered or unexported fields
}
MetalDrawable is a displayable resource that can be rendered or written to by Metal.
Reference: https://developer.apple.com/documentation/quartzcore/cametaldrawable?language=objc.
func (MetalDrawable) Drawable ¶
func (md MetalDrawable) Drawable() unsafe.Pointer
Drawable implements the mtl.Drawable interface.
func (MetalDrawable) Present ¶ added in v2.2.0
func (md MetalDrawable) Present()
Present presents the drawable onscreen as soon as possible.
Reference: https://developer.apple.com/documentation/metal/mtldrawable/1470284-present?language=objc.
func (MetalDrawable) Texture ¶
func (md MetalDrawable) Texture() mtl.Texture
Texture returns a Metal texture object representing the drawable object's content.
Reference: https://developer.apple.com/documentation/quartzcore/cametaldrawable/1478159-texture?language=objc.
type MetalLayer ¶
type MetalLayer struct {
// contains filtered or unexported fields
}
MetalLayer is a Core Animation Metal layer, a layer that manages a pool of Metal drawables.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer?language=objc.
func NewMetalLayer ¶ added in v2.8.0
func NewMetalLayer(colorSpace graphicsdriver.ColorSpace) (MetalLayer, error)
NewMetalLayer creates a new Core Animation Metal layer.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer?language=objc.
func (MetalLayer) Layer ¶
func (ml MetalLayer) Layer() unsafe.Pointer
Layer implements the Layer interface.
func (MetalLayer) NextDrawable ¶
func (ml MetalLayer) NextDrawable() (MetalDrawable, error)
NextDrawable returns a Metal drawable.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/1478172-nextdrawable?language=objc.
func (MetalLayer) PixelFormat ¶
func (ml MetalLayer) PixelFormat() mtl.PixelFormat
PixelFormat returns the pixel format of textures for rendering layer content.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/1478155-pixelformat?language=objc.
func (MetalLayer) PresentsWithTransaction ¶ added in v2.2.0
func (ml MetalLayer) PresentsWithTransaction() bool
PresentsWithTransaction returns a Boolean value that determines whether the layer presents its content using a Core Animation transaction.
func (MetalLayer) SetDevice ¶
func (ml MetalLayer) SetDevice(device mtl.Device)
SetDevice sets the Metal device responsible for the layer's drawable resources.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/1478163-device?language=objc.
func (MetalLayer) SetDisplaySyncEnabled ¶
func (ml MetalLayer) SetDisplaySyncEnabled(enabled bool)
SetDisplaySyncEnabled controls whether the Metal layer and its drawables are synchronized with the display's refresh rate.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/2887087-displaysyncenabled?language=objc.
func (MetalLayer) SetDrawableSize ¶
func (ml MetalLayer) SetDrawableSize(width, height int)
SetDrawableSize sets the size, in pixels, of textures for rendering layer content.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/1478174-drawablesize?language=objc.
func (MetalLayer) SetFramebufferOnly ¶ added in v2.2.0
func (ml MetalLayer) SetFramebufferOnly(framebufferOnly bool)
SetFramebufferOnly sets a Boolean value that determines whether the layer’s textures are used only for rendering.
func (MetalLayer) SetMaximumDrawableCount ¶
func (ml MetalLayer) SetMaximumDrawableCount(count int)
SetMaximumDrawableCount controls the number of Metal drawables in the resource pool managed by Core Animation.
It can set to 2 or 3 only. SetMaximumDrawableCount panics for other values.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/2938720-maximumdrawablecount?language=objc.
func (MetalLayer) SetOpaque ¶
func (ml MetalLayer) SetOpaque(opaque bool)
SetOpaque a Boolean value indicating whether the layer contains completely opaque content.
func (MetalLayer) SetPixelFormat ¶
func (ml MetalLayer) SetPixelFormat(pf mtl.PixelFormat)
SetPixelFormat controls the pixel format of textures for rendering layer content.
The pixel format for a Metal layer must be PixelFormatBGRA8UNorm, PixelFormatBGRA8UNormSRGB, PixelFormatRGBA16Float, PixelFormatBGRA10XR, or PixelFormatBGRA10XRSRGB. SetPixelFormat panics for other values.
Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/1478155-pixelformat?language=objc.
func (MetalLayer) SetPresentsWithTransaction ¶ added in v2.2.0
func (ml MetalLayer) SetPresentsWithTransaction(presentsWithTransaction bool)
SetPresentsWithTransaction sets a Boolean value that determines whether the layer presents its content using a Core Animation transaction.