Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
45820803
Commit
45820803
authored
Apr 05, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented "opacify" and "transparentize" and their aliases.
parent
664c020b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
context.cpp
context.cpp
+4
-0
functions.cpp
functions.cpp
+23
-0
functions.hpp
functions.hpp
+8
-0
No files found.
context.cpp
View file @
45820803
...
...
@@ -44,6 +44,10 @@ namespace Sass {
// Opacity Functions
register_function
(
alpha_descriptor
,
alpha
);
register_function
(
opacity_descriptor
,
alpha
);
register_function
(
opacify_descriptor
,
opacify
);
register_function
(
fade_in_descriptor
,
opacify
);
register_function
(
transparentize_descriptor
,
transparentize
);
register_function
(
fade_out_descriptor
,
transparentize
);
// String Functions
register_function
(
unquote_descriptor
,
unquote
);
register_function
(
quote_descriptor
,
quote
);
...
...
functions.cpp
View file @
45820803
#include "functions.hpp"
#include <iostream>
#include <cmath>
using
std
::
cerr
;
using
std
::
endl
;
namespace
Sass
{
...
...
@@ -111,6 +112,28 @@ namespace Sass {
Node
alpha
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
return
bindings
[
parameters
[
0
]][
3
];
}
Function_Descriptor
opacify_descriptor
=
{
"opacify"
,
"$color"
,
"$amount"
,
0
};
Function_Descriptor
fade_in_descriptor
=
{
"fade_in"
,
"$color"
,
"$amount"
,
0
};
Node
opacify
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
Node
cpy
(
bindings
[
parameters
[
0
]].
clone
());
cpy
[
3
].
content
.
numeric_value
+=
bindings
[
parameters
[
1
]].
content
.
numeric_value
;
if
(
cpy
[
3
].
content
.
numeric_value
>=
1
)
cpy
[
3
].
content
.
numeric_value
=
1
;
return
cpy
;
}
Function_Descriptor
transparentize_descriptor
=
{
"transparentize"
,
"$color"
,
"$amount"
,
0
};
Function_Descriptor
fade_out_descriptor
=
{
"fade_out"
,
"$color"
,
"$amount"
,
0
};
Node
transparentize
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
Node
cpy
(
bindings
[
parameters
[
0
]].
clone
());
cpy
[
3
].
content
.
numeric_value
-=
bindings
[
parameters
[
1
]].
content
.
numeric_value
;
if
(
cpy
[
3
].
content
.
numeric_value
<=
0
)
cpy
[
3
].
content
.
numeric_value
=
0
;
return
cpy
;
}
// String Functions ////////////////////////////////////////////////////
...
...
functions.hpp
View file @
45820803
...
...
@@ -77,6 +77,14 @@ namespace Sass {
extern
Function_Descriptor
opacity_descriptor
;
Node
alpha
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
extern
Function_Descriptor
opacify_descriptor
;
extern
Function_Descriptor
fade_in_descriptor
;
Node
opacify
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
extern
Function_Descriptor
transparentize_descriptor
;
extern
Function_Descriptor
fade_out_descriptor
;
Node
transparentize
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
// String Functions ////////////////////////////////////////////////////
extern
Function_Descriptor
unquote_descriptor
;
Node
unquote
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment