blob: acf962dd0780227914b923d0126ae6a9df95ead5 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.ui.sketchy;
// Specifies the type of a resource created via CreateResourceCmd, along with
// any other required data.
union ResourceArgs {
Stroke stroke;
StrokeGroup stroke_group;
Pen pen;
WobblyStyle wobbly_style;
ExplicitWidthStyle explicit_width_style;
};
// A stroke has a path which is tessellated and rendered as a Mesh when its
// containing stroke-group is inserted into the Scenic scene-graph by attaching
// it to an imported Scenic node. A stroke can belong to at most a single
// stroke-group; to add a stroke to another group it must first be detached from
// the current one.
//
// A stroke is said to be 'empty' when its path has not been changed (via
// SetPath or Begin/Extend/FinishStroke) since it was created, or the last time
// that Clear was called.
//
// Commands:
// - ClearStroke
// - SetStrokePath
// - SetStrokeStyle
// - AddStroke (as arg)
// - BeginStroke (as arg)
// - ExtendStroke (as arg)
// - FinishStroke (as arg)
struct Stroke {
};
// A stroke-group is a container of strokes, which can be inserted into a Scenic
// scene-graph by importing adding it as a child of an imported |fuchsia.ui.gfx.Node|.
//
// Commands:
// - ClearGroup
// - AddStroke
// - RemoveStroke
// - fuchsia.ui.gfx.Detach
// - fuchsia.ui.gfx.AddChild (as arg)
struct StrokeGroup {
};
// A pen handles user input to create a path for a stroke.
// TODO(SCN-246): expose access to stroke-fitter parameters.
//
// Commands:
// - BeginStroke
// - ExtendStroke
// - FinishStroke
// - SetPenStyle
struct Pen {
};
// The classic Escher Sketcy Demo wobbly style that you know and love.
//
// Commands:
// - SetPenStyle (as arg).
// - SetStrokeStyle (as arg).
struct WobblyStyle {
float32 speed1;
float32 amplitude1;
float32 frequency1;
float32 speed2;
float32 amplitude2;
float32 frequency2;
float32 speed3;
float32 amplitude3;
float32 frequency3;
};
// Allows clients to provide a list of float32s that are sampled along the stroke,
// proportionally to the arc-length of the stroke. An example use-case is a
// to visualize the frequency spectrum of an audio signal.
//
// Commands:
// - SetPenStyle (as arg)
// - SetStrokeStyle (as arg).
struct ExplicitWidthStyle {
vector<float32> vals;
};