-
이미지 크기별로 캡쳐 방법론개발 2022. 4. 18. 20:34
이미지 크기별 캪쳐(빨간 테두리는 캡쳐 되는 영역을 표시) 1.해당 기능이 필요한 이유
위에 사진과 같이 캡쳐시 불필요한 영역까지 저장되기 떄문에 이미지 크기멸 캡쳐 영역 조절이 필요하다.
2. 간략한 프로세스 방법론
1.이미지 영역에 부모 뷰에 크기를 먼저 설정을 해줘야함 이렇게 하지 않으면
예를 들어 이미지가 240 *320 작은 사이즈로 선택 했을시 부모영역은 크기는 해당 사이즈로 고정되있어서
다음 이미지 사이즈가 이보다 큰사이즈라도 부모 크기가 작기 때문에 작은 사이즈로 설정됨
그러므로 이미지 영역에 부모뷰는 매번 초기화 해주는 작업이 필요함
child: Obx( () => Container( width: _stickController.isStartImageSizeOperation.value == true ? ScreenUtil().setWidth(360 - getSidePadding * 2) : _stickController.imageWidth.value, height: _stickController.isStartImageSizeOperation.value == true ? ScreenUtil().setHeight(400) : _stickController.imageheight.value, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: _stickController.isStartImageSizeOperation.value == true ? ScreenUtil().setWidth(360 - getSidePadding * 2) : _stickController.imageWidth.value, height: _stickController.isStartImageSizeOperation.value == true ? ScreenUtil().setHeight(400) : _stickController.imageheight.value, decoration: BoxDecoration( border: Border.all( width: ScreenUtil().setWidth(1), // color: Colors.white, //테두리 배경 화면면 ), borderRadius: BorderRadius.circular(10) // ),
2.특정 라이브러리를 사용해서 이미지 영역에 크기를 가져올수있음 밑에 기술함
? WidgetFinder.sizeNotifer( key: imageKey, onSizeChanged: (Size value) { if (_stickController.isStartImageSizeOperation.value == true) { // print('Size is changed! : $value'); _stickController.imageheight.value = value.height; _stickController.imageWidth.value = value.width; _stickController .isStartImageSizeOperation.value = false; //스티커 이동 _stickController.isFreeSetLoad_shape .value = true; _stickController.isFreeSetLoad_line .value = true; _stickController .shapeOffset_x.value = 0; _stickController .shapeOffset_y.value = ScreenUtil().setHeight(50); _stickController .lineOffset_x.value = ScreenUtil().setWidth(100); _stickController .lineOffset_y.value = ScreenUtil().setHeight(50); } //isSetImage=true; },
3. 사용기술
widget_finder
이미지 영역 크기를 가져오기 위해 사용
'개발' 카테고리의 다른 글
외곽선 자석효과 방법론 (0) 2022.04.20 스티커 중앙 자석효과 방법론 (0) 2022.04.19 STICKER 구현 방법론 (0) 2022.04.18 사진 흑백 컬러필터 및 적당히 잘라서 보여주기 (0) 2022.04.17 지도 상점 정보 qr code 구현 (카카오 api+ 네이버 map) (0) 2022.03.17