鸿蒙应用开发图片编辑器练习与分享
头像 Tiechui.Wang 2021-04-14 09:00:00    发布
3138 浏览 25 点赞 12 收藏

显示效果:

 鸿蒙应用开发图片编辑器练习与分享-鸿蒙开发者社区

点击“旋转”

 鸿蒙应用开发图片编辑器练习与分享-鸿蒙开发者社区

点击“剪裁”

 鸿蒙应用开发图片编辑器练习与分享-鸿蒙开发者社区

点击“缩放”

 鸿蒙应用开发图片编辑器练习与分享-鸿蒙开发者社区

点击“镜像”

 鸿蒙应用开发图片编辑器练习与分享-鸿蒙开发者社区

布局中的代码


<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
    xmlns:ohos="http://schemas.huawei.com/res/ohos"
    ohos:height="match_parent"
    ohos:width="match_parent"
    ohos:orientation="vertical">
    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:layout_alignment="horizontal_center"
        ohos:text="蛟龙腾飞图像开发"
        ohos:text_size="80"
        ohos:top_margin="40vp"
        />
    <DirectionalLayout
        xmlns:ohos="http://schemas.huawei.com/res/ohos"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:layout_alignment="horizontal_center"
        ohos:orientation="horizontal"
        ohos:top_margin="20vp">
        <Button
            ohos:id="$+id:jltfwhirl_image"
            ohos:height="match_content"
            ohos:width="match_content"
            ohos:background_element="$graphic:jltfbackground_button"
            ohos:padding="12vp"
            ohos:right_margin="5vp"
            ohos:text="旋转"
            ohos:text_size="20vp"
            ohos:top_margin="10vp">
        </Button>
        <Button
            ohos:id="$+id:jltfcrop_image"
            ohos:height="match_content"
            ohos:width="match_content"
            ohos:background_element="$graphic:jltfbackground_button"
            ohos:left_margin="5vp"
            ohos:padding="12vp"
            ohos:text="剪裁"
            ohos:text_size="20vp"
            ohos:top_margin="10vp">
        </Button>
        <Button
            ohos:id="$+id:jltfscale_image"
            ohos:height="match_content"
            ohos:width="match_content"
            ohos:background_element="$graphic:jltfbackground_button"
            ohos:left_margin="5vp"
            ohos:padding="12vp"
            ohos:text="缩放"
            ohos:text_size="20vp"
            ohos:top_margin="10vp">
        </Button>
        <Button
            ohos:id="$+id:jltfmirror_image"
            ohos:height="match_content"
            ohos:width="match_content"
            ohos:background_element="$graphic:jltfbackground_button"
            ohos:left_margin="5vp"
            ohos:padding="12vp"
            ohos:text="镜像"
            ohos:text_size="20vp"
            ohos:top_margin="10vp"/>
    </DirectionalLayout>
    <Image
        ohos:id="$+id:jltfimage"
        ohos:height="1200px"
        ohos:width="1024px"
        ohos:image_src="$media:shici1"
        ohos:layout_alignment="horizontal_center"
        ohos:top_margin="20vp">
    </Image>
</DirectionalLayout>

学习材料:

https://developer.huawei.com/consumer/cn/codelabsPortal/carddetails/HarmonyOS-Image-Operations

完整代码地址:

https://gitee.com/jltfcloudcn/jump_to/tree/master/tpbjq



©本站发布的所有内容,包括但不限于文字、图片、音频、视频、图表、标志、标识、广告、商标、商号、域名、软件、程序等,除特别标明外,均来源于网络或用户投稿,版权归原作者或原出处所有。我们致力于保护原作者版权,若涉及版权问题,请及时联系我们进行处理。
分类
其它
地址:北京市朝阳区北三环东路三元桥曙光西里甲1号第三置业A座1508室 商务内容合作QQ:2291221 电话:13391790444或(010)62178877
版权所有:电脑商情信息服务集团 北京赢邦策略咨询有限责任公司
声明:本媒体部分图片、文章来源于网络,版权归原作者所有,我司致力于保护作者版权,如有侵权,请与我司联系删除
京ICP备:2022009079号-2
京公网安备:11010502051901号
ICP证:京B2-20230255