Statistics
| Branch: | Revision:

root / src / tkenv / tkImgPNGInit.c @ fbe00e73

History | View | Annotate | Download (1.32 KB)

1
/*
2
 * tkImgPNGInit.c --
3
 *
4
 *                This file initializes a package implementing a PNG photo image
5
 *      type for Tcl/Tk.  See the file tkImgPNG.c for the actual
6
 *      implementation.
7
 *
8
 * Copyright (c) 2005 Michael Kirkham <mikek@muonics.com> & Muonics
9
 *
10
 * See the file "license.terms" for information on usage and redistribution
11
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12
 *
13
 * RCS: @(#) $Id: tkImgPNGInit.c,v 1.3 2005/03/26 22:20:56 mikek Exp $
14
 */
15

    
16
#include <tcl.h>
17
#include <tk.h>
18

    
19
extern Tk_PhotoImageFormat tkImgFmtPNG;
20

    
21
/*
22
 *----------------------------------------------------------------------
23
 *
24
 * Tkpng_Init --
25
 *
26
 *                Initialize the Tcl PNG package.
27
 *
28
 * Results:
29
 *                A standard Tcl result
30
 *
31
 * Side effects:
32
 *                PNG support added to the "photo" image type.
33
 *
34
 *----------------------------------------------------------------------
35
 */
36

    
37
int
38
Tkpng_Init(Tcl_Interp *interp)
39
{
40
        if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
41
                return TCL_ERROR;
42
        }
43
        if (Tcl_PkgRequire(interp, "Tcl", "8.4", 0) == NULL) {
44
                return TCL_ERROR;
45
        }
46
        if (Tk_InitStubs(interp, "8.4", 0) == NULL) {
47
                return TCL_ERROR;
48
        }
49
        if (Tcl_PkgRequire(interp, "Tk", "8.4", 0) == NULL) {
50
                return TCL_ERROR;
51
        }
52

    
53
        Tk_CreatePhotoImageFormat(&tkImgFmtPNG);
54

    
55
        if (Tcl_PkgProvide(interp, "tkpng", "0.7") != TCL_OK) {
56
                return TCL_ERROR;
57
        }
58

    
59
        return TCL_OK;
60
}
61