当前位置: 首页>>代码示例>>Java>>正文


Java ShadowBitmap.getCreatedFromMatrix方法代码示例

本文整理汇总了Java中org.robolectric.shadows.ShadowBitmap.getCreatedFromMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java ShadowBitmap.getCreatedFromMatrix方法的具体用法?Java ShadowBitmap.getCreatedFromMatrix怎么用?Java ShadowBitmap.getCreatedFromMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robolectric.shadows.ShadowBitmap的用法示例。


在下文中一共展示了ShadowBitmap.getCreatedFromMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: centerCropWithGravityHorizontalRight

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropWithGravityHorizontalRight() {
  Bitmap source = Bitmap.createBitmap(20, 10, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop(Gravity.RIGHT).build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 4.0 4.0");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BitmapHunterTest.java

示例2: centerCropWithGravityVerticalBottom

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropWithGravityVerticalBottom() {
  Bitmap source = Bitmap.createBitmap(10, 20, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop(Gravity.BOTTOM).build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 4.0 4.0");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BitmapHunterTest.java

示例3: centerCropWithGravityHorizontalLeft

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropWithGravityHorizontalLeft() {
  Bitmap source = Bitmap.createBitmap(20, 10, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop(Gravity.LEFT).build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 4.0 4.0");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BitmapHunterTest.java

示例4: centerCropResultMatchesTargetSizeWhileDesiredWidthIs0

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropResultMatchesTargetSizeWhileDesiredWidthIs0() {
  Request request = new Request.Builder(URI_1).resize(0, 642).centerCrop().build();
  Bitmap source = Bitmap.createBitmap(640, 640, ARGB_8888);

  Bitmap result = transformResult(request, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  String scalePreOperation = shadowMatrix.getPreOperations().get(0);

  assertThat(scalePreOperation).startsWith("scale ");
  float scaleX = Float.valueOf(scalePreOperation.split(" ")[1]);
  float scaleY = Float.valueOf(scalePreOperation.split(" ")[2]);

  int transformedWidth = Math.round(result.getWidth() * scaleX);
  int transformedHeight = Math.round(result.getHeight() * scaleY);
  assertThat(transformedWidth).isEqualTo(642);
  assertThat(transformedHeight).isEqualTo(642);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:BitmapHunterTest.java

示例5: centerCropResultMatchesTargetSizeWhileDesiredHeightIs0

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropResultMatchesTargetSizeWhileDesiredHeightIs0() {
  Request request = new Request.Builder(URI_1).resize(1080, 0).centerCrop().build();
  Bitmap source = Bitmap.createBitmap(640, 640, ARGB_8888);

  Bitmap result = transformResult(request, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  String scalePreOperation = shadowMatrix.getPreOperations().get(0);

  assertThat(scalePreOperation).startsWith("scale ");
  float scaleX = Float.valueOf(scalePreOperation.split(" ")[1]);
  float scaleY = Float.valueOf(scalePreOperation.split(" ")[2]);

  int transformedWidth = Math.round(result.getWidth() * scaleX);
  int transformedHeight = Math.round(result.getHeight() * scaleY);
  assertThat(transformedWidth).isEqualTo(1080);
  assertThat(transformedHeight).isEqualTo(1080);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:BitmapHunterTest.java

示例6: centerCropTallTooLarge

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropTallTooLarge() {
  Bitmap source = Bitmap.createBitmap(100, 200, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(50, 50).centerCrop().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(50);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(100);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(100);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 0.5 0.5");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BitmapHunterTest.java

示例7: centerInsideResultMatchesTargetSizeWhileDesiredHeightIs0

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerInsideResultMatchesTargetSizeWhileDesiredHeightIs0() {
  Request request = new Request.Builder(URI_1).resize(1080, 0).centerInside().build();
  Bitmap source = Bitmap.createBitmap(640, 640, ARGB_8888);

  Bitmap result = transformResult(request, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  String scalePreOperation = shadowMatrix.getPreOperations().get(0);

  assertThat(scalePreOperation).startsWith("scale ");
  float scaleX = Float.valueOf(scalePreOperation.split(" ")[1]);
  float scaleY = Float.valueOf(scalePreOperation.split(" ")[2]);

  int transformedWidth = Math.round(result.getWidth() * scaleX);
  int transformedHeight = Math.round(result.getHeight() * scaleY);
  assertThat(transformedWidth).isEqualTo(1080);
  assertThat(transformedHeight).isEqualTo(1080);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:BitmapHunterTest.java

示例8: centerCropWideTooSmall

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropWideTooSmall() {
  Bitmap source = Bitmap.createBitmap(20, 10, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(5);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 4.0 4.0");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BitmapHunterTest.java

示例9: centerCropTallTooSmall

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropTallTooSmall() throws Exception {
  Bitmap source = Bitmap.createBitmap(10, 20, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(5);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsOnly("scale 4.0 4.0");
}
 
开发者ID:Pixate,项目名称:picasso,代码行数:18,代码来源:BitmapHunterTest.java

示例10: centerCropTallTooLarge

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropTallTooLarge() throws Exception {
  Bitmap source = Bitmap.createBitmap(100, 200, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(50, 50).centerCrop().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(50);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(100);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(100);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsOnly("scale 0.5 0.5");
}
 
开发者ID:Pixate,项目名称:picasso,代码行数:18,代码来源:BitmapHunterTest.java

示例11: centerCropWideTooSmall

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropWideTooSmall() throws Exception {
  Bitmap source = Bitmap.createBitmap(20, 10, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(5);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsOnly("scale 4.0 4.0");
}
 
开发者ID:Pixate,项目名称:picasso,代码行数:18,代码来源:BitmapHunterTest.java

示例12: centerCropWideTooLarge

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerCropWideTooLarge() throws Exception {
  Bitmap source = Bitmap.createBitmap(200, 100, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(50, 50).centerCrop().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
  assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(50);
  assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(0);
  assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(100);
  assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(100);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsOnly("scale 0.5 0.5");
}
 
开发者ID:Pixate,项目名称:picasso,代码行数:18,代码来源:BitmapHunterTest.java

示例13: exifRotationSizing

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void exifRotationSizing() throws Exception {
  Request data = new Request.Builder(URI_1).resize(5, 10).build();
  Bitmap source = Bitmap.createBitmap(10, 10, ARGB_8888);
  Bitmap result = transformResult(data, source, ORIENTATION_ROTATE_90);
  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).contains("scale 1.0 0.5");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BitmapHunterTest.java

示例14: onlyScaleDownOriginalBiggerHeightIs0

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void onlyScaleDownOriginalBiggerHeightIs0() {
  Bitmap source = Bitmap.createBitmap(50, 50, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(40, 0).onlyScaleDown().build();
  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);

  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 0.8 0.8");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:BitmapHunterTest.java

示例15: centerInsideTallTooLarge

import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test public void centerInsideTallTooLarge() {
  Bitmap source = Bitmap.createBitmap(100, 50, ARGB_8888);
  Request data = new Request.Builder(URI_1).resize(50, 50).centerInside().build();

  Bitmap result = transformResult(data, source, 0);

  ShadowBitmap shadowBitmap = shadowOf(result);
  assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);

  Matrix matrix = shadowBitmap.getCreatedFromMatrix();
  ShadowMatrix shadowMatrix = shadowOf(matrix);
  assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 0.5 0.5");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:BitmapHunterTest.java


注:本文中的org.robolectric.shadows.ShadowBitmap.getCreatedFromMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。