コード例 #1
0
ファイル: flicoinf.c プロジェクト: AnimatorPro/Animator-Pro
Errcode pj_flic_open_info(char *path, Flic *pflic, AnimInfo *pinf)
/*****************************************************************************
 * open a flic, and return info about it as well as leaving it open.
 * (note that some parm checking is done by routine(s) we call).
 ****************************************************************************/
{
	Errcode 	err;

	if (NULL == pinf)
		return pj_error_internal(Err_internal_pointer, modulename, __LINE__);

	if (Success > (err = pj_flic_open(path, pflic))) {
		return err;
	}

	return pj_flic_info(pflic, pinf);
}
コード例 #2
0
ファイル: CAPTURE.C プロジェクト: OhGameKillers/mythosengine
//�������������������������������������������������������������������������Ŀ
// capture_flcframe                                                         �
//                                                                          �
// Loads the next frame in the flic as a bitmap.                            �
//���������������������������������������������������������������������������
BXPColor *capture_flcframe(char *fname, Flic *flic,
                           FlicRaster *raster, byte *pix,
                           ushort *xs, ushort *ys, int forcesize)
{
    int         i;
    int         desirex;
    int         desirey;
    BXPColor    *bm=0;

//��� Load frame
    pj_flic_play_next(flic,raster);

//��� Expand into RGB bitmap buffer
    bm=malloc(raster->width * raster->height * sizeof(BXPColor));
    if (!bm)
        goto error_exit;

    {
        BXPColor *dptr=bm;
        byte *sptr=pix;
        PjRgb *rgb = &raster->cmap->ctab;
        for(i=0; i < raster->width*raster->height; i++)
        {
            dptr->r = rgb[*sptr].r;
            dptr->g = rgb[*sptr].g;
            dptr->b = rgb[*sptr].b;
            dptr++;
            sptr++;
        }
    }

//��� Check for resize
    if (forcesize)
    {
        desirex = *xs;
        desirey = *ys;
    }
    else if (mtl_sizemode == 3)
    {
        AnimInfo info;
        pj_flic_info(flic,&info);

        do_query(fname,info.width,info.height,info.num_frames);

        desirex = query_xsize;
        desirey = query_ysize;
    }
    else if (mtl_sizemode == 2)
    {
        desirex = mtl_sizex;
        desirey = mtl_sizey;
    }
    else
    {
        // Must set size to 16, 32, 64, 128, or 256
        desirex=16;
        desirey=16;

        if (raster->width > desirex)
            desirex=32;
        if (raster->height > desirey)
            desirey=32;

        if (raster->width > desirex)
            desirex=64;
        if (raster->height > desirey)
            desirey=64;

        if (raster->width > desirex)
            desirex=128;
        if (raster->height > desirey)
            desirey=128;

        if (raster->width > desirex)
            desirex=256;
        if (raster->height > desirey)
            desirey=256;
    }

//��� Perform resize
    if (desirex != raster->width
        || desirey != raster->height)
    {
        BXPColor *tbm = bm;

        if ((bm = malloc(desirex * desirey * sizeof(BXPColor)))==0)
        {
            free(tbm);
            goto error_exit;
        }

        gfx_resize_bitmap(tbm, raster->width, raster->height,
                          bm, desirex, desirey, i);

        free(tbm);

        if (i < 1)
        {
            goto error_exit;
        }
    }

//��� Return final image
    *xs = desirex;
    *ys = desirey;

    return bm;

error_exit:;
    if (bm)
        free(bm);

    return 0;
}