Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sources/Gtk3/Widgets/Image+ManualAdditions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import CGtk3

extension Image {
public func clear() {
gtk_image_clear(castedPointer())
}

public func setPath(_ path: String) {
gtk_image_set_from_file(castedPointer(), path)
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Gtk3Backend/Gtk3Backend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,12 @@ public final class Gtk3Backend: AppBackend {
) {
let imageView = imageView as! Gtk3.Image

// check if the resulting image would be empty
guard targetWidth > 0, targetHeight > 0 else {
imageView.clear()
return
}

let pixbuf = Pixbuf(
rgbaData: rgbaData,
width: width,
Expand Down
Loading