Taking screenshot with custom coordinates - libgdx

I am working on a libgdx project. I have to take screenshot but not all the screen, only specific area of the screen. This area can be bigger than screen size. How can I do that?

You can zoom out your camera, position it were you want it, take screenshot, zoom back in and set the position back. The player won't see this.
If that doesn't work, render one frame with the zoomed out camera, take screenshot and then zoom back in. The player will only see a 'flash'.
Or just make some sort of animation, where you zoom out and back in.

Related

Showing large image at original size on mobile devices

I have a very high resolution 'cartoon' road map with a number of locations also drawn on. Users can click on locations drawn on the map to navigate to related pages.
The map is not drawn to scale at all hence I decided to map co-ordinates on the image to create the required links rather than as a GMaps overlay or similar. This works assuming the user has a desktop which shows the image to the full width of a PC monitor, but I'm struggling with how to serve such a high resolution (approx 4000px x 3000px) image in a way which is intuitive for mobile users to navigate and still be able to see sufficient detail (ie. showing the map at original size but with perhaps pinch/drag functionality similar to an actual GMap). Any suggestions?

Preloading ArcGISDynamicMapServiceLayer on pan

When I pan the map with the mouse, I want the visible layers to update (before I release the mouse). Ideally, it would actually be preloaded, like the basemaps, so that you don't have to see the unloaded edge of the layers.
Example: Say I have a layer which is a solid red block over the entire map. When I pan, the screen moves so that you see that the red layer doesn't extend to infinity; it's actually covering only the viewport. It now appears as a rectangle which is moving around the screen as you pan, until you release. I want the user to be able to pan and only ever see red. This is a contrived example, but it's the functionality I want.
What doesn't work: I have already tried running a layer.refresh() command on the map's pan event. That won't work until after you release the mouse.
Well, As I am understanding above requirement. you want to add a layer on the ESRI map; which will refresh every time you pan or zoom.
In this case no need to add the layer as ArcGISDynamicMapServiceLayer. Simply add the layer as a feature layer in ondemand mode.
To know about feature layer and its mode please click here...
As we know it request to update layer automatically whenever you change extent of the map.
Hoping I gave you the hint which you are looking for... :)

Resizing KineticJS stage

I created markers with custom html for my bing map (doesn't matter if is was google maps). The new marker contains kinetic js stage that contains layers interactive to the user. everything is working just fine except that now I want to resize my marker when my map zooms out or in. I want to give my marker max and min sizes and it should change it's size when map is zoomed in or out.
I'm not getting any idea how I can resize my kineticjs canvas.
If I'm understanding correctly, you should be able to handle that by simply changing the scale of the stage.
stage.scale({x: newXScale, y: newYScale})
http://kineticjs.com/docs/Kinetic.Stage.html#scale

How to do image zoom out and zoom in with cursor attribute?

I have a scenario of opening an image in a new window. There i need to add zoom in and zoom out option for the images which are all big.
Here is one example.
I want to know, how they are doing zoom in and zoom out.
Thanks!
It's just an image, there's no magic. Any zoom function you may see there is a feature of your browser.
if you want to do a "custom" zoom in/out, you could use some JS to set the zoom css prop i.e.:
http://www.jsfiddle.net/steweb/65FH5/

Can I draw lines on top of an "gif" image using the <canvas> function?

I'm having difficulty drawing lines on top of an uploaded "map.gif" image.
Basically I've upload a small outline map and use the "area" function to create defined areas (cities, roads, etc). When I click on a city a snall pop up gets displayed with the word "hey, you've just click on Dallas" (or where ever). All that works just fine.
My problem is that my map is actually just a blank outline with no actual cities or roads drawn on it.
Therefore I tried using the "canvas" function to draw the cities (circles) and roads (lines).
The only problem is that they appear below the map rather than on top of it.
Any ideas as to how I can get the lines to appear on the map?
Many thanks,
Pete
You might just have to try playing with the CSS z-index values of the image and canvas.
Do make sure you set the canvas to be transparent.
An other possibility is to replace the image with the canvas (or just load the image in the canvas to begin with).
For some hints on how to use images with canvas take a look here.
I would load the gif directly in the canvas memory, and then do all the rest inside the canvas itself.
The gif is not animated, right?
Some reference about loading: https://developer.mozilla.org/en/Canvas_tutorial/Using_images