Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Creating Facebook app for Android - quesiton
Started by WarrenW Oct 31 2012 10:18 AM

- - - - -
72 replies to this topic
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

mpappas

[GLOBAL: userInfoPane.html]
mpappas
  • Contributor

  • 527 posts
  • Enterprise

I'm saving a group as well, and with a mask (next thing ya know, you'll be saying you're using a mask)...

Seems there's a lot in common between our saving...

I'm not saving a lot of objects (just an image and a watermark in the group) so I am changing the captured images width/height directly, and adjusting the watermark font size / x/y coords in the group based on actual device pixel screen cap size dimensions. I think you can adjust the groups xscale and yscale, but not its width and height... If you scale the group (which would scale all the objects in it), not sure how that will pan out/look for scaling it up... The images might look blurry... (but downscaling should be ok)

I'm afraid text on a blog is not the best way to convey what you're about to go through regarding this scaling... And when you get to the clipping (for odd shaped devices) you're going to have to zag -- instead of zig... But it sounds like you're on the right track :)

So -- You'll have to mess around with it a bit to find out some of the tricks to get everything nice and crisp looking, uploading / downloading nice and fast, and eliminate any other sources of distortion on different resolutions....
uid: 79933 topic_id: 32551 reply_id: 131693


[TOPIC: post.html]
#52

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

Awesome, well I appreciate your tips and thoughts, I will give it a try tomorrow! I'll make sure to let you know how it goes, thanks again!
uid: 19620 topic_id: 32551 reply_id: 131694


[TOPIC: post.html]
#53

mpappas

[GLOBAL: userInfoPane.html]
mpappas
  • Contributor

  • 527 posts
  • Enterprise

Best of luck.

Note for rxm for later: Pssstttttt... You're gonna need a mask on the group for that.
uid: 79933 topic_id: 32551 reply_id: 131695


[TOPIC: post.html]
#54

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

rxmarccall,

If you are only interested in capturing a particular region of the screen, then it would be easier to use our
display.captureBounds()
function.
http://docs.coronalabs.com/api/library/display/captureBounds.html
uid: 32256 topic_id: 32551 reply_id: 131787


[TOPIC: post.html]
#55

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

Yea only issue is that display.captureBounds() cannot save the captured graphic as a file right? it only puts it back on the stage as a display object? I guess then I could maybe do display.save() on the captureBound display object?
uid: 19620 topic_id: 32551 reply_id: 131789


[TOPIC: post.html]
#56

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Yes, you are right. You would have to call display.save() on the object right afterwards and then remove it.
uid: 32256 topic_id: 32551 reply_id: 131791


[TOPIC: post.html]
#57

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

Hmm so maybe I can jimmy rig this by capturing the screen, resizing it to make sure its in the right aspect ratio so corona doesn't screw the image up and then do a display.save() of the display object. Ill give that a try later tonight when I get home.
uid: 19620 topic_id: 32551 reply_id: 131793


[TOPIC: post.html]
#58

mpappas

[GLOBAL: userInfoPane.html]
mpappas
  • Contributor

  • 527 posts
  • Enterprise

I think Joshua is not offering that up as a solution per se, but just something else to think about / look at, in case it could be helpful.

If you do use captureBounds(), you'll still have the capture occurring in device pixels... (requiring the transformation I described to get to your target image size). And you mentioned corona screwing up the aspect ratio... Corona is not screwing it up... You've got a little more to understand....

Devices with square screens tend to take square pictures. Devices with tall screens tend to take rectangular pictures. This is not coronas fault. The fact that the s3 takes a picture that is not 2:3 aspect ratio, but you chose that for your app is not coronas fault.... At some point, perhaps after you can save your pictures reliably at a consistent size, you're going to have to figure out what you want to do to wrangle different device image shapes into your 2:3 app aspect ratio.... But first things first...

One way or another, you should probably shoot for getting your saved images to consistently save at your target pixel size (on widely differing devices). Once you've got that straight, you should be able to see the light at the end of the tunnel.
uid: 79933 topic_id: 32551 reply_id: 131795


