1package org.robolectric.shadows;
2
3import android.graphics.Bitmap;
4import android.graphics.Canvas;
5import android.graphics.Picture;
6import org.robolectric.annotation.Implementation;
7import org.robolectric.annotation.Implements;
8
9@Implements(Picture.class)
10public class ShadowPicture {
11
12  private int width;
13  private int height;
14
15  @Implementation
16  public void __constructor__() {}
17
18  @Implementation
19  public void __constructor__(long nativePicture) {}
20
21  @Implementation
22  public void __constructor__(int nativePicture, boolean fromStream) {}
23
24  @Implementation
25  public void __constructor__(Picture src) {
26    width = src.getWidth();
27    height = src.getHeight();
28  }
29
30  @Implementation
31  public int getWidth() {
32    return width;
33  }
34
35  @Implementation
36  public int getHeight() {
37    return height;
38  }
39
40  @Implementation
41  public Canvas beginRecording(int width, int height) {
42    this.width = width;
43    this.height = height;
44    return new Canvas(Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888));
45  }
46}
47