Code Monkey home page Code Monkey logo

mono / skiasharp Goto Github PK

View Code? Open in Web Editor NEW
4.1K 121.0 517.0 52.94 MB

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.

License: MIT License

C# 97.18% PowerShell 1.26% Shell 0.26% Makefile 0.03% C 0.03% Dockerfile 0.23% HTML 0.02% JavaScript 0.61% TypeScript 0.30% Python 0.01% C++ 0.04% Batchfile 0.02%
xamarin graphics dot-net ios android windows macos cross-platform skia dotnet

skiasharp's Introduction

SkiaSharp

SkiaSharp HarfBuzzSharp

SkiaSharp.Views SkiaSharp.Views.Maui.Controls SkiaSharp.Views.Uno

discord SkiaSharp API Docs HarfBuzzSharp API Docs SkiaSharp Guides

Build Status Build Status

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library (skia.org). It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.

SkiaSharp provides cross-platform bindings for:

  • .NET Standard 1.3
  • .NET Core
  • .NET 6
  • Tizen
  • Android
  • iOS
  • tvOS
  • macOS
  • Mac Catalyst
  • WinUI 3 (Windows App SDK / Uno Platform)
  • Windows Classic Desktop (Windows.Forms / WPF)
  • Web Assembly (WASM)
  • Uno Platform (iOS / macOS / Android / WebAssembly)

The API Documentation is available on the web to browse.

Using SkiaSharp

SkiaSharp is available as a convenient NuGet package, to use install the package like this:

nuget install SkiaSharp

Because there are multiple distros of Linux, and we cannot possibly support them all, we have a separate NuGet package that will contain the supported binaries for a few distros: SkiaSharp.NativeAssets.Linux. (distros) (more info)

There is also a early access feed that you can use to get the latest and greatest, before it goes out to the public:

https://aka.ms/skiasharp-eap/index.json

Building SkiaSharp

Building SkiaSharp is mostly straight forward. The main issue is the multiple dependencies for each platform.

However, these are easy to install as they are found on the various websites. If you are just working on managed code, it is even easier as there mays to skip all the native builds.

  • To get started building, go here.
  • If you are just wanting a custom Linux build, go here

Compare Code

Here are some links to show the differences in our code as compared to Google's code.

What version are we on? m116
Are we up-to-date with Google? Compare
What have we added? Compare

skiasharp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skiasharp's Issues

Could you support AppleTV ?

I'm looking to write an app that requires custom charts, so SkiaSharp is looking interesting.

Would you be supporting AppleTV?

I plan to target AppleTV, Android TV setups (not sure what they are called), MacOS, iOS (iPad, iPhone), Android (phones and tablets), Windows desktop and maybe phone (Win 10?).

Thanks,
Rob.

On iOS the render result is vertically flipped

Tried rendering with SKCanvas on iOS and the resulting raster is vertically flipped (as if origin is bottom-left corner and Y grows up). I worked around this by concatenating scale/translation matrices to the canvas.

This vertical flipping is most likely some OS X related default being applied on iOS?

NullReferenceException when creating SkCanvas backed by a WriteableBitmap

The following code from https://github.com/impsnldavid/skiasharpwpfextensions fails randomly with a NullReferenceException when the SkCanvas is constructed.

The member variable _bitmap is a WriteableBitmap

        protected override void OnRender(DrawingContext dc)
        {
            if (_bitmap == null)
                return;

            _bitmap.Lock();

            using (var surface = SKSurface.Create((int)_bitmap.Width, (int)_bitmap.Height, 
                SKColorType.N_32, SKAlphaType.Premul, _bitmap.BackBuffer, _bitmap.BackBufferStride))
            {
                if (IsClearCanvas)
                    surface.Canvas.Clear(_canvasClearColor);

                Draw(surface.Canvas, (int)_bitmap.Width, (int)_bitmap.Height);
            }

            _bitmap.AddDirtyRect(new Int32Rect(0, 0, (int)_bitmap.Width, (int)_bitmap.Height));
            _bitmap.Unlock();

            dc.DrawImage(_bitmap, new Rect(0, 0, ActualWidth, ActualHeight));
                }

The exception randomly occurs on calls to surface.Canvas.Clear(_canvasClearColor);

The NullReferenceException is wrapped in a TargetInvocationException. Here are the call stacks:

Inner NullReferenceException Stack Trace

   at SkiaSharp.SKObject.RegisterHandle(IntPtr handle, SKObject instance)
   at SkiaSharp.SKCanvas..ctor(IntPtr handle)

TargetInvocationException Stack Trace

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at SkiaSharp.SKObject.GetObject[TSkiaObject](IntPtr handle)
   at SkiaSharp.WpfExtensions.SkiaControl.OnRender(DrawingContext dc) in C:\Users\_\Documents\GitHub\skiasharpwpfextensions\src\Imp.SkiaSharpWpfExtensions\SkiaControl.cs:line 83
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at Imp.SkiaSharpWpfExtensions.Example.App.Main() in C:\Users\magnu_000\Documents\GitHub\skiasharpwpfextensions\src\Imp.SkiaSharpWpfExtensions.Example\obj\x64\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

My guess is that the reason this is happening is the following lines of code in SKObject:

var shouldReplace =
              reference == null ||
              reference.Target != null ||
              ((SKObject)reference.Target).Handle == IntPtr.Zero;

Lets assume that reference is not null but the Target property is.

  • reference == null would be false.
  • reference.Target != null would be false

Since both the above expressions evaluate to false it is necessary to evaluate the last expression as well. But in this case Target is null and this is what is causing the exception.

Get it working on general Mono and ARM devices

Hi,

Would be good if we have SkiaSharp working on general Mono instead of just on Xamarin iOS/Android. I know that nothing on current binding stop us to have it working on Mono however, build Skia native libs is a process not very well documented and with lots of tricks. If we could have guide on how to build it (at least the SkiaSharp fork) to ARMv6/v7 and other platforms, would be perfect.

As SkiaSharp home page said, we have lots of problems with Cairo that just can't be fixed today so would be perfect to remove it with Skia and SkiaSharp.

Good work!

Thanks!

On-screen rendering and ganesh backend support

Do you plan to add hardware acceleration support? I have some native code for win/linux/ios/android that we use in Perspex for hw-accelerated drawing using Skia. For Windows it will add dependency on ANGLE, but performance improvements are worth of adding such dependency.

SKPath iteration

It would be nice to wrap the SKPath::Iter class for iterating over paths.

Augmented API for Rectangles, Points, Sizes

Currently we use a barebones implementation of those structures.

While we need to keep the structure fields in the same order, we should copy/paste the code for RectangleF and Rectangle into SKRect; PointF/PointI into SKPoint and so on.

Support for more functionality in Typeface

I need to get the real typeface used by the SKTypeface when you create it, if font substitution happens.

From what I see in the Skia C++ docs, I would need to expose the method:

void SkTypeface::getFamilyName (SkString * name) const

I think it could be added as a method GetFamilyName() in the SKTypeface C# type. It could also be a property FamilyName, but I am not sure about the performance implications if we don't cache the family name and call getFamilyName each time you call the property.

I would also need to expose a method GetTables() and GetTableTags() which would be wrappers around SKTypeface::getTableTags and SKTypeface::getTableData.

As none of those methods are in the C wrappers, I would have to also modify the C headers.

Is it ok if I add those methods and make a pull request, or maybe someone else is working on this already? If I add them myself, I assume I would have to add some tests too, but what about docs? I don't see xmldocs used in the binding SKTypeface.cs, so I think you are using a different tool for the docs?

SVG support?

Are you working on or planning to support SVG?

Being able to load a SVG document and then rasterize it to export as e.g. PNG would be immensely valuable.

Change the native library names to libSkiaSharp

I have just been working with @galvesribeiro to get SkiaSharp onto a ARM v6l Linux device (yay!) #18. One of the issues was that we had to re-build SkiaSharp just so that we could change the native library name in the [DllImport].

