⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spliter.c.svn-base

📁 A Flash Player with ActionScript support. Write in C and C++. It have two part, one is Player and an
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
    }    tmpint=sizeof(struct GlyphShape);    for (i=0;i<count;i++) {        g_GetShapeRecords(reader,&(p->GlyphShape[i].ShapeRecordP),0);    }    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);}int g_GetDefineFont2(struct reader_t *reader,swf_file_t *swf_p,int len) {    struct  DefineFont *p;    struct GlyphShape *dq;    struct KerningRecord *KRp;    char ptr[4];    UI8 FontNameLen;    UI16 Num;    UI8 Flags;    UI8 LanguageCode;    char *FontNameP;    UI16 id;    UI32 CodeTableOffset;    UI16 count;    int i;    if (reader->read(reader, &id, 2) !=2 )        return gg_error();    id=SWAP16(id);    if (reader->read(reader, &Flags, 1) !=1 )        return gg_error();    if (reader->read(reader, &LanguageCode, 1) !=1 )        return gg_error();    if (reader->read(reader, &FontNameLen, 1) !=1 )        return gg_error();    reader_GetStringWithLen(reader,&FontNameP,FontNameLen);    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    count=SWAP16(Num);    p=(struct DefineFont *)malloc(sizeof(struct DefineFont)+(count-1)*sizeof(struct GlyphShape));    bzero((void *)p,sizeof(struct DefineFont)+(count-1)*sizeof(struct GlyphShape));    p->CharacterType=CharFontTwo;    p->Flags=Flags;    p->LanguageCode=LanguageCode;    p->FontNameP=FontNameP;    p->NumGlyphs=count;    for (i=0;i<count;i++) {        if(p->Flags&FontFlagsWideOffsets) {            if (reader->read(reader, ptr, 4) !=4 )                return gg_error();        } else {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();        }    }    if(p->Flags&FontFlagsWideOffsets) {        if (reader->read(reader, ptr, 4) !=4 )            return gg_error();        CodeTableOffset=GET32(ptr);    } else {        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        CodeTableOffset=SWAP16(Num);    }    dq=(struct GlyphShape *)p->GlyphShape;    for (i=0;i<count;i++) {        g_GetShapeRecords(reader,&(dq->ShapeRecordP),0);        dq++;    }    dq=(struct GlyphShape *)p->GlyphShape;    for (i=0;i<p->NumGlyphs;i++) {        if(p->Flags&FontFlagsWideCodes) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            dq->Code=SWAP16(Num);        } else {            if (reader->read(reader, &(dq->Code), 1) !=1 )                return gg_error();        }        dq++;    }    if(p->Flags&FontFlagsHasLayout) {        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->FontAscent=SWAP16(Num);        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->FontDescent=SWAP16(Num);        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->FontLeading=SWAP16(Num);        dq=(struct GlyphShape *)p->GlyphShape;        for (i=0;i<p->NumGlyphs;i++) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            dq->FontAdvance=SWAP16(Num);            dq++;        }        dq=(struct GlyphShape *)p->GlyphShape;        for (i=0;i<p->NumGlyphs;i++) {            reader_GetRect(reader,&(dq->FontBounds));            dq++;        }        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->KerningCount=SWAP16(Num);        if (p->KerningCount) {            p->KerningTableP=(struct KerningRecord *)malloc(sizeof(struct KerningRecord));            bzero((void *)p->KerningTableP,sizeof(struct KerningRecord));            KRp=p->KerningTableP;            if(p->Flags&FontFlagsWideCodes) {                if (reader->read(reader, &Num, 2) !=2 )                    return gg_error();                KRp->FontKerningCode1=SWAP16(Num);                if (reader->read(reader, &Num, 2) !=2 )                    return gg_error();                KRp->FontKerningCode2=SWAP16(Num);            } else {                if (reader->read(reader, &(KRp->FontKerningCode1), 1) !=1 )                    return gg_error();                if (reader->read(reader, &(KRp->FontKerningCode2), 1) !=1 )                    return gg_error();            }            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            KRp->FontKerningAdjustment=SWAP16(Num);            for(i=1;i<p->KerningCount;i++) {                KRp->NextP=(struct KerningRecord *)malloc(sizeof(struct KerningRecord));                bzero((void *)KRp->NextP,sizeof(struct KerningRecord));                KRp=KRp->NextP;                if(p->Flags&FontFlagsWideCodes) {                    if (reader->read(reader, &Num, 2) !=2 )                        return gg_error();                    KRp->FontKerningCode1=SWAP16(Num);                    if (reader->read(reader, &Num, 2) !=2 )                        return gg_error();                    KRp->FontKerningCode2=SWAP16(Num);                } else {                    if (reader->read(reader, &(KRp->FontKerningCode1), 1) !=1 )                        return gg_error();                    if (reader->read(reader, &(KRp->FontKerningCode2), 1) !=1 )                        return gg_error();                }                if (reader->read(reader, &Num, 2) !=2 )                    return gg_error();                KRp->FontKerningAdjustment=SWAP16(Num);            }        }    }    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);}int g_GetDefineFontInfo(struct reader_t *reader,swf_file_t *swf_p,int len,int type) {    struct  DefineFont *p;    struct GlyphShape *dq;    UI16 id;    UI8 FontNameLen;    UI16 Num;    int i;    if (reader->read(reader, &id, 2) !=2 )        return gg_error();    id=SWAP16(id);    p=(struct DefineFont *)(swf_p->dict_p->dict[id]);    if (reader->read(reader, &FontNameLen, 1) !=1 )        return gg_error();    reader_GetStringWithLen(reader,&(p->FontNameP),FontNameLen);    if (reader->read(reader, &(p->Flags), 1) !=1 )        return gg_error();    if (type==2) {        if (reader->read(reader, &(p->LanguageCode), 1) !=1 )            return gg_error();    }    dq=(struct GlyphShape *)p->GlyphShape;    for (i=0;i<p->NumGlyphs;i++) {        if(p->Flags&FontInfoFlagsWideCodes) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            dq->Code=SWAP16(Num);        } else {            if (reader->read(reader, &(dq->Code), 1) !=1 )                return gg_error();        }        dq++;    }    return 0;}int g_GetTextRecords(struct reader_t *reader,int type,struct TextRecord **TextRecordsP,int GlyphBits,int AdvanceBits) {    struct TextRecord tmp_record;    struct TextRecord *dq,*p,*headP;    UI16 Num;    UI16 FontID;    UI16 TextHeight;    int i;    UI8 GlyphCount;    headP=NULL;    while(1) {        bzero((void *)(&tmp_record),sizeof(struct TextRecord));        if (reader->read(reader, &(tmp_record.Flags), 1) !=1 )            return gg_error();        if (!tmp_record.Flags)            break;        if (tmp_record.Flags&StyleFlagsHasFont) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            FontID=SWAP16(Num);            tmp_record.FontID=FontID;        } else {            tmp_record.FontID=FontID;        }        if (tmp_record.Flags&StyleFlagsHasColor) {            if (type==2) {                reader_GetRgba(reader,&(tmp_record.TextColor));            } else {                reader_GetRgb(reader,&(tmp_record.TextColor));            }        }        if (tmp_record.Flags&StyleFlagsHasXOffset) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            tmp_record.XOffset=SWAP16(Num);        }        if (tmp_record.Flags&StyleFlagsHasYOffset) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            tmp_record.YOffset=SWAP16(Num);        }        if (tmp_record.Flags&StyleFlagsHasFont) {            if (reader->read(reader, &Num, 2) !=2 )                return gg_error();            TextHeight=SWAP16(Num);            tmp_record.TextHeight=TextHeight;        } else {            tmp_record.TextHeight=TextHeight;        }        if (reader->read(reader, &(GlyphCount), 1) !=1 )            return gg_error();        tmp_record.GlyphCount=GlyphCount;        p=(struct TextRecord *)malloc(sizeof(struct TextRecord)+(GlyphCount-1)*sizeof(struct  GlyphEntry));        bzero((void *)p,sizeof(struct TextRecord)+(GlyphCount-1)*sizeof(struct  GlyphEntry));        memcpy((void *)p,(void *)(&tmp_record),sizeof(struct TextRecord));        for(i=0;i<GlyphCount;i++) {            p->GlyphEntries[i].GlyphIndex=reader_GetBits(reader, GlyphBits);            p->GlyphEntries[i].GlyphAdvance=reader_GetSBits(reader, AdvanceBits);        }        dq=headP;        if (!headP) {            headP=p;        } else {            while(dq->NextP)                dq=dq->NextP;            dq->NextP=p;        }    }    *TextRecordsP=headP;    return 0;}int g_GetDefineText(struct reader_t *reader,swf_file_t *swf_p,int len,int type) {    struct DefineText *p;    UI16 Num;    UI16 id;    int pos;    p=(struct DefineText *)malloc(sizeof(struct DefineText));    bzero((void *)p,sizeof(struct DefineText));    pos=reader->pos;    p->CharacterType=CharText;    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    id=SWAP16(Num);    reader_GetRect(reader,&(p->TextBounds));    reader_GetMatrix(reader,&(p->TextMatrix));    if (reader->read(reader, &(p->GlyphBits), 1) !=1 )        return gg_error();    if (reader->read(reader, &(p->AdvanceBits), 1) !=1 )        return gg_error();    g_GetTextRecords(reader,type,&(p->TextRecordsP),p->GlyphBits,p->AdvanceBits);    pos-=reader->pos;    if (pos+len>0) {        g_readdata(reader,pos+len);        printf("read Define Text error,id:%d\n",id);    }    //    text_to_shape(p);    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);}int g_GetDefineEditText(struct reader_t *reader,swf_file_t *swf_p,int len) {    struct DefineEditText *p;    UI16 Num;    UI16 id;    p=(struct DefineEditText *)malloc(sizeof(struct DefineEditText));    bzero((void *)p,sizeof(struct DefineEditText));    p->CharacterType=CharEditText;    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    id=SWAP16(Num);    reader_GetRect(reader,&(p->Bounds));    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    p->Flags=SWAP16(Num);    if (p->Flags&EditTextHasFont) {        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->FontID=SWAP16(Num);        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->FontHeight=SWAP16(Num);    }    if (p->Flags&EditTextHasTextColor) {        reader_GetRgba(reader,&(p->TextColor));    }    if (p->Flags&EditTextHasMaxLength) {        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->MaxLength=SWAP16(Num);    }    if (p->Flags&EditTextHasLayout) {        if (reader->read(reader, &(p->Align), 1) !=1 )            return gg_error();        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->LeftMargin=SWAP16(Num);        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->RightMargin=SWAP16(Num);        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->Indent=SWAP16(Num);        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->Leading=SWAP16(Num);    }    reader_GetString(reader,&(p->VariableNameP));    if (p->Flags&EditTextHasText) {        reader_GetString(reader,&(p->InitialTextP));    }    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);}int g_GetDoAction(struct reader_t *reader,int len) {    struct ActionRecord *p;    struct MovieClips *MCp;    p=NULL;    MCp=reader->MovieClipsPointer;    while (MCp->NextP) {        MCp=MCp->NextP;    }    reader_GetActionRecord(reader,len,&p);    reader_AddActionRecord(&MCp->MovieClipP->Frames[MCp->frame].FrameEventP,p);    return 0;}int g_GetGradientRecords(struct reader_t *reader,struct  MorphGradRecord **GradientP) {    struct  MorphGradRecord *head=NULL;    struct  MorphGradRecord *p=NULL;    struct  MorphGradRecord *dq=NULL;    UI8 count;    int i;    if (reader->read(reader, &count, 1) !=1 )        return gg_error();    for (i=0;i<count;i++) {        p=(struct MorphGradRecord *)malloc(sizeof(struct MorphGradRecord));        bzero((void *)p,sizeof(struct  MorphGradRecord));        if (reader->read(reader, &(p->StartRatio), 1) !=1 )            return gg_error();        reader_GetRgba(reader,&(p->StartColor));        if (reader->read(reader, &(p->EndRatio), 1) !=1 )            return gg_error();        reader_GetRgba(reader,&(p->EndColor));        if(head) {            dq=head;            while(dq->NextP)                dq=dq->NextP;            dq->NextP=p;        } else {            head=p;        }    }    *GradientP=head;    return 0;}int g_GetMorphFillStyle(struct reader_t *re

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -