{"id":16937380,"url":"https://github.com/yageek/codekit","last_synced_at":"2026-04-24T12:34:02.849Z","repository":{"id":97889749,"uuid":"551650961","full_name":"yageek/codekit","owner":"yageek","description":"|||❚|❚|| Create 1D barcode for mobile native and WebAssembly using Rust :crab:","archived":false,"fork":false,"pushed_at":"2024-01-05T14:05:24.000Z","size":69756,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T06:28:06.152Z","etag":null,"topics":["android","barcode","ffi","ios","mobile-multiplatform","rust","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/yageek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-10-14T20:23:50.000Z","updated_at":"2024-03-27T06:52:25.000Z","dependencies_parsed_at":"2024-01-16T01:47:04.620Z","dependency_job_id":null,"html_url":"https://github.com/yageek/codekit","commit_stats":{"total_commits":48,"total_committers":1,"mean_commits":48.0,"dds":0.0,"last_synced_commit":"0cd5bd866ffbfd18078f42dcd996dc1f75a7691a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yageek/codekit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yageek%2Fcodekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yageek%2Fcodekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yageek%2Fcodekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yageek%2Fcodekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yageek","download_url":"https://codeload.github.com/yageek/codekit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yageek%2Fcodekit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32224182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["android","barcode","ffi","ios","mobile-multiplatform","rust","webassembly"],"created_at":"2024-10-13T20:59:25.811Z","updated_at":"2026-04-24T12:34:02.828Z","avatar_url":"https://github.com/yageek.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeKit\n\nA toolkit to generate 1D bar code. The generation logic is done on Rust and then wrapped into\ndifferent platforms/language using FFI or JNI.\n\nYou can generate the following types of codes:\n\n- EAN8\n- EAN13\n- Code39\n- Code93\n- Codabar\n\nThe supported platform:\n\n- iOS/macOS\n- Android\n\n## iOS/macOS\n\nA xcframework and docc module are provided. See the releases page to download them.\n\n## Install\n\nDownload the release asset from the release page or use SPM to add that dependencies to your SPM project:\n\n```swift\n.package(url: \"https://github.com/yageek/codekit.git\", from: \"1.0.0\")\n```\n\n### Register the filters\n\nThe first step is to register the filters into the system. On iOS, best ways would probably be\nin the applications delegate.\n\nIn objective-c:\n\n```objc\n#import\u003cCodeKit/CodeKit.h\u003e\n\n/// Registering the filters\n[[RCKCodeKit sharedInstance] registerFilters];\n```\n\nIn swift:\n\n```swift\nimport CodeKit\n\n/// Registering the filters\nRCKCodeKit.shared.registerFilters()\n```\n\n### Using a filter\n\nFor every filter, you can either use the safe API or the dynamic API.\n\n### Safe API\n\nSee the different methods and protocol\n\n- `RCKCodeGenerator`\n- `RCKCodeKit/ean8GeneratorFilter`\n- `RCKCodeKit/ean13GeneratorFilter`\n- `RCKCodeKit/code39GeneratorFilter`\n- `RCKCodeKit/code93GeneratorFilter`\n- `RCKCodeKit/codabarGeneratorFilter`\n- `RCKCodeKit/i2of5GeneratorFilter`\n\nAs an example, let's create a Code39 code:\n\n```objc\nCIFilter\u003cRCKCodeGenerator\u003e *filter = [RCKCodeKit code93GeneratorFilter];\nfilter.codeValue = @\"TEST93\";\nCIImage *image = filter.outputImage;\n```\n\n```swift\nlet filter = RCKCodeKit.code93Generator()\nfilter.codeValue = \"TEST93\"\nlet image = filter.outputImage\n```\n\n### Dynamic API\n\nThe filters can be used using the standard CoreImage filter system.\nThe name of the different filters are:\n\n- `RCKEAN8CodeGenerator`\n- `RCKEAN13CodeGenerator`\n- `RCKCode39CodeGenerator`\n- `RCKICode93odeGenerator`\n- `RCKI2of5CodeGenerator`\n\nEach of this filter has the following properties as float elements to configure the shape\nof the code:\n\n- `borderWidth`: The border of the code. Defaults to 0.\n- `quietSpace`: The quiet space of the code. Default to 7.\n- `barCodeHeight`: The bar code height. Default to 50.\n\nTo setup the value of the code, use the string parameter `codeValue`.\n\nAs an example, let's create a Code39 code:\n\n```objc\nCIFilter *filter = [CIFilter filterWithName:@\"RCKCode93CodeGenerator\"];\n[filter setValue:@\"TEST93\" forKey:@\"codeValue\"];\n\nCIImage *image = filter.outputImage;\n```\n\n### Render to an UIImage\n\nAs we are using classic CoreImage filters, we can generate a `UIImage` using\nthe regular API:\n\n```objc\nCIFilter\u003cRCKCodeGenerator\u003e *filter = [RCKCodeKit code93GeneratorFilter];\nfilter.codeValue = @\"TEST93\";\nCIImage *image = filter.outputImage;\nCGFloat scaleX = CGRectGetWidth(self.imageView.frame)/CGRectGetWidth(image.extent);\nCGAffineTransform tr = CGAffineTransformScale(CGAffineTransformIdentity, scaleX, scaleX);\nCIImage *scaled = [image imageByApplyingTransform:tr];\nUIImage *uiImage = [UIImage imageWithCIImage:scaled];\nself.imageView.image = uiImage;\n```\n\n### Android\n\nYou can use gradle/mvn to retrieve the package from [Github Package](https://github.com/yageek/codekit/packages/)\n\nA android AAR element is provided also in the release page.\n\nThe library contains functions to create a string of bars (0/1) from a java string\nand one function to create a bitmap from those strings.\n\nThe available methods are the following:\n\n```java\n// Methods to generate a string of bars\npublic native static String makeEAN8(String code) throws IOException;\npublic native static String makeEAN13(String code) throws IOException;\npublic native static String makeCodabar(String code) throws IOException;\npublic native static String makeCode39(String code) throws IOException;\npublic native static String makeCode93(String code) throws IOException;\npublic native static String makeI2Of5(String code) throws IOException;\n\n// Method to generate a bitmap from a string of bar\npublic static Bitmap convertBitmap(String descriptor, CodeOptions options)\n```\n\nA basic usage could be done as the following:\n\n```java\nimport net.yageek.codekit.CodeKit;\nimport net.yageek.codekit.CodeOptions;\n\ntry {\n    // Creating the string of bars from the code\n    String test = CodeKit.makeCode93(\"TEST93\");\n\n    // Creating a code with a height of 200, a quiet space of 7, no border and a bar width of 5\n    CodeOptions options = new CodeOptions(200, 7, 0, 5);\n    Bitmap bitmap = CodeKit.convertBitmap(test, options);\n\n    this.imageView.setImageBitmap(bitmap);\n} catch (IOException e) {\n    e.printStackTrace();\n}\n```\n\n### WebAssembly\n\nUsing the `wasm-bindgen` and `web-sys` crates, a webassembly version of the code generator is available.\nYou can retrieve the packages from [Github packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)\n\nMain functions of the code are the followings:\n\n```js\n// Methods to create String representation of the code\ncodekit_create_ean8(code)\ncodekit_create_ean13(code)\ncodekit_create_codabar(code)\ncodekit_create_code39(code)\ncodekit_create_code93(code)\ncodekit_create_i2of5(code)\n\n// Methods to draw the code in a canvas node\ncodekit_draw_ean8(canvasID, barWidth, codeHeight)\ncodekit_draw_ean13(canvasID, barWidth, codeHeight)\ncodekit_draw_codabar(canvasID, barWidth, codeHeight)\ncodekit_draw_code39(canvasID, barWidth, codeHeight)\ncodekit_draw_code93(canvasID, barWidth, codeHeight)\ncodekit_draw_i2of5(canvasID, barWidth, codeHeight)\n```\n\nLet's see a simple `index.html` file to use this:\n\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en-US\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"utf-8\" /\u003e\n    \u003ctitle\u003ecodekit-wasm example\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e    \n    \u003cscript type=\"module\"\u003e\n      import init, { codekit_create_ean8, codekit_draw_ean8 }  from \"./codekit.js\";\n      init().then(() =\u003e {\n      \n        try {\n          codekit_draw_ean8('drawing', '65833254', 2, 100);\n        } catch (e) {\n          alert(\"Invalid code \" + e)\n        }         \n      });\n    \u003c/script\u003e\n\n    \u003ccanvas id=\"drawing\"\u003e\u003c/canvas\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyageek%2Fcodekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyageek%2Fcodekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyageek%2Fcodekit/lists"}