PdfShading extends PdfObjectWrapper<PdfDictionary> { public int getShadingType() { return (int) getPdfObject().getAsInt(PdfName.ShadingType); } protected  PdfShading(PdfDictionary pdfObject); protected  PdfShading(PdfDictionary pdfObject, int type, PdfColorSpace colorSpace); static PdfShading makeShading(PdfDictionary shadingDictionary); int getShadingType(); PdfObject getColorSpace(); PdfObject getFunction(); void setFunction(PdfFunction function); void setFunction(PdfFunction[] functions); @Override void flush();  }
@Test public void axialShadingGettersTest() { float[] coordsArray = {0f, 0f, 0.5f, 0.5f}; float[] domainArray = {0f, 0.8f}; boolean[] extendArray = {true, false}; PdfDictionary axialShadingDictionary = initShadingDictionary(coordsArray, domainArray, extendArray, ShadingType.AXIAL); Axial axial = new Axial(axialShadingDictionary); Assert.assertArrayEquals(coordsArray, axial.getCoords().toFloatArray(), 0f); Assert.assertArrayEquals(domainArray, axial.getDomain().toFloatArray(), 0f); Assert.assertArrayEquals(extendArray, axial.getExtend().toBooleanArray()); Assert.assertEquals(ShadingType.AXIAL, axial.getShadingType()); }
@Test public void axialShadingGettersWithDomainExtendDefaultValuesTest() { float[] coordsArray = {0f, 0f, 0.5f, 0.5f}; float[] defaultDomainArray = {0f, 1f}; boolean[] defaultExtendArray = {false, false}; PdfDictionary axialShadingDictionary = initShadingDictionary(coordsArray, null, null, ShadingType.AXIAL); Axial axial = new Axial(axialShadingDictionary); Assert.assertArrayEquals(coordsArray, axial.getCoords().toFloatArray(), 0f); Assert.assertArrayEquals(defaultDomainArray, axial.getDomain().toFloatArray(), 0f); Assert.assertArrayEquals(defaultExtendArray, axial.getExtend().toBooleanArray()); Assert.assertEquals(ShadingType.AXIAL, axial.getShadingType()); }
@Test public void radialShadingGettersTest() { float[] coordsArray = {0f, 0f, 0f, 0.5f, 0.5f, 10f}; float[] domainArray = {0f, 0.8f}; boolean[] extendArray = {true, false}; PdfDictionary radialShadingDictionary = initShadingDictionary(coordsArray, domainArray, extendArray, ShadingType.RADIAL); Radial radial = new Radial(radialShadingDictionary); Assert.assertArrayEquals(coordsArray, radial.getCoords().toFloatArray(), 0f); Assert.assertArrayEquals(domainArray, radial.getDomain().toFloatArray(), 0f); Assert.assertArrayEquals(extendArray, radial.getExtend().toBooleanArray()); Assert.assertEquals(ShadingType.RADIAL, radial.getShadingType()); }
@Test public void radialShadingGettersWithDomainExtendDefaultValuesTest() { float[] coordsArray = {0f, 0f, 0f, 0.5f, 0.5f, 10f}; float[] defaultDomainArray = {0f, 1f}; boolean[] defaultExtendArray = {false, false}; PdfDictionary radialShadingDictionary = initShadingDictionary(coordsArray, null, null, ShadingType.RADIAL); Radial radial = new Radial(radialShadingDictionary); Assert.assertArrayEquals(coordsArray, radial.getCoords().toFloatArray(), 0f); Assert.assertArrayEquals(defaultDomainArray, radial.getDomain().toFloatArray(), 0f); Assert.assertArrayEquals(defaultExtendArray, radial.getExtend().toBooleanArray()); Assert.assertEquals(ShadingType.RADIAL, radial.getShadingType()); }