Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Is there a way to capture just a part of the image?
Started by nosoyhackercodigo Mar 27 2019 07:02 PM

4 replies to this topic

Best Answer StarCrunch , 28 March 2019 - 01:42 PM

Can you be more specific about what you're trying to do? Is this a one-time thing, or regularly updated?

 

In the case of an image, if you know the file, its size, and such, you can just use a sprite or an image that uses a sheet. Meshes are another way to go if you need non-rectangular regions (although these use normalized--0 to 1--coordinates, rather than pixels) and / or will be changing the region in question.

 

A middle ground, if you don't need to keep your original object or can make a copy, is to draw it into a canvas and combine that with one of the previous techniques.

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

nosoyhackercodigo

[GLOBAL: userInfoPane.html]
nosoyhackercodigo
  • Enthusiast

  • 69 posts
  • Corona SDK

I want to "cut" a part of a display object (or image), and put it into another object's fill property. Is this even possible to achieve?



Give some code examples, please.

[TOPIC: post.html]
#2

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 817 posts
  • Corona SDK

  Best Answer

Can you be more specific about what you're trying to do? Is this a one-time thing, or regularly updated?

 

In the case of an image, if you know the file, its size, and such, you can just use a sprite or an image that uses a sheet. Meshes are another way to go if you need non-rectangular regions (although these use normalized--0 to 1--coordinates, rather than pixels) and / or will be changing the region in question.

 

A middle ground, if you don't need to keep your original object or can make a copy, is to draw it into a canvas and combine that with one of the previous techniques.



[TOPIC: post.html]
#3

nosoyhackercodigo

[GLOBAL: userInfoPane.html]
nosoyhackercodigo
  • Enthusiast

  • 69 posts
  • Corona SDK

I think this is just what I need.

However, what do I need to do if it's a loop-regularly updated thing? Update with timers?
Also, does moving cost as such amount of resources that better not to try it?


Thanks for fast response.

[TOPIC: post.html]
#4

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 817 posts
  • Corona SDK

Sure, timers or enterFrame.

 

There are also snapshots, which might be easier if you're just trying to do a little picture-in-picture camera or something. (Also forgot image sheet paints as an option.)

 

On that last point, is this anything like what you want? (I figured roaminggamer must have something.  :))



[TOPIC: post.html]
#5

nosoyhackercodigo

[GLOBAL: userInfoPane.html]
nosoyhackercodigo
  • Enthusiast

  • 69 posts
  • Corona SDK

Sorry for late response,

 

Is not what I was looking for but thank you anyway!




[topic_controls]
[/topic_controls]