ImageData represents the data of an image that can be read from a source. Please note that this interface can be backed by any reader, including lazy AsyncBuffer. There is no other way to guarantee that the data is read without errors except reading it till EOF.
| 18 | // Please note that this interface can be backed by any reader, including lazy AsyncBuffer. |
| 19 | // There is no other way to guarantee that the data is read without errors except reading it till EOF. |
| 20 | type ImageData interface { |
| 21 | io.Closer // Close closes the image data and releases any resources held by it |
| 22 | Reader() io.ReadSeeker // Reader returns a new ReadSeeker for the image data |
| 23 | Format() imagetype.Type // Format returns the image format from the metadata (shortcut) |
| 24 | Size() (int, error) // Size returns the size of the image data in bytes |
| 25 | Error() error // Error returns any error that occurred during reading data from source |
| 26 | |
| 27 | // AddCancel attaches a cancel function to the image data. |
| 28 | // Please note that Cancel functions must be idempotent: for instance, an implementation |
| 29 | // could wrap cancel into sync.Once. |
| 30 | AddCancel(cancel context.CancelFunc) |
| 31 | } |
| 32 | |
| 33 | // imageDataBytes represents image data stored in a byte slice in memory |
| 34 | type imageDataBytes struct { |
no outgoing calls
no test coverage detected