Skip to content

Commit 20450ad

Browse files
authored
Merge pull request #33 from fluttercandies/patch-ios-transparent
Patch ios transparent background with png format.
2 parents 9d4b067 + 4d706ed commit 20450ad

File tree

6 files changed

+48
-13
lines changed

6 files changed

+48
-13
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# CHANGELOG
2+
3+
- [CHANGELOG](#changelog)
4+
- [0.5.1](#051)
5+
- [0.5.0](#050)
6+
- [0.4.1](#041)
7+
- [0.4.0+2](#0402)
8+
- [0.4.0+1](#0401)
9+
- [0.4.0](#040)
10+
- [0.3.0](#030)
11+
- [0.2.0](#020)
12+
- [0.1.6](#016)
13+
- [0.1.5](#015)
14+
- [0.1.4](#014)
15+
- [0.1.3](#013)
16+
- [0.1.2](#012)
17+
- [0.1.1](#011)
18+
- [0.1.0](#010)
19+
20+
## 0.5.1
21+
22+
Fix some png background error.
23+
124
## 0.5.0
225

326
Support add text.

example/ios/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ PODS:
1111

1212
DEPENDENCIES:
1313
- Flutter (from `Flutter`)
14-
- image_editor (from `/Volumes/Samsung-T5/code/flutter/plugins/flutter_image_editor/ios/image_editor.podspec`)
15-
- "image_picker (from `/Users/caijinglong/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.1+8/ios/image_picker.podspec`)"
16-
- path_provider (from `/Users/caijinglong/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.4.0/ios/path_provider.podspec`)
14+
- image_editor (from `/Volumes/Evo512/code/flutter/plugins/flutter_image_editor/ios/image_editor.podspec`)
15+
- "image_picker (from `/Users/cai/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.1+8/ios/image_picker.podspec`)"
16+
- path_provider (from `/Users/cai/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.4.0/ios/path_provider.podspec`)
1717

1818
SPEC REPOS:
1919
trunk:
@@ -23,11 +23,11 @@ EXTERNAL SOURCES:
2323
Flutter:
2424
:path: Flutter
2525
image_editor:
26-
:path: "/Volumes/Samsung-T5/code/flutter/plugins/flutter_image_editor/ios/image_editor.podspec"
26+
:path: "/Volumes/Evo512/code/flutter/plugins/flutter_image_editor/ios/image_editor.podspec"
2727
image_picker:
28-
:path: "/Users/caijinglong/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.1+8/ios/image_picker.podspec"
28+
:path: "/Users/cai/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.1+8/ios/image_picker.podspec"
2929
path_provider:
30-
:path: "/Users/caijinglong/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.4.0/ios/path_provider.podspec"
30+
:path: "/Users/cai/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.4.0/ios/path_provider.podspec"
3131

3232
SPEC CHECKSUMS:
3333
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec

example/lib/add_text_page.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dart:convert';
21
import 'dart:typed_data';
32

43
import 'package:flutter/material.dart';
@@ -71,7 +70,7 @@ class _AddTextPageState extends State<AddTextPage> {
7170
image: u,
7271
imageEditorOption: option,
7372
);
74-
print(JsonEncoder.withIndent(' ').convert(option.toJson()));
73+
print(option.toString());
7574
this.target = MemoryImage(result);
7675
setState(() {});
7776
},

ios/Classes/FIUIImageHandler.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ - (void)fixOrientation {
6161
return;
6262
}
6363

64-
UIGraphicsBeginImageContextWithOptions(outImage.size, YES, outImage.scale);
64+
// UIGraphicsBeginImageContextWithOptions(outImage.size, YES, outImage.scale);
65+
UIGraphicsBeginImageContext(outImage.size);
6566

6667
[outImage
6768
drawInRect:CGRectMake(0, 0, outImage.size.width, outImage.size.height)];
@@ -86,7 +87,8 @@ - (void)flip:(FIFlipOption *)option {
8687

8788
CGSize size = outImage.size;
8889

89-
UIGraphicsBeginImageContextWithOptions(size, YES, 1);
90+
// UIGraphicsBeginImageContextWithOptions(size, YES, 1);
91+
UIGraphicsBeginImageContext(outImage.size);
9092
CGContextRef ctx = UIGraphicsGetCurrentContext();
9193
if (!ctx) {
9294
return;
@@ -147,8 +149,10 @@ - (void)rotate:(FIRotateOption *)option {
147149
CGAffineTransform aff = CGAffineTransformMakeRotation(redians);
148150
CGRect newRect = CGRectApplyAffineTransform(oldRect, aff);
149151
CGSize newSize = newRect.size;
152+
153+
UIGraphicsBeginImageContext(outImage.size);
150154

151-
UIGraphicsBeginImageContextWithOptions(newSize, YES, outImage.scale);
155+
// UIGraphicsBeginImageContextWithOptions(newSize, YES, outImage.scale);
152156

153157
CGContextRef ctx = UIGraphicsGetCurrentContext();
154158
if (!ctx) {
@@ -274,7 +278,8 @@ - (void)addText:(FIAddTextOption *)option {
274278
return;
275279
}
276280

277-
UIGraphicsBeginImageContextWithOptions(outImage.size, YES, outImage.scale);
281+
// UIGraphicsBeginImageContextWithOptions(outImage.size, YES, outImage.scale);
282+
UIGraphicsBeginImageContext(outImage.size);
278283

279284
CGContextRef ctx = UIGraphicsGetCurrentContext();
280285
if (!ctx) {

lib/src/option/edit_options.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:collection';
2+
import 'dart:convert';
23
import 'dart:io';
34

45
import 'package:flutter/foundation.dart';
@@ -95,6 +96,13 @@ class ImageEditorOption implements IgnoreAble {
9596
}
9697
return true;
9798
}
99+
100+
String toString() {
101+
final m = <String, dynamic>{};
102+
m['options'] = toJson();
103+
m['fmt'] = outputFormat.toJson();
104+
return JsonEncoder.withIndent(' ').convert(m);
105+
}
98106
}
99107

100108
class OptionGroup extends ListBase<Option> implements IgnoreAble {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: image_editor
22
description: Rotate ,flip, crop your image. Use objc/kotlin to handle it.
3-
version: 0.5.0
3+
version: 0.5.1
44
author: Caijinglong<[email protected]>
55
homepage: https://github.com/fluttercandies/flutter_image_editor
66

0 commit comments

Comments
 (0)