tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/image/jpeg/callback.go (about)

     1  package jpeg
     2  
     3  var (
     4  	callback    Callback = func(data []uint16, x, y, w, h, width, height int16) {}
     5  	callbackBuf []uint16
     6  )
     7  
     8  // A portion of the image data consisting of data, x, y, w, and h is passed to
     9  // Callback. The size of the whole image is passed as width and height.
    10  // If the callback is not called, add the implementation to
    11  // image/png.readImagePass.
    12  type Callback func(data []uint16, x, y, w, h, width, height int16)
    13  
    14  // SetCallback registers the buffer and fn required for Callback. Callback can
    15  // be called multiple times by calling Decode().
    16  func SetCallback(buf []uint16, fn Callback) {
    17  	callbackBuf = buf
    18  	callback = fn
    19  }