Skip to content
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

toDataURL不支持, 但是我必须要生成图片, 怎么办呢? #152

Open
shenguanjiejie opened this issue May 3, 2020 · 4 comments
Open

Comments

@shenguanjiejie
Copy link

这是一个必备的需求吧, #38 这个问题已经被提了很久了, 但是没有人解决一下, 为什么呢?

@shenguanjiejie
Copy link
Author

shenguanjiejie commented May 3, 2020

更奇怪的是我尝试使用原生的截图, 把整个屏幕都截下来了, 但是gcanvas上面画的内容却没进去? 这是为什么啊, 真是无解了!
图片加载失败

这张是实际上我画过的签名版, 下方是使用Objective-C代码生成的截图, 里面没有画的内容...
图片加载失败

@shenguanjiejie
Copy link
Author

换了一种截图方式可以截图了,

// 这种方式不行
// [view.layer renderInContext:UIGraphicsGetCurrentContext()];
// 这种方式可以
[view drawViewHierarchyInRect:view.frame afterScreenUpdates:YES];

@jwxbond
Copy link
Contributor

jwxbond commented Sep 30, 2020

在weex架构下不去加这块逻辑了。

[view.layer renderInContext:UIGraphicsGetCurrentContext()]; 是用的CoreGraphic Context的上下文

@flyskywhy
Copy link

@shenguanjiejie , @flyskywhy/react-native-gcanvas@2.2.0 support toDataURL() with png or jpeg on Android and iOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants