Beispiel #1
0
/* ---------------------------------------------------------------------------
* Read a Targa image from a file named <filename> to <dest>.  This is just a
* wrapper around tga_read_from_FILE().
*
* Returns: TGA_NOERR on success, or a matching TGAERR_* code on failure.
*/
tga_result tga_read(tga_image *dest, const char *filename)
{
	tga_result result;
	FILE *fp = fopen(filename, "rb");
	if (fp == NULL) return TGAERR_FOPEN;
	result = tga_read_from_FILE(dest, fp);
	fclose(fp);
	return result;
}
Beispiel #2
0
/* ---------------------------------------------------------------------------
 * Read a Targa image from a file named <filename> to <dest>.  This is just a
 * wrapper around tga_read_from_FILE().
 *
 * Returns: TGA_NOERR on success, or a matching TGAERR_* code on failure.
 */
tga_result tga_read(tga_image *dest, const char *filename)
{
    tga_result result;
    FILE *fp;
    if (0 != physx::shdfnd::fopen_s(&fp, filename, "rb")) return TGAERR_FOPEN;
    result = tga_read_from_FILE(dest, fp);
    fclose(fp);
    return result;
}
/* ---------------------------------------------------------------------------
 * Read a Targa image from a file named <filename> to <dest>.  This is just a
 * wrapper around tga_read_from_FILE().
 *
 * Returns: TGA_NOERR on success, or a matching TGAERR_* code on failure.
 */
tga_result tga_read(tga_image *dest, const char *filename, tgaFileOperations* fops)
{
    tga_result result;
	
    TGA_FP *fp = NULL;
	if (0 != TGA_FOPEN_S(fops, &fp, filename, "rb")) return TGAERR_FOPEN;
    result = tga_read_from_FILE(dest, fp, fops);
    TGA_FCLOSE(fops, fp);
    return result;
}