diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5028b7485bcbb59588ce6d3b2305670007efcc2d --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.customcanvas", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..13a613e8fccccf05502e2bd282e778580b091cee --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "CustomCanvas" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index a426ed632c210b94da7e1c90dad26a193f006b01..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# CustomCanvas - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index cf7de2770838a0f875aa9a28332653bed2028a12..db7a960382f4903280d7a9fcaa103354fece32c4 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,63 @@ -# CustomCanvas +# 自定义Canvas画布 -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} +### 介绍 -#### 软件架构 -软件架构说明 +本示例介绍了使用Canvas实现一个包括了画笔粗细、颜色和透明度的选择、绘制、缩放、清除等功能的自定义画布。 +### 效果图预览 -#### 安装教程 +![](./screenshots/device/canvas.gif) -1. xxxx -2. xxxx -3. xxxx +##### 使用说明 -#### 使用说明 +1. 进入首页后,下方有五个按钮,画笔默认选中,可以在空白部分进行绘画,默认粗细是3,颜色是黑色不透明。 +2. 进行绘制后,撤回按钮会高亮可点击,点击后可以撤回上一步的笔画;同时重做按钮会高亮可点击,点击重做后还原上一步撤销的笔画。 +3. 点击橡皮擦按钮后,手指绘画就会实现擦除效果,画笔按钮取消高亮。 +4. 点击清空按钮会清空整个画布的所有绘制,同时清空按钮高亮。 +5. 点击画笔按钮,会弹出半模态弹窗,在弹窗内可以选择画笔的类型、颜色、不透明度和粗细。 +6. 本示例只展示圆珠笔和马克笔两种类型,圆珠笔为默认类型,这里可以点击马克笔,关闭弹窗再次进行绘画,笔画就变为马克笔。 +7. 再次点击画笔唤起弹窗,可以切换颜色、不透明度和粗细,不透明度只有马克笔可以切换,圆珠笔不可以切换。 +8. 双指捏合画布缩小,双指外扩画布放大,缩放时画笔按钮取消高亮,缩放结束后,点击画笔就可以再次进行绘制。 -1. xxxx -2. xxxx -3. xxxx +### 工程目录 -#### 参与贡献 +``` +├──entry/src/main/ets/ +│ ├──common +│ │ └──CommonConstants.ets // 公共常量类 +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──pages +│ │ └──Index.ets // 首页 +│ ├──view +│ │ └──myPaintSheet.ets // 半模态页面 +│ └──viewmodel +│ ├──DrawInvoker.ets // 绘制方法 +│ ├──IBrush.ets // 笔刷接口 +│ ├──IDraw.ets // 绘制类 +│ └──Paint.ets // 绘制属性类 +└──entry/src/main/resources // 应用静态资源目录 +``` -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +### 具体实现 +1. 通过在Canvas上绑定onTouch事件获取触摸点的相对画布的x轴和y轴坐标,将坐标传入路径对象Path2D的moveTo和lineTo方法实现绘制功能。 +2. 橡皮擦功能是通过修改CanvasRenderingContext2D的strokeStyle属性为白色来实现的。 +3. 每条绘制路径都会通过add方法存放到绘制数组drawPathList中,撤回功能将drawPathList最后一项移除并存到重做数组redoList中,重做功能把redoList中最后一项清除并重新放回drawPathList中。 +4. 清除功能是将drawPathList和redoList数组清空后重新绘制画布。 +5. 笔刷中圆珠笔的globalAlpha属性值默认为1,且不可改变,马克笔的globalAlpha属性值默认为0.5,可以通过Slider组件调整不透明度。 +6. 颜色和粗细修改是通过修改CanvasRenderingContext2D的strokeStyle和lineWidth属性来实现的。 -#### 特技 +### 相关权限 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 + +2. HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 + +3. DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 + +4. HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 \ No newline at end of file diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c033ce4278fb0641d84107c3c134047ac487368e --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,35 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..808380f3b726e2036a3d6cf5fb9b0fd9513a8215 --- /dev/null +++ b/entry/build-profile.json5 @@ -0,0 +1,25 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/entry/hvigorfile.ts b/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/entry/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a --- /dev/null +++ b/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/entry/src/main/ets/common/CommonConstants.ets b/entry/src/main/ets/common/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..c77d7b601d0afdec6fb2cb9d64f35667d2fcf200 --- /dev/null +++ b/entry/src/main/ets/common/CommonConstants.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class CommonConstants { + /** + * Zero. + */ + static readonly ZERO: number = 0; + + /** + * One. + */ + static readonly ONE: number = 1; + + /** + * Negative one. + */ + static readonly NEGATIVE_ONE: number = -1; + + /** + * Three. + */ + static readonly THREE: number = 3; + + /** + * Ten. + */ + static readonly TEN: number = 10; + + /** + * Twenty-one. + */ + static readonly TWENTY_ONE: number = 21; + + /** + * One hundred. + */ + static readonly ONE_HUNDRED: number = 100; + + /** + * String empty. + */ + static readonly COLOR_STRING: string = ''; + + /** + * Percent sign. + */ + static readonly SIGN: string = '%'; + + /** + * Basic color. + */ + static readonly BLACK: string = 'black'; + + /** + * One hundred percent. + */ + static readonly ONE_HUNDRED_PERCENT: string = '100%'; + + /** + * Arr color. + */ + static readonly COLOR_ARR: string[] = ['#E90808', '#63B959', '#0A59F7', '#E56224', '#F6C800', '#5445EF', '#A946F1', + '#000000'] + + /** + * White. + */ + static readonly WHITE: string = '#ffffff'; + + /** + * Detents. + */ + static readonly DETENTS: [Length, Length] = [550, 600]; +} \ No newline at end of file diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..217744d8eb6d893e1138cd660209ce4d0441ac4f --- /dev/null +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a492d614ed6c124b4d36d7f1f78969c8fcf0d1b --- /dev/null +++ b/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DrawInvoker from '../viewmodel/DrawInvoker'; +import DrawPath from '../viewmodel/IDraw'; +import { IBrush } from '../viewmodel/IBrush'; +import NormalBrush from '../viewmodel/IBrush'; +import Paint from '../viewmodel/Paint'; +import { CommonConstants } from '../common/CommonConstants'; +import { myPaintSheet } from '../view/myPaintSheet'; + +@Entry +@Component +struct DrawCanvas { + @State @Watch('createDraw') isDrawing: boolean = false; + @State unDoDraw: boolean = false; + @State redoDraw: boolean = false; + @State isPaint: boolean = true; + @State isShow: boolean = false; + @State isMarker: boolean = false; + @State scaleValue: number = 1; + @State pinchValue: number = 1; + @State strokeWidth: number = 3; + @State alpha: number = 1; + @State color: string = '#000000'; + @State thicknessesValue: number = 3; + @State index: number = -1; + @State clean: boolean = false; + @State percent: string = '100'; + @Provide mPaint: Paint = new Paint(0, '', 1); + @Provide mBrush: IBrush = new NormalBrush(); + private setting: RenderingContextSettings = new RenderingContextSettings(true); + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.setting); + private drawInvoker: DrawInvoker = new DrawInvoker(); + private path2Db: Path2D = new Path2D(); + private mPath: DrawPath = new DrawPath(this.mPaint, this.path2Db); + private arr: number[] = []; + + aboutToAppear(): void { + this.mPaint = new Paint(CommonConstants.ZERO, CommonConstants.COLOR_STRING, CommonConstants.ONE); + this.mPaint.setStrokeWidth(CommonConstants.THREE); + this.mPaint.setColor(CommonConstants.BLACK); + this.mPaint.setGlobalAlpha(CommonConstants.ONE); + this.mBrush = new NormalBrush(); + } + + createDraw() { + if (this.isDrawing) { + this.context.fillStyle = Color.White; + this.context.fillRect(CommonConstants.ZERO, CommonConstants.ZERO, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + this.isDrawing = false; + } + } + + /** + * Add a sketch path. + */ + add(path: DrawPath): void { + this.drawInvoker.add(path); + } + + /** + * Toggle weight, color, transparency. + */ + ToggleThicknessColor(): void { + this.mPaint = new Paint(CommonConstants.ZERO, CommonConstants.COLOR_STRING, CommonConstants.ONE); + this.mPaint.setStrokeWidth(this.strokeWidth); + this.mPaint.setColor(this.color); + this.mPaint.setGlobalAlpha(this.alpha); + this.mBrush = new NormalBrush(); + } + + /** + * Undo operation. + */ + drawOperateUndo(): void { + this.drawInvoker.undo(); + this.isDrawing = true; + if (!this.drawInvoker.canUndo()) { + this.unDoDraw = false; + } + this.redoDraw = true; + } + + /** + * Redo operation. + */ + drawOperateRedo(): void { + this.drawInvoker.redo(); + this.isDrawing = true; + if (!this.drawInvoker.canRedo()) { + this.redoDraw = false; + } + this.unDoDraw = true; + } + + /** + * Clear operation. + */ + clear(): void { + this.drawInvoker.clear(); + this.isDrawing = true; + this.redoDraw = false; + this.unDoDraw = false; + } + + @Builder + myPaintSheet() { + Column() { + myPaintSheet({ + isMarker: this.isMarker, + alpha: this.alpha, + percent: this.percent, + color: this.color, + thicknessesValue: this.thicknessesValue, + strokeWidth: this.strokeWidth + }) + } + } + + build() { + Stack({ alignContent: Alignment.Bottom }) { + Canvas(this.context) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .backgroundColor($r('sys.color.white')) + .onTouch((event: TouchEvent) => { + this.clean = false; + if (this.index === 1 || event.touches.length > 1) { + return; + } + this.arr.push(event.touches[0].x + event.touches[0].y); + if (event.touches.length === 1 && event.touches[0].id === 0 && event.type === TouchType.Down) { + this.mPath = new DrawPath(this.mPaint, this.path2Db); + this.mPath.paint = this.mPaint; + this.mPath.path = new Path2D(); + this.mBrush.down(this.mPath.path, event.touches[0].x, event.touches[0].y); + } + if (event.touches.length === 1 && event.touches[0].id === 0 && event.type === TouchType.Move) { + this.mBrush.move(this.mPath.path, event.touches[0].x, event.touches[0].y); + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + if (this.arr.length > 4) { + this.mPath.draw(this.context); + } + } + if (event.touches.length === 1 && event.touches[0].id === 0 && event.type === TouchType.Up) { + this.add(this.mPath); + this.arr = []; + this.redoDraw = false; + this.unDoDraw = true; + this.isDrawing = true; + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + } + }) + .scale({ + x: this.scaleValue, + y: this.scaleValue, + z: CommonConstants.ONE + }) + .gesture( + PinchGesture() + .onActionStart(() => { + this.index = 1; + }) + .onActionUpdate((event: GestureEvent) => { + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + if (event) { + this.scaleValue = this.pinchValue * event.scale; + } + }) + .onActionEnd(() => { + this.pinchValue = this.scaleValue; + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + }) + ) + Column() + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .backgroundColor(Color.Transparent) + .zIndex(this.index) + .gesture( + PinchGesture() + .onActionStart(() => { + this.index = 1; + }) + .onActionUpdate((event: GestureEvent) => { + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + if (event) { + this.scaleValue = this.pinchValue * event.scale; + } + }) + .onActionEnd(() => { + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + this.pinchValue = this.scaleValue; + }) + ) + Row() { + Stack() { + Column() { + Image(this.isPaint && this.index === CommonConstants.NEGATIVE_ONE ? $r('app.media.paintbrush_active') : + $r('app.media.paintbrush')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .margin({ bottom: $r('app.float.bottom') }) + Text($r('app.string.paint')) + .fontSize($r('app.float.font_size_m')) + .fontColor(this.isPaint && this.index === CommonConstants.NEGATIVE_ONE ? $r('app.color.theme_color') : + $r('sys.color.mask_secondary')) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + + Button({ type: ButtonType.Normal }) + .backgroundColor(Color.Transparent) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .onClick(() => { + this.ToggleThicknessColor(); + this.isPaint = true; + this.isShow = !this.isShow; + this.index = -1; + this.arr = []; + }) + } + .bindSheet($$this.isShow, this.myPaintSheet(), { + height: $r('app.float.height'), + backgroundColor: Color.White, + title: { + title: $r('app.string.paint') + }, + detents: CommonConstants.DETENTS + }) + .width($r('app.float.paint_width')) + .height($r('app.float.paint_height')) + + Stack() { + Column() { + Image(this.isPaint || this.index === CommonConstants.ONE ? $r('app.media.rubbers') : + $r('app.media.rubbers_active')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .margin({ bottom: $r('app.float.bottom') }) + Text($r('app.string.rubber')) + .fontSize($r('app.float.font_size_m')) + .fontColor(this.isPaint || this.index === CommonConstants.ONE ? $r('sys.color.mask_secondary') : + $r('app.color.theme_color')) + + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + + Button({ type: ButtonType.Normal }) + .backgroundColor(Color.Transparent) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .onClick(() => { + this.mPaint = new Paint(CommonConstants.ZERO, CommonConstants.COLOR_STRING, CommonConstants.ONE); + this.mPaint.setStrokeWidth(CommonConstants.TEN); + this.mPaint.setColor(CommonConstants.WHITE); + this.mPaint.setGlobalAlpha(CommonConstants.ONE); + this.isPaint = false; + }) + } + .width($r('app.float.paint_width')) + .height($r('app.float.paint_height')) + + Stack() { + Column() { + Image(this.unDoDraw ? $r('app.media.recall_active') : $r('app.media.recall')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .margin({ bottom: $r('app.float.bottom') }) + Text($r('app.string.redo')) + .fontSize($r('app.float.font_size_m')) + .fontColor(this.unDoDraw ? $r('app.color.theme_color') : $r('sys.color.mask_secondary')) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + + Button({ type: ButtonType.Normal }) + .backgroundColor(Color.Transparent) + .enabled(this.unDoDraw) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .onClick(async () => { + this.drawOperateUndo(); + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + }) + } + .width($r('app.float.paint_width')) + .height($r('app.float.paint_height')) + + Stack() { + Column() { + Image(this.redoDraw ? $r('app.media.redo_active') : $r('app.media.redo')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .margin({ bottom: $r('app.float.bottom') }) + Text($r('app.string.undo')) + .fontSize($r('app.float.font_size_m')) + .fontColor(this.redoDraw ? $r('app.color.theme_color') : $r('sys.color.mask_secondary')) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + + Button({ type: ButtonType.Normal }) + .backgroundColor(Color.Transparent) + .enabled(this.redoDraw) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .onClick(async () => { + this.drawOperateRedo(); + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + }) + } + .width($r('app.float.paint_width')) + .height($r('app.float.paint_height')) + + Stack() { + Column() { + Image(this.clean ? $r('app.media.clear_active') : $r('app.media.clear')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .margin({ bottom: $r('app.float.bottom') }) + Text($r('app.string.clear')) + .fontSize($r('app.float.font_size_m')) + .fontColor(this.clean ? $r('app.color.theme_color') : $r('sys.color.mask_secondary')) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + + Button({ type: ButtonType.Normal }) + .backgroundColor(Color.Transparent) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .onClick(async () => { + this.clear(); + this.context.clearRect(0, 0, this.context.width, this.context.height); + this.drawInvoker.execute(this.context); + this.clean = true; + }) + } + .width($r('app.float.paint_width')) + .height($r('app.float.paint_height')) + } + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Center) + .zIndex(CommonConstants.TEN) + } + .backgroundColor($r('sys.color.comp_background_focus')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/view/myPaintSheet.ets b/entry/src/main/ets/view/myPaintSheet.ets new file mode 100644 index 0000000000000000000000000000000000000000..7affec48a6059590094ba7df04b8f372eeb92387 --- /dev/null +++ b/entry/src/main/ets/view/myPaintSheet.ets @@ -0,0 +1,332 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants } from '../common/CommonConstants'; +import { IBrush } from '../viewmodel/IBrush'; +import NormalBrush from '../viewmodel/IBrush'; +import Paint from '../viewmodel/Paint'; + +@Component +export struct myPaintSheet { + @Link isMarker: boolean; + @Link alpha: number; + @Link percent: string; + @Link color: string; + @Link thicknessesValue: number; + @Link strokeWidth: number; + @Consume mPaint: Paint; + @Consume mBrush: IBrush; + + ToggleThicknessColor() { + this.mPaint = new Paint(CommonConstants.ZERO, CommonConstants.COLOR_STRING, CommonConstants.ONE); + this.mPaint.setStrokeWidth(this.strokeWidth); + this.mPaint.setColor(this.color); + this.mPaint.setGlobalAlpha(this.alpha); + this.mBrush = new NormalBrush(); + } + + build() { + Column() { + Column() { + Text($r('app.string.brash')) + .textAlign(TextAlign.Start) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ bottom: $r('app.float.margin_bottom') }) + Row() { + Column() { + Stack() { + Text() + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .backgroundColor(this.isMarker ? $r('app.color.paint_color') : $r('app.color.theme_color')) + .borderRadius($r('app.float.border_radius')) + Image(this.isMarker ? $r('app.media.Ballpoint') : $r('app.media.Ballpoint_active')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + Button({ type: ButtonType.Normal }) + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .borderRadius($r('app.float.border_radius')) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.isMarker = false; + this.alpha = 1; + this.percent = '100'; + this.ToggleThicknessColor(); + }) + } + + Text($r('app.string.ballpoint')) + .fontSize($r('app.float.font_size')) + .fontColor(this.isMarker ? $r('sys.color.mask_secondary') : $r('app.color.theme_color')) + .margin({ top: $r('app.float.margin_top') }) + } + .width($r('app.float.brash_width')) + .height($r('app.float.brash_height')) + + Column() { + Stack() { + Text() + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .backgroundColor(this.isMarker ? $r('app.color.theme_color') : $r('app.color.paint_color')) + .borderRadius($r('app.float.border_radius')) + Image(this.isMarker ? $r('app.media.marker_active') : $r('app.media.marker')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + Button({ type: ButtonType.Normal }) + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .borderRadius($r('app.float.border_radius')) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.isMarker = true; + this.alpha = 0.5; + this.percent = '50'; + this.ToggleThicknessColor(); + }) + } + + Text($r('app.string.marker')) + .fontSize($r('app.float.font_size')) + .fontColor(this.isMarker ? $r('app.color.theme_color') : $r('sys.color.mask_secondary')) + .margin({ top: $r('app.float.margin_top') }) + } + .width($r('app.float.brash_width')) + .height($r('app.float.brash_height')) + + Column() { + Stack() { + Text() + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .backgroundColor($r('app.color.paint_color')) + .borderRadius($r('app.float.border_radius')) + Image($r('app.media.pencils')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + } + + Text($r('app.string.pencil')) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ top: $r('app.float.margin_top') }) + } + .width($r('app.float.brash_width')) + .height($r('app.float.brash_height')) + + Column() { + Stack() { + Text() + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .backgroundColor($r('app.color.paint_color')) + .borderRadius($r('app.float.border_radius')) + Image($r('app.media.fountain')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + } + + Text($r('app.string.fountain_pen')) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ top: $r('app.float.margin_top') }) + } + .width($r('app.float.brash_width')) + .height($r('app.float.brash_height')) + + Column() { + Stack() { + Text() + .width($r('app.float.back_width')) + .height($r('app.float.back_width')) + .backgroundColor($r('app.color.paint_color')) + .borderRadius($r('app.float.border_radius')) + Image($r('app.media.laser')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + } + + Text($r('app.string.laser_pointer')) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ top: $r('app.float.margin_top') }) + } + .width($r('app.float.brash_width')) + .height($r('app.float.brash_height')) + } + .padding({ + left: $r('app.float.margin_top'), + right: $r('app.float.margin_top') + }) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + .padding({ + left: $r('app.float.padding_left'), + right: $r('app.float.padding_left'), + top: $r('app.float.margin_bottom') + }) + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .margin({ bottom: $r('app.float.title_bottom') }) + + Column() { + Text($r('app.string.color')) + .textAlign(TextAlign.Start) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ bottom: $r('app.float.margin_bottom') }) + Row() { + ForEach(CommonConstants.COLOR_ARR, (item: string) => { + Text() + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .borderRadius($r('app.float.border_radius_m')) + .backgroundColor(item) + .onClick(() => { + this.color = item; + this.ToggleThicknessColor(); + }) + }, (item: string) => JSON.stringify(item)) + } + .padding({ + left: $r('app.float.margin_top'), + right: $r('app.float.margin_top') + }) + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + } + .padding({ + left: $r('app.float.padding_left'), + right: $r('app.float.padding_left') + }) + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .margin({ bottom: $r('app.float.margin_bottom') }) + + Column() { + Text($r('app.string.opacity')) + .textAlign(TextAlign.Start) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ bottom: $r('app.float.margin_top') }) + Row() { + Stack() { + Slider({ + style: SliderStyle.InSet, + value: this.alpha * CommonConstants.ONE_HUNDRED + }) + .height($r('app.float.brash_width')) + .width($r('app.float.slider_width')) + .selectedColor(Color.Transparent) + .minResponsiveDistance(CommonConstants.ONE) + .trackColor(new LinearGradient([ + { color: $r('app.color.linear_start'), offset: CommonConstants.ZERO }, + { color: $r('app.color.linear_end'), offset: CommonConstants.ONE } + ])) + .onChange((value: number) => { + if (this.isMarker) { + this.alpha = value / 100; + this.percent = value.toFixed(0); + this.ToggleThicknessColor(); + } + }) + if (!this.isMarker) { + Row() + .backgroundColor(Color.Transparent) + .width($r('app.float.slider_width')) + .height($r('app.float.brash_width')) + } + } + + Text(this.percent + CommonConstants.SIGN) + .width($r('app.float.number')) + .height($r('app.float.image_width')) + .fontSize($r('app.float.font_size_l')) + .borderRadius($r('app.float.border_radius_m')) + .textAlign(TextAlign.Center) + .backgroundColor($r('app.color.number_color')) + } + .padding({ + left: $r('app.float.margin_top'), + right: $r('app.float.margin_top') + }) + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + } + .padding({ + left: $r('app.float.padding_left'), + right: $r('app.float.padding_left') + }) + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .margin({ bottom: $r('app.float.margin_bottom') }) + + Column() { + Text($r('app.string.thicknesses')) + .textAlign(TextAlign.Start) + .fontSize($r('app.float.font_size')) + .fontColor($r('sys.color.mask_secondary')) + .margin({ bottom: $r('app.float.margin_bottom') }) + Row() { + Image($r('app.media.minuses')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .onClick(() => { + this.thicknessesValue -= 1; + this.strokeWidth = this.thicknessesValue; + this.ToggleThicknessColor(); + }) + Slider({ + value: this.thicknessesValue, + min: CommonConstants.THREE, + max: CommonConstants.TWENTY_ONE + }) + .width($r('app.float.slider_width')) + .minResponsiveDistance(CommonConstants.ONE) + .onChange((value: number, _mode: SliderChangeMode) => { + this.thicknessesValue = value; + this.strokeWidth = value; + this.ToggleThicknessColor(); + }) + Image($r('app.media.add')) + .width($r('app.float.image_width')) + .height($r('app.float.image_width')) + .onClick(() => { + this.thicknessesValue += 1; + this.strokeWidth = this.thicknessesValue; + this.ToggleThicknessColor(); + }) + } + .padding({ + left: $r('app.float.margin_bottom'), + right: $r('app.float.margin_bottom') + }) + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + } + .padding({ + left: $r('app.float.padding_left'), + right: $r('app.float.padding_left') + }) + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/DrawInvoker.ets b/entry/src/main/ets/viewmodel/DrawInvoker.ets new file mode 100644 index 0000000000000000000000000000000000000000..c82999fd746b37272b596d2de240c91cc5651b50 --- /dev/null +++ b/entry/src/main/ets/viewmodel/DrawInvoker.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { List } from '@kit.ArkTS'; +import DrawPath from './IDraw'; + +export default class DrawInvoker { + // Draw list. + private drawPathList: List = new List(); + // Redo list. + private redoList: Array = new Array(); + + add(command: DrawPath): void { + this.drawPathList.add(command); + this.redoList = []; + } + + clear(): void { + if (this.drawPathList.length > 0 || this.redoList.length > 0) { + this.drawPathList.clear(); + this.redoList = []; + } + } + + undo(): void { + if (this.drawPathList.length > 0) { + let undo: DrawPath = this.drawPathList.get(this.drawPathList.length - 1); + this.drawPathList.removeByIndex(this.drawPathList.length - 1); + this.redoList.push(undo) + } + } + + redo(): void { + if (this.redoList.length > 0) { + let redoCommand = this.redoList[this.redoList.length - 1]; + this.redoList.pop(); + this.drawPathList.add(redoCommand); + } + } + + execute(context: CanvasRenderingContext2D): void { + if (this.drawPathList !== null) { + this.drawPathList.forEach((element: DrawPath) => { + element.draw(context); + }); + } + } + + canRedo(): boolean { + return this.redoList.length > 0; + } + + canUndo(): boolean { + return this.drawPathList.length > 0; + } +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/IBrush.ets b/entry/src/main/ets/viewmodel/IBrush.ets new file mode 100644 index 0000000000000000000000000000000000000000..ebbfd97a792e27ae2e47bca2b92583a810b67442 --- /dev/null +++ b/entry/src/main/ets/viewmodel/IBrush.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface IBrush { + /** + * When the contacts are in contact. + */ + down(path: Path2D, x: number, y: number): void; + + /** + * When the contact moves. + */ + move(path: Path2D, x: number, y: number): void; + + /** + * When the contact stops. + */ + up(path: Path2D, x: number, y: number): void; +} + +export default class NormalBrush implements IBrush { + down(path: Path2D, x: number, y: number): void { + path.moveTo(x, y); + } + + move(path: Path2D, x: number, y: number): void { + path.lineTo(x, y); + } + + up(path: Path2D, x: number, y: number): void {} + +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/IDraw.ets b/entry/src/main/ets/viewmodel/IDraw.ets new file mode 100644 index 0000000000000000000000000000000000000000..055eae7ead94c1e46be8610fafb3191f58d90aff --- /dev/null +++ b/entry/src/main/ets/viewmodel/IDraw.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Paint from './Paint'; + +export interface IDraw { + /** + * Drawing commands. + */ + draw(context: CanvasRenderingContext2D): void; +} + +/** + * Drawn path. + */ +export default class DrawPath implements IDraw { + public paint: Paint; + public path: Path2D; + + constructor(paint: Paint, path: Path2D) { + this.paint = paint; + this.path = path; + } + + draw(context: CanvasRenderingContext2D): void { + context.lineWidth = this.paint.lineWidth; + context.strokeStyle = this.paint.StrokeStyle; + context.globalAlpha = this.paint.globalAlpha; + context.lineCap = 'round'; + context.stroke(this.path) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/Paint.ets b/entry/src/main/ets/viewmodel/Paint.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b5a5b4e1c6daa718d883287e5b221acab9d0ff4 --- /dev/null +++ b/entry/src/main/ets/viewmodel/Paint.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class Paint { + lineWidth: number; + StrokeStyle: string; + globalAlpha: number; + + constructor(lineWidth: number, StrokeStyle: string, globalAlpha: number) { + this.lineWidth = lineWidth; + this.StrokeStyle = StrokeStyle; + this.globalAlpha = globalAlpha; + } + + setColor(color: string) { + this.StrokeStyle = color; + } + + setStrokeWidth(width: number) { + this.lineWidth = width; + } + + setGlobalAlpha(alpha: number) { + this.globalAlpha = alpha; + } +} \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..28328906853d35f1b4513b05385f5cef739477bc --- /dev/null +++ b/entry/src/main/module.json5 @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c3cb8e72cb6d1279efff2597dd2d679b13be6cd --- /dev/null +++ b/entry/src/main/resources/base/element/color.json @@ -0,0 +1,28 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "theme_color", + "value": "#0A59F7" + }, + { + "name": "paint_color", + "value": "#D8D8D8" + }, + { + "name": "linear_start", + "value": "#000A59F7" + }, + { + "name": "linear_end", + "value": "#F70A59F7" + }, + { + "name": "number_color", + "value": "#0D000000" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..09720e738c1a9c645a23c3bbcd2deb9c158917cf --- /dev/null +++ b/entry/src/main/resources/base/element/float.json @@ -0,0 +1,80 @@ +{ + "float": [ + { + "name": "font_size", + "value": "14fp" + }, + { + "name": "margin_bottom", + "value": "20vp" + }, + { + "name": "back_width", + "value": "32vp" + }, + { + "name": "image_width", + "value": "24vp" + }, + { + "name": "border_radius", + "value": "16vp" + }, + { + "name": "border_radius_m", + "value": "12vp" + }, + { + "name": "margin_top", + "value": "10vp" + }, + { + "name": "font_size_m", + "value": "10fp" + }, + { + "name": "font_size_l", + "value": "12fp" + }, + { + "name": "brash_width", + "value": "42vp" + }, + { + "name": "brash_height", + "value": "59vp" + }, + { + "name": "padding_left", + "value": "18vp" + }, + { + "name": "title_bottom", + "value": "30vp" + }, + { + "name": "paint_width", + "value": "72vp" + }, + { + "name": "paint_height", + "value": "52vp" + }, + { + "name": "slider_width", + "value": "242vp" + }, + { + "name": "number", + "value": "47vp" + }, + { + "name": "bottom", + "value": "5vp" + }, + { + "name": "height", + "value": "550vp" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9661186273e4e771e04854d6e2529fd1005784e --- /dev/null +++ b/entry/src/main/resources/base/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "自定义Canvas画布" + }, + { + "name": "paint", + "value": "画笔" + }, + { + "name": "brash", + "value": "笔刷" + }, + { + "name": "ballpoint", + "value": "圆珠笔" + }, + { + "name": "marker", + "value": "马克笔" + }, + { + "name": "pencil", + "value": "铅笔" + }, + { + "name": "fountain_pen", + "value": "钢笔" + }, + { + "name": "laser_pointer", + "value": "激光笔" + }, + { + "name": "color", + "value": "颜色" + }, + { + "name": "opacity", + "value": "不透明度" + }, + { + "name": "thicknesses", + "value": "粗细" + }, + { + "name": "rubber", + "value": "橡皮擦" + }, + { + "name": "redo", + "value": "撤回" + }, + { + "name": "undo", + "value": "重做" + }, + { + "name": "clear", + "value": "清空" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/Ballpoint.svg b/entry/src/main/resources/base/media/Ballpoint.svg new file mode 100644 index 0000000000000000000000000000000000000000..06fcebe1c82c4cb3779b851536d612290c04c8d2 --- /dev/null +++ b/entry/src/main/resources/base/media/Ballpoint.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/Ballpoint_active.svg b/entry/src/main/resources/base/media/Ballpoint_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..383d7eb1e0d61b448575d17d2ff517f1b8f1724b --- /dev/null +++ b/entry/src/main/resources/base/media/Ballpoint_active.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/add.svg b/entry/src/main/resources/base/media/add.svg new file mode 100644 index 0000000000000000000000000000000000000000..d35fc2ed8d19944af8dde43ff043278c356cf52e --- /dev/null +++ b/entry/src/main/resources/base/media/add.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/background.png b/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/entry/src/main/resources/base/media/background.png differ diff --git a/entry/src/main/resources/base/media/clear.svg b/entry/src/main/resources/base/media/clear.svg new file mode 100644 index 0000000000000000000000000000000000000000..b5dbc75d319864a80e60159542215501543f1f78 --- /dev/null +++ b/entry/src/main/resources/base/media/clear.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/clear_active.svg b/entry/src/main/resources/base/media/clear_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..6203da54e8133a37b490e104f36f745cfe10aa5b --- /dev/null +++ b/entry/src/main/resources/base/media/clear_active.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/foreground.png b/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/entry/src/main/resources/base/media/foreground.png differ diff --git a/entry/src/main/resources/base/media/fountain.svg b/entry/src/main/resources/base/media/fountain.svg new file mode 100644 index 0000000000000000000000000000000000000000..b971f3d9100a49b81bcdfa9f202341ff1294bd8c --- /dev/null +++ b/entry/src/main/resources/base/media/fountain.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/laser.svg b/entry/src/main/resources/base/media/laser.svg new file mode 100644 index 0000000000000000000000000000000000000000..67415f9909370799252826531da75fa6f359da02 --- /dev/null +++ b/entry/src/main/resources/base/media/laser.svg @@ -0,0 +1,17 @@ + + + Created with Pixso. + + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/layered_image.json b/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/marker.svg b/entry/src/main/resources/base/media/marker.svg new file mode 100644 index 0000000000000000000000000000000000000000..ab897149d8fc1078536d5e9e4c1579574f5b2060 --- /dev/null +++ b/entry/src/main/resources/base/media/marker.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/marker_active.svg b/entry/src/main/resources/base/media/marker_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..55bddb9e08dcd70956b85f19312096451267cc2f --- /dev/null +++ b/entry/src/main/resources/base/media/marker_active.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/minuses.svg b/entry/src/main/resources/base/media/minuses.svg new file mode 100644 index 0000000000000000000000000000000000000000..a5152576783aa9ef2836fe87c523a6dbf2c71009 --- /dev/null +++ b/entry/src/main/resources/base/media/minuses.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/paintbrush.svg b/entry/src/main/resources/base/media/paintbrush.svg new file mode 100644 index 0000000000000000000000000000000000000000..67f2444fef80b957557b8887d77b1f4653563c31 --- /dev/null +++ b/entry/src/main/resources/base/media/paintbrush.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/paintbrush_active.svg b/entry/src/main/resources/base/media/paintbrush_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..2a2fd19dc15b33bdb8a7ecbc344b118a6f73db26 --- /dev/null +++ b/entry/src/main/resources/base/media/paintbrush_active.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/pencils.svg b/entry/src/main/resources/base/media/pencils.svg new file mode 100644 index 0000000000000000000000000000000000000000..a20d8483efb172b5b0d0c35537bddf6f9e20402d --- /dev/null +++ b/entry/src/main/resources/base/media/pencils.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/recall.svg b/entry/src/main/resources/base/media/recall.svg new file mode 100644 index 0000000000000000000000000000000000000000..9de20b027b4f5c8770179a9b9f76778bf12a1d3d --- /dev/null +++ b/entry/src/main/resources/base/media/recall.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/recall_active.svg b/entry/src/main/resources/base/media/recall_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..4dc56e5a47810191f9c391cd26d895588b9d40d5 --- /dev/null +++ b/entry/src/main/resources/base/media/recall_active.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/redo.svg b/entry/src/main/resources/base/media/redo.svg new file mode 100644 index 0000000000000000000000000000000000000000..338d235c531288f13ba83c658ef64fa496fce121 --- /dev/null +++ b/entry/src/main/resources/base/media/redo.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/redo_active.svg b/entry/src/main/resources/base/media/redo_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..814bd5ad9812837e7e1b40f9f99203773ef03ae2 --- /dev/null +++ b/entry/src/main/resources/base/media/redo_active.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/rubbers.svg b/entry/src/main/resources/base/media/rubbers.svg new file mode 100644 index 0000000000000000000000000000000000000000..aee6d588435dc12401d4049db1ead4286497849c --- /dev/null +++ b/entry/src/main/resources/base/media/rubbers.svg @@ -0,0 +1,17 @@ + + + Created with Pixso. + + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/rubbers_active.svg b/entry/src/main/resources/base/media/rubbers_active.svg new file mode 100644 index 0000000000000000000000000000000000000000..4f672b2ee2984c9d6c07154085f793248ae75847 --- /dev/null +++ b/entry/src/main/resources/base/media/rubbers_active.svg @@ -0,0 +1,17 @@ + + + Created with Pixso. + + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/startIcon.png b/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/entry/src/main/resources/base/media/startIcon.png differ diff --git a/entry/src/main/resources/base/profile/backup_config.json b/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fb1bfa40156b07d118c352d467c6f18d2533381d --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "CustomCanvas" + }, + { + "name": "paint", + "value": "paint" + }, + { + "name": "brash", + "value": "brush" + }, + { + "name": "ballpoint", + "value": "ballpoint" + }, + { + "name": "marker", + "value": "marker" + }, + { + "name": "pencil", + "value": "pencil" + }, + { + "name": "fountain_pen", + "value": "fountain pen" + }, + { + "name": "laser_pointer", + "value": "laser pointer" + }, + { + "name": "color", + "value": "color" + }, + { + "name": "opacity", + "value": "opacity" + }, + { + "name": "thicknesses", + "value": "thicknesses" + }, + { + "name": "rubber", + "value": "rubber" + }, + { + "name": "redo", + "value": "redo" + }, + { + "name": "undo", + "value": "undo" + }, + { + "name": "clear", + "value": "clear" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ce9102c86bff3915170081a4417226c2f509fab3 --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "自定义Canvas画布" + }, + { + "name": "paint", + "value": "画笔" + }, + { + "name": "brash", + "value": "笔刷" + }, + { + "name": "ballpoint", + "value": "圆珠笔" + }, + { + "name": "marker", + "value": "马克笔" + }, + { + "name": "pencil", + "value": "铅笔" + }, + { + "name": "fountain_pen", + "value": "钢笔" + }, + { + "name": "laser_pointer", + "value": "激光笔" + }, + { + "name": "color", + "value": "颜色" + }, + { + "name": "opacity", + "value": "不透明度" + }, + { + "name": "thicknesses", + "value": "粗细" + }, + { + "name": "rubber", + "value": "橡皮擦" + }, + { + "name": "redo", + "value": "撤回" + }, + { + "name": "undo", + "value": "重做" + }, + { + "name": "clear", + "value": "清空" + } + ] +} \ No newline at end of file diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..06b2783670a348f95533b352c1ceda909a842bbc --- /dev/null +++ b/hvigor/hvigor-config.json5 @@ -0,0 +1,22 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/hvigorfile.ts b/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775 --- /dev/null +++ b/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/oh-package.json5 b/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8bf916d4a165e0466c65bc49f58ab2e3c27e8931 --- /dev/null +++ b/oh-package.json5 @@ -0,0 +1,8 @@ +{ + "modelVersion": "5.0.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + } +} diff --git a/screenshots/device/canvas.gif b/screenshots/device/canvas.gif new file mode 100644 index 0000000000000000000000000000000000000000..edcb57584c15242d517a4365f27f20f92b24b2f2 Binary files /dev/null and b/screenshots/device/canvas.gif differ