Package com.itextpdf.text

Examples of com.itextpdf.text.BaseColor


      }
      switch (nOperands) {
      case 1:
        return new GrayColor(c[0]);
      case 3:
        return new BaseColor(c[0], c[1], c[2]);
      case 4:
        return new CMYKColor(c[0], c[1], c[2], c[3]);
      }
      return null;
    }
View Full Code Here


                text.setFontAndSize(currentFont.getFont(), currentFont.size());
            }
            Object textRender[] = (Object[])chunk.getAttribute(Chunk.TEXTRENDERMODE);
            int tr = 0;
            float strokeWidth = 1;
            BaseColor color = chunk.color();
            BaseColor strokeColor = null;
            if (textRender != null) {
                tr = ((Integer)textRender[0]).intValue() & 3;
                if (tr != PdfContentByte.TEXT_RENDER_MODE_FILL)
                    text.setTextRenderingMode(tr);
                if (tr == PdfContentByte.TEXT_RENDER_MODE_STROKE || tr == PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE) {
View Full Code Here

                case META_SETPOLYFILLMODE:
                    state.setPolyFillMode(in.readWord());
                    break;
                case META_SETPIXEL:
                {
                    BaseColor color = in.readColor();
                    int y = in.readShort();
                    int x = in.readShort();
                    cb.saveState();
                    cb.setColorFill(color);
                    cb.rectangle(state.transformX(x), state.transformY(y), .2f, .2f);
View Full Code Here

            ty = 0;
        else if ((align & MetaState.TA_BOTTOM) == MetaState.TA_BOTTOM)
            ty = -descender;
        else
            ty = -ury;
        BaseColor textColor;
        if (state.getBackgroundMode() == MetaState.OPAQUE) {
            textColor = state.getCurrentBackgroundColor();
            cb.setColorFill(textColor);
            cb.rectangle(tx, ty + descender, textWidth, ury - descender);
            cb.fill();
View Full Code Here

        return array;
    }

    public BaseColor lab2Rgb(float l, float a, float b) {
        double[] clinear = lab2RgbLinear(l, a, b);
        return new BaseColor((float)clinear[0], (float)clinear[1], (float)clinear[2]);
    }
View Full Code Here

        switch (obj.getType()) {
            case MetaObject.META_BRUSH:
                currentBrush = (MetaBrush)obj;
                style = currentBrush.getStyle();
                if (style == MetaBrush.BS_SOLID) {
                    BaseColor color = currentBrush.getColor();
                    cb.setColorFill(color);
                }
                else if (style == MetaBrush.BS_HATCHED) {
                    BaseColor color = currentBackgroundColor;
                    cb.setColorFill(color);
                }
                break;
            case MetaObject.META_PEN:
            {
                currentPen = (MetaPen)obj;
                style = currentPen.getStyle();
                if (style != MetaPen.PS_NULL) {
                    BaseColor color = currentPen.getColor();
                    cb.setColorStroke(color);
                    cb.setLineWidth(Math.abs(currentPen.getPenWidth() * scalingX / extentWx));
                    switch (style) {
                        case MetaPen.PS_DASH:
                            cb.setLineDash(18, 6, 0);
View Full Code Here

                throw new RuntimeException(MessageLocalization.getComposedMessage("devicen.component.names.shall.be.different"));
            if (colorantsDetails != null)
                colorantsDict.put(spotColorant.getName(), colorantsDetails[i].getIndirectReference());
            else
                colorantsDict.put(spotColorant.getName(), spotColorant.getPdfObject(writer));
            BaseColor color = spotColorant.getAlternativeCS();
            if (color instanceof ExtendedColor) {
                int type = ((ExtendedColor)color).type;
                switch (type) {
                    case ExtendedColor.TYPE_GRAY:
                        CMYK[0][i] = 0;
                        CMYK[1][i] = 0;
                        CMYK[2][i] = 0;
                        CMYK[3][i] = 1 - ((GrayColor)color).getGray();
                        break;
                    case ExtendedColor.TYPE_CMYK:
                        CMYK[0][i] = ((CMYKColor)color).getCyan();
                        CMYK[1][i] = ((CMYKColor)color).getMagenta();
                        CMYK[2][i] = ((CMYKColor)color).getYellow();
                        CMYK[3][i] = ((CMYKColor)color).getBlack();
                        break;
                    case ExtendedColor.TYPE_LAB:
                        CMYKColor cmyk = ((LabColor)color).toCmyk();
                        CMYK[0][i] = cmyk.getCyan();
                        CMYK[1][i] = cmyk.getMagenta();
                        CMYK[2][i] = cmyk.getYellow();
                        CMYK[3][i] = cmyk.getBlack();
                        break;
                    default:
                        throw new RuntimeException(MessageLocalization.getComposedMessage("only.rgb.gray.and.cmyk.are.supported.as.alternative.color.spaces"));
                }
            } else {
                float r = color.getRed();
                float g = color.getGreen();
                float b = color.getBlue();
                float computedC = 0, computedM = 0, computedY = 0, computedK = 0;

                // BLACK
                if (r==0 && g==0 && b==0) {
                    computedK = 1;
View Full Code Here

    public BaseColor readColor() throws IOException{
        int red = readByte();
        int green = readByte();
        int blue = readByte();
        readByte();
        return new BaseColor(red, green, blue);
    }
View Full Code Here

        else if ((options & MULTILINE) == 0)
            ptext = removeCRLF(text);
        else
          ptext = text; //fixed by Kazuya Ujihara (ujihara.jp)
        BaseFont ufont = getRealFont();
        BaseColor fcolor = textColor == null ? GrayColor.GRAYBLACK : textColor;
        int rtl = checkRTL(ptext) ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_NO_BIDI;
        float usize = fontSize;
        Phrase phrase = composePhrase(ptext, ufont, fcolor, usize);
        if ((options & MULTILINE) != 0) {
            float width = box.getWidth() - 4 * offsetX - extraMarginLeft;
View Full Code Here

        topFirst = first;
        app.saveState();
        app.rectangle(offsetX, offsetX, box.getWidth() - 2 * offsetX, box.getHeight() - 2 * offsetX);
        app.clip();
        app.newPath();
        BaseColor fcolor = textColor == null ? GrayColor.GRAYBLACK : textColor;


        // background boxes for selected value[s]
        app.setColorFill(new BaseColor(10, 36, 106));
        for (int curVal = 0; curVal < choiceSelections.size(); ++curVal) {
          int curChoice = (choiceSelections.get( curVal )).intValue();
          // only draw selections within our display range... not strictly necessary with
          // that clipping rect from above, but it certainly doesn't hurt either
          if (curChoice >= first && curChoice <= last) {
            app.rectangle(offsetX, offsetX + h - (curChoice - first + 1) * leading, box.getWidth() - 2 * offsetX, leading);
            app.fill();
          }
        }
        float xp = offsetX * 2;
        float yp = offsetX + h - ufont.getFontDescriptor(BaseFont.BBOXURY, usize);
        for (int idx = first; idx < last; ++idx, yp -= leading) {
            String ptext = choices[idx];
            int rtl = checkRTL(ptext) ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_NO_BIDI;
            ptext = removeCRLF(ptext);
            // highlight selected values against their (presumably) darker background
            BaseColor textCol = choiceSelections.contains( Integer.valueOf( idx )) ? GrayColor.GRAYWHITE : fcolor;
            Phrase phrase = composePhrase(ptext, ufont, textCol, usize);
            ColumnText.showTextAligned(app, Element.ALIGN_LEFT, phrase, xp, yp, 0, rtl, 0);
        }
        app.restoreState();
        app.endVariableText();
View Full Code Here

TOP

Related Classes of com.itextpdf.text.BaseColor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.