summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix VaadinFinderLocator for UIElement (#14010).Dmitrii Rogozin2014-11-034-28/+155
| | | | Change-Id: If25ebdcdd4df438402d1cdc60a63c629e84c73a0
* Update testbench icon in debug window (#14913)Dmitrii Rogozin2014-11-034-30/+30
| | | | Change-Id: Ic114cb1c61a925347e70da3820e4b9f22abeb27c
* Set upload button width to 100% when immediate on Valo. (#14485)Sauli Tähkäpää2014-11-028-34/+200
| | | | Change-Id: I473fc080c143bc242326bd6f2b819450c42ffae5
* Add addButton() AbstractTestUI.Sauli Tähkäpää2014-10-2913-49/+20
| | | | Change-Id: I55a02e96466b63f6b00047cc87ab111f6c08e45b
* Set correct versions for json package imports in OSGi manfiests (#14618)Maciej Przepióra2014-10-292-2/+2
| | | | Change-Id: I4761ab889bfacedd66bd7ed5f37fe763d7539bef
* resolve org.json version conflict between server and shared (#14618)Markus Koivisto2014-10-291-1/+1
| | | | Change-Id: Iae1723bfcfa56084a1339247b1f82e9277555a5e
* Fix button on immediate upload does not obey setWidth() (#14485)denis.magdenkov2014-10-293-0/+105
| | | | | | Added sass selector for upload in base theme. Change-Id: Iebf796f0965de6afeac98d6e2a2a9246c9251bab
* Set v-disabled on Button inside Upload when disabled. (#14655)Sauli Tähkäpää2014-10-293-2/+104
| | | | Change-Id: Ic28c8e4020eddae32a71b5c7f9da0ad61f2f7af9
* FormLayout margins do not work (#14610)Jouni Koivuviita2014-10-291-2/+22
| | | | Change-Id: Ibad03664be53489121914a2dd7bb051cc6e5350c
* Fix: Empty space on page after expanded component (#12672)Anna Miroshnik2014-10-295-10/+163
| | | | | | | | | | | | | | | | | Full defect name: Empty space on page after expanded component - incorrect height calculation in Chrome Layout: [ Panel (auto x auto) [ Grid (auto x auto) ] AnyComponent (100% x 100%) <EMPTY SPACE> Also sleep() was removed from tests BaseLayoutExpandTest and BaseAddReplaceMoveTest Change-Id: Ie8a14a58dd53a26a133ea99a7b809d92c1b33a1f
* FieldGroup should not throw NPE when data source is not set (#14901).Denis Anisimov2014-10-292-1/+57
| | | | Change-Id: I74bea857306fac5123aa86cdabc70d81c2a72094
* Test fix now that FormLayout margins work again. (#14890)Anna Koskinen2014-10-291-0/+1
| | | | Change-Id: Ifa7d4ae9d36c1180a5c635833a9a13ad576d5c70
* Replace no-break-spaces with whitespaces (#14890)Sara Seppola2014-10-2915-45/+45
| | | | Change-Id: Ib378fbea73bc16caa12deb14f760025e68f16288
* Correct positioning and sizing logic for context menu (#14863).Denis Anisimov2014-10-293-6/+215
| | | | Change-Id: Ic2edd6e6f53cd8ae3dc2d39477f59261356beafd
* Fix TabSheet becomes unresponsive after setSelectedTab (#14710)Guillermo Alvarez2014-10-292-2/+8
| | | | | | | Fixed unresponsiveness issue without removing the waitingForResponse flag from VTabsheet. The flag is now set in revertToSharedStateSelection Change-Id: I62cabc44d4ac4c284b0b35921d8624483b0150be
* Removed the waitingForResponse flag from VTabsheet (#14710)Taras Hupalo2014-10-294-9/+197
| | | | Change-Id: Idd918197c2026a3c574cffd0e9595ff9f02eb2d8
* Add missing tests (#12976)Guillermo Alvarez2014-10-292-0/+120
| | | | | | Adapted TB2 tests included in changeset number [26188] of Vaadin 6.8 SVN Change-Id: Ib935524538e06bd51acc01068df6ad86beba05fb
* Removes scrolling caused by updating an unfocused table (#12976)Taras Hupalo2014-10-291-1/+3
| | | | Change-Id: Ifd5037c576480a03c7c74c29730338d5a592d20d
* Added missing test when unframed (#14450)Guillermo Alvarez2014-10-291-0/+11
| | | | | | Now we check closing element is present in unframed tabsheets Change-Id: If29c1006db0f9267d213b5f063a1c478efe60ea9
* Fix Tabsheet close button not shown on tabsheet (Firefox 24) (#14450)Jouni Koivuviita2014-10-291-23/+42
| | | | Change-Id: I099f94f47f2f7aa5856026f6cf6e53629732527c
* fix: Tooltip does not shrink when content changes (#11871)Anna Miroshnik2014-10-293-0/+132
| | | | Change-Id: I6b0cc0996560b2f8dd28e110e455445952c0fbd9
* Fixed FontIcons on VWindow (#14481).Tapio Aali2014-10-293-33/+76
| | | | Change-Id: I1b7cb280088379a6512e23a663dbf2a31f8123cd
* Use deployment url property value for base URL if it's defined (#14758).Denis Anisimov2014-10-292-4/+14
| | | | Change-Id: I249e37cfaf23564b00136b33132df3d339a46e98
* Add @since to isEnabled() and setEnabled(). (#14797)Sauli Tähkäpää2014-10-161-0/+3
| | | | Change-Id: Ic9b7e8f597afd68c4190b7eaffaee203876e24e0
* Implement HasEnabled in VPopupView. (#14797)Sauli Tähkäpää2014-10-163-12/+71
| | | | Change-Id: I7384fb6312a921330d8b57193e53c235213dcf00
* Handle all native events in preview handler for Combobox popup (#14321).Denis Anisimov2014-10-163-0/+161
| | | | Change-Id: Ibad2f45fb81d9573125fbc786bd3493ac6cdfc00
* Postpone shortcut action handler initialization in PopupView (#14275).Denis Anisimov2014-10-163-9/+204
| | | | Change-Id: I233a63fac4f1afe3f99105ac6dfbbbb38f9b9fad
* Add @since to ContainerEventProvider. (#14178)Sauli Tähkäpää2014-10-161-0/+4
| | | | Change-Id: Ic44e8abf1e7405735c940573558e150b4e0de35d
* All day property support is added to ContainerEventProvider (#14178).Denis Anisimov2014-10-162-0/+109
| | | | Change-Id: I8d5580895a218440a8295ed79453d6cbe24195b1
* Fix @since for isIPhone() and isIPad(). (#14424, #14423)Sauli Tähkäpää2014-10-162-2/+6
| | | | Change-Id: I8b72b362134d564165a7037e0722c3ff28f59497
* Update atmosphere-runtime to 2.1.2.vaadin6. (#14674, #14861)7.3.3Sauli Tähkäpää2014-10-1515-30/+130
| | | | Change-Id: Ie239bf110909f8acb47f2141431965061f9ac407
* Ease test creation by making description and ticket number optionalArtur Signell2014-10-151-2/+6
| | | | Change-Id: I00cde9e1ebc51669b959a6e98094fea87059a022
* Not able to scroll BrowserFrames on iOS Devices (#14813)Sergey Budkin2014-10-142-0/+13
| | | | | | Added CSS fixes. Change-Id: I1f1d27a18b925ab9b4e21292218c75206d3d4984
* Fixed the sizing of relative-sized components in AbsoluteLayout (#13131)Anna Koskinen2014-10-143-2/+374
| | | | Change-Id: Ibc0757fa383b15dbf33f0b75a7d20ee78db5e88a
* Use workaround for JDK6 Introspection bug JDK-6788525 (#14839).Denis Anisimov2014-10-142-3/+106
| | | | Change-Id: Ib7ef769b7537675c681ac1fab24a425d19a267e7
* TreeTable should support font icons for items (#14077)Guillermo Alvarez2014-10-143-8/+95
| | | | Change-Id: I758e0f80446290f17280447b1ff5c1f44cb8604b
* Fix empty table captions in Valo theme (#14812)Teemu Pöntelin2014-10-143-0/+107
| | | | Change-Id: I6d18e9a16ea5c4c4de0653233fefa1af8f76205a
* Incorrect rendering of Panel with undefined size in Firefox (#14631).Sergey Budkin2014-10-143-0/+114
| | | | | | Copied the fix from Valo. Change-Id: I677fc4cfb65a57211fd82d994d75743fd49a83a2
* isIPad() and isIPhone() methods are added to WebBrowser (#14424,#14423).Denis Anisimov2014-10-143-2/+57
| | | | Change-Id: I7b3556d5f9c1dd84beec638d7fbff1c5382070a4
* FieldGroup.commit throws NPE if not bound to an item (#14732).Sergey Budkin2014-10-142-2/+41
| | | | | | Added null check and corresponding test. Change-Id: I197dad14d6b5f7bf9bedcdf083d4b1f0f20efdcd
* Add favicon.ico to Valo. (#14781)Sauli Tähkäpää2014-10-142-0/+60
| | | | Change-Id: Ic0c5152d634dfc8f07890cfee18bbebd6e54bbc3
* Check eventRouter value against null in Page class (#14803).Denis Anisimov2014-10-142-5/+100
| | | | Change-Id: Ia7dd54c4cf10a2c56a5ef36864a6bb94f1d9167f
* Add ".v-required" style for required component (#10201).Denis Anisimov2014-10-144-0/+114
| | | | Change-Id: I889587234acdb79e33e625f993c1918befa6aae3
* Add outside-range styles for DateField. (#14711)Jouni Koivuviita2014-10-143-9/+35
| | | | Change-Id: I0f85fb72605c5500b0a835ddf715d60bc9c7a524
* Assign timezone before setting initial date in DateField. (#14653)Sauli Tähkäpää2014-10-143-6/+115
| | | | Change-Id: I3b527084d23ee8bd49887bef3d018c1003f492e2
* Open combobox popup on click to icon (#14624).Denis Anisimov2014-10-143-0/+107
| | | | Change-Id: I203b92561ab14d427466945845c6fbb62d6eb07b
* Audio component requests audio content on each client poll when in Window ↵Sergey Budkin2014-10-141-19/+34
| | | | | | | | (#14785) Changed cloning implementation. Change-Id: Ic909551e6f78a0171f87f1f432b554abb900744c
* A cursor is displayed when clicking on radio buttons on iOS 8.0 (#14681)Sergey Budkin2014-10-141-0/+5
| | | | | | Added css instructions for enclosing span to prevent this. Change-Id: Ib5e396b85ce37ab722e70fddf3553179248d59e8
* Action on click button contained in table is called two times on iOS 8.0 ↵Sergey Budkin2014-10-141-3/+20
| | | | | | | | (#14632) Added suppression of second phantom click event. Change-Id: I97d01831b09f0a41976bbefef389f47a0271fc70
* Call endUpload() in finally block of fail handling (#14677).Denis Anisimov2014-10-142-12/+115
| | | | Change-Id: I0b5976abf0d8804e8cd34c5dd489da8617ef89f1
OODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ============================================================================ * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation and was originally created by * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ package org.apache.fop.pdf; // Java... import java.util.List; /** * class representing a PDF Function. * * PDF Functions represent parameterized mathematical formulas and * sampled representations with * arbitrary resolution. Functions are used in two areas: device-dependent * rasterization information for halftoning and transfer * functions, and color specification for smooth shading (a PDF 1.3 feature). * * All PDF Functions have a FunctionType (0,2,3, or 4), a Domain, and a Range. */ public class PDFFunction extends PDFObject { // Guts common to all function types /** * Required: The Type of function (0,2,3,4) default is 0. */ protected int functionType = 0; // Default /** * Required: 2 * m Array of Double numbers which are possible inputs to the function */ protected List domain = null; /** * Required: 2 * n Array of Double numbers which are possible outputs to the function */ protected List range = null; /* ********************TYPE 0***************************** */ // FunctionType 0 specific function guts /** * Required: Array containing the Integer size of the Domain and Range, respectively. * Note: This is really more like two seperate integers, sizeDomain, and sizeRange, * but since they're expressed as an array in PDF, my implementation reflects that. */ protected List size = null; /** * Required for Type 0: Number of Bits used to represent each sample value. * Limited to 1,2,4,8,12,16,24, or 32 */ protected int bitsPerSample = 1; /** * Optional for Type 0: order of interpolation between samples. * Limited to linear (1) or cubic (3). Default is 1 */ protected int order = 1; /** * Optional for Type 0: A 2 * m array of Doubles which provides a * linear mapping of input values to the domain. * * Required for Type 3: A 2 * k array of Doubles that, taken * in pairs, map each subset of the domain defined by Domain * and the Bounds array to the domain of the corresponding function. * Should be two values per function, usually (0,1), * as in [0 1 0 1] for 2 functions. */ protected List encode = null; /** * Optional for Type 0: A 2 * n array of Doubles which provides * a linear mapping of sample values to the range. Defaults to Range. */ protected List decode = null; /** * Optional For Type 0: A stream of sample values */ /** * Required For Type 4: Postscript Calculator function * composed of arithmetic, boolean, and stack operators + boolean constants */ protected StringBuffer functionDataStream = null; /** * Required (?) For Type 0: A vector of Strings for the * various filters to be used to decode the stream. * These are how the string is compressed. Flate, LZW, etc. */ protected List filter = null; /* *************************TYPE 2************************** */ /** * Required For Type 2: An Array of n Doubles defining * the function result when x=0. Default is [0]. */ protected List cZero = null; /** * Required For Type 2: An Array of n Doubles defining * the function result when x=1. Default is [1]. */ protected List cOne = null; /** * Required for Type 2: The interpolation exponent. * Each value x will return n results. * Must be greater than 0. */ protected double interpolationExponentN = 1; /* *************************TYPE 3************************** */ /** * Required for Type 3: An vector of PDFFunctions which * form an array of k single input functions making up * the stitching function. */ protected List functions = null; /** * Optional for Type 3: An array of (k-1) Doubles that, * in combination with Domain, define the intervals to which * each function from the Functions array apply. Bounds * elements must be in order of increasing magnitude, * and each value must be within the value of Domain. * k is the number of functions. * If you pass null, it will output (1/k) in an array of k-1 elements. * This makes each function responsible for an equal amount of the stitching function. * It makes the gradient even. */ protected List bounds = null; // See encode above, as it's also part of Type 3 Functions. /* *************************TYPE 4************************** */ // See 'data' above. /** * create an complete Function object of Type 0, A Sampled function. * * Use null for an optional object parameter if you choose not to use it. * For optional int parameters, pass the default. * * @param theDomain List objects of Double objects. * This is the domain of the function. * See page 264 of the PDF 1.3 Spec. * @param theRange List objects of Double objects. * This is the Range of the function. * See page 264 of the PDF 1.3 Spec. * @param theSize A List object of Integer objects. * This is the number of samples in each input dimension. * I can't imagine there being more or less than two input dimensions, * so maybe this should be an array of length 2. * * See page 265 of the PDF 1.3 Spec. * @param theBitsPerSample An int specifying the number of bits used to represent each sample value. * Limited to 1,2,4,8,12,16,24 or 32. * See page 265 of the 1.3 PDF Spec. * @param theOrder The order of interpolation between samples. Default is 1 (one). Limited * to 1 (one) or 3, which means linear or cubic-spline interpolation. * * This attribute is optional. * * See page 265 in the PDF 1.3 spec. * @param theEncode List objects of Double objects. * This is the linear mapping of input values intop the domain * of the function's sample table. Default is hard to represent in * ascii, but basically [0 (Size0 1) 0 (Size1 1)...]. * This attribute is optional. * * See page 265 in the PDF 1.3 spec. * @param theDecode List objects of Double objects. * This is a linear mapping of sample values into the range. * The default is just the range. * * This attribute is optional. * Read about it on page 265 of the PDF 1.3 spec. * @param theFunctionDataStream The sample values that specify * the function are provided in a stream. * * This is optional, but is almost always used. * * Page 265 of the PDF 1.3 spec has more. * @param theFilter This is a vector of String objects which are the various filters that * have are to be applied to the stream to make sense of it. Order matters, * so watch out. * * This is not documented in the Function section of the PDF 1.3 spec, * it was deduced from samples that this is sometimes used, even if we may never * use it in FOP. It is added for completeness sake. * @param theNumber The object number of this PDF object. * @param theFunctionType This is the type of function (0,2,3, or 4). * It should be 0 as this is the constructor for sampled functions. */ public PDFFunction(int theNumber, int theFunctionType, List theDomain, List theRange, List theSize, int theBitsPerSample, int theOrder, List theEncode, List theDecode, StringBuffer theFunctionDataStream, List theFilter) { super(theNumber); this.functionType = 0; // dang well better be 0; this.size = theSize; this.bitsPerSample = theBitsPerSample; this.order = theOrder; // int this.encode = theEncode; // vector of int this.decode = theDecode; // vector of int this.functionDataStream = theFunctionDataStream; this.filter = theFilter; // vector of Strings // the domain and range are actually two dimensional arrays. // so if there's not an even number of items, bad stuff // happens. this.domain = theDomain; this.range = theRange; } /** * create an complete Function object of Type 2, an Exponential Interpolation function. * * Use null for an optional object parameter if you choose not to use it. * For optional int parameters, pass the default. * * @param theNumber the object's number * @param theDomain List objects of Double objects. * This is the domain of the function. * See page 264 of the PDF 1.3 Spec. * @param theRange List of Doubles that is the Range of the function. * See page 264 of the PDF 1.3 Spec. * @param theCZero This is a vector of Double objects which defines the function result * when x=0. * * This attribute is optional. * It's described on page 268 of the PDF 1.3 spec. * @param theCOne This is a vector of Double objects which defines the function result * when x=1. * * This attribute is optional. * It's described on page 268 of the PDF 1.3 spec. * @param theInterpolationExponentN This is the inerpolation exponent. * * This attribute is required. * PDF Spec page 268 * @param theFunctionType The type of the function, which should be 2. */ public PDFFunction(int theNumber, int theFunctionType, List theDomain, List theRange, List theCZero, List theCOne, double theInterpolationExponentN) { super(theNumber); this.functionType = 2; // dang well better be 2; this.cZero = theCZero; this.cOne = theCOne; this.interpolationExponentN = theInterpolationExponentN; this.domain = theDomain; this.range = theRange; } /** * create an complete Function object of Type 3, a Stitching function. * * Use null for an optional object parameter if you choose not to use it. * For optional int parameters, pass the default. * * @param theNumber the object's number * @param theDomain List objects of Double objects. * This is the domain of the function. * See page 264 of the PDF 1.3 Spec. * @param theRange List objects of Double objects. * This is the Range of the function. * See page 264 of the PDF 1.3 Spec. * @param theFunctions A List of the PDFFunction objects that the stitching function stitches. * * This attributed is required. * It is described on page 269 of the PDF spec. * @param theBounds This is a vector of Doubles representing the numbers that, * in conjunction with Domain define the intervals to which each function from * the 'functions' object applies. It must be in order of increasing magnitude, * and each must be within Domain. * * It basically sets how much of the gradient each function handles. * * This attributed is required. * It's described on page 269 of the PDF 1.3 spec. * @param theEncode List objects of Double objects. * This is the linear mapping of input values intop the domain * of the function's sample table. Default is hard to represent in * ascii, but basically [0 (Size0 1) 0 (Size1 1)...]. * This attribute is required. * * See page 270 in the PDF 1.3 spec. * @param theFunctionType This is the function type. It should be 3, * for a stitching function. */ public PDFFunction(int theNumber, int theFunctionType, List theDomain, List theRange, List theFunctions, List theBounds, List theEncode) { super(theNumber); this.functionType = 3; // dang well better be 3; this.functions = theFunctions; this.bounds = theBounds; this.encode = theEncode; this.domain = theDomain; this.range = theRange; } /** * create an complete Function object of Type 4, a postscript calculator function. * * Use null for an optional object parameter if you choose not to use it. * For optional int parameters, pass the default. * * @param theDomain List object of Double objects. * This is the domain of the function. * See page 264 of the PDF 1.3 Spec. * @param theRange List object of Double objects. * This is the Range of the function. * See page 264 of the PDF 1.3 Spec. * @param theFunctionDataStream This is a stream of arithmetic, * boolean, and stack operators and boolean constants. * I end up enclosing it in the '{' and '}' braces for you, so don't do it * yourself. * * This attribute is required. * It's described on page 269 of the PDF 1.3 spec. * @param theNumber The object number of this PDF object. * @param theFunctionType The type of function which should be 4, as this is * a Postscript calculator function */ public PDFFunction(int theNumber, int theFunctionType, List theDomain, List theRange, StringBuffer theFunctionDataStream) { super(theNumber); this.functionType = 4; // dang well better be 4; this.functionDataStream = theFunctionDataStream; this.domain = theDomain; this.range = theRange; } /** * represent as PDF. Whatever the FunctionType is, the correct * representation spits out. The sets of required and optional * attributes are different for each type, but if a required * attribute's object was constructed as null, then no error * is raised. Instead, the malformed PDF that was requested * by the construction is dutifully output. * This policy should be reviewed. * * @return the PDF string. */ public byte[] toPDF() { int vectorSize = 0; int numberOfFunctions = 0; int tempInt = 0; StringBuffer p = new StringBuffer(); p.append(this.number + " " + this.generation + " obj\n<< \n/FunctionType " + this.functionType + " \n"); // FunctionType 0 if (this.functionType == 0) { if (this.domain != null) { // DOMAIN p.append("/Domain [ "); vectorSize = this.domain.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt)) + " "); } p.append("] \n"); } else { p.append("/Domain [ 0 1 ] \n"); } // SIZE if (this.size != null) { p.append("/Size [ "); vectorSize = this.size.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.size.get(tempInt)) + " "); } p.append("] \n"); } // ENCODE if (this.encode != null) { p.append("/Encode [ "); vectorSize = this.encode.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.encode.get(tempInt)) + " "); } p.append("] \n"); } else { p.append("/Encode [ "); vectorSize = this.functions.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append("0 1 "); } p.append("] \n"); } // BITSPERSAMPLE p.append("/BitsPerSample " + this.bitsPerSample); // ORDER (optional) if (this.order == 1 || this.order == 3) { p.append(" \n/Order " + this.order + " \n"); } // RANGE if (this.range != null) { p.append("/Range [ "); vectorSize = this.range.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt)) + " "); } p.append("] \n"); } // DECODE if (this.decode != null) { p.append("/Decode [ "); vectorSize = this.decode.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.decode.get(tempInt)) + " "); } p.append("] \n"); } // LENGTH if (this.functionDataStream != null) { p.append("/Length " + (this.functionDataStream.length() + 1) + " \n"); } // FILTER? if (this.filter != null) { // if there's a filter vectorSize = this.filter.size(); p.append("/Filter "); if (vectorSize == 1) { p.append("/" + ((String)this.filter.get(0)) + " \n"); } else { p.append("[ "); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append("/" + ((String)this.filter.get(0)) + " "); } p.append("] \n"); } } p.append(">> \n"); // stream representing the function if (this.functionDataStream != null) { p.append("stream\n" + this.functionDataStream + "\nendstream\n"); } p.append("endobj\n"); // end of if FunctionType 0 } else if (this.functionType == 2) { // DOMAIN if (this.domain != null) { p.append("/Domain [ "); vectorSize = this.domain.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt)) + " "); } p.append("] \n"); } else { p.append("/Domain [ 0 1 ] \n"); } // RANGE if (this.range != null) { p.append("/Range [ "); vectorSize = this.range.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt)) + " "); } p.append("] \n"); } // FunctionType, C0, C1, N are required in PDF // C0 if (this.cZero != null) { p.append("/C0 [ "); vectorSize = this.cZero.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.cZero.get(tempInt)) + " "); } p.append("] \n"); } // C1 if (this.cOne != null) { p.append("/C1 [ "); vectorSize = this.cOne.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.cOne.get(tempInt)) + " "); } p.append("] \n"); } // N: The interpolation Exponent p.append("/N " + PDFNumber.doubleOut(new Double(this.interpolationExponentN)) + " \n"); p.append(">> \nendobj\n"); } else if (this.functionType == 3) { // fix this up when my eyes uncross // DOMAIN if (this.domain != null) { p.append("/Domain [ "); vectorSize = this.domain.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt)) + " "); } p.append("] \n"); } else { p.append("/Domain [ 0 1 ] \n"); } // RANGE if (this.range != null) { p.append("/Range [ "); vectorSize = this.range.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt)) + " "); } p.append("] \n"); } // FUNCTIONS if (this.functions != null) { p.append("/Functions [ "); numberOfFunctions = this.functions.size(); for (tempInt = 0; tempInt < numberOfFunctions; tempInt++) { p.append(((PDFFunction)this.functions.get(tempInt)).referencePDF() + " "); } p.append("] \n"); } // ENCODE if (this.encode != null) { p.append("/Encode [ "); vectorSize = this.encode.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.encode.get(tempInt)) + " "); } p.append("] \n"); } else { p.append("/Encode [ "); vectorSize = this.functions.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append("0 1 "); } p.append("] \n"); } // BOUNDS, required, but can be empty p.append("/Bounds [ "); if (this.bounds != null) { vectorSize = this.bounds.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.bounds.get(tempInt)) + " "); } } else { if (this.functions != null) { // if there are n functions, // there must be n-1 bounds. // so let each function handle an equal portion // of the whole. e.g. if there are 4, then [ 0.25 0.25 0.25 ] String functionsFraction = PDFNumber.doubleOut(new Double(1.0 / ((double)numberOfFunctions))); for (tempInt = 0; tempInt + 1 < numberOfFunctions; tempInt++) { p.append(functionsFraction + " "); } functionsFraction = null; // clean reference. } } p.append("] \n"); p.append(">> \nendobj\n"); } else if (this.functionType == 4) { // fix this up when my eyes uncross // DOMAIN if (this.domain != null) { p.append("/Domain [ "); vectorSize = this.domain.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt)) + " "); } p.append("] \n"); } else { p.append("/Domain [ 0 1 ] \n"); } // RANGE if (this.range != null) { p.append("/Range [ "); vectorSize = this.range.size(); for (tempInt = 0; tempInt < vectorSize; tempInt++) { p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt)) + " "); } p.append("] \n"); } // LENGTH if (this.functionDataStream != null) { p.append("/Length " + (this.functionDataStream.length() + 1) + " \n"); } p.append(">> \n"); // stream representing the function if (this.functionDataStream != null) { p.append("stream\n{ " + this.functionDataStream + " } \nendstream\n"); } p.append("endobj\n"); } return (p.toString().getBytes()); } /** * Check if this function is equal to another object. * This is used to find if a particular function already exists * in a document. * * @param obj the obj to compare * @return true if the functions are equal */ public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof PDFFunction)) { return false; } PDFFunction func = (PDFFunction)obj; if (functionType != func.functionType) { return false; } if (bitsPerSample != func.bitsPerSample) { return false; } if (order != func.order) { return false; } if (interpolationExponentN != func.interpolationExponentN) { return false; } if (domain != null) { if (!domain.equals(func.domain)) { return false; } } else if (func.domain != null) { return false; } if (range != null) { if (!range.equals(func.range)) { return false; } } else if (func.range != null) { return false; } if (size != null) { if (!size.equals(func.size)) { return false; } } else if (func.size != null) { return false; } if (encode != null) { if (!encode.equals(func.encode)) { return false; } } else if (func.encode != null) { return false; } if (decode != null) { if (!decode.equals(func.decode)) { return false; } } else if (func.decode != null) { return false; } if (functionDataStream != null) { if (!functionDataStream.equals(func.functionDataStream)) { return false; } } else if (func.functionDataStream != null) { return false; } if (filter != null) { if (!filter.equals(func.filter)) { return false; } } else if (func.filter != null) { return false; } if (cZero != null) { if (!cZero.equals(func.cZero)) { return false; } } else if (func.cZero != null) { return false; } if (cOne != null) { if (!cOne.equals(func.cOne)) { return false; } } else if (func.cOne != null) { return false; } if (functions != null) { if (!functions.equals(func.functions)) { return false; } } else if (func.functions != null) { return false; } if (bounds != null) { if (!bounds.equals(func.bounds)) { return false; } } else if (func.bounds != null) { return false; } return true; } }