{"id":37042081,"url":"https://github.com/simulation-tree/textures","last_synced_at":"2026-01-14T04:58:13.739Z","repository":{"id":299687840,"uuid":"824369264","full_name":"simulation-tree/textures","owner":"simulation-tree","description":"Images and atlases of sprites","archived":false,"fork":false,"pushed_at":"2025-09-24T03:03:39.000Z","size":94,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T05:21:15.535Z","etag":null,"topics":["csharp","dotnet","images","textures"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simulation-tree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-05T01:44:59.000Z","updated_at":"2025-09-24T03:00:38.000Z","dependencies_parsed_at":"2025-08-14T19:10:04.772Z","dependency_job_id":"450d05ea-d5c0-40d0-a139-cbcd495bbb18","html_url":"https://github.com/simulation-tree/textures","commit_stats":null,"previous_names":["simulation-tree/textures"],"tags_count":57,"template":false,"template_full_name":null,"purl":"pkg:github/simulation-tree/textures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Ftextures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Ftextures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Ftextures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Ftextures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simulation-tree","download_url":"https://codeload.github.com/simulation-tree/textures/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Ftextures/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28410001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","images","textures"],"created_at":"2026-01-14T04:58:13.140Z","updated_at":"2026-01-14T04:58:13.729Z","avatar_url":"https://github.com/simulation-tree.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Textures\n\nDefinitions for images, and for atlases with their sprites.\n\n### Importing images\n\n```cs\nTexture texture = new(world, \"*/texture.png\");\nwhile (!texture.IsCompliant)\n{\n    simulator.Broadcast(new DataUpdate()); //to load the bytes\n    simulator.Broadcast(new TextureUpdate()); //load import the texture from the bytes\n}\n\nAssert.That(texture.Width, Is.EqualTo(1024));\nAssert.That(texture.Height, Is.EqualTo(1024));\n\nReadOnlySpan\u003cPixel\u003e pixels = texture.Pixels;\nAssert.That(pixels.Length, Is.EqualTo(1024 * 1024));\n```\n\n### Evaluating pixels\n\nWhen textures are loaded, their colours can be evaluated at floating point coordinates, or exact coordinates:\n```cs\nColor color = texture.Evaluate(0.5f, 0.5f);\nPixel exactPixel = texture[512, 512];\n```\n\n### Creating atlases from inputs\n\nAn `AtlasTexture` can be created from a series of sprites, each with individual pixel data into\nthe smallest possible texture:\n```cs\nSpan\u003cAtlasTexture.InputSprite\u003e sprites = stackalloc AtlasTexture.InputSprite[1];\nAtlasTexture.InputSprite firstSprite = new(\"firstSprite\", 32, 32);\nSpan\u003cPixel\u003e firstSpritePixels = firstSprite.Pixels;\nfirstSpritePixels.Fill(new Pixel(255, 0, 0, 255));\nsprites[0] = firstSprite;\n\nAtlasTexture atlas = new(world, sprites);\nif (atlas.TryGetSprite(\"firstSprite\", out AtlasSprite sprite))\n{\n    Vector4 region = sprite.region;\n}\n\nConsole.WriteLine($\"Atlas texture size: {atlas.Width}x{atlas.Height}\");\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Ftextures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimulation-tree%2Ftextures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Ftextures/lists"}