{"id":18675537,"url":"https://github.com/bithatch/jdraw","last_synced_at":"2025-11-07T05:30:42.286Z","repository":{"id":57743615,"uuid":"320829536","full_name":"bithatch/jdraw","owner":"bithatch","description":"Very basic, toolkit agnostic Java drawing API","archived":false,"fork":false,"pushed_at":"2020-12-12T22:33:28.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T20:35:00.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/bithatch.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}},"created_at":"2020-12-12T12:49:05.000Z","updated_at":"2020-12-12T22:33:30.000Z","dependencies_parsed_at":"2022-08-26T01:43:20.686Z","dependency_job_id":null,"html_url":"https://github.com/bithatch/jdraw","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithatch%2Fjdraw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithatch%2Fjdraw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithatch%2Fjdraw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithatch%2Fjdraw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bithatch","download_url":"https://codeload.github.com/bithatch/jdraw/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239520206,"owners_count":19652649,"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-11-07T09:25:20.986Z","updated_at":"2025-11-07T05:30:42.255Z","avatar_url":"https://github.com/bithatch.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JDraw\n\nA very simple, no-dependencies drawing API for Java, providing some primitive operations including lines, rectangles, circles, ellipses and arcs. \n\nIt doesn't actually draw TO anything, you must provide your own implementation of `Backing` to actually paint the pixels. \n\nThis project is intended for use with Snake, my project for Razer devices on Linux, but is made available in case others may find it useful. \n\nIt doesn't have anything fancy like anti-alias, transformations or even line widths, and there are currently no plans to develop it any further, but contributions are of course welcome!\n\n## Dependencies\n\nNo dependencies other than Java itself.\n\n## Configuring your project\n\nThe library is available in Maven Central.\n\n### Maven\n\n```xml\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003euk.co.bithatch\u003c/groupId\u003e\n\t\t\u003cartifactId\u003ejdraw\u003c/artifactId\u003e\n\t\t\u003cversion\u003e1.0\u003c/version\u003e\n\t\u003c/dependency\u003e\n```\n\nDevelopment versions (whem available), will be the next version number, suffixed with -SNAPSHOT).\n\n```xml\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003euk.co.bithatch\u003c/groupId\u003e\n\t\t\u003cartifactId\u003ejdraw\u003c/artifactId\u003e\n\t\t\u003cversion\u003e1.1-SNAPSHOT\u003c/version\u003e\n\t\u003c/dependency\u003e\n```\n\n## Usage\n\nTo add to your own project, first you need an implementation of `Backing`. For example, if you wanted to draw on a `BufferedImage`, you would do the following. \n\n**Note this is a pointless example really, as BufferedImage can be drawn on with Java's own Graphics API, but it is a quick way to get some useful output from JDraw**.\n\n```java\n\npublic class MyBacking implements Backing {\n\n\tpublic BufferedImage img;\n\n\tpublic \tMyBacking() {\n\t\timg = new BufferedImage(512, 512, BufferedImage.TYPE_INT_ARGB);\n\t}\n\n\t@Override\n\tpublic int getWidth() {\n\t\treturn img.getWidth();\n\t}\n\n\t@Override\n\tpublic int getHeight() {\n\t\treturn img.getHeight();\n\t}\n\n\t@Override\n\tpublic void plot(int x, int y, int[] rgb) {\n\t\tbimg.setRGB(x, y, (0xff \u003c\u003c 24) | (rgb[0] \u003c\u003c 16) | (rgb[1] \u003c\u003c 8) | (rgb[2]));\n\t\tdraw.repaint();\n\t}\n}\n```\n\nNow you have a `Backing` implementation, you can draw on it using JDraw. The following will draw  a 100x100 red rectangle at 10, 10.\n\n```java\n\tMyBacking backing = new MyBacking();\n\tRGBCanvas canvas = new RGBCanvas(backing);\n\t\n\tcanvas.setColour(RGBCanvas.RED);\n\tcanvas.fillRect(10, 10, 100, 100);\n\t\n\t// Now do something useful with your drawing, for example save it as a PNG..\n\tImageIO.write(backing.img, \"png\", new File(\"my-image.png\"));\n\t\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbithatch%2Fjdraw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbithatch%2Fjdraw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbithatch%2Fjdraw/lists"}