Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

Surface vs workspace #96

Closed
st0ffern opened this issue Jul 6, 2016 · 8 comments
Closed

Surface vs workspace #96

st0ffern opened this issue Jul 6, 2016 · 8 comments

Comments

@st0ffern
Copy link

st0ffern commented Jul 6, 2016

Hi,

Would it be possible to set a surface size and a workspace size?
So in a captureFrame the size will be according to the workspace and not the surface space?

Some mobiles have smaller screens and if you capture depending on some device-widths the capture result will be different on the devices. (tested on Android not iOS)

Example:

<Surface height={300} width={300} workspace={{width: 600, height: 600}} resizeMode="cover">
 ...
</Surface>

@gre would this be possible? :)

@gre
Copy link
Owner

gre commented Jul 13, 2016

Sounds like you could use ImageEditor to resize the image after screenshot?
https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageEditor.js

That said, I think eventually we will have this: https://github.com/ProjectSeptemberInc/gl-react/issues/57

so you could basically have this:

<Surface width={displayWidth} height={displayHeight}>
  <GL.Node width={glWidth} height={glHeight} ... />
</Surface>

with a way to screenshot the internal GL.Node (probably with ref, need to think more about this)

so you could have a constant gl size with a variable display size that way.

@st0ffern
Copy link
Author

@gre thanks for the answer. ImageEditor can not be used in this case as it would have to upscale the image.
Assigning refs to the GL.Nodes and then giving them a captureFrame function would be nice.
ProjectSeptemberInc/gl-react#57 does cover it i guess 👍

@gre
Copy link
Owner

gre commented Jul 13, 2016

ok cool. we'll focus on ProjectSeptemberInc/gl-react#57 in next features to come

@gre gre closed this as completed Jul 13, 2016
@kesha-antonov
Copy link
Contributor

Hello guys! @Stoffern @gre
Can you clarify - is it possible to capture effected image with "custom dimensions" and not dimensions of the Surface?

@st0ffern
Copy link
Author

st0ffern commented Mar 31, 2017

@kesha-antonov as for now i dont think so. @gre is working on gl-react v3 that is made for Exponent and not pure react-native... as it uses the GLView of Exponent.

The issue https://github.com/ProjectSeptemberInc/gl-react/issues/57 as you no longer can see was a list of fixes to get the function you want.
Capture different layers and also capture in different dimensions.

@gre Why not open up tickets on the gl-react again, and let community help develop it futher as not everyone will and want to use Exponent 😉

@gre
Copy link
Owner

gre commented Mar 31, 2017

@Stoffern the repo and its issues have moved to https://github.com/gre/gl-react so the issue you mentioned is still in gre/gl-react#57 and has been addressed in the v3.

The repos https://github.com/ProjectSeptemberInc/gl-react and https://github.com/ProjectSeptemberInc/gl-react-native only exists to track the v2. the v3 is on https://github.com/gre/gl-react – it's a single repo for all the libs.

as not everyone will and want to use Exponent 😉

actually the current gl-react-native@next (v3) is available, still in alpha but works and have textures working too. so it's not true anymore you need Exponent to run it. There are both gl-react-native and gl-react-expo implementations available.

@superandrew213
Copy link
Contributor

@kesha-antonov you can use pixelRatio if you want an image bigger than the surface and use react-native-image-resizer to adjust it further.

@kesha-antonov
Copy link
Contributor

Thank you, guys!
Will look at "v3"

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

No branches or pull requests

4 participants