Skip to content

Commit 0924643

Browse files
committed
- add public api CaptureImage
1 parent 0fd0ae3 commit 0924643

File tree

3 files changed

+65
-27
lines changed

3 files changed

+65
-27
lines changed

README.md

+5-16
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,15 @@ Capture camera image and save to a specified path.
99
[Full Documentation](https://blightue.github.io/CameraImageCapture/)
1010

1111
## Installation instructions
12+
### Add the line below to `Packages/manifest.json`
1213

13-
### Unity package manager(Git)
14-
15-
1. Go to **Package Manager** window via `Window/Package Manager`
16-
2. Click the **add** ![img](https://docs.unity3d.com/uploads/Main/iconAdd.png) button in the status bar
17-
3. Select **Add package from git URL** from the add menu
18-
4. Fill the git URL with https://github.com/blightue/UnityCameraImageCapture.git and click **Add**
19-
20-
### Unity package manager(Local)
21-
22-
1. Download and unzip the source code to your disk
23-
2. Go to **Package Manager** window via `Window/Package Manager`
24-
3. Click the **add** ![img](https://docs.unity3d.com/uploads/Main/iconAdd.png) button in the status bar
25-
4. Select **Add package from disk** from the add menu
26-
5. Select the **package.json** file in the unzipped folder
14+
for version `1.0.0`
15+
```csharp
16+
"net.suisuishou.cameraimagecapture":"https://github.com/wolf-org/CameraImageCapture.git#1.0.0",
17+
```
2718

2819
## Quick Start
2920

30-
### Version 0.5.0 Update:
31-
3221
Recommend use component **Capture with config**
3322

3423
Create a config asset by click the plus button in the Project window and follow `Camera Image Capture/Capturer config`

RunTime/Photographer.cs

+59-10
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,87 @@ namespace SuiSuiShou.CIC.Core
88
public static class Photographer
99
{
1010
private static ImageCapture _imageCapture = new ImageCapture();
11-
11+
1212
/// <summary>
1313
/// Capture image resolution
1414
/// </summary>
15-
public static Vector2Int ImageResolution { get => _imageCapture.ImageResolution; set => _imageCapture.ImageResolution = value; }
15+
public static Vector2Int ImageResolution
16+
{
17+
get => _imageCapture.ImageResolution;
18+
set => _imageCapture.ImageResolution = value;
19+
}
20+
1621
/// <summary>
1722
/// Target camera for capturing
1823
/// </summary>
19-
public static Camera TargetCamera { get => _imageCapture.TargetCamera; set => _imageCapture.TargetCamera = value; }
24+
public static Camera TargetCamera
25+
{
26+
get => _imageCapture.TargetCamera;
27+
set => _imageCapture.TargetCamera = value;
28+
}
29+
2030
/// <summary>
2131
/// Image file write type
2232
/// </summary>
23-
public static WriteFileType WriteType { get => _imageCapture.WriteType; set => _imageCapture.WriteType = value; }
33+
public static WriteFileType WriteType
34+
{
35+
get => _imageCapture.WriteType;
36+
set => _imageCapture.WriteType = value;
37+
}
38+
2439
/// <summary>
2540
/// Image type
2641
/// </summary>
27-
public static ImageFormat ImageFormat { get => _imageCapture.ImageFormat; set => _imageCapture.ImageFormat = value; }
42+
public static ImageFormat ImageFormat
43+
{
44+
get => _imageCapture.ImageFormat;
45+
set => _imageCapture.ImageFormat = value;
46+
}
47+
2848
/// <summary>
2949
/// True for logging capture status
3050
/// </summary>
31-
public static bool IsLogCap { get => _imageCapture.IsLogCap; set => _imageCapture.IsLogCap = value; }
51+
public static bool IsLogCap
52+
{
53+
get => _imageCapture.IsLogCap;
54+
set => _imageCapture.IsLogCap = value;
55+
}
56+
3257
/// <summary>
3358
/// True for sequential image file name
3459
/// </summary>
35-
public static bool IsImageSerial { get => _imageCapture.IsImageSerial; set => _imageCapture.IsImageSerial = value; }
60+
public static bool IsImageSerial
61+
{
62+
get => _imageCapture.IsImageSerial;
63+
set => _imageCapture.IsImageSerial = value;
64+
}
65+
3666
/// <summary>
3767
/// True for changing ImageResolution in editor
3868
/// </summary>
39-
public static bool IsOverrideCameraResolution { get => _imageCapture.IsOverrideCameraResolution; set => _imageCapture.IsOverrideCameraResolution = value; }
69+
public static bool IsOverrideCameraResolution
70+
{
71+
get => _imageCapture.IsOverrideCameraResolution;
72+
set => _imageCapture.IsOverrideCameraResolution = value;
73+
}
74+
4075
/// <summary>
4176
/// Fold path for image file to writing
4277
/// </summary>
43-
public static string SaveFolderPath { get => _imageCapture.SaveFolderPath; set => _imageCapture.SaveFolderPath = value; }
78+
public static string SaveFolderPath
79+
{
80+
get => _imageCapture.SaveFolderPath;
81+
set => _imageCapture.SaveFolderPath = value;
82+
}
83+
4484
/// <summary>
4585
/// Image file name
4686
/// </summary>
47-
public static string FileName { get => _imageCapture.FileName; set => _imageCapture.FileName = value; }
87+
public static string FileName
88+
{
89+
get => _imageCapture.FileName;
90+
set => _imageCapture.FileName = value;
91+
}
4892

4993
/// <summary>
5094
/// Capture and save image file base on this singleton config
@@ -53,6 +97,11 @@ public static void CaptureAndSaveImage()
5397
{
5498
_imageCapture.CaptureAndSaveImage();
5599
}
100+
101+
public static Texture2D CaptureImage(int depth)
102+
{
103+
return _imageCapture.CaptureImage(TargetCamera, ImageResolution, depth);
104+
}
56105
}
57106

58107
internal class ImageCapture : ICameraImageCaptureCore

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "net.suisuishou.cameraimagecapture",
3-
"version": "0.6.5",
3+
"version": "1.0.0",
44
"displayName": "CameraImageCapture",
55
"description": "Capture camera image and save to a specified path.",
66
"unity": "2020.1",

0 commit comments

Comments
 (0)