-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Created by Marc Rousavy on 28.06.21. | ||
// | ||
|
||
#include "JImage.h" | ||
|
||
#include <jni.h> | ||
#include <fbjni/fbjni.h> | ||
|
||
namespace vision { | ||
|
||
using namespace facebook; | ||
using namespace jni; | ||
|
||
|
||
bool JImage::getIsValid() { | ||
static const auto getNativeContextMethod = getClass()->getMethod<jlong()>("getNativeContext"); | ||
try { | ||
getNativeContextMethod(javaClassLocal()); | ||
return true; | ||
} catch (...) { | ||
// function throws if the image is not active anymore | ||
return false; | ||
} | ||
} | ||
|
||
} // namespace vision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Created by Marc Rousavy on 28.06.21. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <jni.h> | ||
#include <fbjni/fbjni.h> | ||
|
||
namespace vision { | ||
|
||
struct JImage : public facebook::jni::JavaClass<JImage> { | ||
static constexpr auto kJavaDescriptor = "Landroid/media/Image;"; | ||
|
||
public: | ||
bool getIsValid(); | ||
}; | ||
|
||
} // namespace vision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters