#android #graphics #perspective
#Android #графика #перспектива
Вопрос:
Создавая приложение, мне нужно было нарисовать перспективу. На api> 27 все в порядке, но на 27 и ниже странные вещи! Две нижние точки указывают на неправильную перспективу построения
float[] srcT = {
0, 0, // Coordinate of top left point
0, height, // Coordinate of bottom left point
wight, height, // Coordinate of bottom right point
wight, 0 // Coordinate of top right point
};
float[] dstT = {
top_left_x, top_left_y, // Coordinate of top left point
bottom_left_x, bottom_left_y, // Coordinate of bottom left point
bottom_right_x, bottom_right_y, // Coordinate of bottom right point
top_right_x, top_right_y // Coordinate of top right point
};
Shader shader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
matrix.setPolyToPoly(srcT, 0, dstT, 0, 4);
shader.setLocalMatrix(matrix);
paint.setShader(shader);
это на 28 api :
и это 22 api: