1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/*
* tkImgPNGInit.c --
*
* This file initializes a package implementing a PNG photo image
* type for Tcl/Tk. See the file tkImgPNG.c for the actual
* implementation.
*
* Copyright (c) 2006 Muonics, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tkImgPNGInit.c,v 1.4 2006/11/27 14:44:59 muonics Exp $
*/
#include <tcl.h>
#include <tk.h>
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.8"
#endif
extern Tk_PhotoImageFormat tkImgFmtPNG;
#ifndef USE_PANIC_ON_PHOTO_ALLOC_FAILURE
#if ((TCL_MAJOR_VERSION > 8) || \
((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5)))
#define TKPNG_REQUIRE "8.5"
#else
#define TKPNG_REQUIRE "8.3"
#endif
#endif /* !USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
/*
*----------------------------------------------------------------------
*
* Tkpng_Init --
*
* Initialize the Tcl PNG package.
*
* Results:
* A standard Tcl result
*
* Side effects:
* PNG support added to the "photo" image type.
*
*----------------------------------------------------------------------
*/
#ifdef __cplusplus
extern "C"
{
#endif
DLLEXPORT
int
Tkpng_Init(Tcl_Interp *interp)
{
if (Tcl_InitStubs(interp, TKPNG_REQUIRE, 0) == NULL) {
return TCL_ERROR;
}
if (Tcl_PkgRequire(interp, "Tcl", TKPNG_REQUIRE, 0) == NULL) {
return TCL_ERROR;
}
if (Tk_InitStubs(interp, TKPNG_REQUIRE, 0) == NULL) {
return TCL_ERROR;
}
if (Tcl_PkgRequire(interp, "Tk", TKPNG_REQUIRE, 0) == NULL) {
return TCL_ERROR;
}
Tk_CreatePhotoImageFormat(&tkImgFmtPNG);
if (Tcl_PkgProvide(interp, "tkpng", PACKAGE_VERSION) != TCL_OK) {
return TCL_ERROR;
}
return TCL_OK;
}
#ifdef __cplusplus
extern "C"
}
#endif
|