Itext中設置透明度不起做用的問題

今天在設置畫的線條透明度的時候,用baseColor設置透明度不起做用,最後發現原來要靠pdfGState來設置才行,具體代碼以下:

        PdfGState gState = new PdfGState();
        if(alphas < 255){
            gState.setStrokeOpacity(0.5f);
        }else{
            gState.setStrokeOpacity(1f);
        }
        canvas.setGState(gState);

        Log.i(TAG, "red =="+red + ",green =="+green +",blue =="+blue+",alphas =="+alphas);

        BaseColor baseclor= new BaseColor(red, green, blue);

        canvas.setColorStroke(baseclor);
相關文章
相關標籤/搜索