Java Code Examples for java.awt.Composite

The following are top voted examples for showing how to use java.awt.Composite. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: MaskFill.java   View source code 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 2
Project: brModelo   File: Tabela.java   View source code 6 votes vote down vote up
private void FillCampos(Graphics2D g, Rectangle r, boolean normal) {
    Composite originalComposite = g.getComposite();
    float alfa = 1f - getAlfa();
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alfa));
    Paint bkpp = g.getPaint();
    g.setColor(getMaster().getBackground()); //# Não: isDisablePainted()? disabledColor : 
    if (!normal) {
        if (isGradiente()) {
            g.setColor(getGradienteStartColor());
        } else {
            g.setColor(getForeColor());
        }
    }
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getAlfa()));
    g.fill(r);

    g.setPaint(bkpp);
    g.setComposite(originalComposite);
}
 
Example 3
Project: brModelo   File: Desenhador.java   View source code 6 votes vote down vote up
public void DrawImagem(Graphics2D g) {
    BufferedImage imgB = getImagem();
    if (imgB == null) {
        return;
    }
    Rectangle rec = getBounds();
    rec.grow(-2, -2);
    if (imgres == null) {
        imgres = imgB.getScaledInstance(rec.width, rec.height, Image.SCALE_SMOOTH);
    }

    Composite originalComposite = g.getComposite();
    if (alfa != 1f) {
        int type = AlphaComposite.SRC_OVER;
        g.setComposite(AlphaComposite.getInstance(type, alfa));
    }
    Image img = imgres;
    if (isDisablePainted()) {
        img = util.Utilidades.dye(new ImageIcon(imgres), disabledColor);
    }
    
    g.drawImage(img, rec.x, rec.y, null);
    g.setComposite(originalComposite);
}
 
Example 4
Project: parabuild-ci   File: Plot.java   View source code 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the specified area.
 * 
 * @param g2  the graphics device.
 * @param area  the area.
 */
protected void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage != null) {
        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, this.backgroundAlpha));
        Rectangle2D dest = new Rectangle2D.Double(
            0.0, 0.0,
            this.backgroundImage.getWidth(null), this.backgroundImage.getHeight(null)
        );
        Align.align(dest, area, this.backgroundImageAlignment);
        g2.drawImage(
            this.backgroundImage,
            (int) dest.getX(), (int) dest.getY(),
            (int) dest.getWidth() + 1, (int) dest.getHeight() + 1, null
        );
        g2.setComposite(originalComposite);
    }
}
 
Example 5
Project: Logisim   File: SubcircuitFactory.java   View source code 6 votes vote down vote up
@Override
public void paintGhost(InstancePainter painter) {
	Graphics g = painter.getGraphics();
	Color fg = g.getColor();
	int v = fg.getRed() + fg.getGreen() + fg.getBlue();
	Composite oldComposite = null;
	if (g instanceof Graphics2D && v > 50) {
		oldComposite = ((Graphics2D) g).getComposite();
		Composite c = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
		((Graphics2D) g).setComposite(c);
	}
	paintBase(painter, g);
	if (oldComposite != null) {
		((Graphics2D) g).setComposite(oldComposite);
	}
}
 
Example 6
Project: jdk8u-jdk   File: MaskFill.java   View source code 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 7
Project: OpenJSharp   File: OGLBlitLoops.java   View source code 6 votes vote down vote up
@Override
public synchronized void Transform(SurfaceData src, SurfaceData dst,
                                   Composite comp, Region clip,
                                   AffineTransform at, int hint, int srcx,
                                   int srcy, int dstx, int dsty, int width,
                                   int height){
    Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
                                        CompositeType.SrcNoEa,
                                        SurfaceType.IntArgbPre);
    // use cached intermediate surface, if available
    final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null;
    // convert source to IntArgbPre
    src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc,
                      BufferedImage.TYPE_INT_ARGB_PRE);

    // transform IntArgbPre intermediate surface to OpenGL surface
    performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty,
                        width, height);

    if (src != cachedSrc) {
        // cache the intermediate surface
        srcTmp = new WeakReference<>(src);
    }
}
 
Example 8
Project: jdk8u-jdk   File: D3DTextRenderer.java   View source code 5 votes vote down vote up
@Override
protected void validateContext(SunGraphics2D sg2d, Composite comp) {
    // assert rq.lock.isHeldByCurrentThread();
    D3DSurfaceData d3dDst = (D3DSurfaceData)sg2d.surfaceData;
    D3DContext.validateContext(d3dDst, d3dDst,
                               sg2d.getCompClip(), comp,
                               null, sg2d.paint, sg2d,
                               D3DContext.NO_CONTEXT_FLAGS);
}
 
Example 9
Project: brModelo   File: LivreBase.java   View source code 5 votes vote down vote up
@Override
protected void PinteRegiao(Graphics2D g) {
    Composite originalComposite = g.getComposite();
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alfa));
    g.setPaint(this.getForeColor());

    if (isGradiente()) {
        int dist = 0;
        int w = getWidth() - dist;
        int h = getHeight() - dist;
        int L = getLeft();
        int T = getTop();
        boolean dv = getGDirecao() == VERTICAL;

        GradientPaint GP = new GradientPaint(L, T, getGradienteStartColor(), dv ? L : L + w, dv ? T + h : T, getGradienteEndColor(), true);
        g.setPaint(GP);
    }

    if (getTipoDesenho() != TipoDraw.tpTexto) {
        Stroke bkp = g.getStroke();
        if (isDashed()) {
            g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{1, 2}, 0));
        }
        if (isGradiente()) {
            g.fill(getRegiao());
        }
        g.draw(getRegiao()); //Pinta as eventuais linhas internas do dezenho. Ex. LivreVariosDocumemtos 

        g.setStroke(bkp);
    }
    g.setComposite(originalComposite);
}
 
Example 10
Project: incubator-netbeans   File: BalloonManager.java   View source code 5 votes vote down vote up
@Override
protected void paintChildren(Graphics g) {
    Graphics2D g2d = (Graphics2D)g;
    Composite oldC = g2d.getComposite();
    g2d.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, currentAlpha ) );
    super.paintChildren(g);
    g2d.setComposite( oldC );
}
 
Example 11
Project: openjdk-jdk10   File: GDIRenderer.java   View source code 5 votes vote down vote up
void doDrawOval(GDIWindowSurfaceData sData,
                Region clip, Composite comp, int color,
                int x, int y, int w, int h)
{
    GraphicsPrimitive.tracePrimitive("GDIDrawOval");
    super.doDrawOval(sData, clip, comp, color, x, y, w, h);
}
 
Example 12
Project: incubator-netbeans   File: AquaSlidingButtonUI.java   View source code 5 votes vote down vote up
@Override
protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect) {
    Graphics2D g2d = (Graphics2D) g;

    Composite comp = g2d.getComposite();
    if( b.getModel().isRollover() || b.getModel().isSelected() ) {
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
    }
    super.paintIcon(g, b, iconRect);
    g2d.setComposite(comp);
}
 
Example 13
Project: OpenJSharp   File: GDIRenderer.java   View source code 5 votes vote down vote up
void doFillOval(GDIWindowSurfaceData sData,
                Region clip, Composite comp, int color,
                int x, int y, int w, int h)
{
    GraphicsPrimitive.tracePrimitive("GDIFillOval");
    super.doFillOval(sData, clip, comp, color, x, y, w, h);
}
 
Example 14
Project: jdk8u-jdk   File: OGLMaskBlit.java   View source code 5 votes vote down vote up
@Override
protected void validateContext(SurfaceData dstData,
                               Composite comp, Region clip)
{
    OGLSurfaceData oglDst = (OGLSurfaceData)dstData;
    OGLContext.validateContext(oglDst, oglDst,
                               clip, comp, null, null, null,
                               OGLContext.NO_CONTEXT_FLAGS);
}
 
Example 15
Project: FreeCol   File: ReportLabourPanel.java   View source code 5 votes vote down vote up
@Override
public void paint(Graphics g) {
    if (selected) {
        Graphics2D g2d = (Graphics2D) g;
        Composite oldComposite = g2d.getComposite();
        Color oldColor = g2d.getColor();
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
        g2d.setColor(Color.BLACK);
        g2d.fillRect(0, 0, getWidth(), getHeight());
        g2d.setComposite(oldComposite);
        g2d.setColor(oldColor);
    }
    super.paint(g);
}
 
Example 16
Project: parabuild-ci   File: DefaultPolarItemRenderer.java   View source code 5 votes vote down vote up
/**
 * Plots the data for a given series.
 * 
 * @param g2  the drawing surface.
 * @param dataArea  the data area.
 * @param info  collects plot rendering info.
 * @param plot  the plot.
 * @param dataset  the dataset.
 * @param seriesIndex  the series index.
 */
public void drawSeries(Graphics2D g2, 
                       Rectangle2D dataArea, 
                       PlotRenderingInfo info,
                       PolarPlot plot,
                       XYDataset dataset,
                       int seriesIndex) {
    
    Polygon poly = new Polygon();
    int numPoints = dataset.getItemCount(seriesIndex);
    for (int i = 0; i < numPoints; i++) {
        double theta = dataset.getXValue(seriesIndex, i);
        double radius = dataset.getYValue(seriesIndex, i);
        Point p = plot.translateValueThetaRadiusToJava2D(theta, radius, dataArea);
        poly.addPoint(p.x, p.y);
    }
    g2.setPaint(getSeriesPaint(seriesIndex));
    g2.setStroke(getSeriesStroke(seriesIndex));
    if (isSeriesFilled(seriesIndex)) {
        Composite savedComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
        g2.fill(poly);
        g2.setComposite(savedComposite);
    }
    else {
        g2.draw(poly);
    }
}
 
Example 17
Project: jdk8u-jdk   File: GDIRenderer.java   View source code 5 votes vote down vote up
void doDrawRoundRect(GDIWindowSurfaceData sData,
                     Region clip, Composite comp, int color,
                     int x, int y, int w, int h,
                     int arcW, int arcH)
{
    GraphicsPrimitive.tracePrimitive("GDIDrawRoundRect");
    super.doDrawRoundRect(sData, clip, comp, color,
                          x, y, w, h, arcW, arcH);
}
 
Example 18
Project: brModelo   File: EapProcesso.java   View source code 5 votes vote down vote up
@Override
public void DoPaint(Graphics2D g) {
    Composite bkp = g.getComposite();
    Paint p = g.getPaint();
    super.DoPaint(g);
    g.setPaint(p);
    g.setComposite(bkp);
}
 
Example 19
Project: parabuild-ci   File: ClipPath.java   View source code 5 votes vote down vote up
/**
 * Draws the clip path.
 *
 * @param g2  current graphics2D.
 * @param dataArea  the dataArea that the plot is being draw in.
 * @param horizontalAxis  the horizontal axis.
 * @param verticalAxis  the vertical axis.
 *
 * @return the GeneralPath defining the outline
 */
public GeneralPath draw(Graphics2D g2,
                        Rectangle2D dataArea,
                        ValueAxis horizontalAxis, ValueAxis verticalAxis) {

    GeneralPath generalPath = generateClipPath(dataArea, horizontalAxis, verticalAxis);
    if (this.fillPath || this.drawPath) {
        Composite saveComposite = g2.getComposite();
        Paint savePaint = g2.getPaint();
        Stroke saveStroke = g2.getStroke();

        if (this.fillPaint != null) {
            g2.setPaint(this.fillPaint);
        }
        if (this.composite != null) {
            g2.setComposite(this.composite);
        }
        if (this.fillPath) {
            g2.fill(generalPath);
        }

        if (this.drawStroke != null) {
            g2.setStroke(this.drawStroke);
        }
        if (this.drawPath) {
            g2.draw(generalPath);
        }
        g2.setPaint(savePaint);
        g2.setComposite(saveComposite);
        g2.setStroke(saveStroke);
    }
    return generalPath;

}
 
Example 20
Project: chordatlas   File: FeatureCache.java   View source code 5 votes vote down vote up
@Override
		public void paint( Graphics2D g, PanMouseAdaptor ma ) {

			{
				Composite old = g.getComposite();
				Composite comp = AlphaComposite.getInstance( AlphaComposite.SRC_OVER, 0.5f );
				g.setComposite( comp );

				// draw rectified image at the width of the ortho image...
				
				double height = getRectified().getHeight() / 40.;

				g.drawImage( getRectified(), 
						ma.toX( Math.min( start, end ) ), 
						ma.toY( 0 - height ), 
						ma.toZoom( Math.abs(start - end) ), 
						ma.toZoom( height ), null );
				g.setComposite( old );
			}

//			for ( int i = 0; i < miniFacades.size(); i++ )
//				miniFacades.get( i ).paint( g, ma );

			//			for (double d : o.windowCuts)
			//				g.drawLine( ma.toX(d), 0, ma.toX(d), 10000 );
			//			
			g.setColor( Color.orange );
			//			
			//			for (double d : o.classCuts)
			//				g.drawLine( ma.toX(d), 0, ma.toX(d), 10000 );
			//		
			//			g.setColor( new Color(255, 100,100, 255) );
			//			if (o.windows != null)
			//			for (Rectangle2D.Double w : o.windows) {
			//				g.drawRect( ma.toX( w.x ), ma.toY (-w.y-w.height), ma.toZoom( w.width ), ma.toZoom( w.height ) );
			//			}
		}
 
Example 21
Project: openjdk-jdk10   File: OGLBlitLoops.java   View source code 5 votes vote down vote up
private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
                                          Composite comp, Region clip,
                                          int sx, int sy, int dx, int dy,
                                          int w, int h) {
    SurfaceData cachedSrc = null;
    if (srcTmp != null) {
        // use cached intermediate surface, if available
        cachedSrc = srcTmp.get();
    }

    // We can convert argb_pre data from OpenGL surface in two places:
    // - During OpenGL surface -> SW blit
    // - During SW -> SW blit
    // The first one is faster when we use opaque OGL surface, because in
    // this case we simply skip conversion and use color components as is.
    // Because of this we align intermediate buffer type with type of
    // destination not source.
    final int type = typeval == OGLSurfaceData.PF_INT_ARGB_PRE ?
                     BufferedImage.TYPE_INT_ARGB_PRE :
                     BufferedImage.TYPE_INT_ARGB;

    src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);

    // copy intermediate SW to destination SW using complex clip
    final Blit performop = Blit.getFromCache(src.getSurfaceType(),
                                             CompositeType.SrcNoEa,
                                             dst.getSurfaceType());
    performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);

    if (src != cachedSrc) {
        // cache the intermediate surface
        srcTmp = new WeakReference<>(src);
    }
}
 
Example 22
Project: openjdk-jdk10   File: MaskFill.java   View source code 5 votes vote down vote up
public void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
                        Composite comp,
                        double x, double y,
                        double dx1, double dy1,
                        double dx2, double dy2,
                        double lw1, double lw2)
{
    tracePrimitive(drawPgramTarget);
    target.DrawAAPgram(sg2d, sData, comp,
                       x, y, dx1, dy1, dx2, dy2, lw1, lw2);
}
 
