/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setPenT4
 * Signature: ([F)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setPenT4
  (JNIEnv *env, jobject obj, jfloatArray t4)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (t4 == NULL) {
	(*cdata->stroker)->setPenT4(cenv, cdata->stroker, NULL);
    } else {
	jfloat* ct4;
	if (((*env)->GetArrayLength(env, t4)) < 4) {
	    doeError_set(cenv, dcPRError, dcPRError_BAD_pent4);
	    CJError_throw(cenv);
	    return;
	}
	ct4 = (*env)->GetPrimitiveArrayCritical(env, t4, NULL);
	(*cdata->stroker)->setPenT4(cenv, cdata->stroker, (f32*)ct4);
	(*env)->ReleasePrimitiveArrayCritical(env, t4, ct4, JNI_ABORT);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Example #2
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    setOutputT6
 * Signature: ([F)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_setOutputT6
  (JNIEnv *env, jobject obj, jfloatArray t6)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (t6 == NULL) {
	(*cdata->dasher)->setOutputT6(cenv, cdata->dasher, NULL);
    } else {
	jfloat*	ct6;
	if (((*env)->GetArrayLength(env, t6)) < 6) {
	    doeError_set(cenv, dcPRError, dcPRError_BAD_outputt6);
	    CJError_throw(cenv);
	    return;
	}
	ct6 = (*env)->GetPrimitiveArrayCritical(env, t6, NULL);
	(*cdata->dasher)->setOutputT6(cenv, cdata->dasher, (f32*)ct6);
	(*env)->ReleasePrimitiveArrayCritical(env, t6, ct6, JNI_ABORT);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
/*
 * Disposer Method Called by Disposer thread
 * All the native memory associated with stroker is  cleaned here.
 */
void PathStroker_DisposeOps(JNIEnv *env, jlong ops)
{
    doeObject	cobj;
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(ops);
    doeE	cenv;

    /* protect against getting called twice */
    if (cdata == NULL) {
        return;
    }

    cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    cobj = (doeObject)(cdata->stroker);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    cobj = (doeObject)(cdata->cjout);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    doeMem_free(cenv, cdata);

    doeE_destroy(cenv);
}
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    reset
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_reset
  (JNIEnv *env, jobject obj)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cdata->stroker)->reset(cenv, cdata->stroker);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    appendQuadratic
 * Signature: (FFFF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_appendQuadratic
  (JNIEnv *env, jobject obj, jfloat xm, jfloat ym, jfloat x1, jfloat y1)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    dcPathConsumer
		cstroker= (dcPathConsumer)(cdata->stroker);

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cstroker)->appendQuadratic(cenv, cstroker, xm, ym, x1, y1);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    beginSubpath
 * Signature: (FF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_beginSubpath
  (JNIEnv *env, jobject obj, jfloat x0, jfloat y0)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    dcPathConsumer
		cstroker= (dcPathConsumer)(cdata->stroker);

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cstroker)->beginSubpath(cenv, cstroker, x0, y0);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Example #7
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    closedSubpath
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_closedSubpath
  (JNIEnv *env, jobject obj)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    dcPathConsumer
		cdasher	= (dcPathConsumer)(cdata->dasher);

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cdasher)->closedSubpath(cenv, cdasher);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Example #8
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    setDash
 * Signature: ([FF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_setDash
  (JNIEnv *env, jobject obj, jfloatArray dash, jfloat offset)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (dash == NULL) {
	(*cdata->dasher)->setDash(cenv, cdata->dasher, NULL, 0, offset);
    } else {
	jint	len	= (*env)->GetArrayLength(env, dash);
	jfloat*	cdash	= (*env)->GetPrimitiveArrayCritical(env, dash, NULL);  

	(*cdata->dasher)->setDash(cenv, cdata->dasher, cdash, len, offset);
	(*env)->ReleasePrimitiveArrayCritical(env, dash, cdash, JNI_ABORT);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setCorners
 * Signature: (IF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setCorners
  (JNIEnv *env, jobject obj, jint corners, jfloat miterlimit)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (corners == jround)
	corners = dcPathStroker_ROUND;
    else
	if (corners == jmiter)
	    corners = dcPathStroker_MITER;
	else
	    if (corners == jbevel)
		corners = dcPathStroker_BEVEL;

    (*cdata->stroker)->setCorners(cenv, cdata->stroker, corners, miterlimit);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Example #10
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setCaps
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setCaps
  (JNIEnv *env, jobject obj, jint caps)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (caps == jround)
	caps = dcPathStroker_ROUND;
    else
	if (caps == jsquare)
	    caps = dcPathStroker_SQUARE;
	else
	    if (caps == jbutt)
		caps = dcPathStroker_BUTT;

    (*cdata->stroker)->setCaps(cenv, cdata->stroker, caps);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Example #11
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    dispose
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_dispose
  (JNIEnv *env, jobject obj)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    doeObject	cobj;

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    cobj = (doeObject)(cdata->dasher);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    cobj = (doeObject)(cdata->cjout);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    doeMem_free(cenv, cdata);

    doeE_destroy(cenv);
}
Example #12
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setOutputConsumer
 * Signature: (Lsun/dc/path/PathConsumer;)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setOutputConsumer
  (JNIEnv *env, jobject obj, jobject out)
{
    jclass	cls;
    jmethodID	mid;

    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    /* ________________________________________________
     * determines if "out" has a native implementation.
     */
    cls = (*env)->GetObjectClass(env, out);
    mid = (*env)->GetMethodID(env, cls, "getCPathConsumer", "()J");
    cdata->cout = (dcPathConsumer)
	jlong_to_ptr((*env)->CallLongMethod(env, out, mid));

    if (cdata->cout) {
	(*cdata->stroker)->setOutputConsumer(cenv, cdata->stroker, cdata->cout);
    } else {
	/*
	 * update CJ stub to use new java path consumer
	 */
	(*cdata->cjout)->setJPathConsumer(cenv, cdata->cjout, out);
	if (doeError_occurred(cenv)) {
	    CJError_throw(cenv);
	    return;
	}
	(*cdata->stroker)->setOutputConsumer(cenv, cdata->stroker,
					 (dcPathConsumer)cdata->cjout);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}