Skip to content

Commit bcd8132

Browse files
committed
feat: * and fix textBackgroundStyle #38 \n * update readme
1 parent 8d7a3f0 commit bcd8132

File tree

14 files changed

+320
-120
lines changed

14 files changed

+320
-120
lines changed

README.MD

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ Add text or icon watermark to your images
55
## sample
66

77
<figure>
8-
 <img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/IOSMarker.gif" width='300'><img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/AndroidMarker.gif" width='300'>
8+
 <img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/IOSMarker.gif" width='300'>
9+
<img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/AndroidMarker.gif" width='300'>
10+
</figure>
11+
12+
<figure>
13+
 <img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/shadow_bg_fit.png" width='300'>
14+
<img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/shadow_bg_sx.png" width='300'>
15+
<img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/shadow.png" width='300'>
16+
<img src="https://raw.githubusercontent.com/JimmyDaddy/react-native-image-marker/master/asset/shadow_bg_sy.png" width='300'>
917
</figure>
1018

1119
## Installation
@@ -44,6 +52,7 @@ pod 'RNImageMarker', :path => '../node_modules/react-native-image-marker'
4452
|`scale`| scale image |
4553
|`quality`| image qulaity |
4654
|`filename` | set filename for the result |
55+
|`textBackgroundStyle` | text background style |
4756

4857
* `ImageMarkOption`
4958

@@ -68,6 +77,19 @@ pod 'RNImageMarker', :path => '../node_modules/react-native-image-marker'
6877
|`dy`| y offset|
6978
|`color`| shadow color |
7079

80+
* `textBackgroundStyle`
81+
82+
'paddingX': number,
83+
'paddingY': number,
84+
'type': TextBackgroundType,
85+
'color': string
86+
|name|description|
87+
|--|--|
88+
|`paddingX`| padding X |
89+
|`paddingY`| padding y|
90+
|`type`| default is fit the text, `stretchX` stretch to fill width, `stretchY` stretch to fill height |
91+
|`color`| bg color |
92+
7193
## Usage
7294

7395
```javascript
@@ -86,14 +108,20 @@ import ImageMarker from "react-native-image-marker"
86108
X: 30,
87109
Y: 30,
88110
color: '#FF0000',
89-
fontName: 'Arial-BoldItalicMT',
90-
fontSize: 44,
111+
fontName: 'Arial-BoldItalicMT',
112+
fontSize: 44,
91113
shadowStyle: {
92114
dx: 10.5,
93115
dy: 20.8,
94116
radius: 20.9,
95117
color: '#ff00ff'
96118
},
119+
textBackgroundStyle: {
120+
type: 'stretchX',
121+
paddingX: 10,
122+
paddingY: 10,
123+
color: '#0f0'
124+
},
97125
scale: 1,
98126
quality: 100
99127
}).then((res) => {

android/src/main/java/com/jimmydaddy/imagemarker/ImageMarkerManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ private void markImageByText(
364364
}
365365

366366
// Draw text background
367-
if(null != textBackgroundStyle) {
367+
if(null != textBackgroundStyle) {
368368
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
369369
paint.setStyle(Paint.Style.FILL);
370370
paint.setColor(textBackgroundStyle.color);

asset/shadow.png

640 KB
Loading

asset/shadow_bg_fit.png

640 KB
Loading

asset/shadow_bg_sx.png

553 KB
Loading

asset/shaow_bg_sy.png

453 KB
Loading

0 commit comments

Comments
 (0)