상속: SKObject
예제 #1
0
		public static bool IsValid3DColorCube(SKData cubeData, int cubeDimension)
		{
			var minMemorySize = 4 * cubeDimension * cubeDimension * cubeDimension;
			return
				(cubeDimension >= MinColorCubeDimension) && (cubeDimension <= MaxColorCubeDimension) &&
				(null != cubeData) && (cubeData.Size >= minMemorySize);
		}
예제 #2
0
		public static SKImage FromData (SKData data)
		{
			if (data == null)
				throw new ArgumentNullException (nameof (data));
			var handle = SkiaApi.sk_image_new_from_encoded (data.Handle, IntPtr.Zero);
			return GetObject<SKImage> (handle);
		}
예제 #3
0
		public static SKColorFilter CreateColorCube(SKData cubeData, int cubeDimension)
		{
			if (cubeData == null)
				throw new ArgumentNullException(nameof(cubeData));
			if (!IsValid3DColorCube(cubeData, cubeDimension))
				throw new ArgumentException("Invalid cube data.", nameof(cubeData));
			return GetObject<SKColorFilter>(SkiaApi.sk_colorfilter_new_color_cube(cubeData.Handle, cubeDimension));
		}
예제 #4
0
파일: SKImage.cs 프로젝트: Core2D/SkiaSharp
        public static SKImage FromData(SKData data, SKRectI subset)
        {
            if (data == null)
                throw new ArgumentNullException ("data");

            var handle = SkiaApi.sk_image_new_from_encoded (data.Handle, ref subset);
            return GetObject<SKImage> (handle);
        }
예제 #5
0
 public static SKBitmap Decode(SKData data, SKImageInfo bitmapInfo)
 {
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     using (var codec = SKCodec.Create(data)) {
         if (codec == null)
         {
             return(null);
         }
         return(Decode(codec, bitmapInfo));
     }
 }
예제 #6
0
        public static SKImage FromEncodedData(byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (data.Length == 0)
            {
                throw new ArgumentException("The data buffer was empty.");
            }

            using (var skdata = SKData.CreateCopy(data)) {
                return(FromEncodedData(skdata));
            }
        }
예제 #7
0
        public static SKBitmap Decode(byte[] buffer, SKImageInfo bitmapInfo)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            fixed(byte *b = buffer)
            {
                using (var skdata = SKData.Create((IntPtr)b, buffer.Length))
                    using (var codec = SKCodec.Create(skdata)) {
                        return(Decode(codec, bitmapInfo));
                    }
            }
        }
예제 #8
0
        public static SKImageInfo DecodeBounds(byte[] buffer)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            fixed(byte *b = buffer)
            {
                using (var skdata = SKData.Create((IntPtr)b, buffer.Length))
                    using (var codec = SKCodec.Create(skdata)) {
                        return(codec?.Info ?? SKImageInfo.Empty);
                    }
            }
        }
예제 #9
0
        public static SKImage FromEncodedData(string filename)
        {
            if (filename == null)
            {
                throw new ArgumentNullException(nameof(filename));
            }

            using (var skdata = SKData.Create(filename)) {
                if (skdata == null)
                {
                    return(null);
                }
                return(FromEncodedData(skdata));
            }
        }
예제 #10
0
파일: SKImage.cs 프로젝트: KDet/SkiaSharp
        public static SKImage FromData(SKData data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            var handle = SkiaApi.sk_image_new_from_encoded(data.Handle, IntPtr.Zero);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new SKImage(handle));
        }
