2
foreground
텍스처를 background
텍스처 위에 겹쳐서 표시하고 싶습니다. 이 두 텍스처 외에도 전경의 어느 부분이 투명해야 하는지를 나타내는 mask
이 있습니다. 이것은 내가 시도한 것입니다 :LibGDX에서 텍스처의 투명도 수정
// Initially, the mask should have an alpha of 1
Pixmap mask = new Pixmap(128, 128, Pixmap.Format.Alpha);
// Cut a rectangle of alpha value 0
mask.setColor(new Color(0f, 0f, 0f, 0f));
mask.fillRectangle(0, 0, 32, 32);
// Load the foreground. The foreground should the same alpha values
// as the mask. If the mask has an alpha value of 1, then the foreground is
// visible. If the mask is 0, then the foreground is invisible.
Pixmap fg = new Pixmap(Gdx.files.internal("foreground.png"));
fg.drawPixmap(mask, fg.getWidth(), fg.getHeight());
Texture foreground = new Texture(fg);
Texture background = new Texture("background.png");
말할 필요도없이 결과는 내가 원하는 것입니다. 마스크의 알파 값이 0이고 마스크의 알파 값이 1 인 모든 위치에서 배경이 보이도록 전경을 변경해야합니까?