securesmartcam / app / src / main / java / org / witness / obscuracam / photo / filters / ConsentTagger.java @ 41590feb
History | View | Annotate | Download (1.33 KB)
1 |
package org.witness.obscuracam.photo.filters; |
---|---|
2 |
|
3 |
import java.util.Properties; |
4 |
|
5 |
import android.graphics.Bitmap; |
6 |
import android.graphics.Canvas; |
7 |
import android.graphics.RectF; |
8 |
|
9 |
public class ConsentTagger implements RegionProcesser |
10 |
{ |
11 |
Properties mProps;
|
12 |
private Bitmap mPreview;
|
13 |
|
14 |
public ConsentTagger ()
|
15 |
{ |
16 |
mProps = new Properties (); |
17 |
mProps.put("regionSubject", ""); |
18 |
mProps.put("informedConsent", "false"); |
19 |
mProps.put("persistObscureType", "false"); |
20 |
mProps.put("obfuscationType", this.getClass().getName()); |
21 |
} |
22 |
|
23 |
@Override
|
24 |
public void processRegion (RectF rect, Canvas canvas, Bitmap bitmap) |
25 |
{ |
26 |
// return properties and data as a map
|
27 |
mProps.put("initialCoordinates", "[" + rect.top + "," + rect.left + "]"); |
28 |
mProps.put("regionWidth", Float.toString(Math.abs(rect.left - rect.right))); |
29 |
mProps.put("regionHeight", Float.toString(Math.abs(rect.top - rect.bottom))); |
30 |
mPreview = Bitmap.createBitmap( |
31 |
bitmap, |
32 |
(int) rect.left,
|
33 |
(int) rect.top,
|
34 |
(int) Math.min(bitmap.getWidth(),(Math.abs(rect.left - rect.right))), |
35 |
(int) Math.min(bitmap.getHeight(), (Math.abs(rect.top - rect.bottom))) |
36 |
); |
37 |
} |
38 |
|
39 |
public Properties getProperties() |
40 |
{ |
41 |
return mProps;
|
42 |
} |
43 |
|
44 |
public void setProperties(Properties props) |
45 |
{ |
46 |
mProps = props; |
47 |
} |
48 |
|
49 |
@Override
|
50 |
public Bitmap getBitmap() {
|
51 |
// TODO Auto-generated method stub
|
52 |
return mPreview;
|
53 |
} |
54 |
} |