-
-
Notifications
You must be signed in to change notification settings - Fork 891
feat: Add animation loop control to DrawImage with repeatCount parameter #2995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nimation control in DrawImageExtensions and DrawImageProcessor classes.
|
|
…e correct repeat count handling.
|
HI @Yushu2606 It's standard practice to create a post here in our Ideas channel for feature enhancements to ensure that any new features are fully fleshed out before discussion. Upon reading this PR I'm not sure exactly what benefit this feature actually brings. Could you please visit the channel and state you case. Thanks! |
|
@Yushu2606 I had a quick look at this and I think we can look at adding the feature. I'll do a thorough review asap. |
|
Hi @Yushu2606 would you please be able to give me write access to your fork (i.e add me as a contributor). Git LFS doesn't let me upload test reference images without it. |
ok, i have invited you as a collaborator |
JimBobSquarePants
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to merge this now. Thanks @Yushu2606 for your patience, sometimes, unfortunately it takes a very long time to get things organised.
Prerequisites
Description
This pull request enhances the
DrawImagefunctionality by adding animation loop control through a newrepeatCountparameter. This allows users to control how many times animated images (GIFs, APNGs, WebP animations, etc.) should loop when drawn onto another image.Close #2997
Changes Made
repeatCountparameter to allDrawImageextension methods inDrawImageExtensions.csDrawImageProcessorconstructors to accept and store therepeatCountparameterDrawImageProcessor<TPixelBg, TPixelFg>with animation frame cycling logic:currentFrameLoopfield to track animation progressrepeatCount >= 0Key Features
repeatCountparameter controls how many times an animated image loops0= infinite loop>0= specific number of loopsDrawImagemethod signatures are preserved with the new parameter addedUsage Example
Technical Details
currentFrameLoopfieldcurrentFrameIndex = currentFrameLoop % ForegroundImage.Frames.CountrepeatCountrepeatCountis non-negative usingGuard.MustBeGreaterThanOrEqualToImages