实例方法
drawing
drawingGroup(opaque:colorMode:)
在最终显示之前将此视图的内容合成为屏幕外图像。
声明
func drawingGroup(
opaque: Bool = false,
colorMode: ColorRenderingMode = .nonLinear
) -> some View
返回值
在显示之前将此视图的内容合成为屏幕外图像的视图。
参数
opaque
一个布尔值,指示图像是否不透明。默认为
false
;如果设置为true
,则图像的 alpha 通道必须为1
。colorMode
ColorRenderingMode
中定义的工作色彩空间和存储格式之一。默认值为ColorRenderingMode/nonLinear
。
详述
drawingGroup(opaque:colorMode:)
修饰符在渲染之前将视图的子树展平为单个视图。
在下面的示例中,视图的内容被合成为一个位图;然后显示位图代替视图:
VStack {
ZStack {
Text("DrawingGroup")
.foregroundColor(.black)
.padding(20)
.background(Color.red)
Text("DrawingGroup")
.blur(radius: 2)
}
.font(.largeTitle)
.compositingGroup()
.opacity(1.0)
}
.background(Color.white)
.drawingGroup()
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+
相关用法
- Swift Optional dynamicTypeSize(_:)用法及代码示例
- Swift Optional digitalCrownRotation(_:from:through:by:sensitivity:isContinuous:isHapticFeedbackEnabled:)用法及代码示例
- Swift Optional disabled(_:)用法及代码示例
- Swift Optional defaultWheelPickerItemHeight(_:)用法及代码示例
- Swift Optional digitalCrownRotation(_:)用法及代码示例
- Swift Optional symbolVariant(_:)用法及代码示例
- Swift Optional popover(isPresented:attachmentAnchor:arrowEdge:content:)用法及代码示例
- Swift Optional mask(alignment:_:)用法及代码示例
- Swift Optional listSectionSeparatorTint(_:edges:)用法及代码示例
- Swift Optional badge(_:)用法及代码示例
- Swift Optional fullScreenCover(isPresented:onDismiss:content:)用法及代码示例
- Swift Optional keyboardType(_:)用法及代码示例
- Swift Optional clipShape(_:style:)用法及代码示例
- Swift Optional preferredColorScheme(_:)用法及代码示例
- Swift Optional background(_:ignoresSafeAreaEdges:)用法及代码示例
- Swift Optional saturation(_:)用法及代码示例
- Swift Optional focusSection()用法及代码示例
- Swift Optional overlay(alignment:content:)用法及代码示例
- Swift Optional colorMultiply(_:)用法及代码示例
- Swift Optional confirmationDialog(_:isPresented:titleVisibility:presenting:actions:message:)用法及代码示例
- Swift Optional offset(_:)用法及代码示例
- Swift Optional focused(_:equals:)用法及代码示例
- Swift Optional hidden()用法及代码示例
- Swift Optional previewDevice(_:)用法及代码示例
- Swift Optional keyboardShortcut(_:modifiers:localization:)用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 Optional drawingGroup(opaque:colorMode:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。