Example 23
Project: freecol   File: FreeColButtonUI.java   View source code 5 votes vote down vote up
@Override
protected void paintButtonPressed(Graphics g, AbstractButton c) {
    if (c.isContentAreaFilled()) {
        Graphics2D g2d = (Graphics2D) g;
        Dimension size = c.getSize();
        Composite oldComposite = g2d.getComposite();
        Color oldColor = g2d.getColor();
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
        g2d.setColor(Color.BLACK);
        g2d.fillRect(0, 0, size.width, size.height);
        g2d.setComposite(oldComposite);
        g2d.setColor(oldColor);

    }
}
 
Example 24
Project: freecol   File: FreeColComboBoxRenderer.java   View source code 5 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    Composite oldComposite = g2d.getComposite();
    Color oldColor = g2d.getColor();
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
    g2d.setColor(Color.BLACK);
    g2d.fillRect(0, 0, getWidth(), getHeight());
    g2d.setComposite(oldComposite);
    g2d.setColor(oldColor);

    super.paintComponent(g);
}
 
Example 25
Project: freecol   File: FreeColSelectedPanelUI.java   View source code 5 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    Graphics2D g2d = (Graphics2D) g;
    Composite oldComposite = g2d.getComposite();
    Color oldColor = g2d.getColor();
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
    g2d.setColor(Color.BLACK);
    g2d.fillRect(0, 0, c.getWidth(), c.getHeight());
    g2d.setComposite(oldComposite);
    g2d.setColor(oldColor);

    //super.paintComponent(g);
}
 
Example 26
Project: jdk8u-jdk   File: D3DBlitLoops.java   View source code 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, true);
}
 
Example 27
Project: jdk8u-jdk   File: D3DBlitLoops.java   View source code 5 votes vote down vote up
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    D3DBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx1, sy1, sx2, sy2,
                         dx1, dy1, dx2, dy2,
                         true);
}
 
Example 28
Project: jdk8u-jdk   File: OGLTextRenderer.java   View source code 5 votes vote down vote up
@Override
protected void validateContext(SunGraphics2D sg2d, Composite comp) {
    // assert rq.lock.isHeldByCurrentThread();
    OGLSurfaceData oglDst = (OGLSurfaceData)sg2d.surfaceData;
    OGLContext.validateContext(oglDst, oglDst,
                               sg2d.getCompClip(), comp,
                               null, sg2d.paint, sg2d,
                               OGLContext.NO_CONTEXT_FLAGS);
}
 
Example 29
Project: openjdk-jdk10   File: OGLBlitLoops.java   View source code 5 votes vote down vote up
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    OGLBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx1, sy1, sx2, sy2,
                      dx1, dy1, dx2, dy2,
                      typeval, false);
}
 
Example 30
Project: parabuild-ci   File: MarkerAxisBand.java   View source code 5 votes vote down vote up
/**
 * Draws the band.
 *
 * @param g2  the graphics device.
 * @param plotArea  the plot area.
 * @param dataArea  the data area.
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 */
public void draw(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea,
                 double x, double y) {

    double h = getHeight(g2);
    Iterator iterator = this.markers.iterator();
    while (iterator.hasNext()) {
        IntervalMarker marker = (IntervalMarker) iterator.next();
        double start =  Math.max(
            marker.getStartValue(), this.axis.getRange().getLowerBound()
        );
        double end = Math.min(
            marker.getEndValue(), this.axis.getRange().getUpperBound()
        );
        double s = this.axis.valueToJava2D(
            start, dataArea, RectangleEdge.BOTTOM
        );
        double e = this.axis.valueToJava2D(
            end, dataArea, RectangleEdge.BOTTOM
        );
        Rectangle2D r = new Rectangle2D.Double(
            s, y + this.topOuterGap, e - s, 
            h - this.topOuterGap - this.bottomOuterGap
        );

        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(
            AlphaComposite.SRC_OVER, marker.getAlpha())
        );
        g2.setPaint(marker.getPaint());
        g2.fill(r);
        g2.setPaint(marker.getOutlinePaint());
        g2.draw(r);
        g2.setComposite(originalComposite);

        g2.setPaint(Color.black);
        drawStringInRect(g2, r, this.font, marker.getLabel());
    }

}
 
Example 31
Project: jdk8u-jdk   File: D3DBlitLoops.java   View source code 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx, sy, sx+w, sy+h,
                         dx, dy, dx+w, dy+h,
                         true);
}
 
Example 32
Project: openjdk-jdk10   File: OGLBlitLoops.java   View source code 5 votes vote down vote up
public void Transform(SurfaceData src, SurfaceData dst,
                      Composite comp, Region clip,
                      AffineTransform at, int hint,
                      int sx, int sy, int dx, int dy,
                      int w, int h)
{
    OGLBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, at, hint,
                         sx, sy, sx+w, sy+h,
                         dx, dy, dx+w, dy+h,
                         false);
}
 
Example 33
Project: jdk8u-jdk   File: Blit.java   View source code 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int srcx, int srcy, int dstx, int dsty,
                 int width, int height)
{
    tracePrimitive(target);
    target.Blit(src, dst, comp, clip,
                srcx, srcy, dstx, dsty, width, height);
}
 
Example 34
Project: openjdk-jdk10   File: Blit.java   View source code 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int srcx, int srcy, int dstx, int dsty,
                 int width, int height)
{
    tracePrimitive(target);
    target.Blit(src, dst, comp, clip,
                srcx, srcy, dstx, dsty, width, height);
}
 
Example 35
Project: OpenJSharp   File: D3DBlitLoops.java   View source code 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx, sy, sx+w, sy+h,
                         dx, dy, dx+w, dy+h,
                         true);
}
 
Example 36
Project: jdk8u-jdk   File: MaskFill.java   View source code 5 votes vote down vote up
public void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
                        Composite comp,
                        double x, double y,
                        double dx1, double dy1,
                        double dx2, double dy2)
{
    tracePrimitive(fillPgramTarget);
    target.FillAAPgram(sg2d, sData, comp,
                       x, y, dx1, dy1, dx2, dy2);
}
 
Example 37
Project: FreeCol   File: FreeColButtonUI.java   View source code 5 votes vote down vote up
@Override
protected void paintButtonPressed(Graphics g, AbstractButton c) {
    if (c.isContentAreaFilled()) {
        Graphics2D g2d = (Graphics2D) g;
        Dimension size = c.getSize();
        Composite oldComposite = g2d.getComposite();
        Color oldColor = g2d.getColor();
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
        g2d.setColor(Color.BLACK);
        g2d.fillRect(0, 0, size.width, size.height);
        g2d.setComposite(oldComposite);
        g2d.setColor(oldColor);

    }
}
 
Example 38
Project: OpenJSharp   File: Blit.java   View source code 5 votes vote down vote up
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    performop.MaskBlit(srcData, dstData, comp, clip,
                       srcx, srcy, dstx, dsty,
                       width, height,
                       null, 0, 0);
}
 
Example 39
Project: OpenJSharp   File: D3DBlitLoops.java   View source code 5 votes vote down vote up
public void Transform(SurfaceData src, SurfaceData dst,
                      Composite comp, Region clip,
                      AffineTransform at, int hint,
                      int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.Blit(src, dst,
                      comp, clip, at, hint,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, false);
}
 
Example 40
Project: openjdk-jdk10   File: MaskBlit.java   View source code 5 votes vote down vote up
/**
 * All MaskBlit implementors must have this invoker method
 */
public native void MaskBlit(SurfaceData src, SurfaceData dst,
                            Composite comp, Region clip,
                            int srcx, int srcy,
                            int dstx, int dsty,
                            int width, int height,
                            byte[] mask, int maskoff, int maskscan);