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

📄 dynamic_text_ins.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 页 / 共 4 页
字号:
    Globle_VarP->GlobleText.TextMatrix = TextMatrix;    tmpHeadTextRecordP = Globle_VarP->GlobleText.TextRecordsP;    if(tmpHeadTextRecordP) {        while(tmpHeadTextRecordP->NextP)            tmpHeadTextRecordP = tmpHeadTextRecordP->NextP;        tmpHeadTextRecordP->NextP = headTextRecordP;    } else {        Globle_VarP->GlobleText.TextRecordsP = headTextRecordP;    }    //    Globle_VarP->GlobleText.TextRecordsP = headTextRecordP;    free(TextAlign);    return 0;}void freeDefineText(struct DefineText *data) {    struct TextRecord* tmp;    int i;    tmp =NULL;    if(data==NULL)        return ;    if(data->TextRecordsP ==NULL)        return;    while(data->TextRecordsP) {        tmp = data->TextRecordsP->NextP;        for(i=0;i<data->TextRecordsP->GlyphCount;i++) {            freeDefineShape(&(data->TextRecordsP->GlyphEntries[i].Shape));        }        free(data->TextRecordsP);        data->TextRecordsP =tmp;    }}void freeDefineShape(struct DefineShape *data) {    struct ShapeRecord *tmp;    int i = 0;    tmp = NULL;    assert(data->FillStylesP==0);    if(data->FillStylesP) {        for(i=0; i<data->FillStylesP->count; i++) {            freeFillStyle(&(data->FillStylesP->FillStyles[i]));        }        free(data->FillStylesP);        data->FillStylesP = NULL;    }    if(data->LineStylesP) {        free(data->LineStylesP);        data->LineStylesP = NULL;    }    if(data->ShapeRecordsP == NULL)        return;    while(data->ShapeRecordsP) {        tmp = data->ShapeRecordsP->NextP;        free(data->ShapeRecordsP);        data->ShapeRecordsP =tmp;    }}void freeFillStyle(struct FillStyle *data) {    if(data->GradientP) {        free(data->GradientP->g_ramp);        data->GradientP->g_ramp = NULL;        free(data->GradientP);        data->GradientP = NULL;    }    if(data->cmap) {        free(data->cmap);        data->cmap = NULL;    }    if(data->alpha_table) {        free(data->alpha_table);        data->alpha_table = NULL;    }}int DecomposeHTML(char *str) {    return 0;}int getTextBounds(GNode* node_p,struct TextRecord *outRecordP) {    struct  DefineEditText *Text;    //    struct DefineShape	 Shape;    struct StyleChangeRecord *StyleChangeRecordP;    struct StraightEdgeRecord *StraightEdgeRecordP;    struct ShapeRecord *headShapeP,*endShapeP;    struct ShapeRecord *ShapeP;    double tmpscale;    dtx_ins_t    *data_p   = (dtx_ins_t*)(node_p->data);    Text = data_p->define_p;    headShapeP = NULL;    endShapeP = NULL;    tmpscale = 1024.0/Text->FontHeight;    StyleChangeRecordP = (struct StyleChangeRecord*)malloc(sizeof(struct StyleChangeRecord));    bzero((void *)(StyleChangeRecordP),sizeof(struct StyleChangeRecord));    StyleChangeRecordP->MoveDeltaX = Text->Bounds.Xmin*tmpscale;    StyleChangeRecordP->MoveDeltaY = Text->Bounds.Ymin*tmpscale;    /*    printf("\n---------------Text->Bounds---------------Xmin:%d	,Ymin:%d	,Xmax:%d	,Ymax:%d	.\n"\    	,Text->Bounds.Xmin,Text->Bounds.Ymin,Text->Bounds.Xmax,Text->Bounds.Ymax);    printf("\n---------------data_p->boundary---------------Xmin:%d	,Ymin:%d	,Xmax:%d	,Ymax:%d	.\n"\    	,data_p->boundary.Xmin,data_p->boundary.Ymin,data_p->boundary.Xmax,data_p->boundary.Ymax);    */    StyleChangeRecordP->Flags = StateMoveTo|StateFillStyle0|StateFillStyle1|StateLineStyle;    StyleChangeRecordP->FillStyle0 = 0;    StyleChangeRecordP->FillStyle1 = 1;    StyleChangeRecordP->LineStyle = 0;    ShapeP = (struct ShapeRecord *)StyleChangeRecordP;    headShapeP = ShapeP ;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 0;    StraightEdgeRecordP->HorLineDeltaX = (Text->Bounds.Xmax - Text->Bounds.Xmin)*tmpscale;    StraightEdgeRecordP->VertLineDeltaY =0;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    headShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 1;    StraightEdgeRecordP->HorLineDeltaX = 0;    StraightEdgeRecordP->VertLineDeltaY =(Text->Bounds.Ymax - Text->Bounds.Ymin)*tmpscale;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 0;    StraightEdgeRecordP->HorLineDeltaX = (Text->Bounds.Xmin - Text->Bounds.Xmax)*tmpscale;    StraightEdgeRecordP->VertLineDeltaY =0;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 1;    StraightEdgeRecordP->HorLineDeltaX = 0;    StraightEdgeRecordP->VertLineDeltaY =(Text->Bounds.Ymin - Text->Bounds.Ymax)*tmpscale;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StyleChangeRecordP = (struct StyleChangeRecord*)malloc(sizeof(struct StyleChangeRecord));    bzero((void *)(StyleChangeRecordP),sizeof(struct StyleChangeRecord));    StyleChangeRecordP->MoveDeltaX = (Text->Bounds.Xmin + 20)*tmpscale;    StyleChangeRecordP->MoveDeltaY = (Text->Bounds.Ymin + 20)*tmpscale;    StyleChangeRecordP->Flags = StateMoveTo|StateFillStyle0|StateFillStyle1|StateLineStyle;    StyleChangeRecordP->FillStyle0 = 1;    StyleChangeRecordP->FillStyle1 = 0;    StyleChangeRecordP->LineStyle = 0;    ShapeP = (struct ShapeRecord *)StyleChangeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 0;    StraightEdgeRecordP->HorLineDeltaX = (Text->Bounds.Xmax - Text->Bounds.Xmin - 40)*tmpscale;    StraightEdgeRecordP->VertLineDeltaY =0;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 1;    StraightEdgeRecordP->HorLineDeltaX = 0;    StraightEdgeRecordP->VertLineDeltaY =(Text->Bounds.Ymax - Text->Bounds.Ymin - 40)*tmpscale;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 0;    StraightEdgeRecordP->HorLineDeltaX = (Text->Bounds.Xmin - Text->Bounds.Xmax +40)*tmpscale;    StraightEdgeRecordP->VertLineDeltaY =0;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 1;    StraightEdgeRecordP->HorLineDeltaX = 0;    StraightEdgeRecordP->VertLineDeltaY =(Text->Bounds.Ymin - Text->Bounds.Ymax +40)*tmpscale;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    endShapeP->NextP = NULL;    mat_new(&(outRecordP->GlyphEntries[0].GlyphMatrix));    outRecordP->GlyphEntries[0].GlyphMatrix.TranslateX	= 0;    outRecordP->GlyphEntries[0].GlyphMatrix.TranslateY	= 0;    outRecordP->GlyphEntries[0].GlyphMatrix.ScaleX	= Text->FontHeight/1024.0;    outRecordP->GlyphEntries[0].GlyphMatrix.ScaleY	= Text->FontHeight/1024.0;    outRecordP->GlyphEntries[0].Shape.CharacterType	= CharShape;    //outRecordP->GlyphEntries[0].Shape.ShapeBounds	= Text->Bounds;    outRecordP->GlyphEntries[0].Shape.ShapeRecordsP	= headShapeP;    return 0;}int getCursor(GNode* node_p,struct TextRecord *outRecordP,long x,long y) {    struct  DefineEditText *Text;    //    struct DefineShape	 Shape;    struct StyleChangeRecord *StyleChangeRecordP;    struct StraightEdgeRecord *StraightEdgeRecordP;    struct ShapeRecord *headShapeP,*endShapeP;    struct ShapeRecord *ShapeP;    double tmpscale;    dtx_ins_t    *data_p   = (dtx_ins_t*)(node_p->data);    Text = data_p->define_p;    headShapeP = NULL;    endShapeP = NULL;    tmpscale = 1024.0/Text->FontHeight;    StyleChangeRecordP = (struct StyleChangeRecord*)malloc(sizeof(struct StyleChangeRecord));    bzero((void *)(StyleChangeRecordP),sizeof(struct StyleChangeRecord));    StyleChangeRecordP->MoveDeltaX = x*tmpscale;    StyleChangeRecordP->MoveDeltaY = (y - Text->FontHeight*0.85)*tmpscale;    /*    printf("\n---------------Text->Bounds---------------Xmin:%d	,Ymin:%d	,Xmax:%d	,Ymax:%d	.\n"\    	,Text->Bounds.Xmin,Text->Bounds.Ymin,Text->Bounds.Xmax,Text->Bounds.Ymax);    printf("\n---------------data_p->boundary---------------Xmin:%d	,Ymin:%d	,Xmax:%d	,Ymax:%d	.\n"\    	,data_p->boundary.Xmin,data_p->boundary.Ymin,data_p->boundary.Xmax,data_p->boundary.Ymax);    */    StyleChangeRecordP->Flags = StateMoveTo|StateFillStyle1|StateLineStyle;    //    StyleChangeRecordP->FillStyle0 = 0;    StyleChangeRecordP->FillStyle1 = 1;    StyleChangeRecordP->LineStyle = 0;    ShapeP = (struct ShapeRecord *)StyleChangeRecordP;    headShapeP = ShapeP ;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 0;    StraightEdgeRecordP->HorLineDeltaX = 40*tmpscale;    StraightEdgeRecordP->VertLineDeltaY =0;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    headShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 1;    StraightEdgeRecordP->HorLineDeltaX = 0;    StraightEdgeRecordP->VertLineDeltaY =Text->FontHeight*tmpscale;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 0;    StraightEdgeRecordP->HorLineDeltaX = (-40)*tmpscale;    StraightEdgeRecordP->VertLineDeltaY =0;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    StraightEdgeRecordP = (struct StraightEdgeRecord*)malloc(sizeof(struct StraightEdgeRecord));    bzero((void *)(StraightEdgeRecordP),sizeof(struct StraightEdgeRecord*));    StraightEdgeRecordP->StraightLineFlag = 0;    StraightEdgeRecordP->Flags = TStraightEdge;    StraightEdgeRecordP->VertLineFlag = 1;    StraightEdgeRecordP->HorLineDeltaX = 0;    StraightEdgeRecordP->VertLineDeltaY = Text->FontHeight*(-1)*tmpscale;    ShapeP = (struct ShapeRecord *)StraightEdgeRecordP;    endShapeP->NextP = ShapeP;    endShapeP = ShapeP;    endShapeP->NextP = NULL;    mat_new(&(outRecordP->GlyphEntries[0].GlyphMatrix));    outRecordP->GlyphEntries[0].GlyphMatrix.TranslateX	= 1*tmpscale;    outRecordP->GlyphEntries[0].GlyphMatrix.TranslateY	= 0;//Text->FontHeight*(-1)*tmpscale;    outRecordP->GlyphEntries[0].GlyphMatrix.ScaleX	= Text->FontHeight/1024.0;    outRecordP->GlyphEntries[0].GlyphMatrix.ScaleY	= Text->FontHeight/1024.0;    outRecordP->GlyphEntries[0].Shape.CharacterType	= CharShape;    //outRecordP->GlyphEntries[0].Shape.ShapeBounds	= Text->Bounds;    outRecordP->GlyphEntries[0].Shape.ShapeRecordsP	= headShapeP;    return 0;}int drawTextBounds(GNode* node_p,struct Globle_Var *Globle_VarP) {    dtx_ins_t    *data_p   = (dtx_ins_t*)(node_p->data);    struct  DefineFont *Font;    struct TextRecord *TextBoundP;    struct Matrix TextMatrix;    struct  DefineEditText *Text;    Text = data_p->define_p;    Font = (struct  DefineFont *)data_p->swf_p->dict_p->dict[Text->FontID];    if(Text->Flags&EditTextBorder) {        TextBoundP = (struct TextRecord*)malloc(sizeof(struct TextRecord));        bzero((void *)TextBoundP,(sizeof(struct TextRecord)));        TextBoundP->Flags =StyleFlagsHasColor;        TextBoundP->FontID =Text->FontID;        TextBoundP->TextColor = Text->TextColor;        TextBoundP->TextHeight = Text->FontHeight;        TextBoundP->GlyphCount = 1;        TextBoundP->GlyphEntries[0].Shape.FillStylesP = NULL;        TextBoundP->GlyphEntries[0].Shape.LineStylesP = NULL;        getTextBounds(node_p,TextBoundP);        TextBoundP->NextP = NULL;        bzero((void *)(&TextMatrix),sizeof(struct Matrix));        MatrixPrepare(&TextMatrix);        Globle_VarP->GlobleText.TextMatrix = TextMatrix;        Globle_VarP->GlobleText.TextRecordsP = TextBoundP;    } else {        Globle_VarP->GlobleText.TextRecordsP = NULL;    }    return 0;}

⌨️ 快捷键说明

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