Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
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
abdullh.alsoleman
Front-End
Commits
6b2d121f
Commit
6b2d121f
authored
Oct 19, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1674 from abarth/rm_color_filter
Remove ColorFilter widget
parents
0ef9da85
9baf8eb3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
120 deletions
+0
-120
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+0
-26
object.dart
packages/flutter/lib/src/rendering/object.dart
+0
-37
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+0
-39
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+0
-18
No files found.
packages/flutter/lib/src/rendering/layer.dart
View file @
6b2d121f
...
...
@@ -307,29 +307,3 @@ class OpacityLayer extends ContainerLayer {
builder
.
pop
();
}
}
/// A composited layer that applies a color filter to its children
class
ColorFilterLayer
extends
ContainerLayer
{
ColorFilterLayer
({
Offset
offset:
Offset
.
zero
,
this
.
bounds
,
this
.
color
,
this
.
transferMode
})
:
super
(
offset:
offset
);
/// Unused
Rect
bounds
;
// TODO(abarth): Remove.
/// The color to use as input to the color filter
Color
color
;
/// The transfer mode to use to combine [color] with the children's painting
TransferMode
transferMode
;
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
pushColorFilter
(
color
,
transferMode
,
bounds
.
shift
(
offset
));
addChildrenToScene
(
builder
,
offset
+
layerOffset
);
builder
.
pop
();
}
}
packages/flutter/lib/src/rendering/object.dart
View file @
6b2d121f
...
...
@@ -276,43 +276,6 @@ class PaintingContext {
}
}
static
Paint
_getPaintForColorFilter
(
Color
color
,
TransferMode
transferMode
)
{
return
new
Paint
()
..
colorFilter
=
new
ui
.
ColorFilter
.
mode
(
color
,
transferMode
)
..
isAntiAlias
=
false
;
}
/// Paint a child with a color filter
///
/// The color filter is constructed by combining the given color and the given
/// transfer mode, as if they were passed to the [ColorFilter.mode] constructor.
///
/// If the child needs compositing, the blending operation will be applied by
/// a compositing layer. Otherwise, the blending operation will be applied by
/// the canvas.
void
paintChildWithColorFilter
(
RenderObject
child
,
Point
childPosition
,
Rect
bounds
,
Color
color
,
TransferMode
transferMode
)
{
assert
(
debugCanPaintChild
(
child
));
final
Offset
childOffset
=
childPosition
.
toOffset
();
if
(!
child
.
needsCompositing
)
{
canvas
.
saveLayer
(
bounds
,
_getPaintForColorFilter
(
color
,
transferMode
));
canvas
.
translate
(
childOffset
.
dx
,
childOffset
.
dy
);
insertChild
(
child
,
Offset
.
zero
);
canvas
.
restore
();
}
else
{
ColorFilterLayer
paintLayer
=
new
ColorFilterLayer
(
offset:
childOffset
,
bounds:
bounds
,
color:
color
,
transferMode:
transferMode
);
_containerLayer
.
append
(
paintLayer
);
compositeChild
(
child
,
parentLayer:
paintLayer
);
}
}
static
Paint
_getPaintForShaderMask
(
Rect
bounds
,
ShaderCallback
shaderCallback
,
TransferMode
transferMode
)
{
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
6b2d121f
...
...
@@ -621,45 +621,6 @@ class RenderOpacity extends RenderProxyBox {
}
}
/// Applies a color filter when painting its child
///
/// This class paints its child into an intermediate buffer and then blends the
/// child back into the scene using a color filter.
///
/// Note: This class is relatively expensive because it requires painting the
/// child into an intermediate buffer.
class
RenderColorFilter
extends
RenderProxyBox
{
RenderColorFilter
({
RenderBox
child
,
Color
color
,
TransferMode
transferMode
})
:
_color
=
color
,
_transferMode
=
transferMode
,
super
(
child
);
/// The color to use as input to the color filter
Color
get
color
=>
_color
;
Color
_color
;
void
set
color
(
Color
newColor
)
{
assert
(
newColor
!=
null
);
if
(
_color
==
newColor
)
return
;
_color
=
newColor
;
markNeedsPaint
();
}
/// The transfer mode to use when combining the child's painting and the [color]
TransferMode
get
transferMode
=>
_transferMode
;
TransferMode
_transferMode
;
void
set
transferMode
(
TransferMode
newTransferMode
)
{
assert
(
newTransferMode
!=
null
);
if
(
_transferMode
==
newTransferMode
)
return
;
_transferMode
=
newTransferMode
;
markNeedsPaint
();
}
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
paintChildWithColorFilter
(
child
,
offset
.
toPoint
(),
offset
&
size
,
_color
,
_transferMode
);
}
}
class
RenderShaderMask
extends
RenderProxyBox
{
RenderShaderMask
({
RenderBox
child
,
ShaderCallback
shaderCallback
,
TransferMode
transferMode
})
:
_shaderCallback
=
shaderCallback
,
_transferMode
=
transferMode
,
super
(
child
);
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
6b2d121f
...
...
@@ -83,24 +83,6 @@ class Opacity extends OneChildRenderObjectWidget {
}
}
class
ColorFilter
extends
OneChildRenderObjectWidget
{
ColorFilter
({
Key
key
,
this
.
color
,
this
.
transferMode
,
Widget
child
})
:
super
(
key:
key
,
child:
child
)
{
assert
(
color
!=
null
);
assert
(
transferMode
!=
null
);
}
final
Color
color
;
final
TransferMode
transferMode
;
RenderColorFilter
createRenderObject
()
=>
new
RenderColorFilter
(
color:
color
,
transferMode:
transferMode
);
void
updateRenderObject
(
RenderColorFilter
renderObject
,
ColorFilter
oldWidget
)
{
renderObject
.
color
=
color
;
renderObject
.
transferMode
=
transferMode
;
}
}
class
ShaderMask
extends
OneChildRenderObjectWidget
{
ShaderMask
({
Key
key
,
...
...
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