Skip to content

Commit 65618a7

Browse files
authored
0.1.1 (#38)
* feat: make live demo code better (#37) * feat: add image loader in vue image (#39) * feat: use cssparser => csscolorparser (#40) * feat: playground use 0.1.1-beta vue-skia * feat: version 0.1.1 and modified font of playground hint * feat: playground font work correctly and blink no code back issue
1 parent e793a4d commit 65618a7

File tree

15 files changed

+178
-65
lines changed

15 files changed

+178
-65
lines changed

Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,3 @@ members = ["soft-skia", "soft-skia-wasm"]
1414
[dependencies]
1515
png = "0.17.5"
1616
colorsys = "0.6.5"
17-
18-
[dependencies.neon]
19-
version = "0.10.1"
20-
default-features = false
21-
features = ["napi-6", "promise-api", "task-api"]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monorepo",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": "true",
55
"scripts": {},
66
"packageManager": "pnpm@7.32.0"

soft-skia-wasm/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "soft-skia-wasm"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
authors = ["meloalright <meloalright@gmail.com>"]
55
edition = "2018"
66

@@ -15,7 +15,7 @@ serde = { version = "1.0", features = ["derive"] }
1515
serde-wasm-bindgen = "0.5.0"
1616
wasm-bindgen = "0.2.63"
1717
base64 = "0.21.0"
18-
cssparser = "0.29"
18+
csscolorparser = "0.7.0"
1919
soft_skia = { path = "../soft-skia" }
2020

2121
# The `console_error_panic_hook` crate provides better debugging of panics by

soft-skia-wasm/src/lib.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use soft_skia::shape::Rect;
1010
use soft_skia::shape::{Circle, Image, Line, PaintStyle, Points, RoundRect, Shapes, Text};
1111
use soft_skia::tree::Node;
1212
use wasm_bindgen::prelude::*;
13-
14-
use cssparser::{Color as CSSColor, Parser, ParserInput};
13+
use csscolorparser;
1514

1615
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
1716
// allocator.
@@ -457,15 +456,9 @@ impl SoftSkiaWASM {
457456

458457
fn parse_color(color: Option<String>) -> Option<ColorU8> {
459458
if let Some(color_str) = color {
460-
let mut parser_input = ParserInput::new(&color_str);
461-
let mut parser = Parser::new(&mut parser_input);
462-
463-
if let Ok(css_color) = CSSColor::parse(&mut parser) {
464-
if let CSSColor::RGBA(rgba) = css_color {
465-
return Some(ColorU8::from_rgba(
466-
rgba.red, rgba.green, rgba.blue, rgba.alpha,
467-
));
468-
}
459+
if let Ok(css_color) = csscolorparser::parse(&color_str) {
460+
let css_rgba8 = css_color.to_rgba8();
461+
return Some(ColorU8::from_rgba(css_rgba8[0], css_rgba8[1], css_rgba8[2], css_rgba8[3]))
469462
}
470463
}
471464
None

soft-skia/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "soft_skia"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
edition = "2021"
55
description="software rasterization skia binding"
66
license = "MIT"

vue-playground/package-ci.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-playground",
3-
"version": "0.10.0",
3+
"version": "0.11.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
@@ -14,7 +14,7 @@
1414
"prismjs": "^1.29.0",
1515
"vue": "^3.2.13",
1616
"vue-live": "^2.5.4",
17-
"vue-skia": "0.1.0"
17+
"vue-skia": "0.1.1"
1818
},
1919
"devDependencies": {
2020
"@types/node": "^20.5.0",

vue-playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-playground",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
3.21 MB
Binary file not shown.

vue-playground/public/OFL.txt

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
Copyright (c) 2010, NHN Corporation (http://www.nhncorp.com),
2+
with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver
3+
NanumGothic, NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver
4+
NanumBrush, NanumPen, Naver NanumPen.
5+
6+
7+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
8+
This license is copied below, and is also available with a FAQ at:
9+
https://openfontlicense.org
10+
11+
12+
-----------------------------------------------------------
13+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
14+
-----------------------------------------------------------
15+
16+
PREAMBLE
17+
The goals of the Open Font License (OFL) are to stimulate worldwide
18+
development of collaborative font projects, to support the font creation
19+
efforts of academic and linguistic communities, and to provide a free and
20+
open framework in which fonts may be shared and improved in partnership
21+
with others.
22+
23+
The OFL allows the licensed fonts to be used, studied, modified and
24+
redistributed freely as long as they are not sold by themselves. The
25+
fonts, including any derivative works, can be bundled, embedded,
26+
redistributed and/or sold with any software provided that any reserved
27+
names are not used by derivative works. The fonts and derivatives,
28+
however, cannot be released under any other type of license. The
29+
requirement for fonts to remain under this license does not apply
30+
to any document created using the fonts or their derivatives.
31+
32+
DEFINITIONS
33+
"Font Software" refers to the set of files released by the Copyright
34+
Holder(s) under this license and clearly marked as such. This may
35+
include source files, build scripts and documentation.
36+
37+
"Reserved Font Name" refers to any names specified as such after the
38+
copyright statement(s).
39+
40+
"Original Version" refers to the collection of Font Software components as
41+
distributed by the Copyright Holder(s).
42+
43+
"Modified Version" refers to any derivative made by adding to, deleting,
44+
or substituting -- in part or in whole -- any of the components of the
45+
Original Version, by changing formats or by porting the Font Software to a
46+
new environment.
47+
48+
"Author" refers to any designer, engineer, programmer, technical
49+
writer or other person who contributed to the Font Software.
50+
51+
PERMISSION & CONDITIONS
52+
Permission is hereby granted, free of charge, to any person obtaining
53+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
54+
redistribute, and sell modified and unmodified copies of the Font
55+
Software, subject to the following conditions:
56+
57+
1) Neither the Font Software nor any of its individual components,
58+
in Original or Modified Versions, may be sold by itself.
59+
60+
2) Original or Modified Versions of the Font Software may be bundled,
61+
redistributed and/or sold with any software, provided that each copy
62+
contains the above copyright notice and this license. These can be
63+
included either as stand-alone text files, human-readable headers or
64+
in the appropriate machine-readable metadata fields within text or
65+
binary files as long as those fields can be easily viewed by the user.
66+
67+
3) No Modified Version of the Font Software may use the Reserved Font
68+
Name(s) unless explicit written permission is granted by the corresponding
69+
Copyright Holder. This restriction only applies to the primary font name as
70+
presented to the users.
71+
72+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
73+
Software shall not be used to promote, endorse or advertise any
74+
Modified Version, except to acknowledge the contribution(s) of the
75+
Copyright Holder(s) and the Author(s) or with their explicit written
76+
permission.
77+
78+
5) The Font Software, modified or unmodified, in part or in whole,
79+
must be distributed entirely under this license, and must not be
80+
distributed under any other license. The requirement for fonts to
81+
remain under this license does not apply to any document created
82+
using the Font Software.
83+
84+
TERMINATION
85+
This license becomes null and void if any of the above conditions are
86+
not met.
87+
88+
DISCLAIMER
89+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
91+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
92+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
93+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
94+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
95+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
96+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
97+
OTHER DEALINGS IN THE FONT SOFTWARE.

vue-playground/public/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
88
<title><%= htmlWebpackPlugin.options.title %></title>
9+
<style type="text/css">
10+
@font-face {
11+
font-family: 'Nanum Pen Script';
12+
src: url('<%= BASE_URL %>NanumPenScript-Regular.ttf') format("truetype");
13+
}
14+
</style>
915
</head>
1016
<body>
1117
<noscript>

0 commit comments

Comments
 (0)