What are the opinions of changing the native library name to a uniform libSkiaSharp so that future Linux (or any other "normal" builds) can just use the Desktop assembly?

We might even remove the need for the .dll.config file currently. (just a guess)

Build error with VS 2015

I'm seeing a build error with Visual Studio 2015 Update 2 (community edition) on 64-bit Windows 7.

"C:\...\SkiaSharp\native-builds\libskia_windows\libskia_windows_x64.sln" (Build target) (1) ->
"C:\...\SkiaSharp\skia\out\gyp\core.vcxproj" (default target) (6) ->
(ClCompile target) ->
  ..\..\src\core\SkVarAlloc.cpp(48): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits
(was 64-bit shift intended?) [C:\...\SkiaSharp\skia\out\gyp\core.vcxproj]

And the build doesn't complete:

 ..\..\src\core\SkVarAlloc.cpp(48): error C2220: warning treated as error

Some searching around turned up this skia upstream bug: https://bugs.chromium.org/p/chromium/issues/detail?id=593448. I don't think it's been fixed upstream yet, but they have identified a workaround, which is to suppress warning C4334.

By applying the following patch in skia, this issue is resolved:

diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index cf43271..3cc5dfb 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -54,6 +54,7 @@
             4275,  # An exported class was derived from a class that was not ex
             4345,  # This is an FYI about a behavior change from long ago. Chro
             4355,  # 'this' used in base member initializer list. Off by defaul
