swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] swfc: updated getPoint()


From: Vladimir Dzhuvinov
Subject: [Swftools-common] swfc: updated getPoint()
Date: Sat, 24 Nov 2007 15:55:03 +0200
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

Allegra!

I noticed the pin parameter in {put|change|jump} had support only for
the "center" and "bottom-center" positions, so I updated the
swfc.c:getPoint() function to add the keywords "top-center", "top-left",
"top-right", "right-center", "left-center", "bottom-left" and
"bottom-right".

Here is the code for the the maintainers (Matthias?) to check and merge
into the trunk if it's appropriate:

"""

SPOINT getPoint(SRECT r, char*name)
{
    int l=0;
    if(!strcmp(name, "center")) {
        SPOINT p;
        p.x = (r.xmin + r.xmax)/2;
        p.y = (r.ymin + r.ymax)/2;
        return p;
    }
    if (!strcmp(name, "bottom-center")) {
        SPOINT p;
        p.x = (r.xmin + r.xmax)/2;
        p.y = r.ymax;
        return p;
    }
    if (!strcmp(name, "top-center")) {
        SPOINT p;
        p.x = (r.xmin + r.xmax)/2;
        p.y = r.ymin;
        return p;
    }
    if (!strcmp(name, "top-left")) {
        SPOINT p;
        p.x = r.xmin;
        p.y = r.ymin;
        return p;
    }
    if (!strcmp(name, "top-right")) {
        SPOINT p;
        p.x = r.xmax;
        p.y = r.ymin;
        return p;
    }
    if (!strcmp(name, "bottom-right")) {
        SPOINT p;
        p.x = r.xmax;
        p.y = r.ymax;
        return p;
    }
    if (!strcmp(name, "bottom-left")) {
        SPOINT p;
        p.x = r.xmin;
        p.y = r.ymax;
        return p;
    }
    if (!strcmp(name, "left-center")) {
        SPOINT p;
        p.x = r.xmin;
        p.y = (r.ymin + r.ymax)/2;
        return p;
    }
    if (!strcmp(name, "right-center")) {
        SPOINT p;
        p.x = r.xmax;
        p.y = (r.ymin + r.ymax)/2;
        return p;
    }


    if(points_initialized)
        l = (int)dictionary_lookup(&points, name);
    if(l==0) {
        syntaxerror("Invalid point: \"%s\".", name);
    }
    l--;
    return *(SPOINT*)&mpoints.buffer[l];
}

"""

And, here is the script I used to test the code:

"""
### Vladimir Dzhuvinov, 16.11.2007 ###

### Test pin parameter ###

.flash filename="pin_test.swf" bbox=300x200 background=white fps=50
version=8

.circle bbox_center r=5 color=red
.put bbox_center 150 100 pin=center

.box testbox color=blue width=50 height=20

.frame 1
        .put testbox 150 100 pin=top-left

.frame 50
        .jump testbox pin=top-center

.frame 100
        .jump testbox pin=top-right

.frame 150
        .jump testbox pin=right-center

.frame 200
        .jump testbox pin=center

.frame 250
        .jump testbox pin=left-center

.frame 300
        .jump testbox pin=bottom-left

.frame 350
        .jump testbox pin=bottom-center

.frame 400
        .jump testbox pin=bottom-right

.frame 450

.end
"""


Have a good weekend,


Vladimir

--
Vladimir Dzhuvinov * www.TheTransactionCompany.com * PGP key ID AC9A5C6C

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]