Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Visual C+;中的swflib库从多个.JPG图像创建.swf文件+;? 我写了一个C++代码,从多JPG图片创建一个动画SWF文件。_C++_Flash_Dll_Caa - Fatal编程技术网

如何使用Visual C+;中的swflib库从多个.JPG图像创建.swf文件+;? 我写了一个C++代码,从多JPG图片创建一个动画SWF文件。

如何使用Visual C+;中的swflib库从多个.JPG图像创建.swf文件+;? 我写了一个C++代码,从多JPG图片创建一个动画SWF文件。,c++,flash,dll,caa,C++,Flash,Dll,Caa,现在,我有像“图像0”到“图像100”这样的图片。我找到了一个swflib库。我想这会有帮助的。到目前为止,我可以使用这个库的方法创建.SWF文件,.SWF文件的大小是.JPG格式的图片的总和 所以,我想我差不多完成了。但是,主权财富基金并不参与。我疯了。 下面是我修改的代码: `void CSWFLIBTestProjectDlg::CreateSWFMovie_Bitmap() { // Set movie params SIZE_F movieSize = {100, 10

现在,我有像“图像0”到“图像100”这样的图片。我找到了一个swflib库。我想这会有帮助的。到目前为止,我可以使用这个库的方法创建.SWF文件,.SWF文件的大小是.JPG格式的图片的总和

所以,我想我差不多完成了。但是,主权财富基金并不参与。我疯了。 下面是我修改的代码:

`void CSWFLIBTestProjectDlg::CreateSWFMovie_Bitmap()
{
    // Set movie params
    SIZE_F movieSize = {100, 100};
    int frameRate = 14;
    POINT_F pt;

    // Create empty .SWF file
    CSWFMovie swfMovie;

    swfMovie.OpenSWFFile(_T("SWF Sample Movies/Sample2.swf"), movieSize, frameRate);

    SWF_RGB bgColor = {255, 255, 255};
    swfMovie.SetBackgroundColor(bgColor);

    // Define bitmap object
    CSWFBitmap bitmap(2, (UCHAR*)"gif_0.jpg");//bm128
    swfMovie.DefineObject(&bitmap, -1, true);

    // Define custom shape
    RECT_F shapeRect = {0, 0, 1000, 1000};
    CSWFShape shape(1, shapeRect, 1);
    SWF_RGBA lineColor = {0, 0, 0, 255};
    shape.AddLineStyle(0, lineColor);
    RECT_F bitmapRect = {0, 0, 1246, 622};                              // size of the bitmap
    RECT_F clipRect = {0, 0, 100, 100};                                 // where to fill
    shape.AddBitmapFillStyle(bitmap.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect);
    pt.x = 0;
    pt.y = 0;
    shape.ChangeStyle(1, 1, 0, &pt);
    shape.AddLineSegment(100, 0);
    shape.AddLineSegment(0, 100);
    shape.AddLineSegment(-100, 0);
    shape.AddLineSegment(0, -100);


    swfMovie.DefineObject(&shape, shape.m_Depth, true);

    swfMovie.ShowFrame();
    /****************************************
    *   move
    ****************************************/
    float i;
    for (i=0; i<10; i++)
    {
        shape.Translate(i, 0);
        swfMovie.UpdateObject(&shape, shape.m_Depth, NULL, -1);
        swfMovie.ShowFrame();
        //if (i>200)
        //{ 
        //  swfMovie.RemoveObject(shape.m_Depth);

        //}

    }


/****************************************
 *  add jpg
 ****************************************/

    swfMovie.RemoveObject(shape.m_Depth);

    for (int i=1;i<=100;i++)
    {
        char filename[100]; 
        sprintf(filename,"gif_%d%s",i,".jpg");

        CSWFBitmap bitmap2(3, (UCHAR*)filename);//gif_0
        swfMovie.DefineObject(&bitmap2, -1, true);//

        // Define custom shape
        RECT_F shapeRect2 = {0, 0, 1000, 1000};
        CSWFShape shape2(1, shapeRect2, 1);
        SWF_RGBA lineColor2 = {0, 0, 0, 255};
        shape2.AddLineStyle(0, lineColor2);
        RECT_F bitmapRect2 = {0, 0, 1246, 622};                             // size of the bitmap
        RECT_F clipRect2 = {0, 0, 100, 100};                                    // where to fill
        shape2.AddBitmapFillStyle(bitmap2.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect2, clipRect2);
        pt.x = 0;
        pt.y = 0;
        shape2.ChangeStyle(1, 1, 0, &pt);
        shape2.AddLineSegment(100, 0);
        shape2.AddLineSegment(0, 100);
        shape2.AddLineSegment(-100, 0);
        shape2.AddLineSegment(0, -100);

        swfMovie.UpdateObject(&shape2, shape2.m_Depth, NULL, -1);
        //swfMovie.DefineObject(&shape2, shape2.m_Depth, true);

        swfMovie.ShowFrame(); 
        //swfMovie.RemoveObject(shape2.m_Depth);


    }








    // Close .SWF file
    swfMovie.CloseSWFFile();
}`
`void CSWFLIBTestProjectDlg::CreateSWFMovie_Bitmap()
{
//设置电影参数
大小F movieSize={100100};
整数帧率=14;
点F pt;
//创建空的.SWF文件
斯夫莫维电影公司;
swfMovie.OpenSWFFile(_T(“SWF Sample Movies/Sample2.SWF”)、movieSize、帧速率);
SWF_RGB bgColor={255,255,255};
swfMovie.SetBackgroundColor(bgColor);
//定义位图对象
CSWFBitmap位图(2,(UCHAR*)“gif_0.jpg”);//bm128
swfMovie.DefineObject(&位图,-1,true);
//定义自定义形状
RECT_F shapperstright={0,0,1000,1000};
cswf形状(1,形状直立,1);
SWF_RGBA lineColor={0,0,0,255};
shape.AddLineStyle(0,lineColor);
RECT_F bitmapRect={0,0124622};//位图的大小
RECT_F clipRect={0,0,100,100};//填充的位置
AddBitmapFillStyle(bitmap.m_ID、SWF_FILLSTYLETYPE_bitmap_0、bitmapRect、clipRect);
pt.x=0;
pt.y=0;
shape.ChangeStyle(1,1,0和pt);
shape.AddLineSegment(100,0);
shape.AddLineSegment(0,100);
shape.AddLineSegment(-100,0);
形状。添加线段(0,-100);
swfMovie.DefineObject(&shape,shape.m_Depth,true);
swfMovie.ShowFrame();
/****************************************
*移动
****************************************/
浮点数i;
对于(i=0;i200)
//{ 
//swfMovie.RemoveObject(形状、m_深度);
//}
}
/****************************************
*添加jpg
****************************************/
swfMovie.RemoveObject(形状、m_深度);

