You are not logged in.

jvh

Beginner

  • "jvh" started this thread

Posts: 9

Location: Mexico

  • Send private message

1

Monday, January 7th 2019, 2:58am

Makescreenshot

Hello

Im trying to capture part of the screen as new image to download, the example Makescreenshot api works for all the screen but i need just the part that is in frame


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
		// add a 'makescreenshot' action to krpano		krpano.makescreenshot = function()		{			// if there is already a screenshot layer, remove it now			krpano.call("removelayer(screenshot,true)");
			var otherKRPano = document.getElementById("krpanoSWFObject");
			var query = "layer[imageCamera]";    		var myHotspot = otherKRPano.get(query);
			var imgLayerW = myHotspot.DATA.width;			var imgLayerH = myHotspot.DATA.height;			var imgLayerX = myHotspot.DATA.x;			var imgLayerY = myHotspot.DATA.y;
			//krpano.call("set(layer[introimage].visible,false)");
			// create an empty Object as makeScreenshot cache			krpano.makeScreenshotCache = {};
			// make a screenshot as canvas			var sizeinfo = {w:imgLayerW, h:imgLayerH};			var screenshotcanvas = krpano.webGL.makeScreenshot(imgLayerX, imgLayerY, true, "canvas",0, null, sizeinfo, krpano.makeScreenshotCache);
	     	img = new Image();			img.src = screenshotcanvas.toDataURL();
			var ctx = screenshotcanvas.getContext("2d");
			if (screenshotcanvas)			{				// example - draw something on the canvas				if (0)				{					var ctx = screenshotcanvas.getContext("2d");				}

				// add some krpano layers that show the screenshot and allow saving it				var container = krpano.addlayer("screenshot");				container.type = "container";				container.align="center";				container.registercontentsize(sizeinfo.w, sizeinfo.h);				// container.width  = sizeinfo.w > sizeinfo.h ? "70%" : "prop";				// container.height = sizeinfo.w > sizeinfo.h ? "prop" : "70%";				container.width  = imgLayerW;				container.height = imgLayerH;				container.bgcolor = 0xFFFFFF;				container.bgalpha = 0.0;				container.bgshadow = "0 5 40 0x000000 0.0";				container.bgroundedge = 1;				container.bgcapture = true;				container.zorder = 99;				container.onclick = "set(enabled,false);tween(alpha,0,0.2,default,removelayer(get(name),true));";				container.onover = "tween(layer[screenshotsaveasbutton].alpha,1,0.2)";				container.onout = "tween(layer[screenshotsaveasbutton].alpha,0,0.2)";
				var image = krpano.addlayer("screenshotimage");				image.url = screenshotcanvas.toDataURL();				image.parent = "screenshot";				image.align = "center";				image.width = -10;				image.height = -10;				image.zorder = 1;				image.enabled = false;

2

Monday, January 7th 2019, 5:47pm

Hi,

see here the 'crop' parameter - with it you can crop/cut-out a part of the screen:
https://krpano.com/docu/plugininterface/….makeScreenshot

Best regards,
Klaus

jvh

Beginner

  • "jvh" started this thread

Posts: 9

Location: Mexico

  • Send private message

3

Sunday, January 13th 2019, 4:54am

Hi Klaus

I want to capture part of the pano for the crop parameter but I can't obtain the x and y position for the crop that is with layer[imagecamera]


Also when i change from canvas to jpeg or png i only get a with box

This post has been edited 3 times, last edit by "jvh" (Mar 1st 2019, 1:30am)


jeromebg

Professional

Posts: 727

Location: Angers - France

Occupation: Photographer

  • Send private message

4

Sunday, January 13th 2019, 11:14am

here is the link for the sample

https://pixartag.com/IntegracionJVH/tour.html


Hi, why are you trying to reproduce exactly my snapshot UI ???
You can make your snapshot plugin but please design your own plugin UI ;)

jvh

Beginner

  • "jvh" started this thread

Posts: 9

Location: Mexico

  • Send private message

5

Sunday, January 20th 2019, 7:05am

I will not reproduce your UI, but first i need to solve the technical part for all my needs and then i will design the UI, can you help me with my question? *smile*

jeromebg

Professional

Posts: 727

Location: Angers - France

Occupation: Photographer

  • Send private message

6

Sunday, January 20th 2019, 11:37am

I will not reproduce your UI, but first i need to solve the technical part for all my needs and then i will design the UI, can you help me with my question? *smile*

https://krpano.com/plugins/userplugins/snapshot/#top *whistling*

jordi

Intermediate

Posts: 426

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

7

Sunday, January 20th 2019, 8:08pm

I want to capture part of the pano for the crop parameter but I can't obtain the x and y position for the crop that is with layer[imagecamera]


Check that action to get the layer position in the screen

https://krpano.com/docu/actions/#layertoscreen

Did not check both UI s but as Jerome says copying exactly that UI should be avoided.
everpano.com smart virtual tours