fstab
fstab

Reputation: 5029

GdkPixbuf can be created with `new_from_data` and `new_from_stream`. Why doesn't the latter require the resolution?

I am trying to understand the basics behind Pixbuf and its factory methods new_from_data and new_from_stream.

new_from_data requires a string of bytes containing the image data, and other information such as bits per sample, with and height of image.

What I don't understand is why new_from_stream does not require those additional image information. Then, how can the Pixbuf know how to render the image new_from_stream does not provide any additional information other than the Gio.InputStream ?

Upvotes: 0

Views: 401

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14587

new_from_stream() expects to get a stream of a supported image file, equivalent to new_from_file(). All the image formats contain metadata like height and width.

new_from_data() on the other hand expects a pixel buffer, which is essentially just an array of pixels without any metadata.

Upvotes: 1

Related Questions