s8hrs8hr 2015-09-15 12:41 采纳率: 0%
浏览 2096

关于如何用swflib库将一组jpg图片合称为动态swf文件

大神们好,我是第一次在这里发帖,现在项目遇到的问题是用C++将一组jpg图片合成为一个动态的swf文件,我在网上查到了swflib这个类库,研究了下代码感觉应该能实现,但本人才疏学浅,实在搞不出来。只有来这里求教各路大神了,不知道c币怎么弄,要是有人能帮到我省省伙食费支付宝感谢一下也没问题的,谢谢啦!
附:(现在只能做到这个阶段,能移动,但是后面的图片不显示)

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();
    /****************************************
    *   移动图像
    ****************************************/
    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);

        //}

    }


/****************************************
 *  测试加一张图片
 ****************************************/

    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();
}
  • 写回答

3条回答 默认 最新

  • devmiao 2015-09-15 15:48
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退