Ejemplo n.º 1
0
 private void setComposite(Composite comp, int flags) {
   // assert rq.lock.isHeldByCurrentThread();
   if (comp instanceof AlphaComposite) {
     AlphaComposite ac = (AlphaComposite) comp;
     rq.ensureCapacity(16);
     buf.putInt(SET_ALPHA_COMPOSITE);
     buf.putInt(ac.getRule());
     buf.putFloat(ac.getAlpha());
     buf.putInt(flags);
   } else if (comp instanceof XORComposite) {
     int xorPixel = ((XORComposite) comp).getXorPixel();
     rq.ensureCapacity(8);
     buf.putInt(SET_XOR_COMPOSITE);
     buf.putInt(xorPixel);
   } else {
     throw new InternalError("not yet implemented");
   }
 }
Ejemplo n.º 2
0
 private void setClip(Region clip) {
   // assert rq.lock.isHeldByCurrentThread();
   if (clip.isRectangular()) {
     rq.ensureCapacity(20);
     buf.putInt(SET_RECT_CLIP);
     buf.putInt(clip.getLoX()).putInt(clip.getLoY());
     buf.putInt(clip.getHiX()).putInt(clip.getHiY());
   } else {
     rq.ensureCapacity(28); // so that we have room for at least a span
     buf.putInt(BEGIN_SHAPE_CLIP);
     buf.putInt(SET_SHAPE_CLIP_SPANS);
     // include a placeholder for the span count
     int countIndex = buf.position();
     buf.putInt(0);
     int spanCount = 0;
     int remainingSpans = buf.remaining() / BYTES_PER_SPAN;
     int span[] = new int[4];
     SpanIterator si = clip.getSpanIterator();
     while (si.nextSpan(span)) {
       if (remainingSpans == 0) {
         buf.putInt(countIndex, spanCount);
         rq.flushNow();
         buf.putInt(SET_SHAPE_CLIP_SPANS);
         countIndex = buf.position();
         buf.putInt(0);
         spanCount = 0;
         remainingSpans = buf.remaining() / BYTES_PER_SPAN;
       }
       buf.putInt(span[0]); // x1
       buf.putInt(span[1]); // y1
       buf.putInt(span[2]); // x2
       buf.putInt(span[3]); // y2
       spanCount++;
       remainingSpans--;
     }
     buf.putInt(countIndex, spanCount);
     rq.ensureCapacity(4);
     buf.putInt(END_SHAPE_CLIP);
   }
 }
Ejemplo n.º 3
0
 private void resetTransform() {
   // assert rq.lock.isHeldByCurrentThread();
   rq.ensureCapacity(4);
   buf.putInt(RESET_TRANSFORM);
 }
Ejemplo n.º 4
0
 private void resetComposite() {
   // assert rq.lock.isHeldByCurrentThread();
   rq.ensureCapacity(4);
   buf.putInt(RESET_COMPOSITE);
 }
Ejemplo n.º 5
0
 private void resetClip() {
   // assert rq.lock.isHeldByCurrentThread();
   rq.ensureCapacity(4);
   buf.putInt(RESET_CLIP);
 }