Load issue with .tmx file - xamarin

I've got an issue when I try to load a .tmx file in a CCTileMap CocosSharp object.
Here is the code :
layer2 = new CCLayer();
CCTileMap tileMap;
tileMap = new CCTileMap("TestCCS.Droid.Assets/TileMaps/TestTile2.tmx");
layer2.AddChild(tileMap);
this.AddChild(layer2);
I tried :
tileMap = new CCTileMap("TestCCS.Droid.Assets.TileMaps.TestTile2.tmx");
or :
tileMap = new CCTileMap("Assets.TileMaps.TestTile2.tmx");
The TestTile2.tmx file build Action is set to "Embedded resource"
And this my solution explorer :
Thank you for your help.

Found a way to load the TileMap file.
The solution I found :
save the TileMap file in .xml format in Tiled software.
save the .tsx file in .xml format.
I use this code to load the tile map file :
layer2 = new CCLayer();
CCTileMap tileMap;
CCTileMapInfo mi = new CCTileMapInfo("TestTile2.xml");
tileMap = new CCTileMap(mi);
layer2.AddChild(tileMap);
this.AddChild(layer2);
Where "TestTile2.xml" is an android asset.
every tile of layers must have an Id.
I had tiles without "gid", I had to set them to a transparent gid.
Hope this will help others !

Related

GSAP Scrolltrigger Parallax Sections

I'm kind of newbie and and I'm starting to be very fascinated by GSAP animations...
I found this with the code and everything: https://codepen.io/GreenSock/pen/QWjjYEw.
My problem is that in this animation I have some random pictures, but I want to use some local images that I have instead. Any suggestion of what to change?
I'm using Vue 2 and I put already the JS in the mounted :)
Thanks in advance!
I know that I should change this part but I don't know how
section.bg.style.backgroundImage = `url(https://picsum.photos/1600/800?random=${i})`;
I tried to duplicate this
part:section.bg = section.querySelector(".bg");
with:
section.bg = section.querySelector(".bg");
section.bg = section.querySelector(".bg2")
section.bg = section.querySelector(".bg3");
and then here :
section.bg.style.backgroundImage = "url('myImagePath')";
section.bg2.style.backgroundImage = "url('myImagePath')";
section.bg3.style.backgroundImage = "url('myImagePath')";
Nothing happens...if I put the imagepath inline style on the html I lose the animation.
First, your Q not related to vue.
Next inspect your code (For errors -- your main mistake section.bg is item inside a forEach loop - the path should be related to each iteration).
One way (DRY) to change the images from random images is to get the data-attribute of each bg item inside the forEach "section" loop.
One way to solve this.
Change the path from random path:
section.bg.style.backgroundImage = `url(https://picsum.photos/1600/800?random=${i})`;
To specific one for each iteration:
/*#### NEW CODE ####*/
let image_path = section.bg.dataset.image;
// Get images path from data attribute
section.bg.style.backgroundImage = `url(${image_path})`;
Read more:
Use_data_attributes: https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
GSAP UtilityMethods: https://greensock.com/docs/v3/GSAP/UtilityMethods/toArray()
querySelector: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector

add an image to given coordinates on a PDF page

How can I add an image to given coordinates (x,y) on a PDF page, using IronPdf?
Using the samples, I managed easily to add a "stamp", but that is placed in the center of the page.
I would need to be able to pass (x,y) as parameters when adding the image to each page, and I find this info nowhere in the class documentation.
var stamper = new IronPdf.Editing.ImageStamper(Image);
pdf.ApplyStamp(stamper, pageNumber);
See code above that adds the image in the page center.
You can set HorizontalOffset and VerticalOffset by IronPdf.Editing.Length .
I wrote sample code as below, hope it helps:
var pdf = new PdfDocument("./test.pdf");
ImageStamper logoImageStamper = new ImageStamper("[YOUR IMAGE PATH]/cat.jpg");
logoImageStamper.HorizontalOffset = new Length(300, MeasurementUnit.Pixel);
logoImageStamper.VerticalOffset = new Length(-500, MeasurementUnit.Pixel);
pdf.ApplyStamp(logoImageStamper);
pdf.SaveAs("test_new.pdf");
Code running effect:

ArcGIS Runtime : SceneView load tif file not work

I want to load a tif file into SceneView, I tried the method from this, the code is as follows:
Esri.ArcGISRuntime.Geometry.Envelope pacificSouthwestEnvelope = ...;
// Create an ImageFrame with a local image file and the extent envelope
ImageFrame imageFrame = new ImageFrame(new System.Uri(TifFilePath), pacificSouthwestEnvelope);
//ImageFrame imageFrame = new ImageFrame(image, pacificSouthwestEnvelope);
// Add the ImageFrame to an ImageOverlay and set it to be 50% transparent
ImageOverlay imageOverlay = new ImageOverlay(imageFrame);
imageOverlay.Opacity = 1;
// Add the ImageOverlay to the scene view's ImageOverlay collection
MySceneView.ImageOverlays.Add(imageOverlay);
imageFrame.LoadAsync().Wait();
await MySceneView.SetViewpointAsync(new Viewpoint(imageFrame.Extent));
But it did not succeed.
Envelope's range is obtained in arcmap.
The LoadAsync() method is called to ensure that the layer has been loaded.
Finally, I set the display range of SceneView to the range of imageFrame.
But I did not see my picture on SceneView.
Then I tried to load .png and .jpg files, but they were also unsuccessful.
I don't know what's wrong with my code?
Finally, I used RasterLayer to complete the loading of the tif file.
Raster raster = new Raster(filePath);
RasterLayer rasterLayer = new RasterLayer(raster);
MySceneView.Scene.Basemap.BaseLayers.Add(rasterLayer);

Vaadin Image in a Grid not showing

I'm trying to display a tiny little image (16x16 pixels) in a TreeGrid Column.
treeGrid.addComponentColumn(i -> new Image("file://c:/temp/reddot.png", "alt")).setHeader("Preview");
In my IDE, this file url is underlined, I can click it, it opens the image in my browser. So, the file seems ok and exists.
But somehow, it does not appear in the grid column and the "alt" text doesn't appear either.
Hm. Anyone any idea what's going wrong ? Unfortunatly I don't see any error messages...
thanks,
Thorsten
PS: I'm using Version 13.
You could try to put image under META-INF/resources. Then you could reference image directly by name like this : Image im=new Image("kissa.jpg","Random picture");
Otherwise, you could create a inside and then reference mentioning also folder. In the picture below I have this set-up
And this is the output :
The whole code:
TreeGrid<Person> grid = new TreeGrid<>(Person.class);
grid.setHierarchyColumn("name");
grid.addComponentColumn(e->{
if(e.getName().equals("daughter")) {
Image im=new Image("test/cat.jpg","Random picture");
im.setWidth("200px");
im.setHeight("150px");
return im;}
else {
Image im=new Image("kissa.jpg","Random picture");
im.setWidth("200px");
im.setHeight("150px");
return im;}}).setHeader("Cat");
Person dad = new Person("dad", null);
Person son = new Person("son", dad);
Person daughter = new Person("daughter", dad);
List<Person> all = Arrays.asList(dad, son, daughter);
all.forEach(p -> grid.getTreeData().addItem(p.getParent(), p));
add(grid);
The example of TreeGrid is copied from here: Using new features with the LTS version: case TreeGrid

ActionScript 2 loadClip depth

When I use:
loader = new MovieClipLoader();
_root.createEmptyMovieClip("level1",getNextHighestDepth());
_root.level1.createEmptyMovieClip("image",getNextHighestDepth());
loader.loadClip("http://someimage.jpg",_root.level1.image);
...it works and the image shows up.
But when I use:
loader = new MovieClipLoader();
_root.createEmptyMovieClip("level1",getNextHighestDepth());
_root.level1.createEmptyMovieClip("level2",getNextHighestDepth());
_root.level1.level2.createEmptyMovieClip("image",getNextHighestDepth());
loader.loadClip("http://someimage.jpg",_root.level1.level2.image);
...the image doesn't show up. Can anyone tell me why? How can I make this work?
the depth you are supplying is going to be '1'. is that what you are expecting?
each movie clip has it's own set of depths, so the nextHighestDepth() of the newly create 'image' mc, will be 1. it should not prevent loading the image though.
As gthmb says, you should call getNextHighestDepth() on the same MovieClip as you do the createEmptyMovieClip() on. So your code example should be more like:
loader = new MovieClipLoader();
_root.createEmptyMovieClip("level1",_root.getNextHighestDepth());
_root.level1.createEmptyMovieClip("level2",_root.level1.getNextHighestDepth());
_root.level1.level2.createEmptyMovieClip("image",_root.level1.level2.getNextHighestDepth());
loader.loadClip("http://someimage.jpg",_root.level1.level2.image);
Also, I would recommend storing references to the created MovieClips, so you won't have to use the full path in each occurrence in the code, something in the lines of this:
loader = new MovieClipLoader();
var level1:MovieClip = _root.createEmptyMovieClip("level1",_root.getNextHighestDepth());
var level2:MovieClip = level1.createEmptyMovieClip("level2",level1.getNextHighestDepth());
var image:MovieClip = level2.createEmptyMovieClip("image",level2.getNextHighestDepth());
loader.loadClip("http://someimage.jpg",image);

Resources