UXIosGraphics
UXIosGraphics is the UIKit realization of
UXGraphics, sibling of
UXCocoaGraphics.
#use <UXKit> // or #import "UXIosGraphics.xc"The CGContext of the draw in flight
Section titled “The CGContext of the draw in flight”The ops act on the CGContext that UIKit set for this draw, inside
libUXIos.m’s UXDrawView. It is valid during the callback and not outside
it, the same arrangement as NSGraphicsContext on macOS and cairo_t on GTK.
Coordinates passed in are bounds-relative; the bound origin makes them absolute.
No flip, unlike its macOS sibling
Section titled “No flip, unlike its macOS sibling”This is the main difference between the two Apple vocabularies, and it is easy to get backwards.
| AppKit | default space grows y up; the shim declares a flipped view |
| UIKit | default space grows y down; nothing to do |
UIKit already matches the protocol, so there is no flipped-view override here and no arithmetic to invert. Both frameworks draw through CoreGraphics, yet they differ in this convention, which would otherwise leak into every custom view.
The platforms do not agree on a coordinate convention, so the toolkit defines one in the protocol instead of in each view.
It strokes natively
Section titled “It strokes natively”strokesNatively() // trueCoreGraphics strokes at sub-pixel precision with its own joins, so a path goes to it rather than through the neutral offsetter. Arrowheads stay neutral because CoreGraphics has no arrowhead, as on every hosted backend.
See also
Section titled “See also”UXGraphics: the protocolUXIosDriver: the backendUXCocoaGraphics: the sibling, and the flipUXPainter: strokes and gradient fills