对于(int i=1;i),我找到了一种用C++从一组图像创建.SWF文件的方法,以及<强> SWFLIB < /St>。 void CSWFLIBTestProjectDlg::CreateSWFMovie_位图() {

SIZE\u F movieSize={4000,4000};
整数帧率=40;
点F pt;
斯夫莫维电影公司;
swfMovie.OpenSWFFile(_T(“SWF Sample Movies/Sample2.SWF”)、movieSize、帧速率);
SWF_RGB bgColor={255,255,255};
swfMovie.SetBackgroundColor(bgColor);
CSWF位图(2,(UCHAR*)“bm128.jpg”);
swfMovie.DefineObject(&位图,-1,false);
RECT_F shappright={0,0,1000,1000};//形状大小
cswf形状(1,形状直立,1);
SWF_RGBA lineColor={0,0,0,255};
shape.AddLineStyle(3,lineColor);
RECT_F bitmapRect={0,0,128,128};//位图的大小
RECT_F clipRect={0,0,100,100};//填充的位置
AddBitmapFillStyle(bitmap.m_ID、SWF_FILLSTYLETYPE_bitmap_0、bitmapRect、clipRect);
pt.x=0;
pt.y=0;
shape.ChangeStyle(1,1,0和pt);
shape.AddLineSegment(100,0);
shape.AddLineSegment(0,100);
shape.AddLineSegment(-100,0);
形状。添加线段(0,-100);
swfMovie.DefineObject(&shape,shape.m_Depth,true);
swfMovie.ShowFrame();
对于(int i=0;i
SIZE_F movieSize = {4000, 4000};
int frameRate = 40;
POINT_F pt;


CSWFMovie swfMovie;
swfMovie.OpenSWFFile(_T("SWF Sample Movies/Sample2.swf"), movieSize, frameRate);
SWF_RGB bgColor = {255, 255, 255};
swfMovie.SetBackgroundColor(bgColor);


CSWFBitmap bitmap(2, (UCHAR*)"bm128.jpg");
swfMovie.DefineObject(&bitmap, -1, false);


RECT_F shapeRect = {0, 0, 1000, 1000};//shape大小
CSWFShape shape(1, shapeRect, 1);
SWF_RGBA lineColor = {0, 0, 0, 255};
shape.AddLineStyle(3, lineColor);
RECT_F bitmapRect = {0, 0, 128, 128};                               // size of the bitmap
RECT_F clipRect = {0, 0, 100, 100};                                 // where to fill
shape.AddBitmapFillStyle(bitmap.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect);
pt.x = 0;
pt.y = 0;
shape.ChangeStyle(1, 1, 0, &pt);
shape.AddLineSegment(100, 0);
shape.AddLineSegment(0, 100);
shape.AddLineSegment(-100, 0);
shape.AddLineSegment(0, -100);
swfMovie.DefineObject(&shape, shape.m_Depth, true);
swfMovie.ShowFrame();



for (int i=0; i<100; i++)
{
    char filename[50]=""; 
    sprintf(filename,"gif_%d%s",i,".jpg");
    CSWFBitmap bitmap2(300+i, (UCHAR*)filename);
    swfMovie.DefineObject(&bitmap2, -1, false);//false
    CSWFShape shape2(7+i,shapeRect,2+i);//depth值也不能一样 id不能重复
    shape2.AddLineStyle(3, lineColor);
    RECT_F bitmapRect2 = {0, 0, 128, 128};                              
    RECT_F clipRect2 = {0, 0, 100, 100};                                    
    shape2.AddBitmapFillStyle(bitmap2.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect2, clipRect2);

    pt.x = 0;
    pt.y = 0;
    shape2.ChangeStyle(1, 1, 0, &pt);
    shape2.AddLineSegment(1000, 0);
    shape2.AddLineSegment(0, 1000);
    shape2.AddLineSegment(-1000, 0);
    shape2.AddLineSegment(0, -1000);
    shape2.Translate(80, 0);
    swfMovie.DefineObject(&shape2, shape2.m_Depth, true);//必须define才能动 可以不update

    swfMovie.ShowFrame();


}