mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
imagebitmap: Crop bitmap data with formatting (#37397)
Follow the ImageBitmap specification and make cropping of the bitmap data to the source rectangle with formatting: https://html.spec.whatwg.org/multipage/#cropped-to-the-source-rectangle-with-formatting For now the next functionality not implemented: - image orientation support (such as EXIF metadata) - color space conversion (image, blob) The convertion from ResizeQuality to "image" FilterType: - pixelated/low/medium/high -> Nearest/Triangle/CatmullRom/Lanczos3 Other browsers use the following sample filtering: - chromium (skia): Nearest/Linear/Linear/CatmullRom - firefox (skia): Lanczos3 Testing: Improvements in the following WPT tests - html/canvas/element/manual/imagebitmap/* Fixes (partially): #34112 Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
parent
0f61361e27
commit
bcade589e7
12 changed files with 441 additions and 164 deletions
|
@ -195,6 +195,10 @@ impl Snapshot<Data> {
|
|||
&self.data
|
||||
}
|
||||
|
||||
pub fn data_mut(&mut self) -> &mut [u8] {
|
||||
&mut self.data
|
||||
}
|
||||
|
||||
/// Convert inner data of snapshot to target format and alpha mode.
|
||||
/// If data is already in target format and alpha mode no work will be done.
|
||||
pub fn transform(&mut self, target_alpha_mode: AlphaMode, target_format: PixelFormat) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue