Code Search for Developers
 
 
  

gdip_custom.cpp from MASE: Agile Software Engineering at Krugle


Show gdip_custom.cpp syntax highlighted

/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

#include "swt.h"
#include "gdip_structs.h"
#include "gdip_stats.h"

extern "C" {

#define Gdip_NATIVE(func) Java_org_eclipse_swt_internal_gdip_Gdip_##func

#ifndef NO_Graphics_1DrawLines
JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawLines)
	(JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3)
{
	Point *points = NULL;
	jint *lparg2=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, Graphics_1DrawLines_FUNC);
	if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail;
	if (lparg2) {
		points = new Point[arg3];
		for (int i=0, j=0; i<arg3; i++, j+=2) {
			Point *point = new Point(lparg2[j], lparg2[j + 1]);
			points[i] = *point;
			delete point;
		}
	}
	rc = (jint)((Graphics *)arg0)->DrawLines((Pen *)arg1, points, (INT)arg3);
fail:
	if (lparg2 && points) delete points;
	if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT);
	Gdip_NATIVE_EXIT(env, that, Graphics_1DrawLines_FUNC);
	return rc;
}
#endif

#ifndef NO_Graphics_1DrawPolygon
JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPolygon)
	(JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3)
{
	Point *points = NULL;
	jint *lparg2=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, Graphics_1DrawPolygon_FUNC);
	if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail;
	if (lparg2) {
		points = new Point[arg3];
		for (int i=0, j=0; i<arg3; i++, j+=2) {
			Point *point = new Point(lparg2[j], lparg2[j + 1]);
			points[i] = *point;
			delete point;
		}
	}
	rc = (jint)((Graphics *)arg0)->DrawPolygon((Pen *)arg1, points, (INT)arg3);
fail:
	if (lparg2 && points) delete points;
	if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT);
	Gdip_NATIVE_EXIT(env, that, Graphics_1DrawPolygon_FUNC);
	return rc;
}
#endif

#ifndef NO_Graphics_1FillPolygon
JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillPolygon)
	(JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3, jint arg4)
{
	Point *points = NULL;
	jint *lparg2=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, Graphics_1FillPolygon_FUNC);
	if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail;
	if (lparg2) {
		points = new Point[arg3];
		for (int i=0, j=0; i<arg3; i++, j+=2) {
			Point *point = new Point(lparg2[j], lparg2[j + 1]);
			points[i] = *point;
			delete point;
		}
	}
	rc = (jint)((Graphics *)arg0)->FillPolygon((Brush *)arg1, points, (INT)arg3, (FillMode)arg4);
fail:
	if (lparg2 && points) delete points;
	if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT);
	Gdip_NATIVE_EXIT(env, that, Graphics_1FillPolygon_FUNC);
	return rc;
}
#endif

#ifndef NO_GraphicsPath_1GetPathPoints
JNIEXPORT jint JNICALL Gdip_NATIVE(GraphicsPath_1GetPathPoints)
	(JNIEnv *env, jclass that, jint arg0, jfloatArray arg1, jint arg2)
{
	PointF *points = NULL;
	jfloat *lparg1=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, GraphicsPath_1GetPathPoints_FUNC);
	if (arg1) if ((lparg1 = env->GetFloatArrayElements(arg1, NULL)) == NULL) goto fail;
	if (lparg1) {
		points = new PointF[arg2];
	}
	rc = (jint)((GraphicsPath *)arg0)->GetPathPoints(points, arg2);
fail:
	if (lparg1 && points) {
		for (int i=0, j=0; i<arg2; i++, j+=2) {
			lparg1[j] = points[i].X;
			lparg1[j + 1] = points[i].Y;
		}
		delete points;
	}
	if (arg1 && lparg1) env->ReleaseFloatArrayElements(arg1, lparg1, 0);
	Gdip_NATIVE_EXIT(env, that, GraphicsPath_1GetPathPoints_FUNC);
	return rc;
}
#endif

#ifndef NO_Matrix_1TransformPoints__I_3FI
JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__I_3FI)
	(JNIEnv *env, jclass that, jint arg0, jfloatArray arg1, jint arg2)
{
	PointF *points = NULL;
	jfloat *lparg1=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, Matrix_1TransformPoints__I_3FI_FUNC);
	if (arg1) if ((lparg1 = env->GetFloatArrayElements(arg1, NULL)) == NULL) goto fail;
	if (lparg1) {
		points = new PointF[arg2];
		for (int i=0, j=0; i<arg2; i++, j+=2) {
			PointF *point = new PointF(lparg1[j], lparg1[j + 1]);
			points[i] = *point;
			delete point;
		}
	}
	rc = (jint)((Matrix *)arg0)->TransformPoints(points, arg2);
fail:
	if (lparg1 && points) {
		for (int i=0, j=0; i<arg2; i++, j+=2) {
			lparg1[j] = points[i].X;
			lparg1[j + 1] = points[i].Y;
		}
		delete points;
	}
	if (arg1 && lparg1) env->ReleaseFloatArrayElements(arg1, lparg1, 0);
	Gdip_NATIVE_EXIT(env, that, Matrix_1TransformPoints__I_3FI_FUNC);
	return rc;
}
#endif

#ifndef NO_LinearGradientBrush_1SetInterpolationColors
JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1SetInterpolationColors)
	(JNIEnv *env, jclass that, jint arg0, jintArray arg1, jfloatArray arg2, jint arg3)
{
	Color *colors;
	jint *lparg1=NULL;
	jfloat *lparg2=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, LinearGradientBrush_1SetInterpolationColors_FUNC);
	if (arg1) if ((lparg1 = env->GetIntArrayElements(arg1, NULL)) == NULL) goto fail;
	if (arg2) if ((lparg2 = env->GetFloatArrayElements(arg2, NULL)) == NULL) goto fail;
	if (lparg1) {
		colors = new Color[arg3];
		for (int i=0; i<arg3; i++) {
			colors[i] = *(Color *)lparg1[i];
		}
	}
	rc = (jint)((LinearGradientBrush *)arg0)->SetInterpolationColors(colors, (const REAL *)lparg2, arg3);
fail:
	if (lparg1 && colors) {
		delete colors;
	}
	if (arg2 && lparg2) env->ReleaseFloatArrayElements(arg2, lparg2, 0);
	if (arg1 && lparg1) env->ReleaseIntArrayElements(arg1, lparg1, 0);
	Gdip_NATIVE_EXIT(env, that, LinearGradientBrush_1SetInterpolationColors_FUNC);
	return rc;
}
#endif

#ifndef NO_PathGradientBrush_1SetSurroundColors
JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetSurroundColors)
	(JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2)
{
	Color *colors;
	jint *lparg1=NULL;
	jint *lparg2=NULL;
	jint rc = 0;
	Gdip_NATIVE_ENTER(env, that, PathGradientBrush_1SetSurroundColors_FUNC);
	if (arg1) if ((lparg1 = env->GetIntArrayElements(arg1, NULL)) == NULL) goto fail;
	if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail;
	if (lparg1 && lparg2) {
		colors = new Color[lparg2[0]];
		for (int i=0; i<lparg2[0]; i++) {
			colors[i] = *(Color *)lparg1[i];
		}
	}
	rc = (jint)((PathGradientBrush *)arg0)->SetSurroundColors((Color *)colors, (INT *)lparg2);
fail:
	if (lparg1 && lparg2 && colors) {
		delete colors;
	}	
	if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, 0);
	if (arg1 && lparg1) env->ReleaseIntArrayElements(arg1, lparg1, 0);
	Gdip_NATIVE_EXIT(env, that, PathGradientBrush_1SetSurroundColors_FUNC);
	return rc;
}
#endif

}



See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  .settings/
    org.eclipse.jdt.core.prefs
    org.eclipse.jdt.ui.prefs
  about_files/
    IJG_README
  ebe/
    manymouse/
      cursor/
        DetectMice.java
        MouseCursor.java
        MouseCursorData.java
        ReadMiceData.java
        mouse.gif
      events/
        HandleMiceEvents.java
      jni/
        ManyMouse.java
        ManyMouseEvent.java
      test/
        TestManyMouse.java
      utils/
        MouseUtils.java
        hidden_mouse.gif
      MultipleMice.java
    test/
      GuiTest.java
      ListenerTest.java
      MultipleMouseDemo.java
      SendSystemEvents.java
      Snippet110.java
      Snippet118.java
      Snippet119.java
      Snippet142.java
      Snippet146.java
      Snippet219.java
      Snippet242.java
      Snippet44.java
      Snippet46.java
      Snippet92.java
      SwtSample.java
      TestGui.java
  org/
    eclipse/
  .classpath
  .project
  ManyMouseJava.c
  ManyMouseJava.dll
  ManyMouseJava.exp
  ManyMouseJava.h
  ManyMouseJava.lib
  ManyMouse_LICENSE
  ManyMouse_README
  Manymouse_Makefile
  about.html
  build-ce.bat
  build.bat
  build.xml
  callback.c
  callback.h
  com.c
  com.h
  com_custom.h
  com_stats.c
  com_stats.h
  com_structs.c
  com_structs.h
  defines.h
  gdip.cpp
  gdip.h
  gdip_custom.cpp
  gdip_stats.cpp
  gdip_stats.h
  gdip_structs.cpp
  gdip_structs.h
  javaw.exe.manifest
  linux_evdev.c
  linux_evdev.dll
  macosx_hidmanager.c
  macosx_hidmanager.dll
  make_common.mak
  make_win32.mak
  make_wince.mak
  manymouse.c
  manymouse.dll
  manymouse.h
  os.c
  os.h
  os_custom.c
  os_custom.h
  os_stats.c
  os_stats.h
  os_structs.c
  os_structs.h
  swt-awt-win32-3232.dll
  swt-gdip-win32-3232.dll
  swt-wgl-win32-3232.dll
  swt-win32-3232.dll
  swt.c
  swt.h
  swt.rc
  swt_awt.c
  swt_awt.rc
  swt_gdip.rc
  swt_wgl.rc
  version.txt
  wgl.c
  wgl.h
  wgl_stats.c
  wgl_stats.h
  wgl_structs.c
  wgl_structs.h
  windows_wminput.c
  windows_wminput.dll
  x11_xinput.c
  x11_xinput.dll