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
a4640521
Commit
a4640521
authored
Jun 02, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve docs for paintImage (#4317)
We now describe what each parameter does. Fixes #4256
parent
00c7734c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
3 deletions
+35
-3
box_painter.dart
packages/flutter/lib/src/painting/box_painter.dart
+35
-3
No files found.
packages/flutter/lib/src/painting/box_painter.dart
View file @
a4640521
...
@@ -6,6 +6,7 @@ import 'dart:math' as math;
...
@@ -6,6 +6,7 @@ import 'dart:math' as math;
import
'dart:ui'
as
ui
show
Image
,
Gradient
,
lerpDouble
;
import
'dart:ui'
as
ui
show
Image
,
Gradient
,
lerpDouble
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:meta/meta.dart'
;
import
'basic_types.dart'
;
import
'basic_types.dart'
;
import
'decoration.dart'
;
import
'decoration.dart'
;
...
@@ -761,10 +762,41 @@ Iterable<Rect> _generateImageTileRects(Rect outputRect, Rect fundamentalRect, Im
...
@@ -761,10 +762,41 @@ Iterable<Rect> _generateImageTileRects(Rect outputRect, Rect fundamentalRect, Im
}
}
/// Paints an image into the given rectangle in the canvas.
/// Paints an image into the given rectangle in the canvas.
///
/// * `canvas`: The canvas onto which the image will be painted.
/// * `rect`: The region of the canvas into which the image will be painted.
/// The image might not fill the entire rectangle (e.g., depending on the
/// `fit`).
/// * `image`: The image to paint onto the canvas.
/// * `colorFilter`: If non-null, the color filter to apply when painting the
/// image.
/// * `fit`: How the image should be inscribed into `rect`. If null, the
/// default behavior depends on `centerSlice`. If `centerSlice` is also null,
/// the default behavior is [ImageFit.scaleDown]. If `centerSlice` is
/// non-null, the default behavior is [ImageFit.fill]. See [ImageFit] for
/// details.
/// * `repeat`: If the image does not fill `rect`, whether and how the image
/// should be repeated to fill `rect`. By default, the image is not repeated.
/// See [ImageRepeat] for details.
/// * `centerSlice`: The image is drawn in nine portions described by splitting
/// the image by drawing two horizontal lines and two vertical lines, where
/// `centerSlice` describes the rectangle formed by the four points where
/// these four lines intersect each other. (This forms a 3-by-3 grid
/// of regions, the center region being described by `centerSlice`.)
/// The four regions in the corners are drawn, without scaling, in the four
/// corners of the destination rectangle defined by applying `fit`. The
/// remaining five regions are drawn by stretching them to fit such that they
/// exactly cover the destination rectangle while maintaining their relative
/// positions.
/// * `alignment`: How the destination rectangle defined by applying `fit` is
/// aligned within `rect`. For example, if `fit` is [ImageFit.contain] and
/// `alignment` is [FractionalOffset.bottomRight], the image will be as large
/// as possible within `rect` and placed with its bottom right corner at the
/// bottom right corner of `rect`.
void
paintImage
(
{
void
paintImage
(
{
Canvas
canvas
,
@required
Canvas
canvas
,
Rect
rect
,
@required
Rect
rect
,
ui
.
Image
image
,
@required
ui
.
Image
image
,
ColorFilter
colorFilter
,
ColorFilter
colorFilter
,
ImageFit
fit
,
ImageFit
fit
,
ImageRepeat
repeat:
ImageRepeat
.
noRepeat
,
ImageRepeat
repeat:
ImageRepeat
.
noRepeat
,
...
...
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