Tcl Library Source Code

Check-in [2313b69a8f]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

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

Overview
Comment:png: added tests for physical dimension retrieval
Timelines: family | ancestors | png-get-physical-dimension
Files: files | file ages | folders
SHA3-256:2313b69a8fe1b0d75e115f8933aa94546a68c9efd659536b92892566a79eb49d
User & Date: oehhar 2018-12-13 10:52:19
Context
2018-12-13
10:52
png: added tests for physical dimension retrieval Closed-Leaf check-in: 2313b69a8f user: oehhar tags: png-get-physical-dimension
2018-12-12
19:19
Add "getPhysicalDimension" to png package to get physical pixel size. Ticket [48fe95c519] check-in: cc43ba987d user: oehhar tags: png-get-physical-dimension
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/png/png.man.

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
[arg keyword], in the language specified by the language identifier
[arg lang].

[call [cmd ::png::getPixelDimension] [arg file]]

Returns a dictionary with keys [const ppux], [const ppuy] and [const unit] if the information is present.
Otherwise, it returns the empty string.
The values of [const ppux] and [const ppuy] return the pixel per unit value iiiin X or Y direction.
The value of [const unit] may be meter or unknown. In case of meter, a dpi value may be found by the multiplication of 0.0254.

[call [cmd ::png::image] [arg file]]

Given a PNG file returns the image in the list of scanlines format used by Tk_GetColor.

[call [cmd ::png::write] [arg file] [arg data]]








|
|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
[arg keyword], in the language specified by the language identifier
[arg lang].

[call [cmd ::png::getPixelDimension] [arg file]]

Returns a dictionary with keys [const ppux], [const ppuy] and [const unit] if the information is present.
Otherwise, it returns the empty string.
The values of [const ppux] and [const ppuy] return the pixel per unit value in X or Y direction.
The value of [const unit] may be meter or unknown. In case of meter, the dpi value may retrieved by the multiplication of 0.0254.

[call [cmd ::png::image] [arg file]]

Given a PNG file returns the image in the list of scanlines format used by Tk_GetColor.

[call [cmd ::png::write] [arg file] [arg data]]

Changes to modules/png/png.test.

297
298
299
300
301
302
303















304
305
306

	::png::removeComments $copy
	set res [list [::png::validate $copy] [::png::getComments $copy]]
	removeFile pngrc.$root
	set res
    } {OK {}}
}
















# -------------------------------------------------------------------------
testsuiteCleanup







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



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321

	::png::removeComments $copy
	set res [list [::png::validate $copy] [::png::getComments $copy]]
	removeFile pngrc.$root
	set res
    } {OK {}}
}

# -------------------------------------------------------------------------
# PhysicalDimensions

test png-physical-dimensions-missing {Test for empty list if no physical dimensions present} {
    ::png::getPixelDimension [file join\
	    [file dirname [file join [pwd] [info script]]]\
	    testimages/physicaldimensions/basi0g01.png]
} {}

test png-physical-dimensions-missing {Test for empty list if no physical dimensions present} {
    ::png::getPixelDimension [file join\
	    [file dirname [file join [pwd] [info script]]]\
	    testimages/physicaldimensions/basi0g01_300dpi.png]
} {ppux 11811 ppuy 11811 unit meter}

# -------------------------------------------------------------------------
testsuiteCleanup

Added modules/png/testimages/physicaldimensions/basi0g01.png.

cannot compute difference between binary files

Added modules/png/testimages/physicaldimensions/basi0g01_300dpi.png.

cannot compute difference between binary files