fix: sharper images on non-retina displays
This commit is contained in:
1 parent
a2bb19ffcb
commit
1bb4d2a1c8
3 files changed
+16
-4
No files matched your search
@@ -161,3 +161,15 @@ extension NSControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension NSImage {
|
||||||
|
// copy and resize an image using high quality interpolation
|
||||||
|
func resizedCopy(_ width: CGFloat, _ height: CGFloat) -> NSImage {
|
||||||
|
let img = NSImage(size: CGSize(width: width, height: height))
|
||||||
|
img.lockFocus()
|
||||||
|
NSGraphicsContext.current?.imageInterpolation = .high
|
||||||
|
draw(in: NSMakeRect(0, 0, width, height), from: NSMakeRect(0, 0, size.width, size.height), operation: .copy, fraction: 1)
|
||||||
|
img.unlockFocus()
|
||||||
|
return img
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,8 +26,8 @@ class FeedbackWindow: NSWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func setupView() {
|
private func setupView() {
|
||||||
let appIcon = NSImageView(image: App.shared.applicationIconImage)
|
let appIcon = NSImageView(image: NSImage(named: "app-icon")!.resizedCopy(80, 80))
|
||||||
appIcon.fit(80, 80)
|
appIcon.imageScaling = .scaleNone
|
||||||
let appText = NSStackView(views: [
|
let appText = NSStackView(views: [
|
||||||
BoldLabel(NSLocalizedString("Share improvement ideas, or report bugs", comment: "")),
|
BoldLabel(NSLocalizedString("Share improvement ideas, or report bugs", comment: "")),
|
||||||
HyperlinkLabel(NSLocalizedString("View existing discussions", comment: ""), App.repository + "/issues"),
|
HyperlinkLabel(NSLocalizedString("View existing discussions", comment: ""), App.repository + "/issues"),
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ class AboutTab: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func makeView() -> NSGridView {
|
static func makeView() -> NSGridView {
|
||||||
let appIcon = NSImageView(image: App.shared.applicationIconImage)
|
let appIcon = NSImageView(image: NSImage(named: "app-icon")!.resizedCopy(150, 150))
|
||||||
appIcon.fit(150, 150)
|
appIcon.imageScaling = .scaleNone
|
||||||
let appText = NSStackView(views: [
|
let appText = NSStackView(views: [
|
||||||
BoldLabel(App.name),
|
BoldLabel(App.name),
|
||||||
NSTextField(wrappingLabelWithString: NSLocalizedString("Version", comment: "") + " " + App.version),
|
NSTextField(wrappingLabelWithString: NSLocalizedString("Version", comment: "") + " " + App.version),
|
||||||
|
|||||||
Reference in new issue
Block a user