{"id":13606802,"url":"https://github.com/Raed-Mughaus/DrawingView","last_synced_at":"2025-04-12T11:30:47.924Z","repository":{"id":55614361,"uuid":"462317144","full_name":"Raed-Mughaus/DrawingView","owner":"Raed-Mughaus","description":"RasmView is an Android drawing view; it provides a view that allows users to draw on top of a bitmap.","archived":false,"fork":false,"pushed_at":"2022-08-10T00:46:30.000Z","size":567,"stargazers_count":79,"open_issues_count":6,"forks_count":17,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-07T12:41:07.403Z","etag":null,"topics":["android","custom-view","drawing","drawingview","painting","view"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Raed-Mughaus.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":"2022-02-22T13:47:32.000Z","updated_at":"2024-10-16T16:23:33.000Z","dependencies_parsed_at":"2022-08-15T04:31:08.990Z","dependency_job_id":null,"html_url":"https://github.com/Raed-Mughaus/DrawingView","commit_stats":null,"previous_names":["raed-mughaus/rasmview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raed-Mughaus%2FDrawingView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raed-Mughaus%2FDrawingView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raed-Mughaus%2FDrawingView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raed-Mughaus%2FDrawingView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Raed-Mughaus","download_url":"https://codeload.github.com/Raed-Mughaus/DrawingView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248560041,"owners_count":21124580,"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":["android","custom-view","drawing","drawingview","painting","view"],"created_at":"2024-08-01T19:01:12.545Z","updated_at":"2025-04-12T11:30:47.403Z","avatar_url":"https://github.com/Raed-Mughaus.png","language":"Kotlin","readme":"# RasmView\nRasmView is an Android drawing library; it provides a view that allows users to draw on top of a bitmap.\n\n## Demo\n[https://www.youtube.com/watch?v=8qYhwjleT_8](https://www.youtube.com/watch?v=8qYhwjleT_8)\n\n![Screenshot](https://raw.githubusercontent.com/Raed-Mughaus/RasmView/main/sample_screenshot.jpg)\n\n## Features\n* 8 already defined brushes, and you can define your own.\n* Drawing on top of images.\n* Undo/redo operations.\n* Zooming in/out, rotation \u0026 translation.\n* Custom background color.\n\n\n## Download\n#### Gradle:\n```gradle\ndependencies {\n  implementation 'com.raedapps:rasmview:1.2.1'\n}\n```\n#### Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.raedapps\u003c/groupId\u003e\n  \u003cartifactId\u003erasmview\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n## Usage Guide\n#### Add the following to your layout file:\n```\n\u003ccom.raed.rasmview.RasmView\n  android:id=\"@+id/rasmView\"\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"match_parent\"\n  /\u003e\n```\n#### RasmContext\n`RasmContext` allows you to control the brush configuration, undo/redo, reset transformation, and more. `RasmContext` can be accessed from `RasmView`:\n```kotlin\nval rasmView = findViewById\u003cRasmView\u003e(R.id.rasmView)\nval rasmContext = rasmView.rasmContext\n```\n#### Changing the brush\nYou can use the `BrushesRepository` to get an already defined brush.\n```kotlin\nval brushesRepository = BrushesRepository(resources)\nrasmContext.brushConfig = brushesRepository.get(Brush.Marker)\n```\nThe following brushes are already defined:\n```kotlin\nenum class Brush {\n    Pencil,\n    Pen,\n    Calligraphy,\n    AirBrush,\n    Marker,\n    HardEraser,\n    SoftEraser,\n}\n```\n\n#### Brush color\nHere is how to change the brush color:\n```kotlin\nrasmContext.brushColor = Color.RED\nrasmContext.brushColor = 0xff2187bb.toInt() //ARGB\n```\nThe alpha channel value is ignored, you can control alpha by setting `brushConfig.flow`.\n#### Brush size and other configurations\n```kotlin\nval brushConfig = rasmContext.brushConfig\nbrushConfig.size = 0.5f\nbrushConfig.flow = 0.25f\nbrushConfig.isEraser = true\n```\n#### Custom brushes\n```kotlin\nval myStampBitmap = ...\nval customBrushConfig = BrushConfig()\ncustomBrushConfig.stamp = BrushStamp.BitmapStamp(myStampBitmap)\ncustomBrushConfig.size = 0.25f\ncustomBrushConfig.spacing = 0.1f\nrasmContext.brushConfig = customBrushConfig\n```\n#### Drawing on a bitmap (your own image)\n```kotlin\nval imageBitmap = ... //load your bitmap whether from a URI or resources\nrasmContext.setRasm(imageBitmap)\nrasmView.resetTransformation() \n```\n#### Exporting the drawing\n```kotlin\nval drawingBitmap = rasmContext.exportRasm()\n```\n#### Background color\n```kotlin\nrasmContext.setBackgroundColor(Color.BLACK)\n```\n#### Undo/redo\n```kotlin\nval rasmState = rasmContext.state\nrasmState.undo()\nrasmState.redo()\n```\nBut you do not want to keep your buttons enabled when undo/redo is not possible, you can listen to state updates:\n```kotlin\nundoButton.setOnClickListener {\n    rasmState.undo()\n}\nredoButton.setOnClickListener {\n    rasmState.redo()\n}\nrasmState.addOnStateChangedListener {\n    undoButton.isEnabled = rasmState.canCallUndo()\n    redoButton.isEnabled = rasmState.canCallRedo()\n}\nundoButton.isEnabled = rasmState.canCallUndo()\nredoButton.isEnabled = rasmState.canCallRedo()\n```\n#### Clearing the drawing\n```kotlin\nrasmContext.clear()\n```\n#### Enabling rotation\n```kotlin\nrasmContext.rotationEnabled = true\n```\n#### Resetting the transformation\n```kotlin\nrasmView.resetTransformation()\n```\n\n\n## License\n```\nCopyright 2022 Raed Mughaus\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRaed-Mughaus%2FDrawingView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRaed-Mughaus%2FDrawingView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRaed-Mughaus%2FDrawingView/lists"}