Check-in [5376cf14bc]

Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:TIP529: worded next insights: property functions and new call functions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5376cf14bcade356d5d24145567d55d2af5cdef96528b6b6a567d95985836811
User & Date: oehhar 2018-12-18 17:07:33
Context
2019-01-01
17:05
Added TIP 531, with apologies to Shannon Noe for taking so long to get this in check-in: 04c80b80d0 user: dkf tags: trunk
2018-12-18
17:07
TIP529: worded next insights: property functions and new call functions check-in: 5376cf14bc user: oehhar tags: trunk
2018-12-17
04:40
Added 530 to index.md check-in: f4f9d9861e user: leon tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tip/529.md.

81
82
83
84
85
86
87















































88
89
90
91
92
93
94
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Any current contents is lost.

The write file commands uses any dict keys it knows.
Any unknown dict keys are ignored.

## C interface
















































Two new stub table functions are added:

    Tcl_Obj * Tk_PhotoGetMetadata(Tk_PhotoHandle handle)

    void Tk_PhotoSetMetadata(Tk_PhotoHandle handle, Tcl_Obj *metadata)

This works well for image read. The function "Tk_PhotoSetMetadata" is called within the image read function.
................................................................................
    static int CommonWriteGIF(Tcl_Interp *interp,
            const char *fileName,
            WriteBytesFunc *writeProc,
            Tcl_Obj *format,
            Tk_PhotoImageBlock *blockPtr);

In consequence, the write function should be extended by the metadata object pointer.

# Implementation

The current implementation is only a sketch in my brain.
I hope, that an image handler can set the options after reading and a binary extension of the image handlers is not necessary.
Nevertheless, I don't know jet.

Any help and comments are appreciated.
I am realy a novice here.

Implementation may start soon with the tag tip-529-image-metadata.

# Rejected alternatives



# Copyright

This document has been placed in the public domain.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
...
145
146
147
148
149
150
151















152
153
154
155
Any current contents is lost.

The write file commands uses any dict keys it knows.
Any unknown dict keys are ignored.

## C interface

The current C interface for drivers and other programs is not sufficient to support the metadata dict.

A new extensible interface is envisaged with:

   *   a pair of functions to get or set all options of the image.
   *   a new driver interface to basically only pass the command.
   *   and a compatibility layer to the current driver interface

There are currently functions to access the raster data (Tk_PhotoGetImage, Tk_PhotoPutBlock).
The other properties (-file, -data, -format, -gamma) are not exposed.

A new interface may also be used for other image formats like svg where the image data consists of the rastered image, the image data and metadata.
In this case, an image save operation might even not use the raster data but only metadata and image data.

### image property get and set functions

Two new stub table functions are added:

    Tcl_Obj * Tk_PhotoGetOption(Tk_PhotoHandle handle, char *OptionName)

    void Tk_PhotoSetOption(Tk_PhotoHandle handle, char *OptionName, Tcl_Obj *optionValue)

### Revised image driver commands

The new command interface only passes the image handle. Any required data may be accquired by the get/set functions. Also, access to the raster data is done by the raster access functions.

The current registration function is
    Tk_CreatePhotoImageFormat()

...


# Implementation

The current implementation is only a sketch in my brain.
I hope, that an image handler can set the options after reading and a binary extension of the image handlers is not necessary.
Nevertheless, I don't know jet.

Any help and comments are appreciated.
I am realy a novice here.

Implementation may start soon with the tag tip-529-image-metadata.

# Rejected alternatives

## C interface: only use metadata dict get and set functions

Two new stub table functions are added:

    Tcl_Obj * Tk_PhotoGetMetadata(Tk_PhotoHandle handle)

    void Tk_PhotoSetMetadata(Tk_PhotoHandle handle, Tcl_Obj *metadata)

This works well for image read. The function "Tk_PhotoSetMetadata" is called within the image read function.
................................................................................
    static int CommonWriteGIF(Tcl_Interp *interp,
            const char *fileName,
            WriteBytesFunc *writeProc,
            Tcl_Obj *format,
            Tk_PhotoImageBlock *blockPtr);

In consequence, the write function should be extended by the metadata object pointer.
















# Copyright

This document has been placed in the public domain.