android / ndk

The Android Native Development Kit
1.96k stars 255 forks source link

Bitmap C++ wrapper API #822

Open DanAlbert opened 5 years ago

DanAlbert commented 5 years ago

Forked from https://github.com/android-ndk/ndk/issues/476

Possible API:

namespace android::graphics   {
    class Bitmap final {
    public:
        Bitmap (JNIEnv *env, jobject jbitmap);
        ~Bitmap ();  // Use RAII to release the bitmap/unlock it

        int getInfo (AndroidBitmapInfo& info);
        int lockPixels (void **addrPtr);
        int unlockPixels ();

        // other nice to have, 2D drawing member functions
    };
}
arturbac commented 5 years ago

without even simple raii on pixels , some simple raii pixel locker holding pointer to pixels and pointer to Bitmap ? and second lockPixels should take refrence to pointer instead of pointer to pointer as passing nullptr to lockPixels dosn't have any sense.