grim/guifications3
Clone
Summary
Browse
Changes
Graph
Closing this branch since we moved to "default" for it a while ago now
org.guifications.gf3
2009-12-06, Gary Kramlich
3707becf4df7
Closing this branch since we moved to "default" for it a while ago now
#include
<jni.h>
#include
<gflib/gf_image.h>
#include
<gflib/gf_object.h>
#include
<libgtk-java/jg_jnu.h>
#ifndef _Included_org_guifications_gflib_GfImage
#define _Included_org_guifications_gflib_GfImage
#ifdef __cplusplus
extern
"C"
{
#endif
/*
* Class: org_guifications_gflib_GfImage
* Method: gf_image_new_from_file
* Signature: (Ljava/lang/String;)Lorg/gnu/glib/Handle;
*/
JNIEXPORT
jobject
JNICALL
Java_org_guifications_gflib_GfImage_gf_1image_1new_1from_1file
(
JNIEnv
*
env
,
jclass
klass
,
jstring
str
)
{
return
getHandleFromPointer
(
env
,
gf_image_new_from_file
(
(
gchar
*
)
str
));
}
/*
* Class: org_guifications_gflib_GfImage
* Method: gf_image_new_from_data
* Signature: ([BJ)Lorg/gnu/glib/Handle;
*/
JNIEXPORT
jobject
JNICALL
Java_org_guifications_gflib_GfImage_gf_1image_1new_1from_1data
(
JNIEnv
*
env
,
jclass
klass
,
jbyteArray
bytes
,
jlong
l_ong
)
{
return
getHandleFromPointer
(
env
,
gf_image_new_from_data
(
(
gchar
*
)
bytes
,
(
gsize
)
l_ong
));
}
/*
* Class: org_guifications_gflib_GfImage
* Method: gf_image_set_data
* Signature: (Lorg/gnu/glib/Handle;[BJ)V
*/
JNIEXPORT
void
JNICALL
Java_org_guifications_gflib_GfImage_gf_1image_1set_1data
(
JNIEnv
*
env
,
jclass
klass
,
jobject
obj
,
jbyteArray
bytes
,
jlong
l_ong
)
{
gf_image_set_data
(
(
GfImage
*
)
getPointerFromHandle
(
env
,
obj
),
(
gchar
*
)
bytes
,
(
gsize
)
l_ong
);
}
/*
* Class: org_guifications_gflib_GfImage
* Method: gf_image_get_data
* Signature: (Lorg/gnu/glib/Handle;J)[B
*/
JNIEXPORT
jbyteArray
JNICALL
Java_org_guifications_gflib_GfImage_gf_1image_1get_1data
(
JNIEnv
*
env
,
jclass
klass
,
jobject
obj
,
jlong
l_ong
)
{
gchar
*
data
=
gf_image_get_data
(
getPointerFromHandle
(
env
,
obj
),
(
gsize
)
l_ong
);
jbyteArray
array
=
(
*
env
)
->
NewByteArray
(
env
,
(
jsize
)
l_ong
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
array
,
0
,
(
gsize
)
l_ong
,
data
);
return
array
;
}
#ifdef __cplusplus
}
#endif
#endif