SkBitmap bitmap; int generation = bitmap.getGenerationID(); // draw bitmap to canvas if (generation != bitmap.getGenerationID()) { // bitmap was modified }
SkBitmap bitmap; // modify bitmap bitmap.notifyPixelsChanged(); int oldGeneration = bitmap.getGenerationID(); // draw bitmap to canvas int newGeneration = bitmap.getGenerationID(); if (newGeneration != oldGeneration) { // bitmap was modified }This example modifies a bitmap and then notifies it that the pixel data has changed. It then gets the old and new generation IDs and checks if they are different to determine if the bitmap was modified. Both examples use SkBitmap's getGenerationID function to detect if a bitmap has been modified. This function is part of the Skia Graphics Library.