예제 #1
0
void swfClip(double x0, double x1, double y0, double y1, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("clip called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    SWFFillStyle fill;
    
    /* Set previous clip layer to the appropriate depth */
    if(swfInfo->currentClip)
    {
        SWFDisplayItem_endMask(swfInfo->currentClip);
    }
    
    /* Create new clip layer */
    fill = newSWFSolidFillStyle(0xFF, 0xFF, 0xFF, 0xFF);
    SWFShape_setRightFillStyle(shape, fill);
    SWFArray_append(swfInfo->array, (SWFObject) fill);
    
    SWFShape_movePenTo(shape, x0, y0);
    SWFShape_drawLineTo(shape, x1, y0);
    SWFShape_drawLineTo(shape, x1, y1);
    SWFShape_drawLineTo(shape, x0, y1);
    SWFShape_drawLineTo(shape, x0, y0);
    SWFShape_end(shape);
    swfInfo->currentClip = SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
    SWFDisplayItem_setMaskLevel(swfInfo->currentClip, 99999);
}
예제 #2
0
static int
completeSWFShapeBlock(SWFBlock block)
{
    SWFShape shape = (SWFShape)block;

    SWFShape_end(shape);

    return SWFOutput_getLength(shape->out);
}
예제 #3
0
void swfLine(double x1, double y1, double x2, double y2, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("line called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    swfSetLineStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x1, y1);
    swfDrawStyledLineTo(shape, x2, y2, gc);
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
}
예제 #4
0
void swfCircle(double x, double y, double r, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("circle called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    swfSetLineStyle(shape, gc, swfInfo);
    swfSetFillStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x, y);
    SWFShape_drawCircle(shape, r);
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
}
예제 #5
0
void swfPolyline(int n, double *x, double *y, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("polyline called\n");
    Rprintf("** polyline(n = %d, (x0, y0) = (%f, %f), (x1, y1) = (%f, %f))\n",
        n, x[0], y[0], x[1], y[1]);
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    int i = 0;
    
    swfSetLineStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x[0], y[0]);
    for(i = 1; i < n; i++)
    {
        swfDrawStyledLineTo(shape, x[i], y[i], gc);
    }
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
}
예제 #6
0
void swfPolygon(int n, double *x, double *y, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("polygon called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    int i = 0;
    
    /* First fill the polygon with no stroke, then draw polyline additionally */
    swfSetFillStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x[0], y[0]);
    for(i = 1; i < n; i++)
    {
        SWFShape_drawLineTo(shape, x[i], y[i]);
    }
    SWFShape_drawLineTo(shape, x[0], y[0]);
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
    swfPolyline(n, x, y, gc, dd);
}