-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a new and improved syntax for drawing styles
The new syntax is more consistent and allows users to specify multiple stroke/fill types per draw command. This change also introduces new drawing style structs. Note that the new type names use snake case and don't follow the previous naming convention of using capitalized names for types. This will eventually be cleaned up by either changing everything to snake case or by capitalizing the new type names.
- Loading branch information
Showing
53 changed files
with
834 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* This file is part of the "clip" project | ||
* Copyright (c) 2020 Paul Asmuth | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "path.h" | ||
#include "style_util.h" | ||
|
||
namespace clip::draw { | ||
|
||
ReturnCode path(const path_op& op, Layer* layer) { | ||
DrawCommand shape; | ||
shape.path = op.path; | ||
shape.style = op.style; | ||
|
||
if (!style_is_visible(shape.style)) { | ||
shape.style = layer->draw_default_style; | ||
} | ||
|
||
layer->drawlist.emplace_back(std::move(shape)); | ||
return OK; | ||
} | ||
|
||
} // namespace clip::draw | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* This file is part of the "clip" project | ||
* Copyright (c) 2020 Paul Asmuth | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
#include <stdlib.h> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "layer.h" | ||
#include "graphics/path.h" | ||
#include "style.h" | ||
|
||
namespace clip::draw { | ||
|
||
struct path_op { | ||
Path path; | ||
draw_style::compound style; | ||
Option<AntialiasingMode> antialiasing_mode; | ||
}; | ||
|
||
/** | ||
* Draw a path | ||
*/ | ||
ReturnCode path(const path_op& op, Layer* l); | ||
|
||
} // namespace clip::draw | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.