mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
29f7c8c9f0
commit
8a9a557870
@ -718,19 +718,9 @@ private func generateSpectrumImage(size: CGSize) -> UIImage? {
|
||||
if let image = UIImage(bundleImageName: "Media Editor/Spectrum") {
|
||||
context.draw(image.cgImage!, in: CGRect(origin: .zero, size: size))
|
||||
}
|
||||
|
||||
let colorSpace = CGColorSpaceCreateDeviceRGB()
|
||||
var colors = [UIColor(rgb: 0xffffff).cgColor, UIColor(rgb: 0xffffff, alpha: 0.0).cgColor, UIColor(rgb: 0xffffff, alpha: 0.0).cgColor]
|
||||
var locations: [CGFloat] = [0.0, 0.45, 1.0]
|
||||
|
||||
var gradient = CGGradient(colorsSpace: colorSpace, colors: colors as CFArray, locations: &locations)!
|
||||
context.drawLinearGradient(gradient, start: CGPoint(), end: CGPoint(x: size.width, y: 0.0), options: [.drawsAfterEndLocation])
|
||||
|
||||
colors = [UIColor(rgb: 0x000000, alpha: 0.0).cgColor, UIColor(rgb: 0x000000, alpha: 0.0).cgColor, UIColor(rgb: 0x000000).cgColor]
|
||||
locations = [0.0, 0.5, 1.0]
|
||||
|
||||
gradient = CGGradient(colorsSpace: colorSpace, colors: colors as CFArray, locations: &locations)!
|
||||
context.drawLinearGradient(gradient, start: CGPoint(), end: CGPoint(x: size.width, y: 0.0), options: [.drawsAfterEndLocation])
|
||||
if let image = UIImage(bundleImageName: "Media Editor/Grayscale") {
|
||||
context.draw(image.cgImage!, in: CGRect(origin: .zero, size: size))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,9 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
view.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak view] _ in
|
||||
view?.removeFromSuperview()
|
||||
})
|
||||
view.layer.animateScale(from: 0.0, to: -0.99, duration: 0.2, removeOnCompletion: false, additive: true)
|
||||
if !(view.entity is DrawingVectorEntity) {
|
||||
view.layer.animateScale(from: 0.0, to: -0.99, duration: 0.2, removeOnCompletion: false, additive: true)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -268,6 +268,10 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, TGPhotoDraw
|
||||
}
|
||||
|
||||
if let renderLayer = newElement.setupRenderLayer() {
|
||||
if let currentDrawingLayer = strongSelf.currentDrawingLayer {
|
||||
strongSelf.currentDrawingLayer = nil
|
||||
currentDrawingLayer.removeFromSuperlayer()
|
||||
}
|
||||
strongSelf.currentDrawingView.layer.addSublayer(renderLayer)
|
||||
strongSelf.currentDrawingLayer = renderLayer
|
||||
}
|
||||
|
21
submodules/TelegramUI/Images.xcassets/Media Editor/Grayscale.imageset/Contents.json
vendored
Normal file
21
submodules/TelegramUI/Images.xcassets/Media Editor/Grayscale.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "grayscale.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Media Editor/Grayscale.imageset/grayscale.png
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Media Editor/Grayscale.imageset/grayscale.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 787 B |
Loading…
x
Reference in New Issue
Block a user