+            4334,
         ],
         'msvs_cygwin_shell': 0,
         'msvs_settings': {

I don't know that this should be an open issue on SkiaSharp, but I figured it was worth documenting so others don't have to duplicate the effort.

Having problem cloning repro in Visual Studio 2015 Update 2

I'm getting this message when trying to clone the repro:
"The repository was cloned, but an error was encountered while recursively cloning submodules. Error message: The top level repository was cloned, but there was an error cloning its submodules."

I don't have issues with other repros and github.

Thanks!

SKImage.FromData (SKData data)

We should provide an overload that does not require the SKRectI, so that the size is automatically computed, this is achieved by passing a null on the second parameter (will require another PInvoke signature)

Support for SkColor HSV <-> RGB

It'd be great to wrap these Skia functions from SkColor: SkRGBToHSV and SkHSVToColor.

I've already started work on this, but I figured there should be an issue open so that it can be discussed. One problem I'm having already (it would be great if someone can chime in) is how to add a new file sk_color.{cpp,h} to the Skia C API. I've modified the core.gypi file to include it, and it is compiling, but doesn't seem to be linking it into libskia_windows.dll.

SkDocument PDF output support

This looks very cool, PDF output via SkDocument would be a useful addition. Although it is not exposed via the Skia C API it looks at first glance to be a pretty simple class.

.NET conform xml documentation file for SkiaSharp.dll

It would be great to have such a file to get help texts in the IDE when working with the SkiaSharp.dll.

I was not able to find such a file in the nuget distribution. Can i find it somewhere else? If not, is it planned?

React to user input

I am not sure if this is meant to be part of SkiaSharp, but I was searching through the docs about a way to actually react to user input such as touch gestures.
Reason being, I would like to convert my android drawing app to use shiasharp instead of the drawing canvas api in order to make it kinda platform independant.

Are there any plans to introduce such features at any time? Or are they already there and I missed them?

Sorry for not asking in stackoverflow - I was not sure if you guys would read it there...

Thank you so much for clarifying things!

Trouble compiling, Missing some files included in SkiaKeeper.c

Hey guys, not sure if this is the place to ask, but I'm trying to compile SkiaSharp via the instructions and some files are missing that are referenced in SkiaKeeper.c, specifically sk_typeface.h, sk_stream.h, and sk_bitmap.h.

Edit: found them. Now hitting different problems with compilation.

SkiaFormsDemoiOS fails to build

I have latest of Visual Studio 2015 Update 2 & latest samples.
It seems to connect to Mac, but I get this error:

1>------ Rebuild All started: Project: Skia.Forms.Demo, Configuration: Debug Any CPU ------
1> Skia.Forms.Demo -> C:\Users\Alan\Source\Repos\SkiaSharp4\samples\Skia.Forms.Demo\bin\Debug\Skia.Forms.Demo.dll
2>------ Rebuild All started: Project: Skia.Forms.Demo.iOS, Configuration: Debug iPhoneSimulator ------
2> Generated session id: 3fdec0ee21268ffdc7262eca8ff7ce40
2> Generated build app name: SkiaFormsDemoiOS
2> Connecting to Mac server iMac.local...
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(996,3): warning : The app icon set "AppIcons" has an unassigned child.
2> Skia.Forms.Demo.iOS -> C:\Users\Alan\Source\Repos\SkiaSharp4\samples\Skia.Forms.Demo\iOS\bin\iPhoneSimulator\Debug\SkiaFormsDemoiOS.exe
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(673,3): error : Unknown command line argument: '--target-framework'
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(673,3): error : You should provide one root assembly only, found 2 assemblies: 'Xamarin.iOS,v1.0', 'bin/iPhoneSimulator/Debug/SkiaFormsDemoiOS.exe'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

Handling return strings from C

Hi,
Trying to implement a method that returns a string, I wonder if there is any "standard" for skia/skiasharp in how to do it.

I looked at what is already implemented, but the only methods that return strings seem to be:

const char* sk_imagedecoder_get_format_name_from_format (sk_imagedecoder_format_t cformat);
const char* sk_imagedecoder_get_format_name_from_decoder (sk_imagedecoder_t* cdecoder);

And they don't seem to work fine. They aren't either in the "official" skia distribution yet ( https://github.com/google/skia/tree/master/include/c )

The main issue is with memory management. For example, sk_imagedecoder_get_format_name_from_decoder returns a char* which is generated here:

const char* SkImageDecoder::GetFormatName(Format format) {
    switch (format) {
        case kUnknown_Format:
            return "Unknown Format";
        case kBMP_Format:
            return "BMP";
        case kGIF_Format:
            return "GIF";
 ...

So in this case we are returning constants, and no memory is allocated in the C side. But on the other hand, they shouldn't be deallocated by the C# bindings either.
The current binding declaration is:

        [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
        public extern static string sk_imagedecoder_get_format_name_from_decoder(sk_imagedecoder_t cdecoder);

And accodring to this:
http://stackoverflow.com/questions/370079/pinvoke-for-c-function-that-returns-char
This means that the CLR assumes it needs to free the native memory, and that the memory was allocated with CoTaskMemAlloc. None of this is true, in fact, I don't even know which would be the assumptions in OSX or somewhere else where CoTaskMemAlloc don't exist. As the CLR will try to free the unmanaged memory, but that memory was a constant (and not allocated with CoTaskMemAlloc), this should crash.
And indeed, if I try:

            var ms = new FileStream("r:\\test.png", FileMode.Open);
            var mst = new SKManagedStream(ms);
            SKImageDecoder k = new SKImageDecoder(mst);
            string s = k.FormatName;

The app crashes.

So, given that there doesn't seem to be any example of returning strings in the original bindings, and the new ones don's seem to work correctly, I think it would be important to determine an standard on how to return strings from the C api. I could add my own function (GetFontName) with my own specification, but then other functions returning strings would be either inconsistent or forced to follow what I did. Functions returning strings shouldn't be very common in a graphics API, but still I think it is a good thing to have an standard.
some ideas:

  1. We could use something similar to MultiByteToWideChar in Windows ( https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx )
    In this case, you would define a function that returns the lenght of the needed buffer and copies characters to the buffer if it is not null. So you call the function 2 times:
//pseudocode
GetFontName(&len, NULL);
malloc(buffer, len);
GetFontName(len, buffer);

In the first call you get the size of the needed buffer, then you allocate the buffer and call it again to get the characters copied into the buffer.

Probably the drawback of this is that it is prone to errors, and confessions between char counts and byte counts.
As it says on the top of the linked page fro MultiByteToWideChar:

Caution Using the MultiByteToWideChar function incorrectly can compromise the security of your application. Calling this function can easily cause a buffer overrun because the size of the input buffer indicated by lpMultiByteStr equals the number of bytes in the string, while the size of the output buffer indicated by lpWideCharStr equals the number of characters. To avoid a buffer overrun, your application must specify a buffer size appropriate for the data type the buffer receives. For more information, see Security

The advantage is that memory is allocated and freed in the client.

2)We could have the memory allocated in the C api, and require the calling application to call some
SKIA_FREE(buffer)
when it is done using the buffer.
It makes it more difficult to have buffer overflows, but it makes it simpler to forget to call SKIA_FREE and call the standard Free in the client side and cause a crash.

3)We could return SKString objects, which would have to be freed like any other Skia object. But we still would have to determine if the SKString owns the memory or not when you get the string from the Skia object. Given that I don't expect many methods returning strings, I think creating a SKString wrapper is probably overkill.

This is what I can think of. Any other ideas?

Please add support for SVG assets!

If SkyaSharp doesn't support SVG is useless at the moment. Not supporting SVG for a vector library is like not supporting PNG for a bitmap library. I use SVG assets in my Xamarin apps thanks to the NGraphics library, and I have many advantages:

  • SMALLER APP FOOTPRINTS : SVG files are so small you can have your entire app graphics in less than 10k!
  • FAST DEVELOPMENT - No need to code for creating the views. All the UI controls that once needed DAYS or even WEEKS to code, now are made in a couple of minutes in Inkscape. Productivity boost never seen before!
  • EASY TO MODIFY FOR ARTISTS : my graphic artist works with Inkscape and it can edit the SVG files directly, no need to ask me to modify the code to make them work. He can update on the git the svg assets every day and test the changes by himself. And this even at the last moment! It's an amazing workflow!
  • PORTABLE AND INDEPENDENT : No more graphic assets to use just once and then thrashed. The SVG assets you make for iOS you can reuse on Android, Windows, Linux versions of your app and on the web app too, with no changes. Also you do not depend on a single graphician or artist anymore. I can hire any pro to make my assets, and they can deliver them in SVG or change the existing one if they replaced another artist in the same project. Inkscape is also multiplatform, you can edit SVG assets on every computer you have!

This is why I really hope that Xamarin goes the way of NGraphics and add support for SVG assets to SkyaSharp. PLEASE.

Some of my SVG assets (I made them in Inkscape):

ios_app_buttons

You can download the original svg file from my google drive (click on the download button):
http://goo.gl/m7TbmM

Feel free to use them!

For an easier debug, here it is a splitted version of the two main buttons svg files, you can download the zip from here:
https://drive.google.com/file/d/0BxexooDWEb8ublZlcm5yRWpXTzQ/view?usp=sharing

Access Violation when trying to save as anything but png or jpg

Trying the following code raises and AV:

    class Program
    {
        static void Main(string[] args)
        {
            SKBitmap bmp = new SKBitmap(10, 10);
            IntPtr len;
            SKImage img = SKImage.FromPixels(bmp.Info, bmp.GetPixels(out len), bmp.RowBytes);
            SKData data = img.Encode(SKImageEncodeFormat.Gif, 10);
            using (FileStream fs = new FileStream("..\\..\\test.gif", FileMode.Create))
            {
                data.SaveTo(fs);
            }

        }
    }

I am not sure if I am doing somehting wrong in the code, but it works with png and jpeg. The others fail with and AV.

Support for SkRegion in the future?

I would love to see support for SkRegion, plus more exposure of SkPath. In particular, I'm interested in being able to create an SKRegion from and SkPath, do operations on SkRegion such as intersect, union, subtract, containment, and get the bounary of an SkRegion as an SkPath. Finally, being able to enumerate an SkPath to get all of its components.

All of this is supported in the Skia C++ library; it would be really nice to use this from C#.

All of these operations can be useful in a 2D application even apart from drawing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.