/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2002 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome Team Members:
 *   Jean Van Wyk <jeanvanwyk@iname.com>
 *   Jeffrey S. Morgan <jeffrey.morgan@bristolwest.com>
 *   Dan Bornstein <danfuzz@milk.com>
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 *
 * This file was orriginally generated by the Java-GNOME Code Generator
 * Please do not modify the code that is identified as generated.  Also,
 * please insert your code above the generated code.
 *
 * Generation date: 2002-08-01 07:00:29 EDT
 */

#include <jni.h>
#include <sys/types.h>
#include <gdk/gdk.h>
#ifdef __cplusplus
extern "C" 
{
#endif
    /****************************************
     * BEGINNING OF GENERATED CODE
     ****************************************/
    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_new
     * Signature: ()I
     */
    JNIEXPORT jint JNICALL Java_org_gnu_gdk_Region_gdk_1region_1new (JNIEnv *env, jclass cls) 
    {
        {
            return (jint)gdk_region_new ();
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_polygon
     * Signature: ([Lint ;II)I
     */
    JNIEXPORT jint JNICALL Java_org_gnu_gdk_Region_gdk_1region_1polygon (JNIEnv *env, jclass cls, 
        jintArray points, jint numPoints, jint fillRule) 
    {
        gint *points_g_g = (gint *) (*env)->GetIntArrayElements (env, points, NULL);
        GdkPoint *points_g = (GdkPoint *)points_g_g;
        gint32 numPoints_g = (gint32) numPoints;
        GdkFillRule fillRule_g = (GdkFillRule) fillRule;
        {
            return (jint)gdk_region_polygon (points_g, numPoints_g, fillRule_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_rectangle
     * Signature: (I)I
     */
    JNIEXPORT jint JNICALL Java_org_gnu_gdk_Region_gdk_1region_1rectangle (JNIEnv *env, jclass cls, 
        jint rectangle) 
    {
        GdkRectangle *rectangle_g = (GdkRectangle *)rectangle;
        {
            return (jint)gdk_region_rectangle (rectangle_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_destroy
     * Signature: (I)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1destroy (JNIEnv *env, jclass cls, 
        jint region) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        {
            gdk_region_destroy (region_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_get_clipbox
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1get_1clipbox (JNIEnv *env, jclass 
        cls, jint region, jint rectangle) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        GdkRectangle *rectangle_g = (GdkRectangle *)rectangle;
        {
            gdk_region_get_clipbox (region_g, rectangle_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_get_rectangles
     * Signature: (I[Lint ;[Lint ;)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1get_1rectangles (JNIEnv *env, 
        jclass cls, jint region, jintArray rectangles, jintArray numRectangles) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
	jsize len = (*env)->GetArrayLength(env, rectangles);
        GdkRectangle **rectangles_g = g_malloc(sizeof(GdkRectangle*)*len);
	gint* numRectangles_g = (*env)->GetIntArrayElements(env, numRectangles, NULL);
	int i = 0;

	for (i = 0; i < len; i++)  {
		jint ptr;
		(*env)->GetIntArrayRegion(env, rectangles, i, 1, &ptr);
		rectangles_g[i] = (GdkRectangle*)ptr;
	}
       	gdk_region_get_rectangles (region_g, rectangles_g, numRectangles_g);
        (*env)->ReleaseIntArrayElements (env, numRectangles, (jint *) numRectangles_g, 0);
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_empty
     * Signature: (I)Z
     */
    JNIEXPORT jboolean JNICALL Java_org_gnu_gdk_Region_gdk_1region_1empty (JNIEnv *env, jclass cls, 
        jint region) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        {
            jboolean result_j = (jboolean) (gdk_region_empty (region_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_equal
     * Signature: (II)Z
     */
    JNIEXPORT jboolean JNICALL Java_org_gnu_gdk_Region_gdk_1region_1equal (JNIEnv *env, jclass cls, 
        jint region1, jint region2) 
    {
        GdkRegion *region1_g = (GdkRegion *)region1;
        GdkRegion *region2_g = (GdkRegion *)region2;
        {
            jboolean result_j = (jboolean) (gdk_region_equal (region1_g, region2_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_point_in
     * Signature: (III)Z
     */
    JNIEXPORT jboolean JNICALL Java_org_gnu_gdk_Region_gdk_1region_1point_1in (JNIEnv *env, jclass 
        cls, jint region, jint x, jint y) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        gint32 x_g = (gint32) x;
        gint32 y_g = (gint32) y;
        {
            jboolean result_j = (jboolean) (gdk_region_point_in (region_g, x_g, y_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_rect_in
     * Signature: (II)I
     */
    JNIEXPORT jint JNICALL Java_org_gnu_gdk_Region_gdk_1region_1rect_1in (JNIEnv *env, jclass cls, 
        jint region, jint rect) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        GdkRectangle *rect_g = (GdkRectangle *)rect;
        {
            jint result_j = (jint) (gdk_region_rect_in (region_g, rect_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_offset
     * Signature: (III)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1offset (JNIEnv *env, jclass cls, 
        jint retion, jint dx, jint dy) 
    {
        GdkRegion *retion_g = (GdkRegion *)retion;
        gint32 dx_g = (gint32) dx;
        gint32 dy_g = (gint32) dy;
        {
            gdk_region_offset (retion_g, dx_g, dy_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_shrink
     * Signature: (III)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1shrink (JNIEnv *env, jclass cls, 
        jint region, jint dx, jint dy) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        gint32 dx_g = (gint32) dx;
        gint32 dy_g = (gint32) dy;
        {
            gdk_region_shrink (region_g, dx_g, dy_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_union_with_rect
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1union_1with_1rect (JNIEnv *env, 
        jclass cls, jint region, jint rect) 
    {
        GdkRegion *region_g = (GdkRegion *)region;
        GdkRectangle *rect_g = (GdkRectangle *)rect;
        {
            gdk_region_union_with_rect (region_g, rect_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_intersect
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1intersect (JNIEnv *env, jclass cls, 
        jint source1, jint source2) 
    {
        GdkRegion *source1_g = (GdkRegion *)source1;
        GdkRegion *source2_g = (GdkRegion *)source2;
        {
            gdk_region_intersect (source1_g, source2_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_union
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1union (JNIEnv *env, jclass cls, 
        jint source1, jint source2) 
    {
        GdkRegion *source1_g = (GdkRegion *)source1;
        GdkRegion *source2_g = (GdkRegion *)source2;
        {
            gdk_region_union (source1_g, source2_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_subtract
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1subtract (JNIEnv *env, jclass cls, 
        jint source1, jint source2) 
    {
        GdkRegion *source1_g = (GdkRegion *)source1;
        GdkRegion *source2_g = (GdkRegion *)source2;
        {
            gdk_region_subtract (source1_g, source2_g);
        }
    }

    /*
     * Class:     org.gnu.gdk.Region
     * Method:    gdk_region_xor
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gdk_Region_gdk_1region_1xor (JNIEnv *env, jclass cls, jint 
        source1, jint source2) 
    {
        GdkRegion *source1_g = (GdkRegion *)source1;
        GdkRegion *source2_g = (GdkRegion *)source2;
        {
            gdk_region_xor (source1_g, source2_g);
        }
    }

    /****************************************
     * END OF GENERATED CODE
     ****************************************/
#ifdef __cplusplus
}
#endif

