oehhar / tksvg Goto Github PK
View Code? Open in Web Editor NEWAn extension for Tk to read SVG images based on nanosvg
License: Other
An extension for Tk to read SVG images based on nanosvg
License: Other
Here, the size of the image buffer is computed by 32bit signed integer math, which may lead to overflow for insane settings of width and height, or e.g. -scale:
Line 616 in 68cc55d
Due to the integer wrap-around, it may result in the successful allocation of a small buffer. Suggested fix: Use 64bit math, e.g.
(size_t)w * (size_t) h
and check for overflow (painful). Or don't use ckalloc, but malloc.
For some reason, the configure script is missing INSTALL_FLAGS.
I don't know why autoconf would miss that.
In configure:
PACKAGE_NAME='tksvg'
PACKAGE_TARNAME='tksvg'
PACKAGE_VERSION='0.8'
PACKAGE_STRING='tksvg 0.8'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
TclError: couldn't load library "C:/Users/Thomas King/AppData/Roaming/Python/Python37/site-packages/tksvg/libtksvg.dll": Bad exe format. Possibly a 32/64-bit mismatch.
got this error when trying to use python fork. anyone got a fix?
Hello this issue seems to be still reproducible with 0.13
The data to reproduce it is as follows:
<svg width="120" height="240" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="Gradient1">
<stop offset="0%" stop-color="red" />
<stop offset="50%" stop-color="black" stop-opacity="0" />
<stop offset="95%" stop-color="blue" />
</linearGradient>
<linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" stop-color="red" />
<stop offset="50%" stop-color="black" stop-opacity="0" />
<stop offset="95%" stop-color="blue" />
</linearGradient>
</defs>
<rect id="rect1" x="10" y="10" rx="15" ry="15"
width="100" height="100" fill="url(#Gradient1)"/>
<rect
x="10"
y="120"
rx="15"
ry="15"
width="100"
height="100"
fill="url(#Gradient2)" />
</svg>
When loading tksvg package, "image put" statements do not work correctly anymore.
That's because the parser does not check, if the SVG image could be read correctly.
See following test script (disable package require tksvg to see how it should look):
package require Tk
package require tksvg
proc CreateCellImg { color } {
set img [image create photo -height 13 -width 13]
$img put $color -to 0 0 13 13
return $img
}
for { set i 1 } { $i < 10 } { incr i } {
set colorHex [format "#%02X%02X%02X" [expr $i20] [expr $i10] [expr $i*10]]
label .l_$i -image [CreateCellImg $colorHex]
pack .l_$i
}
Possible solution:
Add following code at the end of function ParseSVGWithOptions:
if (nsvgImage == NULL) {
Tcl_SetResult(interp, "cannot parse SVG image", TCL_STATIC);
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL);
goto error;
}
if (nsvgImage->width == 0.0 && nsvgImage->height == 0.0) {
Tcl_SetResult(interp, "cannot parse SVG image", TCL_STATIC);
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL);
goto error;
}
This new compiler version is causing me issues.
It appears that images created with tksvg using gcc 10.1.0 are not working right.
It crashes when the image is put to use.
64-bit, same version of the compiler works fine.
It is unclear under which license is the tksvg distributed, could you please clarify? Many thanks!
yeah pretty self explanatory.
what the thing is supposed to look like
https://drive.google.com/file/d/13CT8g9gPqKBvJ5-3ouv7JM_Pf-Vn5kLL/view?usp=share_link
what it ends up looking like
https://drive.google.com/file/d/1iSBjp55cQtIhZehwuUSGQExRtZ2TP2CM/view?usp=share_link
Hi,
I maintain some Tcl/Tk packages for Debian; mainly as dependencies of the SAOImageDS9 package; however they are meant for general use as well. In future, SAOImageDS9 will pobably get tksvg as a new dependency. From the author of DS9, @wjoye, I now found another tksvg repository -- https://github.com/wjoye/tksvg which seems to focus on TEA compatibility. Would it be possible to cooperate?
I am asking since I would volunteer to maintain tksvg until Tcl/Tk 8.7 hits Debian mainline; however since I will need it for future DS9 releases, it is required to keep in sync with @wjoye's source.
Thanks for consideration!
Ole
a) SHLIB_LD is not set, should be the same as ${CC}
b) SHLIB_CFLAGS is not set to -shared
c) SHLIB_LDFLAGS is missing -shared
I've built tksvg on Win7x64 using Msys2 64-bit. It is working fine -- thank you!
I had to use a much more recent version of tcl.m4 and re-run autoconf
I used this one: tcl8.6.6/pkgs/thread2.8.0/tclconfig/tcl.m4
I copied the replacement tcl.m4 to tclconfig/ and reran 'autoconf'
Running this configure now works fine:
$ PATH="/C/progra1/tcl/bin:$PATH" ./configure 1/tcl/lib
--with-tcl=/c/progra
--with-tk=/c/progra~1/tcl/lib
--enable-64bit
--exec-prefix=pwd
/PREFIX
A "make" builds the library correctly for windows 64-bit
The only problem is the "make install" which results in:
$ make install
/bin/sh ./tclconfig/install-sh -c @INSTALL_FLAGS@ tksvg01.dll /C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1/tksvg01.dll
cp: cannot stat '@INSTALL_FLAGS@': No such file or directory
mv: cannot stat '/C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1/#inst.5552#': No such file or directory
: /C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1/tksvg01.dll
Install pkgIndex.tcl /C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1
Installing header files in /mingw64/include
I don't know enough about autoconf etc. to remove the reference to @INSTALL_FLAGS@. I can easily work around it by either editing the Makefile or copying the DLL manually.
Linux: ubuntu 16.04 64-bit, gcc 5.4.0
./generic/tkImgSVG.c: In function ‘ParseSVGWithOptions’:
./generic/tkImgSVG.c:426:2: warning: enumeration value ‘OPT_DPI’ not handled in switch [-Wswitch]
switch ((enum fmtOptions) optIndex) {
^
I use pikchr(https://pikchr.org/) to generate svg file, tksvg can't display text items.
should be
I recommend that the pkgIndex.tcl file be changed to have:
if { [package vcompare 8.7 [info tclversion]] > 0 } {
...
}
to protect against inclusion in Tk 8.7 and later.
There is a possibility that the multiple inclusion can cause corruption in 8.7.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.