/*
 * Copyright 2018 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.pdfbox.pdmodel.interactive.annotation;

import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDAppearanceHandler;
import org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDInkAppearanceHandler;

/**
 *
 * @author Paul King
 */
public class PDAnnotationInk extends PDAnnotationMarkup
{
    /**
     * The type of annotation.
     */
    public static final String SUB_TYPE = "Ink";

    private PDAppearanceHandler inkAppearanceHandler;

    /**
     * Constructor.
     */
    public PDAnnotationInk()
    {
        getCOSObject().setName(COSName.SUBTYPE, SUB_TYPE);
    }

    /**
     * Constructor.
     *
     * @param dict The annotations dictionary.
     */
    public PDAnnotationInk(COSDictionary dict)
    {
        super(dict);
    }

    //TODO get InkList
    
    
    /**
     * Set a custom appearance handler for generating the annotations appearance streams.
     * 
     * @param inkAppearanceHandler
     */
    public void setCustomInkAppearanceHandler(PDAppearanceHandler inkAppearanceHandler)
    {
        this.inkAppearanceHandler = inkAppearanceHandler;
    }

    @Override
    public void constructAppearances()
    {
        if (inkAppearanceHandler == null)
        {
            PDInkAppearanceHandler appearanceHandler = new PDInkAppearanceHandler(this);
            appearanceHandler.generateAppearanceStreams();
        }
        else
        {
            inkAppearanceHandler.generateAppearanceStreams();
        }
    }
}

@@ -669,16 +669,93 @@
 ation;%0A%0A
+import org.apache.pdfbox.cos.COSArray;%0Aimport org.apache.pdfbox.cos.COSBase;%0A
 import o
@@ -1550,24 +1550,25 @@
 ct);%0A    %7D%0A%0A
+%0A
     //TODO g
@@ -1570,29 +1570,666 @@
 ODO 
-get InkList%0A    %0A    
+setInkList, javadoc%0A %0A    public float%5B%5D%5B%5D getInkList()%0A    %7B%0A        COSBase base = getCOSObject().getDictionaryObject(COSName.INKLIST);%0A        if (base instanceof COSArray)%0A        %7B%0A            COSArray array = (COSArray) base;%0A            float%5B%5D%5B%5D inkList = new float%5Barray.size()%5D%5B%5D;%0A            for (int i = 0; i %3C array.size(); ++i)%0A            %7B%0A                //TODO check for class%0A                COSArray innerArray = (COSArray) array.getObject(i);%0A                inkList%5Bi%5D = innerArray.toFloatArray();%0A            %7D%0A            return inkList;%0A        %7D%0A        // Should never happen as this is a required item%0A        return null; %0A    %7D%0A
 %0A   

add method to get inkList