[TOPIC: post.html]
#59

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

@mpappas,
I understand that you probably are annoyed that I "blame corona", but there is nothing wrong with pointing out that this is a feature that does not "Universally" work. Corona exists to be a SDK that promotes that "We can let you code once and it will work for both IOS and Android!" I understand that we can run into issues here and there as Corona is growing and thats fine. Again I appreciate your help and insight into this, going to hopefully get started on trying a lot of your ideas tonight. thanks again!
uid: 19620 topic_id: 32551 reply_id: 131801


[TOPIC: post.html]
#60

mpappas

[GLOBAL: userInfoPane.html]
mpappas
  • Contributor

  • 527 posts
  • Enterprise

I coded it once, and it runs on both iOS and Android. display.capture works as advertised.

If you put a circle in the middle of the screen and capture/save it, it will save it correctly (and it will appear circular on various devices).

If your code puts images on the screen that are skewed (because your code is squashing a 720x1280 image into 320x480 space), it will save it, exactly as it appears on the screen.... skewed. (GIGO)

On all platforms, universally, just as advertised. (I'm actually annoyed that you still think it's a corona bug, and you still don't understand what's really going on.... I don't think you are going to make it to point B, if you keep believing it's a corona bug)
uid: 79933 topic_id: 32551 reply_id: 131805


[TOPIC: post.html]
#61

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

First of all @Joshua Quick on the first page of this thread has said that THIS IS A BUG. Second of all, I am not squashing my images at all. I am using the "Letterbox" configuration, so my large images are going off the screen for different devices. My app displays my images perfectly on all devices because of this setup. But display.save() gives me issues. That's fine if you don't think its a bug, doesn't "bug" me ;)
uid: 19620 topic_id: 32551 reply_id: 131809


[TOPIC: post.html]
#62

mpappas

[GLOBAL: userInfoPane.html]
mpappas
  • Contributor

  • 527 posts
  • Enterprise

I'm using letterbox too. Compensating for the device pixels. Compensating for devices taking different shaped images. Works perfectly. If I were Joshua, I wouldn't look much further than checking the displayed image size (which happens to be a camera image in this case, but isn't necessarily) compared to the content size it is displayed on for capturing....

I'd be curious as to when they fix this (non) bug, what would you expect corona to do with your extra 200 pixels?

They could chop off the ends of the picture (the 200 pixels, 100 on eaqch long end) to fit your format... Or they could make the 1280 side fit to you 480 dimension, but then the 320 wont quite fill the 720 real width... So they would presumably leave black bars...

Seriously though, good luck. (Maybe Corona will add a flag or something to capture in content pixels but your corona text wouldn't look as crisp in captured images... alternatively, they could add a flag to the camera capture, to format/clip the image to the content space/aspect)
uid: 79933 topic_id: 32551 reply_id: 131815


[TOPIC: post.html]
#63

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

Thats the whole point, display.save() says it will capture the screen at the devices resolution and save it to a file. So thats exactly what it should do, end of story. Why should I not be able to simply call display.save() and have a non screwed up image saved to the device? Also Joshua already seems to have a very good idea of the issue if you read his post on the last page. Anyways thanks again, I don't have time to sit and argue on these forums, I really do appreciate the ideas you have presented.
uid: 19620 topic_id: 32551 reply_id: 131817


[TOPIC: post.html]
#64

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

rxmarccall,

Have you sent us a bug report about this with a project that reproduces this behavior?
If so, can you post what the bug # is please?

If the captured image is coming out "skewed", then I've only heard of one other person that has ran into this issue, which was only happening to him on one particular device. It sounded very device specific and perhaps you might have that same or similar device. Other than that, we rarely receive tech-support issues about screen captures at this point because it does work for the vast majority of Corona developers. This may just be a rare edge case that we need to take care of on our end, so whatever info you can send us via that bug report would be most helpful. Sending us an example of the screwed up screen shot would be helpful as well. Thanks!
uid: 32256 topic_id: 32551 reply_id: 131857


[TOPIC: post.html]
#65

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

@Joshua,
Yes I submitted it about 2 weeks ago, the case number is "Case 18621". I attached a demo project showing the issue. If you need the demo project again let me know. Here is what the skewed image looks like for example: ( Sorry its huge, but I thought I would leave it at original size that the app is capturing it.

Photobucket
uid: 19620 topic_id: 32551 reply_id: 131859


[TOPIC: post.html]
#66

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I see. Your image is skewed too. This does look like a "stride" issue, as in the pixels in every row of an image needs to be a multiple of 4 pixels, or else the GPU will wrongly shift the top row's pixels to the next row's pixels in the image. Most likely an issue with only particular GPUs. Yeah, we'll have to fix this issue on our end. Thanks for following up on this.
uid: 32256 topic_id: 32551 reply_id: 131864


[TOPIC: post.html]
#67

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

No problem just happy that you guys know about it and can look into it. Let me know, thanks!
uid: 19620 topic_id: 32551 reply_id: 131866


[TOPIC: post.html]
#68

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

@Joshua
Has there been any progress or resolution to the above mentioned display.save issue? Its been a very long time now and I have not heard anything.
uid: 19620 topic_id: 32551 reply_id: 141150


[TOPIC: post.html]
#69

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

No. We haven't had time to work on this yet.
uid: 32256 topic_id: 32551 reply_id: 141237


[TOPIC: post.html]
#70

ymmtny

[GLOBAL: userInfoPane.html]
ymmtny
  • Enthusiast

  • 30 posts
  • Corona SDK

the stride issue is reproducible with the following devices too
they are using GPU Adreno 200/320. Please look into it as soon as possible.
I am involved in a commercial project which display.save is an important feature and encountered the stride problem while beta testing.

IS04
http://android-data.blogspot.jp/2011/05/is04.html

Optimus G LGL21
http://gadgetian.com/42720/japans-kddi-announces-lg-optimus-g-in-white-blue-coming-november-2/
uid: 190 topic_id: 32551 reply_id: 145033


[TOPIC: post.html]
#71

ymmtny

[GLOBAL: userInfoPane.html]
ymmtny
  • Enthusiast

  • 30 posts
  • Corona SDK

the stride issue is reproducible with the following devices too
they are using GPU Adreno 200/320. Please look into it as soon as possible.
I am involved in a commercial project which display.save is an important feature and encountered the stride problem while beta testing.

IS04
http://android-data.blogspot.jp/2011/05/is04.html

Optimus G LGL21
http://gadgetian.com/42720/japans-kddi-announces-lg-optimus-g-in-white-blue-coming-november-2/
uid: 190 topic_id: 32551 reply_id: 145033


[TOPIC: post.html]
#72

Perry Clarke

[GLOBAL: userInfoPane.html]
Perry Clarke
  • Moderator

  • 850 posts
  • Corona Staff

This is something we hope to address properly with Graphics 2.0 (it's hard to be definitive about subtle differences between GPUs).  In the meantime, I was able to work around the issue on the HTC One (the only device I have that reproduces the problem) by adjusting the size of the object group slightly when taking the capture.

 

Like so:

objectGroup.width = objectGroup.width - 2
display.save( objectGroup, "screenshot.jpg" )
objectGroup.width = objectGroup.width + 2

In the test case we were given, subtracting 2 makes the width of the display group divisible by 4 and thus avoids the stride issue.  It's not a perfect solution but with the emailed screenshots that were being generated using it the image was not noticeably affected.  The width adjustment didn't affect the devices that didn't have the problem in the first place.

 

I understand that this isn't a real fix but hopefully it will unblock people for now.



[TOPIC: post.html]
#73

rxmarccall

[GLOBAL: userInfoPane.html]
rxmarccall
  • Contributor

  • 751 posts
  • Corona SDK

@Perry, unfortunately that was not a solution for me.  Still has a skewed image on my Galaxy S3.




[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]