justvanrossum / drawbot-skia Goto Github PK
View Code? Open in Web Editor NEWA cross-platform subset of the DrawBot drawing API, using Skia
License: Apache License 2.0
A cross-platform subset of the DrawBot drawing API, using Skia
License: Apache License 2.0
First, pillow is required to run the test suite and doesn't seem to be mentioned as a test dependency anywhere. I must be blind, it's right there in requirements-dev.txt
.
Second it seems numpy should be listed as a test dependency, not as a regular dependency. It is used directly for tests. I looked through the skip-python code based and it seems the same there, it is never used directly in the library but it is used for the test suite. As such they seem to have it specified properly and the only improper thing is where this shows up and moving it to test deps would be appropriate:
Line 26 in f9d5314
Hi! I just installed Drawbot Skia and I got this error:
Traceback (most recent call last):
File "./test.py", line 3, in <module>
from drawbot_skia.drawbot import *
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/drawbot_skia/drawbot.py", line 1, in <module>
from .drawing import Drawing
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/drawbot_skia/drawing.py", line 4, in <module>
import skia
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skia.cpython-37m-darwin.so, 2): Symbol not found: _XML_ErrorString
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skia.cpython-37m-darwin.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skia.cpython-37m-darwin.so
This is my script
from drawbot_skia.drawbot import *
rect(100, 100, 100, 100)
saveImage('test.jpeg')
And I runned it with python ./test.py
Am I doing something wrong? Iโm on OS: Mac Os Mojave 10.14.6
Skia has in recent years added high-level text support. See:
Just ran into this, handy for knowing what the min/max values are of a axis
Hey Just, this kind of left field. I have ported some drawbot code to drawbot-skia for use on a website. I use Django as my webserver. When I run the drawbot-skia code through a Django view and get it to output a skia SVG, it will output the file. Reload the page and it will output another file with a number variation. Reload again and it just keeps going. If I manually delete those files and reload the page. All the files that I have deleted are but back. Do this too quickly and you get the following warning:
drawbot_skia.errors.DrawbotError: size() can't be called if there's already a canvas active
It is odd that it is saying the canvas is still active even thought there is del canvas in the _def saveImage_svg()
I feel that this file behaviour has something to do with the FILEWStream part. Like it leaves the stream open or something. Because the underlying python-skia library is in C it is impossible for me to figure out what is going on. Outside of Django this works fine.
So I know this is a vague question but have you seen this behaviour before? Any idea why it might be doing this? Ultimately I would just like to grab the SVG and put it in the HTML page.
Talk soon, Maarten
newPage()
requires argument, though mac's drawbot doesn't. This breaks compatibility of code that can be shared in class for both drawbot app and drawbot-skia. Is it intentional? Can I make a PR?
would writing tests checking stuff like these between drawbot-skia and drawbot be desirable?
rect.__code__.co_argcount
rect.__defaults__
rect.__code__.co_varnames
if yes, I would like to do it!
i miss the tracking method to work with text, as described in drawbot://www.drawbot.com/_downloads/tracking.py
are there any plans to implement it?
or is it already implemented under a different name?
Possibly due to a bug in skia-python: kyamagu/skia-python/issues/112
hi and thanks for the great work. i installed it yesterday on debian and everything seems to work well.
is there any way to integrate it in a jupyter notebook, as it is the case for the matplotlib? or what is your normal workflow in coding and watching the result?
cheers -
joachim
This could be done with skia.Path.ConvertConicToQuads()
but that's currently not working for me: kyamagu/skia-python#115
How about:
fontColorPalette(indexOrName)
the svg output of blendMode is quite different from the other outputs, and looks wrong.
it happens on rendering for me, and is the same in the apitests_expected_output.
The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
Currently supported Drawbot functions:
size(width, height)
newPage(width, height)
frameDuration(duration)
width()
height()
rect(x, y, w, h)
oval(x, y, w, h)
line(pt1, pt2)
polygon(firstPoint, *points, close=True)
drawPath(path)
clipPath(path)
fill(*args)
stroke(*args)
strokeWidth(value)
lineCap(lineCap)
lineJoin(lineJoin)
lineDash(firstValue, *values)
blendMode(blendMode)
miterLimit(miterLimit)
linearGradient(...)
radialGradient(...)
limited to a single center point and a zero start radiusfont(fontNameOrPath, fontSize=None)
fontSize(size)
openTypeFeatures(*, resetFeatures=False, **features)
fontVariations(*, resetVariations=False, **variations)
textSize(txt)
language(language)
text(txt, position, align=None)
single line, single style only for nowimage(imagePath, position, alpha=1.0)
limited to pixel formats, PDF is not supportedtranslate(x, y)
rotate(angle, center=(0, 0))
scale(sx, sy=None, center=(0, 0))
skew(sx, sy=0, center=(0, 0))
transform(matrix, center=(0, 0))
savedState()
saveImage(fileName)
currently limited to PNG, JPG, MP4 and PDFBezierPath
currently supports:
path.moveTo(pt)
path.lineTo(pt)
path.curveTo(pt1, pt2, pt3, *pts)
path.qCurveTo(pt1, pt2, *pts)
path.arc(center, radius, startAngle, endAngle, clockwise)
path.arcTo(point1, point2, radius)
path.closePath()
path.endPath()
segment pen method / point pen methodpath.beginPath()
point pen methodpath.addPoint(...)
point pen methodpath.rect(x, y, w, h)
path.oval(x, y, w, h)
path.polygon(firstPoint, *points, close=True)
path.text(txt, ...)
path.pointInside(point)
path.bounds()
path.controlPointBounds()
path.appendPath(other)
path.copy()
path.reverse()
path.translate(x, y)
path.scale(x, y=None, center=(0, 0))
path.rotate(angle, center=(0, 0))
path.skew(x, y=0, center=(0, 0))
path.transform(transform, center=(0, 0))
path.drawToPen(pen)
path.drawToPointPen(pen)
path.removeOverlap()
path.union(other)
and path.__or__(other)
path.intersection(other)
and path.__and__(other)
path.difference(other)
and path.__mod__(other)
path.xor(other)
and path.__xor__(other)
For an overview of changes and additions per release, see https://github.com/justvanrossum/drawbot-skia/blob/master/CHANGELOG.md
See this run: https://github.com/justvanrossum/drawbot-skia/runs/4144164547?check_suite_focus=true
Worked around for now by pinning macos to 10.15, but that should be a temporary solution.
i cannot get functions to use, for instance:
def myline(x1,y1,x2,y2):
line((x1,x2),(y1,y2))
size(700,250)
myline(100,100,200,50)
no error, but also no output.
i also tried different variants, like:
def myline(x1,y1,x2,y2):
path = BezierPath()
path.line((x1,y1),(x2,y2))
path.closePath()
drawPath(path)
am i missing anything, or is this simply not supposed to work?
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.