[FREE] Extended Canvas Flood Fill Extension

Extended Canvas Flood Fill Extension

Introducing the Extended Canvas Flood Fill Extension for Android app development, a powerful and versatile tool designed to bring advanced flood fill capabilities to your apps. This extension is a perfect solution for developers looking to implement custom graphics and interactive art features in their applications.

Features

The Extended Canvas Flood Fill Extension offers a range of functionalities:

  • Flood Fill Circle: Apply flood fill within a specified radius from a point, perfect for creating circular patterns and effects.
  • Flood Fill with Density Control: Adjust the density of the flood fill to control the spread rate, allowing for more artistic control over the filling process.
  • Point Size and Density-Based Flood Fill: Combine point size and density for a granular control over the flood fill pattern and spread.
  • Efficient Bitmap Handling: Utilize Bitmap for efficient pixel manipulation, ensuring smooth and responsive canvas drawing operations.
  • Dynamic Filling Options: Support for various filling parameters like color, radius, density, and point size.
  • Memory management: The extension has good memory management.


Key Improvements:

  1. Modified saveCurrentState Method:

    • The method now creates a copy of the current bitmap state before pushing it onto the undo stack.
    • This change prevents the recycling of the bitmap currently in use, which was causing the error when trying to repaint the same area.
  2. Improved Bitmap Management:

    • Additional checks were implemented to ensure that a bitmap is not recycled if it's still in use or might be used again soon.
    • The code now carefully manages the lifecycle of bitmaps, especially when dealing with undo and redo stacks.
  3. Stack Management:

    • The undo and redo stacks now handle bitmap states more reliably. When a state is pushed to the stack, it's a fresh copy, ensuring the original bitmap can be safely used or recycled without affecting the stack's integrity.
  4. Handling Recycled Bitmaps:

    • Introduced checks for isRecycled() on bitmaps before their use to prevent runtime errors.
    • If a bitmap is found to be recycled when it's needed, the code now handles the scenario by creating a new bitmap.
  5. Optimizations for Performance and Memory Usage:

    • Suggested optimizations to reduce memory consumption by reusing bitmaps where possible.
    • Advised on monitoring the quantity of bitmaps in memory to avoid OutOfMemoryError.

These improvements aim to enhance the application's stability, particularly when performing repetitive bitmap operations such as repainting the same area multiple times.

Blocks

Download and Contribution

You can download the Extended Canvas Flood Fill Extension and contribute to its development:

Support and Contact

For support, queries, or suggestions, please reach out through our Telegram.

Note: Your financial support drives the development of high-quality, innovative extensions. Donate here!


Feel free to use this template as a starting point and modify it to include specific details about your extension, such as the download link, GitHub repository, or support channels. The template is structured to provide a clear and comprehensive overview of the extension and its functionalities.

6 Likes

Added memory management to the extension.

I tested your sample aia, and found:

If one area is filled, and click there again ,the app crashed.

tested in aicompanion.

1 Like

Thanks for reporting! If you can help, take a look at the source code.

NEW VERSION
Please find it in the first post

Key Improvements:

  1. Modified saveCurrentState Method:

    • The method now creates a copy of the current bitmap state before pushing it onto the undo stack.
    • This change prevents the recycling of the bitmap currently in use, which was causing the error when trying to repaint the same area.
  2. Improved Bitmap Management:

    • Additional checks were implemented to ensure that a bitmap is not recycled if it's still in use or might be used again soon.
    • The code now carefully manages the lifecycle of bitmaps, especially when dealing with undo and redo stacks.
  3. Stack Management:

    • The undo and redo stacks now handle bitmap states more reliably. When a state is pushed to the stack, it's a fresh copy, ensuring the original bitmap can be safely used or recycled without affecting the stack's integrity.
  4. Handling Recycled Bitmaps:

    • Introduced checks for isRecycled() on bitmaps before their use to prevent runtime errors.
    • If a bitmap is found to be recycled when it's needed, the code now handles the scenario by creating a new bitmap.
  5. Optimizations for Performance and Memory Usage:

    • Suggested optimizations to reduce memory consumption by reusing bitmaps where possible.
    • Advised on monitoring the quantity of bitmaps in memory to avoid OutOfMemoryError.

These improvements aim to enhance the application's stability, particularly when performing repetitive bitmap operations such as repainting the same area multiple times.

2 Likes