You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: node-graph/gcore/src/blending_nodes.rs
+35-18Lines changed: 35 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -178,61 +178,78 @@ impl SetClip for Table<GradientStops> {
178
178
#[node_macro::node(category("Style"))]
179
179
fnblend_mode<T:SetBlendMode>(
180
180
_:implCtx,
181
+
/// The layer stack that will be composited when rendering.
181
182
#[implementations(
182
183
Table<Graphic>,
183
184
Table<Vector>,
184
185
Table<Raster<CPU>>,
185
186
Table<Color>,
186
187
Table<GradientStops>,
187
188
)]
188
-
mutvalue:T,
189
+
mutcontent:T,
190
+
/// The choice of equation that controls how brightness and color blends between overlapping pixels.
189
191
blend_mode:BlendMode,
190
192
) -> T{
191
193
// TODO: Find a way to make this apply once to the table's parent (i.e. its row in its parent table or TableRow<T>) rather than applying to each row in its own table, which produces the undesired result
192
-
value.set_blend_mode(blend_mode);
193
-
value
194
+
content.set_blend_mode(blend_mode);
195
+
content
194
196
}
195
197
196
-
/// Modifies the opacity of the input graphics by multiplying the existing opacity by this percentage. This affects the transparency of the content (together with any above which is clipped to it).
198
+
/// Modifies the opacity of the input graphics by multiplying the existing opacity by this percentage.
199
+
/// This affects the transparency of the content (together with anything above which is clipped to it).
197
200
#[node_macro::node(category("Style"))]
198
201
fnopacity<T:MultiplyAlpha>(
199
202
_:implCtx,
203
+
/// The layer stack that will be composited when rendering.
200
204
#[implementations(
201
205
Table<Graphic>,
202
206
Table<Vector>,
203
207
Table<Raster<CPU>>,
204
208
Table<Color>,
205
209
Table<GradientStops>,
206
210
)]
207
-
mutvalue:T,
208
-
#[default(100.)]opacity:Percentage,
211
+
mutcontent:T,
212
+
/// How visible the content should be, including any content clipped to it.
213
+
/// Ranges from the default of 100% (fully opaque) to 0% (fully transparent).
214
+
#[default(100.)]
215
+
opacity:Percentage,
209
216
) -> T{
210
217
// TODO: Find a way to make this apply once to the table's parent (i.e. its row in its parent table or TableRow<T>) rather than applying to each row in its own table, which produces the undesired result
211
-
value.multiply_alpha(opacity / 100.);
212
-
value
218
+
content.multiply_alpha(opacity / 100.);
219
+
content
213
220
}
214
221
215
-
/// Sets each of the blending properties at once. The blend mode determines how overlapping content is composited together. The opacity affects the transparency of the content (together with any above which is clipped to it). The fill affects the transparency of the content itself, without affecting that of content clipped to it. The clip property determines whether the content inherits the alpha of the content beneath it.
222
+
/// Sets each of the blending properties at once. The blend mode determines how overlapping content is composited together. The opacity affects the transparency of the content (together with anything above which is clipped to it). The fill affects the transparency of the content itself, without affecting that of content clipped to it. The clip property determines whether the content inherits the alpha of the content beneath it.
/// The layer stack that will be composited when rendering.
219
227
#[implementations(
220
228
Table<Graphic>,
221
229
Table<Vector>,
222
230
Table<Raster<CPU>>,
223
231
Table<Color>,
224
232
Table<GradientStops>,
225
233
)]
226
-
mutvalue:T,
234
+
mutcontent:T,
235
+
/// The choice of equation that controls how brightness and color blends between overlapping pixels.
227
236
blend_mode:BlendMode,
228
-
#[default(100.)]opacity:Percentage,
229
-
#[default(100.)]fill:Percentage,
230
-
#[default(false)]clip:bool,
237
+
/// How visible the content should be, including any content clipped to it.
238
+
/// Ranges from the default of 100% (fully opaque) to 0% (fully transparent).
239
+
#[default(100.)]
240
+
opacity:Percentage,
241
+
/// How visible the content should be, independent of any content clipped to it.
242
+
/// Ranges from 0% (fully transparent) to 100% (fully opaque).
243
+
#[default(100.)]
244
+
fill:Percentage,
245
+
/// Whether the content inherits the alpha of the content beneath it.
246
+
#[default(false)]
247
+
clip:bool,
231
248
) -> T{
232
249
// TODO: Find a way to make this apply once to the table's parent (i.e. its row in its parent table or TableRow<T>) rather than applying to each row in its own table, which produces the undesired result
/// A cache miss occurs when the Option is None. In this case, the node evaluates the inner node and memoizes (stores) the result.
23
13
///
24
-
/// The call from `F` directly reaches the `CacheNode` and the `CacheNode` can decide whether to call `G.eval(input_from_f)`
25
-
/// in the event of a cache miss or just return the cached data in the event of a cache hit.
14
+
/// A cache hit occurs when the Option is Some and has a stored hash matching the hash of the call argument. In this case, the node returns the cached value without re-evaluating the inner node.
15
+
///
16
+
/// Currently, only one input-output pair is cached. Subsequent calls with different inputs will overwrite the previous cache.
26
17
#[derive(Default)]
27
18
pubstructMemoNode<T,CachedNode>{
28
19
cache:Arc<Mutex<Option<(u64,T)>>>,
@@ -71,9 +62,8 @@ pub mod memo {
71
62
}
72
63
73
64
/// Caches the output of a given Node and acts as a proxy.
74
-
/// In contrast to the regular `MemoNode`. This node ignores all input.
75
-
/// Using this node might result in the document not updating properly,
76
-
/// use with caution.
65
+
/// In contrast to the regular `MemoNode`, this variant ignores all input.
66
+
/// This node might result in the document not updating properly. Use with caution!
0 commit comments