Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
react-native-geek-image-editor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huanglu
react-native-geek-image-editor
Commits
05adb648
Commit
05adb648
authored
Mar 18, 2020
by
huanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
dca197a9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
41 deletions
+91
-41
LFPhotoEditingController.m
...toEditingController/controller/LFPhotoEditingController.m
+58
-8
LFDrawView.m
.../class/LFPhotoEditingController/view/subView/LFDrawView.m
+32
-32
NSBundle+LFMediaEditing.m
...ontroller/class/common/category/NSBundle+LFMediaEditing.m
+1
-1
project.pbxproj
ios/RNGeekImageEditor.xcodeproj/project.pbxproj
+0
-0
No files found.
ios/LFMediaEditingController/class/LFPhotoEditingController/controller/LFPhotoEditingController.m
View file @
05adb648
...
...
@@ -141,6 +141,17 @@ LFPhotoEditOperationStringKey const LFPhotoEditCropCanAspectRatioAttributeName =
[
self
.
view
addSubview
:
_check
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
}
-
(
void
)
viewWillDisappear
:
(
BOOL
)
animated
{
[
super
viewWillDisappear
:
animated
];
self
.
navigationController
.
navigationBar
.
hidden
=
YES
;
}
-
(
void
)
viewWillLayoutSubviews
{
[
super
viewWillLayoutSubviews
];
...
...
@@ -246,13 +257,43 @@ LFPhotoEditOperationStringKey const LFPhotoEditCropCanAspectRatioAttributeName =
-
(
void
)
configCustomNaviBar
{
UIBarButtonItem
*
sure
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:[
NSBundle
LFME_localizedStringForKey
:
@"_LFME_oKButtonTitle"
]
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
finishButtonClick
)];
UIBarButtonItem
*
cancel
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:[
NSBundle
LFME_localizedStringForKey
:
@"_LFME_cancelButtonTitle"
]
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
cancelButtonClick
)];
[
sure
setTintColor
:[
UIColor
whiteColor
]];
[
cancel
setTintColor
:[
UIColor
lightGrayColor
]];
self
.
navigationController
.
navigationBar
.
barTintColor
=
[
UIColor
colorWithRed
:(
34
/
255
.
0
)
green
:(
34
/
255
.
0
)
blue
:
(
34
/
255
.
0
)
alpha
:
0
.
7
];
self
.
navigationItem
.
rightBarButtonItem
=
sure
;
self
.
navigationItem
.
leftBarButtonItem
=
cancel
;
CGFloat
margin
=
8
,
topbarHeight
=
0
;
if
(
@available
(
iOS
11
.
0
,
*
))
{
topbarHeight
=
kCustomTopbarHeight_iOS11
;
}
else
{
topbarHeight
=
kCustomTopbarHeight
;
}
CGFloat
naviHeight
=
CGRectGetHeight
(
self
.
navigationController
.
navigationBar
.
frame
);
_edit_naviBar
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
view
.
width
,
topbarHeight
)];
_edit_naviBar
.
autoresizingMask
=
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleBottomMargin
;
_edit_naviBar
.
backgroundColor
=
[
UIColor
colorWithRed
:(
34
/
255
.
0
)
green
:(
34
/
255
.
0
)
blue
:
(
34
/
255
.
0
)
alpha
:
0
.
7
];
UIView
*
naviBar
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
topbarHeight
-
naviHeight
,
_edit_naviBar
.
frame
.
size
.
width
,
naviHeight
)];
naviBar
.
autoresizingMask
=
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleTopMargin
;
[
_edit_naviBar
addSubview
:
naviBar
];
UIFont
*
font
=
[
UIFont
systemFontOfSize
:
15
];
CGFloat
editCancelWidth
=
[[
NSBundle
LFME_localizedStringForKey
:
@"_LFME_cancelButtonTitle"
]
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
font
}
context
:
nil
].
size
.
width
+
30
;
UIButton
*
_edit_cancelButton
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
margin
,
0
,
editCancelWidth
,
naviHeight
)];
_edit_cancelButton
.
autoresizingMask
=
UIViewAutoresizingFlexibleRightMargin
|
UIViewAutoresizingFlexibleTopMargin
|
UIViewAutoresizingFlexibleBottomMargin
;
[
_edit_cancelButton
setTitle
:[
NSBundle
LFME_localizedStringForKey
:
@"_LFME_cancelButtonTitle"
]
forState
:
UIControlStateNormal
];
_edit_cancelButton
.
titleLabel
.
font
=
font
;
[
_edit_cancelButton
setTitleColor
:
self
.
cancelButtonTitleColorNormal
forState
:
UIControlStateNormal
];
[
_edit_cancelButton
addTarget
:
self
action
:
@selector
(
cancelButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
naviBar
addSubview
:
_edit_cancelButton
];
CGFloat
editOkWidth
=
[[
NSBundle
LFME_localizedStringForKey
:
@"_LFME_oKButtonTitle"
]
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
font
}
context
:
nil
].
size
.
width
+
30
;
UIButton
*
_edit_finishButton
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
self
.
view
.
width
-
editOkWidth
-
margin
,
0
,
editOkWidth
,
naviHeight
)];
_edit_finishButton
.
autoresizingMask
=
UIViewAutoresizingFlexibleLeftMargin
|
UIViewAutoresizingFlexibleTopMargin
|
UIViewAutoresizingFlexibleBottomMargin
;
[
_edit_finishButton
setTitle
:[
NSBundle
LFME_localizedStringForKey
:
@"_LFME_oKButtonTitle"
]
forState
:
UIControlStateNormal
];
_edit_finishButton
.
titleLabel
.
font
=
font
;
[
_edit_finishButton
setTitleColor
:
self
.
oKButtonTitleColorNormal
forState
:
UIControlStateNormal
];
[
_edit_finishButton
addTarget
:
self
action
:
@selector
(
finishButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
naviBar
addSubview
:
_edit_finishButton
];
[
self
.
view
addSubview
:
_edit_naviBar
];
}
-
(
void
)
configBottomToolBar
...
...
@@ -400,8 +441,17 @@ LFPhotoEditOperationStringKey const LFPhotoEditCropCanAspectRatioAttributeName =
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
if
([
weakSelf
.
delegate
respondsToSelector
:
@selector
(
lf_PhotoEditingController
:
didFinishPhotoEdit
:
)])
{
[
weakSelf
.
delegate
lf_PhotoEditingController
:
self
didFinishPhotoEdit
:
photoEdit
];
NSData
*
data
=
[
Utils
imageData
:
photoEdit
.
editPreviewImage
];
NSLog
(
@"编辑图片-------编辑后的大小:%.2f"
,
(
double
)
data
.
length
/
1024
/
1024
);
if
(
photoEdit
)
{
NSString
*
path
=
[
NSString
stringWithFormat
:
@"file://%@"
,[
Utils
saveImageTosandBox
:
data
]];
[
self
.
data
[
@"images"
][
self
.
index
]
setObject
:
path
forKey
:
@"editedImage"
];
}
self
.
finishBlock
(
photoEdit
,
self
.
data
);
}
[
weakSelf
hideProgressHUD
];
});
...
...
ios/LFMediaEditingController/class/LFPhotoEditingController/view/subView/LFDrawView.m
View file @
05adb648
...
...
@@ -109,7 +109,7 @@ NSString *const kLFDrawViewData = @"LFDrawViewData";
UITouch
*
touch
=
[
touches
anyObject
];
CGPoint
point
=
[
touch
locationInView
:
self
];
//设置线宽
path
.
lineWidth
=
4
.
0
f
;
path
.
lineWidth
=
self
.
lineWidth
;
path
.
lineCapStyle
=
kCGLineCapRound
;
//线条拐角
path
.
lineJoinStyle
=
kCGLineJoinRound
;
//终点处理
[
path
moveToPoint
:
point
];
...
...
@@ -186,37 +186,37 @@ NSString *const kLFDrawViewData = @"LFDrawViewData";
[
self
setNeedsDisplay
];
}
-
(
void
)
drawRect
:
(
CGRect
)
rect
{
if
(
self
.
lineArray
.
count
)
{
for
(
LFDrawBezierPath
*
path
in
self
.
lineArray
)
{
if
(
path
.
isErase
)
{
[
self
.
backgroundColor
setStroke
];
}
else
{
[
path
.
color
setStroke
];
}
path
.
lineCapStyle
=
kCGLineCapRound
;
path
.
lineJoinStyle
=
kCGLineCapRound
;
if
(
path
.
isErase
)
{
path
.
lineWidth
=
10
;
// 这里可抽取出来枚举定义
[
path
strokeWithBlendMode
:
kCGBlendModeDestinationIn
alpha
:
1
.
0
];
}
else
{
path
.
lineWidth
=
4
.
0
f
;
[
path
strokeWithBlendMode
:
kCGBlendModeNormal
alpha
:
1
.
0
];
}
[
path
stroke
];
}
}
[
super
drawRect
:
rect
];
}
//
-(void)drawRect:(CGRect)rect{
//
//
if (self.lineArray.count) {
//
for (LFDrawBezierPath *path in self.lineArray) {
//
if (path.isErase) {
//
//
[self.backgroundColor setStroke];
//
//
}else{
//
[path.color setStroke];
//
}
//
//
//
path.lineCapStyle = kCGLineCapRound;
//
path.lineJoinStyle = kCGLineCapRound;
//
if (path.isErase) {
//
path.lineWidth = 10; // 这里可抽取出来枚举定义
//
[path strokeWithBlendMode:kCGBlendModeDestinationIn alpha:1.0];
//
}else{
// path.lineWidth = 3
;
//
[path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
//
}
//
[path stroke];
//
//
}
//
//
}
//
//
//
[super drawRect:rect];
//
}
//- (void)drawRect:(CGRect)rect{
// //遍历数组,绘制曲线
...
...
ios/LFMediaEditingController/class/common/category/NSBundle+LFMediaEditing.m
View file @
05adb648
...
...
@@ -18,7 +18,7 @@ NSString *const LFMediaEditingStrings = @"LFMediaEditingController";
static
NSBundle
*
lfMediaEditingBundle
=
nil
;
if
(
lfMediaEditingBundle
==
nil
)
{
// 这里不使用mainBundle是为了适配pod 1.x和0.x
lfMediaEditingBundle
=
[
NSBundle
bundleWithPath
:[[
NSBundle
bundleForClass
:[
LFBaseEditingController
class
]]
pathForResource
:
@"LFMediaEditingController
.bundle/LFMediaEditingController
"
ofType
:
@"bundle"
]];
lfMediaEditingBundle
=
[
NSBundle
bundleWithPath
:[[
NSBundle
bundleForClass
:[
LFBaseEditingController
class
]]
pathForResource
:
@"LFMediaEditingController"
ofType
:
@"bundle"
]];
}
return
lfMediaEditingBundle
;
}
...
...
ios/RNGeekImageEditor.xcodeproj/project.pbxproj
View file @
05adb648
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment