Create basic implementation of Shape
Summary: Create basic implementation of Shape (shadow node, props and component descriptor) changelog: [Internal] Internal changes to support art in Fabric Reviewed By: shergin Differential Revision: D21621482 fbshipit-source-id: e5b9bb2812ee92bce625301b7521f0578eaca0ff
This commit is contained in:
Родитель
a011eaf7e5
Коммит
12fee9af62
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/art/ARTShapeShadowNode.h>
|
||||
#include <react/core/ConcreteComponentDescriptor.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
using ARTShapeComponentDescriptor =
|
||||
ConcreteComponentDescriptor<ARTShapeShadowNode>;
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/components/art/ARTShapeProps.h>
|
||||
#include <react/core/propsConversions.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
ARTShapeProps::ARTShapeProps(
|
||||
const ARTShapeProps &sourceProps,
|
||||
const RawProps &rawProps)
|
||||
: Props(sourceProps, rawProps),
|
||||
|
||||
opacity(convertRawProp(rawProps, "opacity", sourceProps.opacity, {1.0})),
|
||||
transform(
|
||||
convertRawProp(rawProps, "transform", sourceProps.transform, {})),
|
||||
d(convertRawProp(rawProps, "d", sourceProps.d, {})),
|
||||
stroke(convertRawProp(rawProps, "stroke", sourceProps.stroke, {})),
|
||||
strokeDash(
|
||||
convertRawProp(rawProps, "strokeDash", sourceProps.strokeDash, {})),
|
||||
fill(convertRawProp(rawProps, "fill", sourceProps.fill, {})),
|
||||
strokeWidth(convertRawProp(
|
||||
rawProps,
|
||||
"strokeWidth",
|
||||
sourceProps.strokeWidth,
|
||||
{1.0})),
|
||||
strokeCap(
|
||||
convertRawProp(rawProps, "strokeCap", sourceProps.strokeCap, {1})),
|
||||
strokeJoin(convertRawProp(
|
||||
rawProps,
|
||||
"strokeJoin",
|
||||
sourceProps.strokeJoin,
|
||||
{1})){};
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
SharedDebugStringConvertibleList RawTextProps::getDebugProps() const {
|
||||
return {debugStringConvertibleItem("opacity", opacity)};
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/graphics/Geometry.h>
|
||||
#include <memory>
|
||||
|
||||
#include <react/core/Props.h>
|
||||
#include <react/debug/DebugStringConvertible.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class ARTShapeProps;
|
||||
|
||||
class ARTShapeProps : public Props {
|
||||
public:
|
||||
ARTShapeProps() = default;
|
||||
ARTShapeProps(const ARTShapeProps &sourceProps, const RawProps &rawProps);
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
Float opacity{1.0};
|
||||
std::vector<Float> transform{};
|
||||
std::vector<Float> d{};
|
||||
std::vector<Float> stroke{};
|
||||
std::vector<Float> strokeDash{};
|
||||
std::vector<Float> fill{};
|
||||
Float strokeWidth{1.0};
|
||||
int strokeCap{1};
|
||||
int strokeJoin{1};
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "ARTShapeShadowNode.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
extern const char ARTShapeComponentName[] = "ARTShape";
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/art/ARTShapeProps.h>
|
||||
#include <react/core/ConcreteShadowNode.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
extern const char ARTShapeComponentName[];
|
||||
|
||||
/*
|
||||
* `ShadowNode` for <ARTShape> component.
|
||||
*/
|
||||
using ARTShapeShadowNode =
|
||||
ConcreteShadowNode<ARTShapeComponentName, ShadowNode, ARTShapeProps>;
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
Загрузка…
Ссылка в новой задаче