예제 #11
0
        public static SKImage FromEncodedData(ReadOnlySpan <byte> data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (data.Length == 0)
            {
                throw new ArgumentException("The data buffer was empty.");

                fixed(byte *b = data)
                {
                    using (var skdata = SKData.Create((IntPtr)b, data.Length)) {
                        return(FromEncodedData(skdata));
                    }
                }
        }
예제 #12
0
파일: SKImage.cs 프로젝트: mqp/SkiaSharp
 public static SKImage FromData(SKData data)
 {
     return(FromEncodedData(data));
 }
예제 #13
0
파일: SKImage.cs 프로젝트: mqp/SkiaSharp
 public static SKImage FromData(SKData data, SKRectI subset)
 {
     return(FromEncodedData(data, subset));
 }
예제 #14
0
        // Serialize

        public SKData Serialize() =>
        SKData.GetObject(SkiaApi.sk_picture_serialize_to_data(Handle));
예제 #15
0
 public MyUnmanagedMemoryStream(SKData host) : base((byte *)host.Data, host.Size)
 {
     this.host = host;
 }
예제 #16
0
 public static SKBitmap Decode(SKData data)
 {
     using (var codec = SKCodec.Create(data)) {
         return(Decode(codec));
     }
 }
예제 #17
0
		public static SKCodec Create (SKData data)
		{
			if (data == null)
				throw new ArgumentNullException (nameof (data));
			return GetObject<SKCodec> (SkiaApi.sk_codec_new_from_data (data.Handle));
		}
예제 #18
0
		public SKMemoryStream (SKData data)
			: this(SkiaApi.sk_memorystream_new_with_skdata (data), true)
		{
			if (Handle == IntPtr.Zero) {
				throw new InvalidOperationException ("Unable to create a new SKMemoryStream instance.");
			}
		}
예제 #19
0
		public static SKImageInfo DecodeBounds (SKData data)
		{
			if (data == null) {
				throw new ArgumentNullException (nameof (data));
			}
			using (var codec = SKCodec.Create (data)) {
				return codec.Info;
			}
		}
예제 #20
0
            protected override void Dispose(bool disposing)
            {
                base.Dispose(disposing);

                if (disposeHost)
                {
                    host?.Dispose();
                }
                host = null;
            }
예제 #21
0
        // create (data)

        public static SKCodec Create(SKData data)
        {
            if (data == null)
                throw new ArgumentNullException(nameof(data)); }
예제 #22
0
 public SKMemoryStream(SKData data)
     : this(SkiaApi.sk_memorystream_new_with_skdata(data))
 {
 }
예제 #23
0
 public SKData DetachAsData()
 {
     return(SKData.GetObject(SkiaApi.sk_dynamicmemorywstream_detach_as_data(Handle)));
 }
예제 #24
0
 public extern static sk_stream_memorystream_t sk_memorystream_new_with_skdata(SKData data);
예제 #25
0
 public static SKTypeface FromData(SKData data, int index = 0)
 {
     return(SKTypeface.FromStream(new SKMemoryStream(data), index));
 }
예제 #26
0
 public unsafe SKDataStream(SKData host, bool disposeHost = false)
     : base((byte*)host.Data, host.Size)
 {
     this.host = host;
     this.disposeHost = disposeHost;
 }
예제 #27
0
		public extern static sk_stream_memorystream_t sk_memorystream_new_with_skdata(SKData data);
예제 #28
0
        internal static SKData FromCString(string str)
        {
            var bytes = Encoding.ASCII.GetBytes(str ?? string.Empty);

            return(SKData.CreateCopy(bytes, (ulong)(bytes.Length + 1)));             // + 1 for the terminating char
        }
예제 #29
0
 public void DrawAnnotation(SKRect rect, string key, SKData value)
 {
     SkiaApi.sk_canvas_draw_annotation(Handle, ref rect, Util.GetEncodedText(key, SKTextEncoding.Utf8), value == null ? IntPtr.Zero : value.Handle);
 }
예제 #30
0
		public static SKBitmap Decode (SKData data, SKImageInfo bitmapInfo)
		{
			if (data == null) {
				throw new ArgumentNullException (nameof (data));
			}
			using (var codec = SKCodec.Create (data)) {
				return Decode (codec, bitmapInfo);
			}
		}
예제 #31
0
 public void DrawNamedDestinationAnnotation(SKPoint point, SKData value)
 {
     SkiaApi.sk_canvas_draw_named_destination_annotation(Handle, ref point, value == null ? IntPtr.Zero : value.Handle);
 }
예제 #32
0
 public static SKImage FromPixels(SKImageInfo info, SKData data) =>
 FromPixels(info, data, info.RowBytes);
예제 #33
0
 private SKColorFilter ToColorFilter(SKData uniforms) =>
 ToColorFilter(uniforms, null);
예제 #34
0
 static SKData()
 {
     empty = new SKDataStatic(SkiaApi.sk_data_new_empty());
 }
예제 #35
0
 public SKData Encode() =>
 SKData.GetObject(SkiaApi.sk_image_encode(Handle));
예제 #36
0
 public unsafe SKDataStream(SKData host, bool disposeHost = false)
     : base((byte *)host.Data, host.Size)
 {
     this.host        = host;
     this.disposeHost = disposeHost;
 }
예제 #37
0
 public SKData Encode(SKEncodedImageFormat format, int quality)
 {
     return(SKData.GetObject(SkiaApi.sk_image_encode_specific(Handle, format, quality)));
 }
예제 #38
0
 public void DrawUrlAnnotation(SKRect rect, SKData value)
 {
     SkiaApi.sk_canvas_draw_url_annotation(Handle, ref rect, value == null ? IntPtr.Zero : value.Handle);
 }
예제 #39
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     host = null;
 }
예제 #40
0
 public void DrawLinkDestinationAnnotation(SKRect rect, SKData value)
 {
     SkiaApi.sk_canvas_draw_link_destination_annotation(Handle, ref rect, value == null ? IntPtr.Zero : value.Handle);
 }
예제 #41
0
 public static SKImageInfo DecodeBounds(SKData data)
 {
     using (var codec = SKCodec.Create(data)) {
         return(codec.Info);
     }
 }