Suppondo che si sta lavorando sull’oggetto PDPageContentStream, ecco come realizzare un box il cui colore di background possiede anche la trasparenza.
Color boxStrokingColor = Color.BLUE; /* PDExtendedGraphicsState realizza la trasparnza */ /* opacity è un valore tra 0 e 1 che indica il livello di opacità. */ float opacity = 0.8f; PDExtendedGraphicsState extendedGraphicsState = new PDExtendedGraphicsState(); extendedGraphicsState.setNonStrokingAlphaConstant(opacity); contentStream.setGraphicsStateParameters(extendedGraphicsState); contentStream.setNonStrokingColor(boxStrokingColor); contentStream.addRect(scaleDim.get("x"), yRect, widthOverlayScaled, boxHeight); contentStream.fill(); |
Istantaneo direi però ho dovuto girare il web in lungo ed in largo per capire che bisogna utilizzare l’oggetto: PDExtendedGraphicsState!