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
123ec80c
Unverified
Commit
123ec80c
authored
Aug 20, 2021
by
nt4f04uNd
Committed by
GitHub
Aug 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init (#88427)
parent
7d023f0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
57 deletions
+0
-57
image.dart
packages/flutter_test/lib/src/image.dart
+0
-57
No files found.
packages/flutter_test/lib/src/image.dart
View file @
123ec80c
...
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/painting.dart'
;
import
'test_async_utils.dart'
;
...
...
@@ -49,13 +48,6 @@ Future<ui.Image> createTestImage({
});
Future
<
ui
.
Image
>
_createImage
(
int
width
,
int
height
)
async
{
if
(
kIsWeb
)
{
return
_webCreateTestImage
(
width:
width
,
height:
height
,
);
}
final
Completer
<
ui
.
Image
>
completer
=
Completer
<
ui
.
Image
>();
ui
.
decodeImageFromPixels
(
Uint8List
.
fromList
(
List
<
int
>.
filled
(
width
*
height
*
4
,
0
,
growable:
false
)),
...
...
@@ -68,52 +60,3 @@ Future<ui.Image> _createImage(int width, int height) async {
);
return
completer
.
future
;
}
/// Web doesn't support [decodeImageFromPixels]. Instead, generate a 1bpp BMP
/// and just use [instantiateImageCodec].
// TODO(dnfield): Remove this when https://github.com/flutter/flutter/issues/49244
// is resolved.
Future
<
ui
.
Image
>
_webCreateTestImage
({
required
int
width
,
required
int
height
,
})
async
{
// See https://en.wikipedia.org/wiki/BMP_file_format for format examples.
final
int
bufferSize
=
0x36
+
(
width
*
height
);
final
ByteData
bmpData
=
ByteData
(
bufferSize
);
// 'BM' header
bmpData
.
setUint8
(
0x00
,
0x42
);
bmpData
.
setUint8
(
0x01
,
0x4D
);
// Size of data
bmpData
.
setUint32
(
0x02
,
bufferSize
,
Endian
.
little
);
// Offset where pixel array begins
bmpData
.
setUint32
(
0x0A
,
0x36
,
Endian
.
little
);
// Bytes in DIB header
bmpData
.
setUint32
(
0x0E
,
0x28
,
Endian
.
little
);
// width
bmpData
.
setUint32
(
0x12
,
width
,
Endian
.
little
);
// height
bmpData
.
setUint32
(
0x16
,
height
,
Endian
.
little
);
// Color panes
bmpData
.
setUint16
(
0x1A
,
0x01
,
Endian
.
little
);
// bpp
bmpData
.
setUint16
(
0x1C
,
0x01
,
Endian
.
little
);
// no compression
bmpData
.
setUint32
(
0x1E
,
0x00
,
Endian
.
little
);
// raw bitmap data size
bmpData
.
setUint32
(
0x22
,
width
*
height
,
Endian
.
little
);
// print DPI width
bmpData
.
setUint32
(
0x26
,
width
,
Endian
.
little
);
// print DPI height
bmpData
.
setUint32
(
0x2A
,
height
,
Endian
.
little
);
// colors in the palette
bmpData
.
setUint32
(
0x2E
,
0x00
,
Endian
.
little
);
// important colors
bmpData
.
setUint32
(
0x32
,
0x00
,
Endian
.
little
);
// rest of data is zeroed as black pixels.
final
ui
.
Codec
codec
=
await
ui
.
instantiateImageCodec
(
bmpData
.
buffer
.
asUint8List
(),
);
final
ui
.
FrameInfo
frameInfo
=
await
codec
.
getNextFrame
();
return
frameInfo
.
image
;
}
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