{"id":13661469,"url":"https://github.com/ProtoTurtle/UnityBitmapDrawing","last_synced_at":"2025-04-25T02:33:10.103Z","repository":{"id":219325885,"uuid":"20693033","full_name":"ProtoTurtle/UnityBitmapDrawing","owner":"ProtoTurtle","description":"Bitmap Drawing API extension methods for Unity 3D's Texture2D class","archived":false,"fork":false,"pushed_at":"2014-06-12T21:11:39.000Z","size":230,"stargazers_count":170,"open_issues_count":2,"forks_count":33,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-10T16:44:58.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://prototurtle.com/unitybitmapdrawing/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProtoTurtle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2014-06-10T16:36:03.000Z","updated_at":"2024-10-31T13:26:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"822c6335-f457-462e-84c7-37619a70ae4f","html_url":"https://github.com/ProtoTurtle/UnityBitmapDrawing","commit_stats":null,"previous_names":["prototurtle/unitybitmapdrawing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtoTurtle%2FUnityBitmapDrawing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtoTurtle%2FUnityBitmapDrawing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtoTurtle%2FUnityBitmapDrawing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtoTurtle%2FUnityBitmapDrawing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProtoTurtle","download_url":"https://codeload.github.com/ProtoTurtle/UnityBitmapDrawing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250742082,"owners_count":21479729,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-02T05:01:35.199Z","updated_at":"2025-04-25T02:33:09.841Z","avatar_url":"https://github.com/ProtoTurtle.png","language":"C#","funding_links":[],"categories":[":space_invader: 2D \u003ca name=\"2d\"\u003e\u003c/a\u003e","C\\#","Game Development"],"sub_categories":["Unity Engine: Resources"],"readme":"UnityBitmapDrawing\n==================\n\nhttp://prototurtle.com\n\nBitmap Drawing API extension methods for Unity 3D's Texture2D class.\n\n\u003cb\u003eWhat is it?\u003c/b\u003e  \nBy default, Texture2D only provides the methods SetPixel and GetPixel (and SetPixels and GetPixels). This library extends that functionality with useful basic drawing operations. It outputs pixel perfect and not anti-aliased bitmaps.\n```csharp\ntexture.DrawLine(new Vector2(0,0), new Vector2(100,200), Color.red);\n```\n\n\u003cb\u003ex = 0, y = 0 is the top left corner\u003c/b\u003e  \nThis library uses the convention of having the left top corner of the bitmap be the 0, 0 position. By default, Texture2D uses the bottom left corner convention which can be confusing for bitmap operations.\n  \n\u003cb\u003eExtension Methods\u003c/b\u003e  \n![ScreenShot](https://raw.githubusercontent.com/ProtoTurtle/UnityBitmapDrawing/master/documentation/extensionMethods.png)  \nC# Extension Methods work in a way that adds methods to a existing class. To start using this, you only need to include the namespace:\n```\nusing ProtoTurtle.BitmapDrawing;\n```\nYour Texture2D instances will then have all the new methods available.\n\n\u003cb\u003eFeatures\u003c/b\u003e\n* DrawPixel(position, color) - Draws a pixel but with the top left corner being position (x = 0, y = 0)\n* DrawLine(start, end, color) - Draws a line between two points\n* DrawCircle(position, radius, color) - Draws a circle\n* DrawFilledCircle(position, radius, color) - Draws a circle filled with a color\n* DrawRectangle(rectangle, color) - Draws a rectangle or a square\n* DrawFilledRectangle(rectangle, color) - Draws a rectangle or a square filled with a color\n* FloodFill(position, color) - Starts a flood fill of a certaing at the point\n\n\u003cb\u003eExample\u003c/b\u003e\n```csharp\nusing ProtoTurtle.BitmapDrawing;\n\n// ...\n\nTexture2D texture = new Texture2D(1024, 1024, TextureFormat.RGB24, false, true);\ntexture.filterMode = FilterMode.Point;\ntexture.wrapMode = TextureWrapMode.Clamp;\ntexture.DrawFilledRectangle(new Rect(0, 0, TEXTURE_SIZE, TEXTURE_SIZE), Color.grey);\n\ntexture.DrawCircle(100, 100, 20, Color.green);\ntexture.DrawCircle(80, 150, 5, Color.blue);\ntexture.DrawCircle(300, 300, 200, Color.black);\ntexture.FloodFill(100, 100, Color.green);\ntexture.FloodFill(300, 300, Color.white);\ntexture.DrawLine(new Vector2(10, 10), new Vector2(400, 200), Color.magenta);\ntexture.DrawLine(new Vector2(400, 200), new Vector2(100, 200), Color.magenta);\ntexture.Apply();\n```\nOutput from this example (cropped the image to fit):  \n![ScreenShot](https://raw.githubusercontent.com/ProtoTurtle/UnityBitmapDrawing/master/documentation/output.png)\n\n\u003cb\u003eExample project\u003c/b\u003e  \nHere is a ready-to-go Unity project for easy testing.  \nhttps://github.com/ProtoTurtle/BitmapDrawingExampleProject\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProtoTurtle%2FUnityBitmapDrawing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FProtoTurtle%2FUnityBitmapDrawing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProtoTurtle%2FUnityBitmapDrawing/lists"}