This commit is contained in:
Isaac 2025-09-30 15:26:59 +08:00
parent 8c3bfe9890
commit 0570dbb774
4 changed files with 62 additions and 28 deletions

View File

@ -14,6 +14,7 @@ swift_library(
"//submodules/ComponentFlow", "//submodules/ComponentFlow",
"//submodules/Components/ComponentDisplayAdapters", "//submodules/Components/ComponentDisplayAdapters",
"//submodules/UIKitRuntimeUtils", "//submodules/UIKitRuntimeUtils",
"//submodules/AppBundle",
], ],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",

View File

@ -5,6 +5,7 @@ import ComponentFlow
import ComponentDisplayAdapters import ComponentDisplayAdapters
import UIKitRuntimeUtils import UIKitRuntimeUtils
import CoreImage import CoreImage
import AppBundle
private final class ContentContainer: UIView { private final class ContentContainer: UIView {
private let maskContentView: UIView private let maskContentView: UIView
@ -689,16 +690,35 @@ public extension GlassBackgroundView {
addShadow(context, true, CGPoint(), 10.0, 0.0, UIColor(white: 0.0, alpha: 0.06), .normal) addShadow(context, true, CGPoint(), 10.0, 0.0, UIColor(white: 0.0, alpha: 0.06), .normal)
addShadow(context, true, CGPoint(), 20.0, 0.0, UIColor(white: 0.0, alpha: 0.06), .normal) addShadow(context, true, CGPoint(), 20.0, 0.0, UIColor(white: 0.0, alpha: 0.06), .normal)
let innerImage = UIGraphicsImageRenderer(size: size).image { ctx in var a: CGFloat = 0.0
var b: CGFloat = 0.0
var s: CGFloat = 0.0
fillColor.getHue(nil, saturation: &s, brightness: &b, alpha: &a)
let innerImage: UIImage
if size == CGSize(width: 40.0 + inset * 2.0, height: 40.0 + inset * 2.0) {
innerImage = UIGraphicsImageRenderer(size: size).image { ctx in
let context = ctx.cgContext let context = ctx.cgContext
context.setFillColor(fillColor.cgColor) context.setFillColor(fillColor.cgColor)
context.fill(CGRect(origin: CGPoint(), size: size).insetBy(dx: inset, dy: inset).insetBy(dx: 0.1, dy: 0.1)) context.fill(CGRect(origin: CGPoint(), size: size).insetBy(dx: inset, dy: inset).insetBy(dx: 0.1, dy: 0.1))
var a: CGFloat = 0.0 if let image = UIImage(bundleImageName: "Item List/GlassEdge40x40") {
var b: CGFloat = 0.0 if s <= 0.3 && !isDark {
var s: CGFloat = 0.0 image.draw(in: CGRect(origin: CGPoint(), size: size).insetBy(dx: inset, dy: inset), blendMode: .normal, alpha: 0.7)
fillColor.getHue(nil, saturation: &s, brightness: &b, alpha: &a) } else if b >= 0.2 {
image.draw(in: CGRect(origin: CGPoint(), size: size).insetBy(dx: inset, dy: inset), blendMode: .plusLighter, alpha: 0.7)
} else {
image.draw(in: CGRect(origin: CGPoint(), size: size).insetBy(dx: inset, dy: inset), blendMode: .normal, alpha: 0.5)
}
}
}
} else {
innerImage = UIGraphicsImageRenderer(size: size).image { ctx in
let context = ctx.cgContext
context.setFillColor(fillColor.cgColor)
context.fill(CGRect(origin: CGPoint(), size: size).insetBy(dx: inset, dy: inset).insetBy(dx: 0.1, dy: 0.1))
addShadow(context, true, CGPoint(x: 0.0, y: 0.0), 20.0, 0.0, UIColor(white: 0.0, alpha: 0.04), .normal) addShadow(context, true, CGPoint(x: 0.0, y: 0.0), 20.0, 0.0, UIColor(white: 0.0, alpha: 0.04), .normal)
addShadow(context, true, CGPoint(x: 0.0, y: 0.0), 5.0, 0.0, UIColor(white: 0.0, alpha: 0.04), .normal) addShadow(context, true, CGPoint(x: 0.0, y: 0.0), 5.0, 0.0, UIColor(white: 0.0, alpha: 0.04), .normal)
@ -724,6 +744,7 @@ public extension GlassBackgroundView {
addShadow(context, false, CGPoint(x: 0.64, y: 0.64), 1.2, 0.0, UIColor(white: 1.0, alpha: edgeAlpha), .normal) addShadow(context, false, CGPoint(x: 0.64, y: 0.64), 1.2, 0.0, UIColor(white: 1.0, alpha: edgeAlpha), .normal)
} }
} }
}
context.addEllipse(in: CGRect(origin: CGPoint(x: inset, y: inset), size: innerSize)) context.addEllipse(in: CGRect(origin: CGPoint(x: inset, y: inset), size: innerSize))
context.clip() context.clip()

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "iOS 28.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}