简体   繁体   English

给定一组向量(x / y坐标),我如何将其转换为PNG文件(android canvas缺陷)?

[英]given a set of vectors (x/y coordinates ), how do i make that into a PNG file (android canvas deficiency)?

I am writing a javascript app that uses the canvas tag. 我正在编写一个使用canvas标签的javascript应用。 It seems that android prior to 3.0 has no support for the toDataURL() method. 似乎Android 3.0之前的版本不支持toDataURL()方法。 This basically means that you can't save the canvas to an image. 这基本上意味着您无法将画布保存到图像。 I'd like to fake this functionality. 我想伪造此功能。 Currently, I wrote some routines to save the vector coordinates so i have a set like this: 目前,我编写了一些例程来保存矢量坐标,因此我有一个这样的集合:

moveTo,1,1 lineTo,1,10 lineTo,40,50 moveTo,100,200 lineTo,1,1 moveTo,1,1 lineTo,1,10 lineTo,40,50 moveTo,100,200 lineTo,1,1

this is enough to reproduce the drawn canvas, however, I'd like to actually output a png file. 这足以再现绘制的画布,但是,我想实际输出一个png文件。

1 - how do I convert vectors to a bitmap 2 - how do I make that into a png 3 - how do I do this all in javascript :) 1-如何将向量转换为位图2-如何将其转换为png 3-如何在javascript中完成所有操作:)

I've got the same problem and came across this (JavaScript) code that will convert a canvas to a BMP, not using the native .toDataURL 我遇到了同样的问题,并且遇到了此(JavaScript)代码,该代码会将画布转换为BMP,而不使用原生的.toDataURL

http://devpro.it/code/216.html http://devpro.it/code/216.html

Another possibility I'm entertaining is building the image on the server from instructions (similar to your approach, but bypassing JavaScript) 我正在娱乐的另一种可能性是根据指令在服务器上构建映像(类似于您的方法,但是绕过了JavaScript)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM