X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FCapture.cs;h=af2fd4aa74fe924716751de0e8f49cc9fef13a4b;hb=cbc87d1fb05eeff93b220484598e0e42c44ad283;hp=06dc9cf69f6e84714ba5ac2a873ff06a60d7c60f;hpb=297495f8f70af165e97f571bdf3a2ff21cccab68;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Capture.cs b/src/Tizen.NUI/src/public/Capture.cs index 06dc9cf..af2fd4a 100755 --- a/src/Tizen.NUI/src/public/Capture.cs +++ b/src/Tizen.NUI/src/public/Capture.cs @@ -44,6 +44,9 @@ namespace Tizen.NUI /// else { //capture failure, do something. } /// } /// + /// suppose that we want to capture View 'A'. And, the View 'A' is overlapped by another View 'B' that is not a child of 'A'. + /// in this case, if source is root of scene, the captured image includes a part of View 'B' on the 'A'. + /// however, if source is just View 'A', the result includes only 'A'. /// [EditorBrowsable(EditorBrowsableState.Never)] public class Capture : BaseHandle @@ -93,7 +96,77 @@ namespace Tizen.NUI /// /// Start capture and save the image as a file. /// - /// source View or Layer to be used for capture. + /// source View or Layer to be used for capture. + /// This source must be added on the window in advance. + /// top-left position of area to be captured. + /// this position is defined in the window. + /// captured size. + /// image file path to be saved as a file. + /// If path is empty string, the captured result is not be saved as a file. + /// background color of captured scene. + /// This exception can be due to the invalid size values, of when width or height is lower than zero. + /// This exception is due to the path is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Start(Container source, Position position, Size size, string path, Color color ) + { + if (size.Width <= 0 || size.Height <=0) + { + throw new InvalidOperationException("size should larger than zero"); + } + else if (null == path) + { + throw new ArgumentNullException("path should not be null"); + } + + if (source is View || source is Layer) + { + Interop.Capture.Start4(swigCPtr, source.SwigCPtr, new Vector2(position.X, position.Y).SwigCPtr, new Vector2(size.Width, size.Height).SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Start capture and save the image as a file. + /// + /// source View or Layer to be used for capture. + /// This source must be added on the window in advance. + /// captured size. + /// image file path to be saved as a file. + /// If path is empty string, the captured result is not be saved as a file. + /// background color of captured scene. + /// The value to control image quality for jpeg file format in the range [1, 100]. + /// This exception can be due to the invalid size values, of when width or height is lower than zero. + /// This exception is due to the path is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Start(Container source, Size size, string path, Color color, uint quality ) + { + if (size.Width <= 0 || size.Height <=0) + { + throw new InvalidOperationException("size should larger than zero"); + } + else if (null == path) + { + throw new ArgumentNullException("path should not be null"); + } + else if (quality > 100) + { + throw new InvalidOperationException("quality should between 0 to 100"); + } + + if (source is View || source is Layer) + { + Interop.Capture.Start3(swigCPtr, source.SwigCPtr, new Vector2(size.Width, size.Height).SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr, quality); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Start capture and save the image as a file. + /// + /// source View or Layer to be used for capture. + /// This source must be added on the window in advance. /// captured size. /// image file path to be saved as a file. /// If path is empty string, the captured result is not be saved as a file. @@ -126,7 +199,8 @@ namespace Tizen.NUI /// /// Background color of captured scene is transparent. /// - /// source View or Layer to be used for capture. + /// source View or Layer to be used for capture. + /// This source must be added on the window in advance. /// captured size. /// image file path to be saved as a file. /// If path is empty string, the captured result is not be saved as a file. @@ -152,6 +226,22 @@ namespace Tizen.NUI } } + /// + /// Set result image quality in case of jpeg. + /// + /// quality The value to control image quality for jpeg file format in the range [1, 100] + /// This exception can be due to the invalid size values, of when quality is lower than zero or over than 100. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetImageQuality(uint quality) + { + if (quality < 0 || quality > 100) + { + throw new InvalidOperationException("quality should between zero to 100"); + } + + Interop.Capture.SetImageQuality(swigCPtr, quality); + } + private void onFinished(IntPtr data, int state) { if (data != IntPtr.Zero)