Sie sind nicht angemeldet.

1

Montag, 7. Januar 2019, 02:58

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

Montag, 7. Januar 2019, 17:47

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

3

Sonntag, 13. Januar 2019, 04:54

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]

here is the link for the sample

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


and here is the xml


Also when i change from canvas to jpeg or png i only get a with box
»jvh« hat folgende Datei angehängt:
  • pixartag.xml (21,14 kB - 3 mal heruntergeladen - zuletzt: 14. Januar 2019, 12:23)

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »jvh« (14. Januar 2019, 01:00)


Beiträge: 721

Wohnort: Angers - France

Beruf: Photographer

  • Nachricht senden

4

Sonntag, 13. Januar 2019, 11:14

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 ;)