/*
 * Copyright (C) 2025 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 { ImageKnifeComponent } from '@ohos/libraryimageknife';
import fs from '@ohos.file.fs';

@Entry
@Component
struct LocalImage {
  scroller: Scroller = new Scroller;

  build() {
    Scroll(this.scroller) {
      Column() {
        Column() {
          Text($r('app.string.base_image'))
            .fontSize(20)
            .fontWeight(FontWeight.Bold)
          Row() {
            Image($rawfile('rotate/rotate.jpg')).width(100).height(100).margin({ right: 10 })
            ImageKnifeComponent({
              imageKnifeOption: {
                loadSrc: $rawfile('rotate/rotate.jpg'),
                objectFit: ImageFit.Contain
              }
            }).width(100).height(100)
          }
        }
        .margin({ bottom: 20 })

        Column() {
          Text($r('app.string.rotate_mirror'))
            .fontSize(20)
            .fontWeight(FontWeight.Bold)
          Row() {
            Image($rawfile('rotate/rotate_mirror.jpg')).width(100).height(100).margin({ right: 10 })
            ImageKnifeComponent({
              imageKnifeOption: {
                loadSrc: $rawfile('rotate/rotate_mirror.jpg'),
                objectFit: ImageFit.Contain
              }
            }).width(100).height(100)
          }
        }.margin({ bottom: 20 })

        Column() {
          Text($r('app.string.rotate_rotate90'))
            .fontSize(20)
            .fontWeight(FontWeight.Bold)
          Row() {
            Image($rawfile('rotate/rotate_rotate90.jpg')).width(100).height(100).margin({ right: 10 })
            ImageKnifeComponent({
              imageKnifeOption: {
                loadSrc: $rawfile('rotate/rotate_rotate90.jpg'),
                objectFit: ImageFit.Contain
              }
            }).width(100).height(100)
          }
        }.margin({ bottom: 20 })

        Column() {
          Text($r('app.string.rotate_mirror_rotate270'))
            .fontSize(20)
            .fontWeight(FontWeight.Bold)
          Row() {
            Image($rawfile('rotate/rotate_mirror_rotate270.jpg')).width(100).height(100).margin({ right: 10 })
            ImageKnifeComponent({
              imageKnifeOption: {
                loadSrc: $rawfile('rotate/rotate_mirror_rotate270.jpg'),
                objectFit: ImageFit.Contain
              }
            }).width(100).height(100)
          }
        }
      }
      .width('100%')
    }
    .height('100%')
  }
}