-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Backends support #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backends support #829
Conversation
This is a stripped-down version of pull-request Automattic#571 focused only on the backends support, but adding also support for PDF and SVG backends and passing the tests. it also retain backwards compatibility with the old API, so this would be easy to merge since it's mostly to move around the PDF and SVG code and checks to independent classes. There's some code for `pdfStream` and similar methods that I think they should be moved too since they are mostly backend specific, and make more sense there. I didn't do that since it would break the API, but maybe it would be added some functions on the Canvas object that proxy the petitions to the backend to retain compatibility. I know it's a big pull-request, so I'm open for comments over it.
Any update on this one? |
This seems promising! 👍 |
I'm glad you liked it, let's hope if it gets merged soon :-) |
@piranna I couldn't get the example to work, NAN_MODULE_INIT(init) {
Backends::Initialize(target);
Canvas::Initialize(target);
Image::Initialize(target); |
You are right, I missed it :-P It doesn't matter too much since this
pull-request just prepare the backends mechanism and only offer the current
internal ones, so the current API doesn't change. When this got merged then
I'll move forward other ones from my previous pull-request to add support
for fbdev and X11, and in that case the Backends namespace will be needed.
El 27/2/2017 13:08, "Ian Metcalf" <[email protected]> escribió:
… @piranna <https://github.com/piranna> I couldn't get the example to work,
Canvas.backends was undefined. I got it to work by adding the
initialization of backends on the target object in init.cc
NAN_MODULE_INIT(init) {
Backends::Initialize(target);
Canvas::Initialize(target);
Image::Initialize(target);
https://github.com/ianmetcalf/node-canvas/blob/
27a48c6/src/init.cc#L28
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#829 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAgfvnhdeP8ctH6xnKzOIrTcBVwxaaHNks5rgrzAgaJpZM4KhqUD>
.
|
I just pointed it out since this PR includes I really appreciate the work you did abstracting the backends. I'm currently working with the FBDev backend that I extracted from your master branch. |
You are right. Since it's the new behaviour, I've added the missing namespace.
Well, I have just only updated some previous code to use it with static builds for NodeOS :-P So why are you using it? Are you using it on production? |
Any update on this? Can we merge it? |
Ping? |
Awesome work! Sorry for the long delay 🎉 |
Thank you for merging :-) |
I am a bit saddened by the fact, that there is no mention of my work on this. Just found out through coincidence, that this got merged two years after I made my first commit to my fork. |
You were mentioned in the original PR #571 |
@ReneHollander you are right, the foundational code of this pull-request is based on your work, without it I would have not been able to know how to do it, thanks :-) |
I hope now that this got merged, if static builds support gets merged too, since now Github better support pull-requests merges without need to do rebases that we could re-use the previous pull-request as a container for several of the backends, so your work would have a direct repercusion on the node-canvas code :-) |
This is a stripped-down version of pull-request #571 focused only on the
backends support, but adding also support for PDF and SVG backends and
passing the tests. it also retain backwards compatibility with the old API,
so this would be easy to merge since it's mostly to move around the PDF and
SVG code and checks to independent classes. There's some code for
pdfStream
and similar methods that I think they should be moved too sincethey are mostly backend specific, and make more sense there. I didn't do
that since it would break the API, but maybe it would be added some
functions on the Canvas object that proxy the petitions to the backend to
retain compatibility.
I know it's a big pull-request, so I'm open for comments over it.