예제 #1
0
*/	RXIEXT int RXD_Draw(int cmd, RXIFRM *frm, REBCEC *ctx)
/*
**		DRAW command dispatcher.
**
***********************************************************************/
{
	switch (cmd) {

    case CMD_DRAW_INIT_WORDS:
        //temp hack - will be removed later
        draw_ext_words = RL_MAP_WORDS(RXA_SERIES(frm,1));
        break;
    case CMD_DRAW_ANTI_ALIAS:
        agg_anti_alias(ctx->envr, RXA_LOGIC(frm, 1));
        break;

	case CMD_DRAW_ARC:
		agg_arc(
            ctx->envr,
            RXA_PAIR(frm, 1),
            RXA_PAIR(frm, 2),
            (RXA_TYPE(frm, 3) == RXT_DECIMAL) ? RXA_DEC64(frm, 3) : RXA_INT64(frm, 3),
            (RXA_TYPE(frm, 4) == RXT_DECIMAL) ? RXA_DEC64(frm, 4) : RXA_INT64(frm, 4),
            RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 5)) - W_DRAW_OPENED
        );
		break;

	case CMD_DRAW_ARROW:
		agg_arrow(ctx->envr, RXA_PAIR(frm, 1), (RXA_TYPE(frm, 2) == RXT_NONE) ? NULL : RXA_TUPLE(frm, 2)+1);
		break;

	case CMD_DRAW_BOX:
		agg_box(ctx->envr, RXA_PAIR(frm, 1), RXA_PAIR(frm, 2), (RXA_TYPE(frm, 3) == RXT_DECIMAL) ? RXA_DEC64(frm, 3) : RXA_INT64(frm, 3));
		break;

	case CMD_DRAW_CIRCLE:
		agg_circle(ctx->envr, RXA_PAIR(frm, 1), RXA_PAIR(frm, 2));
		break;

	case CMD_DRAW_CLIP:
		agg_clip(ctx->envr, RXA_PAIR(frm, 1), RXA_PAIR(frm, 2));
		break;

	case CMD_DRAW_CURVE:
        if (RXA_TYPE(frm, 4) == RXT_NONE)
			agg_curve3(ctx->envr, RXA_PAIR(frm, 1), RXA_PAIR(frm, 2), RXA_PAIR(frm, 3));
        else
			agg_curve4(ctx->envr, RXA_PAIR(frm, 1), RXA_PAIR(frm, 2), RXA_PAIR(frm, 3), RXA_PAIR(frm, 4));

		break;

	case CMD_DRAW_ELLIPSE:
		agg_ellipse(ctx->envr, RXA_PAIR(frm, 1), RXA_PAIR(frm, 2));
		break;

	case CMD_DRAW_FILL_PEN:
		{
   			//REBYTE* val;
			//REBCNT type;
			//REBSER* img;

        if (RXA_TYPE(frm, 1) == RXT_TUPLE)
            agg_fill_pen(ctx->envr, RXA_TUPLE(frm, 1)+1);
        else if (RXA_TYPE(frm, 1) == RXT_LOGIC && !RXA_LOGIC(frm,1))
            agg_fill_pen(ctx->envr, NULL);
        else {
            agg_fill_pen_image(ctx->envr, RXA_IMAGE_BITS(frm,1), RXA_IMAGE_WIDTH(frm,1), RXA_IMAGE_HEIGHT(frm,1));
            }
        }
		break;

    case CMD_DRAW_FILL_RULE:
        agg_fill_rule(ctx->envr, RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 1)));
        break;

    case CMD_DRAW_GAMMA:
        agg_gamma(ctx->envr, (RXA_TYPE(frm, 1) == RXT_DECIMAL) ? RXA_DEC64(frm, 1) : RXA_INT64(frm, 1));
        break;

	case CMD_DRAW_GRAD_PEN:
        if (RXA_TYPE(frm, 7) == RXT_NONE)
            agg_reset_gradient_pen(ctx->envr);
        else
            agg_gradient_pen(
                ctx->envr,
                RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 1)), //type
                RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 2)), //mode
                RXA_PAIR(frm, 3), //offset
                RXA_PAIR(frm, 4), //range - (begin, end)
                (RXA_TYPE(frm, 5) == RXT_DECIMAL) ? RXA_DEC64(frm, 5) : RXA_INT64(frm, 5), // angle
                RXA_PAIR(frm, 6), // scale
                RXA_SERIES(frm, 7) // unsigned char *colors
            );
        break;

    case CMD_DRAW_IMAGE:
        if (RXA_TYPE(frm, 2) == RXT_PAIR)
            agg_image(ctx->envr, RXA_IMAGE_BITS(frm,1), RXA_IMAGE_WIDTH(frm,1), RXA_IMAGE_HEIGHT(frm,1), RXA_PAIR(frm, 2));
        else {
            agg_image_scale(ctx->envr, RXA_IMAGE_BITS(frm,1), RXA_IMAGE_WIDTH(frm,1), RXA_IMAGE_HEIGHT(frm,1), RXA_SERIES(frm, 2));
        }
        break;

    case CMD_DRAW_IMAGE_FILTER:
        agg_image_filter(
            ctx->envr,
            RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 1)) - W_DRAW_NEAREST,
            RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 2)) - W_DRAW_RESIZE,
            (RXA_TYPE(frm, 3) == RXT_NONE) ? 1.0 : (RXA_TYPE(frm, 3) == RXT_DECIMAL) ? RXA_DEC64(frm, 3) : RXA_INT64(frm, 3)
        );
        break;

    case CMD_DRAW_IMAGE_OPTIONS:
        agg_image_options(ctx->envr, (RXA_TYPE(frm, 1) == RXT_NONE) ? NULL : RXA_TUPLE(frm, 1)+1, RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 2)) - W_DRAW_NO_BORDER);
        break;

    case CMD_DRAW_IMAGE_PATTERN:
        agg_image_pattern(ctx->envr, RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 1)) - W_DRAW_NORMAL, RXA_PAIR(frm, 2), RXA_PAIR(frm, 3));
        break;


	case CMD_DRAW_LINE:
		{
			RXIARG val[2];
			REBCNT type;
			REBCNT n, m = 0;
			REBSER blk = RXA_SERIES(frm, 1);

			for (n = 0; type = RL_GET_VALUE(blk, n, &val[m]); n++) {
				if (type == RXT_PAIR) {
				    switch (++m){
                        case 1:
                            agg_path_open(ctx->envr);
                            break;
				        case 2:
                            agg_line(ctx->envr, val[0].pair,val[1].pair);
                            val[0] = val[1];
                            m--;
                            break;
				    }
				}
			}
		}
		break;

	case CMD_DRAW_LINE_CAP:
		agg_line_cap(ctx->envr, RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 1)) - W_DRAW_BUTT);
		break;

	case CMD_DRAW_LINE_JOIN:
		agg_line_join(ctx->envr, RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 1)) - W_DRAW_MITER);
		break;

	case CMD_DRAW_LINE_WIDTH:
		agg_line_width(ctx->envr, (RXA_TYPE(frm, 1) == RXT_DECIMAL) ? RXA_DEC64(frm, 1) : RXA_INT64(frm, 1), RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 2)) - W_DRAW_VARIABLE);
		break;

	case CMD_DRAW_LINE_PATTERN:
        if (RXA_TYPE(frm, 2) == RXT_NONE)
            agg_line_pattern(ctx->envr, NULL, NULL);
        else {
            REBSER patterns = RXA_SERIES(frm, 2);
            REBINT len = RL_SERIES(patterns, RXI_SER_TAIL);

            if (len > 1){

                RXIARG val;
                REBCNT type;
                REBCNT n;
                REBDEC* pattern = (REBDEC*) malloc ((len + 1) * sizeof(REBDEC)) ;

                pattern[0] = len;

                for (n = 0; type = RL_GET_VALUE(patterns, n, &val); n++) {
                    if (type == RXT_DECIMAL)
                        pattern[n+1] = val.dec64;
                    else if (type == RXT_INTEGER)
                        pattern[n+1] = val.int64;
                    else
                        break;
                }
                agg_line_pattern(ctx->envr, RXA_TUPLE(frm, 1)+1, pattern);
            }

        }
		break;

	case CMD_DRAW_INVERT_MATRIX:
		agg_invert_matrix(ctx->envr);
		break;

	case CMD_DRAW_MATRIX:
        agg_matrix(ctx->envr, RXA_SERIES(frm, 1));
		break;

	case CMD_DRAW_PEN:
        if (RXA_TYPE(frm, 1) == RXT_TUPLE)
            agg_pen(ctx->envr, RXA_TUPLE(frm, 1)+1);
        else if (RXA_TYPE(frm, 1) == RXT_LOGIC && !RXA_LOGIC(frm,1))
            agg_pen(ctx->envr, NULL);
        else
            agg_pen_image(ctx->envr, RXA_IMAGE_BITS(frm,1), RXA_IMAGE_WIDTH(frm,1), RXA_IMAGE_HEIGHT(frm,1));
		break;

	case CMD_DRAW_POLYGON:
		{
			RXIARG val;
			REBCNT type;
			REBCNT n;
			REBSER blk = RXA_SERIES(frm, 1);

			for (n = 0; type = RL_GET_VALUE(blk, n, &val); n++) {
				if (type == RXT_PAIR) {
					if (n > 0)
						agg_add_vertex(ctx->envr, val.pair);
					else
						agg_begin_poly(ctx->envr, val.pair);
				}
			}
			agg_end_poly(ctx->envr);
		}
		break;

    case CMD_DRAW_PUSH:
        {
            REBCEC innerCtx;

            innerCtx.envr = ctx->envr;
            innerCtx.block = RXA_SERIES(frm, 1);
            innerCtx.index = 0;

            agg_push_matrix(ctx->envr);
            RL_Do_Commands(RXA_SERIES(frm, 1), 0, &innerCtx);
            agg_pop_matrix(ctx->envr);
        }
        break;

	case CMD_DRAW_RESET_MATRIX:
		agg_reset_matrix(ctx->envr);
		break;

    case CMD_DRAW_ROTATE:
        agg_rotate(ctx->envr, (RXA_TYPE(frm, 1) == RXT_DECIMAL) ? RXA_DEC64(frm, 1) : RXA_INT64(frm, 1));
        break;

    case CMD_DRAW_SCALE:
        agg_scale(ctx->envr, RXA_PAIR(frm, 1));
        break;

    case CMD_DRAW_SHAPE:
        {
            REBCEC innerCtx;

            innerCtx.envr = ctx->envr;
            innerCtx.block = RXA_SERIES(frm, 1);
            innerCtx.index = 0;

            agg_path_open(ctx->envr);
            RL_Do_Commands(RXA_SERIES(frm, 1), 0, &innerCtx);
            agg_path_close(ctx->envr);
        }
        break;

    case CMD_DRAW_SKEW:
        agg_skew(ctx->envr, RXA_PAIR(frm, 1));
        break;

	case CMD_DRAW_SPLINE:
        {
            REBSER points = RXA_SERIES(frm, 1);
            REBINT len = RL_SERIES(points, RXI_SER_TAIL);

            if (len > 3){
                RXIARG val;
                REBCNT type;
                REBCNT n;

                for (n = 0; type = RL_GET_VALUE(points, n, &val); n++) {
                    if (type == RXT_PAIR) {
                        if (n > 0)
                            agg_add_vertex(ctx->envr, val.pair);
                        else
                            agg_begin_poly(ctx->envr, val.pair);
                    }
                }
                agg_end_spline(ctx->envr, RXA_INT32(frm, 2), RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 3)) - W_DRAW_OPENED);
            }

		}
		break;

    case CMD_DRAW_TEXT:
        agg_text(
            ctx->envr,
            (RL_FIND_WORD(draw_ext_words , RXA_WORD(frm, 3)) == W_DRAW_VECTORIAL) ? 1 : 0,
             RXA_PAIR(frm, 1),
             RXA_PAIR(frm, 2),
             RXA_SERIES(frm, 4)
        );
        break;

	case CMD_DRAW_TRANSFORM:
		agg_transform(
            ctx->envr,
            (RXA_TYPE(frm, 1) == RXT_DECIMAL) ? RXA_DEC64(frm, 1) : RXA_INT64(frm, 1), // angle
            RXA_PAIR(frm, 2), // center
            RXA_PAIR(frm, 3), // scale
            RXA_PAIR(frm, 4) // offset
        );
        break;

    case CMD_DRAW_TRANSLATE:
        agg_translate(ctx->envr, RXA_PAIR(frm, 1));
		break;

	case CMD_DRAW_TRIANGLE:
        {
            REBYTE b[4] = {0,0,0,0};
            agg_triangle(
                ctx->envr,
                RXA_PAIR(frm, 1), // vertex-1
                RXA_PAIR(frm, 2), // vertex-2
                RXA_PAIR(frm, 3), // vertex-3
                (RXA_TYPE(frm, 4) == RXT_NONE) ? NULL : RXA_TUPLE(frm, 4)+1, // color-1
                (RXA_TYPE(frm, 5) == RXT_NONE) ? b : RXA_TUPLE(frm, 5)+1, // color-2
                (RXA_TYPE(frm, 6) == RXT_NONE) ? b : RXA_TUPLE(frm, 6)+1, // color-3
                (RXA_TYPE(frm, 7) == RXT_DECIMAL) ? RXA_DEC64(frm, 7) : RXA_INT64(frm, 7) // dilation
            );
        }
		break;

	default:
		return RXR_NO_COMMAND;
	}

    return RXR_UNSET;
}
예제 #2
0
*/	RXIEXT int RXD_Graphics(int cmd, RXIFRM *frm, void *data)
/*
**		Graphics command extension dispatcher.
**
***********************************************************************/
{
	switch (cmd) {

	case CMD_GRAPHICS_SHOW:
		Show_Gob((REBGOB*)RXA_SERIES(frm, 1));
		break;

    case CMD_GRAPHICS_SIZE_TEXT:
        if (Rich_Text) {
            RXA_TYPE(frm, 2) = RXT_PAIR;
            rt_size_text(Rich_Text, (REBGOB*)RXA_SERIES(frm, 1),&RXA_PAIR(frm, 2));
            RXA_PAIR(frm, 1).x = RXA_PAIR(frm, 2).x;
            RXA_PAIR(frm, 1).y = RXA_PAIR(frm, 2).y;
            RXA_TYPE(frm, 1) = RXT_PAIR;
            return RXR_VALUE;
        }

        break;

    case CMD_GRAPHICS_OFFSET_TO_CARET:
        if (Rich_Text) {
            REBINT element = 0, position = 0;
            REBSER* dialect;
            REBSER* block;
            RXIARG val; //, str;
            REBCNT n, type;

            rt_offset_to_caret(Rich_Text, (REBGOB*)RXA_SERIES(frm, 1), RXA_PAIR(frm, 2), &element, &position);
//            RL_Print("OTC: %d, %d\n", element, position);
            dialect = (REBSER *)GOB_CONTENT((REBGOB*)RXA_SERIES(frm, 1));
            block = RL_MAKE_BLOCK(RL_SERIES(dialect, RXI_SER_TAIL));
            for (n = 0; type = RL_GET_VALUE(dialect, n, &val); n++) {
                if (n == element) val.index = position;
                RL_SET_VALUE(block, n, val, type);
            }

            RXA_TYPE(frm, 1) = RXT_BLOCK;
            RXA_SERIES(frm, 1) = block;
            RXA_INDEX(frm, 1) = element;

            return RXR_VALUE;
        }

        break;

    case CMD_GRAPHICS_CARET_TO_OFFSET:
        if (Rich_Text) {
            REBXYF result;
            REBINT elem,pos;
            if (RXA_TYPE(frm, 2) == RXT_INTEGER){
                elem = RXA_INT64(frm, 2)-1;
            } else {
                elem = RXA_INDEX(frm, 2);
            }
            if (RXA_TYPE(frm, 3) == RXT_INTEGER){
                pos = RXA_INT64(frm, 3)-1;
            } else {
                pos = RXA_INDEX(frm, 3);
            }
//            RL_Print("CTO: %d, %d\n", element, position);
            rt_caret_to_offset(Rich_Text, (REBGOB*)RXA_SERIES(frm, 1), &result, elem, pos);

            RXA_PAIR(frm, 1).x = result.x;
            RXA_PAIR(frm, 1).y = result.y;
            RXA_TYPE(frm, 1) = RXT_PAIR;
            return RXR_VALUE;
        }
        break;

    case CMD_GRAPHICS_CURSOR:
        {
            REBINT n = 0;
            REBSER image = 0;

            if (RXA_TYPE(frm, 1) == RXT_IMAGE) {
                image = RXA_IMAGE_BITS(frm,1);
            } else {
                n = RXA_INT64(frm,1);
            }

            if (Custom_Cursor) {
                //Destroy cursor object only if it is a custom image
                DestroyCursor(Cursor);
                Custom_Cursor = FALSE;
            }

            if (n > 0)
                Cursor = LoadCursor(NULL, (LPCTSTR)n);
            else if (image) {
                Cursor = Image_To_Cursor(image, RXA_IMAGE_WIDTH(frm,1), RXA_IMAGE_HEIGHT(frm,1));
                Custom_Cursor = TRUE;
            } else
                Cursor = NULL;

            SetCursor(Cursor);

        }
        break;

    case CMD_GRAPHICS_DRAW:
        {
            REBYTE* img = 0;
            REBINT w,h;
            if (RXA_TYPE(frm, 1) == RXT_IMAGE) {
                img = RXA_IMAGE_BITS(frm, 1);
                w = RXA_IMAGE_WIDTH(frm, 1);
                h = RXA_IMAGE_HEIGHT(frm, 1);
            } else {
                REBSER* i;
                w = RXA_PAIR(frm,1).x;
                h = RXA_PAIR(frm,1).y;
                i = RL_MAKE_IMAGE(w,h);
                img = (REBYTE *)RL_SERIES(i, RXI_SER_DATA);

                RXA_TYPE(frm, 1) = RXT_IMAGE;
                RXA_ARG(frm, 1).width = w;
                RXA_ARG(frm, 1).height = h;
                RXA_ARG(frm, 1).image = i;
            }
            Draw_Image(img, w, h, RXA_SERIES(frm, 2));
            return RXR_VALUE;
        }
        break;

    case CMD_GRAPHICS_GUI_METRIC:
        {
            REBINT x,y;
            u32 w = RL_FIND_WORD(graphics_ext_words,RXA_WORD(frm, 1));

            switch(w)
            {
                case W_GRAPHICS_SCREEN_SIZE:
                    x = GetSystemMetrics(SM_CXSCREEN);
                    y = GetSystemMetrics(SM_CYSCREEN);
                    break;

                case W_GRAPHICS_TITLE_SIZE:
                    x = 0;
                    y = GetSystemMetrics(SM_CYCAPTION);
                    break;

                case W_GRAPHICS_BORDER_SIZE:
                    x = GetSystemMetrics(SM_CXSIZEFRAME);
                    y = GetSystemMetrics(SM_CYSIZEFRAME);
                    break;

                case W_GRAPHICS_BORDER_FIXED:
                    x = GetSystemMetrics(SM_CXFIXEDFRAME);
                    y = GetSystemMetrics(SM_CYFIXEDFRAME);
                    break;

                case W_GRAPHICS_WORK_ORIGIN:
                    {
                        RECT rect;
                        SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
                        x = rect.left;
                        y = rect.top;
                    }
                    break;

                case W_GRAPHICS_WORK_SIZE:
                    {
                        RECT rect;
                        SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
                        x = rect.right;
                        y = rect.bottom;
                    }
                    break;
            }

            if (w){
                RXA_PAIR(frm, 1).x = x;
                RXA_PAIR(frm, 1).y = y;
                RXA_TYPE(frm, 1) = RXT_PAIR;
            } else {
                RXA_TYPE(frm, 1) = RXT_NONE;
            }
            return RXR_VALUE;
        }
        break;

	case CMD_GRAPHICS_INIT:
		Gob_Root = (REBGOB*)RXA_SERIES(frm, 1); // system/view/screen-gob
		Gob_Root->size.x = (REBD32)GetSystemMetrics(SM_CXSCREEN);
		Gob_Root->size.y = (REBD32)GetSystemMetrics(SM_CYSCREEN);

		//Initialize text rendering context
		if (Rich_Text) Destroy_RichText(Rich_Text);
		Rich_Text = Create_RichText();

		break;

    case CMD_GRAPHICS_INIT_WORDS:
        //temp hack - will be removed later
        graphics_ext_words = RL_MAP_WORDS(RXA_SERIES(frm,1));
        break;

	default:
		return RXR_NO_COMMAND;
	}
    return RXR_UNSET;
}
예제 #3
0
*/	RXIEXT int RXD_Shape(int cmd, RXIFRM *frm, REBCEC *ctx)
/*
**		DRAW command dispatcher.
**
***********************************************************************/
{
//    Reb_Print("SHAPE called\n");
    REBCNT rel = 0;

	switch (cmd) {

    case CMD_SHAPE_INIT_WORDS:
        //temp hack - will be removed later
        shape_ext_words = RL_MAP_WORDS(RXA_SERIES(frm,1));
        break;

    case CMD_SHAPE_ARC_LIT:
        rel = 1;
    case CMD_SHAPE_ARC:
        agg_path_arc(
            ctx->envr,
            rel,
            RXA_PAIR(frm, 1),
            RXA_PAIR(frm, 2),
            (RXA_TYPE(frm, 3) == RXT_DECIMAL) ? RXA_DEC64(frm, 3) : RXA_INT64(frm, 3),
            RL_FIND_WORD(shape_ext_words , RXA_WORD(frm, 4)) - W_SHAPE_NEGATIVE,
            RL_FIND_WORD(shape_ext_words , RXA_WORD(frm, 5)) - W_SHAPE_SMALL
        );
        break;

    case CMD_SHAPE_CLOSE:
        agg_path_close(ctx->envr);
        break;

    case CMD_SHAPE_CURV_LIT:
        rel = 1;
    case CMD_SHAPE_CURV:
        {
			RXIARG val[2];
			REBCNT type;
			REBCNT n, m = 0;
			REBSER blk = RXA_SERIES(frm, 1);

			for (n = 0; type = RL_GET_VALUE(blk, n, &val[m]); n++) {
			    if (type == RXT_PAIR && ++m == 2) {
                    agg_path_curv(ctx->envr, rel, val[0].pair, val[1].pair);
                    m = 0;
			    }
			}
        }
        break;

    case CMD_SHAPE_CURVE_LIT:
        rel = 1;
    case CMD_SHAPE_CURVE:
        {
			RXIARG val[3];
			REBCNT type;
			REBCNT n, m = 0;
			REBSER blk = RXA_SERIES(frm, 1);

			for (n = 0; type = RL_GET_VALUE(blk, n, &val[m]); n++) {
                if (type == RXT_PAIR && ++m == 3) {
                    agg_path_curve(ctx->envr, rel, val[0].pair, val[1].pair, val[2].pair);
                    m = 0;
                }
			}
        }
        break;

    case CMD_SHAPE_HLINE_LIT:
        rel = 1;
    case CMD_SHAPE_HLINE:
        agg_path_hline(ctx->envr, rel, (RXA_TYPE(frm, 1) == RXT_DECIMAL) ? RXA_DEC64(frm, 1) : RXA_INT64(frm, 1));
        break;

    case CMD_SHAPE_LINE_LIT:
        rel = 1;
    case CMD_SHAPE_LINE:
        if (RXA_TYPE(frm, 1) == RXT_PAIR)
            agg_path_line(ctx->envr, rel, RXA_PAIR(frm, 1));
        else {
			RXIARG val;
			REBCNT type;
			REBCNT n;
			REBSER blk = RXA_SERIES(frm, 1);

			for (n = 0; type = RL_GET_VALUE(blk, n, &val); n++) {
				if (type == RXT_PAIR)
                    agg_path_line(ctx->envr, rel, val.pair);
			}
        }
        break;

    case CMD_SHAPE_MOVE_LIT:
        rel = 1;
    case CMD_SHAPE_MOVE:
        agg_path_move(ctx->envr, rel, RXA_PAIR(frm, 1));
        break;

    case CMD_SHAPE_QCURV_LIT:
        rel = 1;
    case CMD_SHAPE_QCURV:
        agg_path_qcurv(ctx->envr, rel, RXA_PAIR(frm, 1));
        break;

    case CMD_SHAPE_QCURVE_LIT:
        rel = 1;
    case CMD_SHAPE_QCURVE:
        {
			RXIARG val[2];
			REBCNT type;
			REBCNT n, m = 0;
			REBSER blk = RXA_SERIES(frm, 1);

			for (n = 0; type = RL_GET_VALUE(blk, n, &val[m]); n++) {
			    if (type == RXT_PAIR && ++m == 2) {
                    agg_path_qcurve(ctx->envr, rel, val[0].pair, val[1].pair);
                    m = 0;
			    }
			}
        }
        break;

    case CMD_SHAPE_VLINE_LIT:
        rel = 1;
    case CMD_SHAPE_VLINE:
        agg_path_vline(ctx->envr, rel, (RXA_TYPE(frm, 1) == RXT_DECIMAL) ? RXA_DEC64(frm, 1) : RXA_INT64(frm, 1));
        break;

    default:
		return RXR_NO_COMMAND;
	}

    return RXR_UNSET;
}
예제 #4
0
RXIEXT int RX_Call(int cmd, RXIFRM *frm, REBCEC *ctx) {
	REBYTE *str;

	switch (cmd) {

	case 0:
		RXA_INT64(frm, 1) = 0;
		RXA_TYPE(frm, 1) = RXT_INTEGER;
		break;

	case 1:
		break; // same as arg

	case 2:
		RXA_INT64(frm, 1) = RXA_INT64(frm, 2);
		RXA_TYPE(frm, 1)  = RXA_TYPE(frm, 2);
		break;

	case 3:
		RXA_WORD(frm, 1) = RL_MAP_WORD("system"); //?? is frame always long enough??
		RXA_TYPE(frm, 1) = RXT_WORD;
		break;

	case 4:
		RL_GET_STRING(RXA_SERIES(frm, 1), 0, (void*)(&str)); // latin-1 only for test
		RXA_WORD(frm, 1) = RL_MAP_WORD(str);
		RXA_TYPE(frm, 1) = RXT_WORD;
		break;

	case 5:
		RXA_TYPE(frm, 1) = RL_GET_FIELD(RXA_OBJECT(frm, 1), RXA_WORD(frm, 2), &RXA_ARG(frm, 1));
		break;

	case 6:
		RXA_TYPE(frm, 1) = Test_Sync_Callback(RXA_OBJECT(frm, 1), RXA_WORD(frm, 2), &RXA_ARG(frm, 1));
		break;

	case 7:
		RXA_LOGIC(frm, 1) = Test_Async_Callback(RXA_OBJECT(frm, 1), RXA_WORD(frm, 2));
		RXA_TYPE(frm, 1) = RXT_LOGIC;
		break;

	case 8:
		RXA_TYPE(frm, 1) = RXT_IMAGE;
		RXA_SERIES(frm, 1) = RL_MAKE_IMAGE(2, 3);
		break;

	case 9:
		{
			REBCEC cec;
			cec.envr = 0;
			cec.block = RXA_SERIES(frm, 1);
			cec.index = 0;
			RL_DO_COMMANDS(RXA_SERIES(frm, 1), 0, &cec);
		}
		return RXR_UNSET;

	case 10:
		RXA_INT64(frm, 1) = (i64)(ctx ? ctx->index : -1);
		RXA_TYPE(frm, 1) = RXT_INTEGER;
		break;

	default:
		return RXR_NO_COMMAND;
	}
    return RXR_VALUE;
}