All Projects → dotnet-ad → Skiasharp.components

dotnet-ad / Skiasharp.components

Licence: mit
Rendered components for an easier declaration of SkiaSharp rendering.

Projects that are alternatives of or similar to Skiasharp.components

Smart-Inspector
Fluent re-take on Unity Inspector UX. Packed with QoL improvements.
Stars: ✭ 680 (+979.37%)
Mutual labels:  components, helpers
Stylable
Stylable - CSS for components
Stars: ✭ 1,109 (+1660.32%)
Mutual labels:  components
React Values
A set of tiny React components for handling state with render props.
Stars: ✭ 1,025 (+1526.98%)
Mutual labels:  components
Scalajs Bootstrap
Scala.js bootstrap components
Stars: ✭ 55 (-12.7%)
Mutual labels:  components
React Components
React components
Stars: ✭ 47 (-25.4%)
Mutual labels:  components
Nestia
Automatic SDK and Document generator for the NestJS
Stars: ✭ 57 (-9.52%)
Mutual labels:  helpers
N3 Components
N3-components , Powerful Vue UI Library.
Stars: ✭ 1,012 (+1506.35%)
Mutual labels:  components
Bootstrap For Vue
Use https://bootstrap-vue.js.org instead.
Stars: ✭ 62 (-1.59%)
Mutual labels:  components
Aem Core Cif Components
A set of configurations and components to get you started with AEM Commerce development
Stars: ✭ 60 (-4.76%)
Mutual labels:  components
Testing Jest Enzyme
List of components and tests for post "React Components Testing with Jest & Enzyme"
Stars: ✭ 54 (-14.29%)
Mutual labels:  components
Antmove
小程序转换器,基于支付宝/微信小程序, 轻松地转换成其它平台的小程序。
Stars: ✭ 1,078 (+1611.11%)
Mutual labels:  components
Oc
OpenComponents, serverless in the front-end world for painless micro-frontends delivery
Stars: ✭ 1,049 (+1565.08%)
Mutual labels:  components
Dotnetify Elements
Backend-ready React components for .NET web apps.
Stars: ✭ 58 (-7.94%)
Mutual labels:  components
Vuedarkmode
👩‍🎨👨‍🎨 A minimalist dark design system for Vue.js. Based components designed for the insomniacs who enjoy dark interfaces as much as we do.
Stars: ✭ 1,034 (+1541.27%)
Mutual labels:  components
Ivory
A modern CSS framework for developing powerful web interfaces faster and easier.
Stars: ✭ 61 (-3.17%)
Mutual labels:  components
Tail Kit
Tail-kit is a free and open source components and templates kit fully coded with Tailwind css 2.0.
Stars: ✭ 997 (+1482.54%)
Mutual labels:  components
Blazorcomponents
Simple reusable Blazor component library
Stars: ✭ 53 (-15.87%)
Mutual labels:  components
Componette Site
➿ Addons, plugins, components and extensions (@componette ❤️ @nette)
Stars: ✭ 56 (-11.11%)
Mutual labels:  components
Elenext
A Vue.js 3.0 UI Toolkit for Web, Elenext by Vue 3.0
Stars: ✭ 63 (+0%)
Mutual labels:  components
Design System Starter
🚀 The Australian Government Design System - Starter
Stars: ✭ 61 (-3.17%)
Mutual labels:  components

SkiaSharp.Components

NuGet Donate

Producing rendering code for SkiaSharp can be extremely verbose and repetitive. SkiaSharp.Components are higher level views that make declarations more concise.

Quickstart

var result = new Grid();

this.Title = new Label
{
    TextSize = 30,
    Text = "Title of the view",
    VerticalAlignment = Alignment.Center,
};

this.Description = new Label
{
    TextSize = 16,
    Spans = new[]
    {
        new Span
        {
            Text = "Nam ut imperdiet nibh. Ut sollicitudin varius nibh,"
        },
        new Span
        {
            ForegroundBrush = new ColorBrush(new SKColor(0xFFF44336)),
            Decorations = TextDecoration.Bold,
            Text = "id ornare tortor convallis sed"
        },
        new Span
        {
            Text = ". Morbi volutpat, lacus efficitur volutpat lacinia, nibh velit ultricies neque, vel faucibus tellus neque at nibh. Nullam vitae tincidunt metus. Vestibulum nec nisl quis lorem tincidunt maximus eu vel lectus. Proin posuere augue molestie imperdiet scelerisque. Phasellus quis suscipit neque."
        },
    },
};

var gradient = new GradientBrush(new SKPoint(0, 0), new SKPoint(0, 1), new[]
{
    new Tuple<float, SKColor>(0, new SKColor(255,255,255,255)),
    new Tuple<float, SKColor>(1, new SKColor(238,238,238,255)),
});

var shadow = new Shadow()
{
    Blur = new SKPoint(10, 10),
    Color = SKColors.Black.WithAlpha(80),
};

this.Image = new Image()
{
    Source = "https://source.unsplash.com/random",
    Fill = new ColorBrush(SKColors.LightGray),
    CornerRadius = 5.0f,
    Shadow = shadow,
};

this.Box = new Box()
{
    Fill = gradient,
    CornerRadius = 5.0f,
    Shadow = shadow,
};

var iconGradient = new GradientBrush(new SKPoint(0, 0), new SKPoint(1, 1), new[]
{
    new Tuple<float, SKColor>(0, new SKColor(0xFFF44336)),
    new Tuple<float, SKColor>(1, new SKColor(0xFF3F51B5)),
});

this.Icon = new Path
{
    Source = IconPath.Aperture,
    ViewBox = SKRect.Create(0, 0, 24, 24),
    Stroke = new Stroke()
    {
        Size = 5,
        Brush = iconGradient,
    },
};

// Setting grid column and rows
result.ColumnDefinitions = new[]
{
    Grid.Definition.Points(100),
    Grid.Definition.Stars(1),
};

result.RowDefinitions = new[]
{
    Grid.Definition.Points(100),
    Grid.Definition.Points(200),
    Grid.Definition.Stars(1),
};

// Setting child positions
result.AddView(this.Icon, 0, 0);
result.AddView(this.Title, 1, 0);
result.AddView(this.Box, 0, 1, 2);
result.AddView(this.Description, 0, 1, 2);

result.Layout(SKRect.Create(0,0,500,500));
result.Render(canvas);

Advanced usage

Invalidation

Each time a property of a view changes, the Invalidated event of a view is raised. This is useful to know when to re-render a view.

Interactions

Basic interactions are available through the Tap control which raises events when the user touches its frame. It is a view like any other components.

this.Button = new Tap()
{
    BackgroundBrush = new ColorBrush(SKColors.DeepPink),
    CornerRadius = 5,
};

this.Button.Tapped += (s,e) => Debug.WriteLine("Tapped");
this.Button.Pressed += (s, e) => ((Tap)s).BackgroundBrush = new ColorBrush(SKColors.LightPink);
this.Button.Released += (s, e) => ((Tap)s).BackgroundBrush = new ColorBrush(SKColors.DeepPink);

If you use provided Renderer, touches will be wired up automatically.

Contributions

Contributions are welcome! If you find a bug please report it and if you want a feature please report it.

If you want to contribute code please file an issue and create a branch off of the current dev branch and file a pull request.

License

MIT © Aloïs Deniel

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].