Skip to content

Commit

Permalink
feat: new API for extracting Image from a channel given the frame index
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmasB committed Apr 4, 2023
1 parent e539eba commit 87ca500
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ class AnimationChannel(val image: Image,
fun getFrameWidth(frame: Int) = getFrameData(frame).width
fun getFrameHeight(frame: Int) = getFrameData(frame).height

/**
* @return a computed image for a given [frameIndex]
*/
fun getFrameImage(frameIndex: Int): Image {
val frameData = getFrameData(frameIndex)

return Texture(image).subTexture(frameData.viewport).image
}

/**
* Returns next frame index or 0 if [frame] is last.
*/
Expand Down

0 comments on commit 87ca500

Please sign in to comment.