~ubuntu-branches/ubuntu/karmic/batik/karmic

« back to all changes in this revision

Viewing changes to sources/org/apache/batik/ext/awt/image/rendered/PadRed.java

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev, Onkar Shinde, Matvey Kozhev
  • Date: 2008-07-19 01:03:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080719010305-0b24skqy185kdsb9
Tags: 1.7.dfsg-0ubuntu1
[ Onkar Shinde ]
* New upstream version (LP: #147818)
* debian/control
  - Add Sun JDK 1.5 as build dependency. Fixes FTBFS on buildd. (LP: #150484)
    Also add Sun JRE as runtime dependencies.
  - Add ant-optional as build dependency.
  - Add libxml-commons-external-java and libxmlgraphics-commons-java as
    build and runtime dependencies.
  - Add 'Homepage' field and correct the url.
  - Change standards version to 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
* debian/rules
  - Change JAVA_HOME_DIRS for Sun JDK.
  - Add jar file names to DEB_JARS to match new build requirements.
  - Extract version from changelog.
  - Delete bundled jar files in clean target.
  - Don't use hardcoded version in install target.
  - Add get-orig-source target.
* debian/README.Debian-source
  - Change the fo tag name to the one used for this version.
* debian/watch
  - Change expression to match src distribution.
* debian/patches/
  - 01_build_xml.patch, 02_fix_jar_target.patch - Refresh for current source.
  - 03_fix_lib_dirs.patch - Fix the library and classpath references needed
    for pdf transcoder build.
  - 04_fix_transcoder_pkg.patch - Fix transcoder-pkg target to not copy
    files from other jar files.

[ Matvey Kozhev ]
* debian/changelog:
  - Added ".dfsg" to version.
* debian/control, debian/rules:
  - Build with openjdk-6-jdk, depend on openjdk-6-jre.
  - Added java-6-sun as an alternate build JAVA_HOME directory.
  - Fixed get-orig-source to not include debian/ and delete the source dir,
    and made it delete jars from lib/, as done in the current batik package.
* debian/wrappers.sh:
  - Changed java-7-icedtea reference to java-6-openjdk, as the former has been
    removed back in Hardy.
  - Added newline.
* debian/libbatik-java.install:
  - Added newline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 
3
 
   Copyright 2001-2003  The Apache Software Foundation 
4
 
 
5
 
   Licensed under the Apache License, Version 2.0 (the "License");
6
 
   you may not use this file except in compliance with the License.
7
 
   You may obtain a copy of the License at
 
3
   Licensed to the Apache Software Foundation (ASF) under one or more
 
4
   contributor license agreements.  See the NOTICE file distributed with
 
5
   this work for additional information regarding copyright ownership.
 
6
   The ASF licenses this file to You under the Apache License, Version 2.0
 
7
   (the "License"); you may not use this file except in compliance with
 
8
   the License.  You may obtain a copy of the License at
8
9
 
9
10
       http://www.apache.org/licenses/LICENSE-2.0
10
11
 
32
33
 * This is an implementation of a Pad operation as a RenderedImage.
33
34
 *
34
35
 * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
35
 
 * @version $Id: PadRed.java,v 1.14 2004/08/18 07:14:08 vhardy Exp $ */
 
36
 * @version $Id: PadRed.java 478276 2006-11-22 18:33:37Z dvholten $ */
36
37
public class PadRed extends AbstractRed {
37
38
 
38
39
    static final boolean DEBUG=false;
61
62
        this.padMode = padMode;
62
63
 
63
64
        if (DEBUG) {
64
 
            System.out.println("Src: " + src + " Bounds: " + bounds + 
 
65
            System.out.println("Src: " + src + " Bounds: " + bounds +
65
66
                               " Off: " +
66
67
                               src.getTileGridXOffset() + ", " +
67
68
                               src.getTileGridYOffset());
79
80
 
80
81
        if (wrR.intersects(srcR)) {
81
82
            Rectangle r = wrR.intersection(srcR);
82
 
        
 
83
 
83
84
            // Limit the raster I send to my source to his rect.
84
85
            WritableRaster srcWR;
85
86
            srcWR = wr.createWritableChild(r.x, r.y, r.width, r.height,
134
135
    protected static class ZeroRecter_INT_PACK extends ZeroRecter {
135
136
        final int base;
136
137
        final int scanStride;
137
 
        final int pixels[];
138
 
        final int zeros[];
 
138
        final int[] pixels;
 
139
        final int[] zeros;
139
140
        final int x0, y0;
140
141
 
141
142
        public ZeroRecter_INT_PACK(WritableRaster wr) {
148
149
            DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
149
150
            x0 = wr.getMinY();
150
151
            y0 = wr.getMinX();
151
 
            base = (db.getOffset() + 
152
 
                    sppsm.getOffset(x0-wr.getSampleModelTranslateX(), 
 
152
            base = (db.getOffset() +
 
153
                    sppsm.getOffset(x0-wr.getSampleModelTranslateX(),
153
154
                                    y0-wr.getSampleModelTranslateY()));
154
155
 
155
156
            pixels = db.getBankData()[0];
230
231
 
231
232
        // Draw #2
232
233
        if (DEBUG) {
233
 
            System.out.println("WrR: [" + 
234
 
                               ar.x + "," + ar.y + "," + 
235
 
                               ar.width + "," + ar.height + 
 
234
            System.out.println("WrR: [" +
 
235
                               ar.x + "," + ar.y + "," +
 
236
                               ar.width + "," + ar.height +
236
237
                               "] s rcR: " + srcR);
237
238
            // g2d.setColor(new Color(0,0,255,128));
238
239
        }
252
253
 
253
254
        // Draw #3
254
255
        if (DEBUG) {
255
 
            System.out.println("WrR: [" + 
256
 
                               ar.x + "," + ar.y + "," + 
257
 
                               ar.width + "," + ar.height + 
 
256
            System.out.println("WrR: [" +
 
257
                               ar.x + "," + ar.y + "," +
 
258
                               ar.width + "," + ar.height +
258
259
                               "] srcR: " + srcR);
259
260
            // g2d.setColor(new Color(0,255,0,128));
260
261
        }
276
277
 
277
278
        // Draw #4
278
279
        if (DEBUG) {
279
 
            System.out.println("WrR: [" + 
280
 
                               ar.x + "," + ar.y + "," + 
281
 
                               ar.width + "," + ar.height + 
 
280
            System.out.println("WrR: [" +
 
281
                               ar.x + "," + ar.y + "," +
 
282
                               ar.width + "," + ar.height +
282
283
                               "] srcR: " + srcR);
283
284
            // g2d.setColor(new Color(255,255,0,128));
284
285
        }
293
294
            dr.width  = w;
294
295
            dr.height = ar.height;
295
296
            zr.zeroRect(dr);
296
 
            
 
297
 
297
298
            ar.width-=w;
298
299
        }
299
300
    }
313
314
        Rectangle   r;
314
315
        {
315
316
            // Calculate an intersection that makes some sense
316
 
            // even when the rects don't really intersect 
 
317
            // even when the rects don't really intersect
317
318
            // (The x and y ranges will be correct if they
318
319
            // overlap in one dimension even if they don't
319
320
            // intersect in both dimensions).
320
321
            int minX = (srcR.x > x) ? srcR.x : x;
321
 
            int maxX = (((srcR.x+srcR.width-1) < (x+width-1)) ? 
 
322
            int maxX = (((srcR.x+srcR.width-1) < (x+width-1)) ?
322
323
                        ( srcR.x+srcR.width-1) : (x+width-1));
323
324
            int minY = (srcR.y > y) ? srcR.y : y;
324
 
            int maxY = (((srcR.y+srcR.height-1) < (y+height-1)) ? 
 
325
            int maxY = (((srcR.y+srcR.height-1) < (y+height-1)) ?
325
326
                        ( srcR.y+srcR.height-1) : (y+height-1));
326
327
 
327
328
            int x0 = minX;
345
346
        //  |      +---------------+      |
346
347
        //  |      | 2             |      |
347
348
        //  +-----------------------------+
348
 
        // 
 
349
        //
349
350
 
350
351
        // Draw #1
351
352
        if (y < srcR.y) {
371
372
            // go to src instead of getting the data from wr because
372
373
            // in some cases wr will be completely off the top of src
373
374
            WritableRaster wr1 = wr.createWritableChild(wrX, wrY,
374
 
                                                        repW, 1, 
 
375
                                                        repW, 1,
375
376
                                                        repX, srcR.y, null);
376
377
            src.copyData(wr1);
377
378
            wrY++;
380
381
            if (y+height < endY) endY = y+height;
381
382
 
382
383
            if (wrY < endY) {
383
 
                int [] pixels = wr.getPixels(wrX, wrY-1, 
 
384
                int [] pixels = wr.getPixels(wrX, wrY-1,
384
385
                                             repW, 1, (int [])null);
385
386
                while (wrY < srcR.y) {
386
387
                    wr.setPixels(wrX, wrY, repW, 1, pixels);
388
389
                }
389
390
            }
390
391
        }
391
 
        
 
392
 
392
393
        // Draw #2
393
394
        if ((y+height) > (srcR.y+srcR.height)) {
394
395
            int repW = r.width;
415
416
 
416
417
            if (DEBUG) {
417
418
                System.out.println("wr: "  + wr.getBounds());
418
 
                System.out.println("req: [" + wrX + ", " + wrY + ", " + 
 
419
                System.out.println("req: [" + wrX + ", " + wrY + ", " +
419
420
                                   repW + ", 1]");
420
421
            }
421
422
 
423
424
            // go to src instead of getting the data from wr because
424
425
            // in some cases wr will be completely off the bottom of src).
425
426
            WritableRaster wr1 = wr.createWritableChild(wrX, wrY,
426
 
                                                        repW, 1, 
 
427
                                                        repW, 1,
427
428
                                                        repX, repY, null);
428
 
            // This fills the top row of section 2 from src 
 
429
            // This fills the top row of section 2 from src
429
430
            src.copyData(wr1);
430
431
            wrY++;
431
432
 
432
433
            int endY = y+height;
433
434
            if (wrY < endY) {
434
435
                // This fills the rest of section 2 from the first line.
435
 
                int [] pixels = wr.getPixels(wrX, wrY-1, 
 
436
                int [] pixels = wr.getPixels(wrX, wrY-1,
436
437
                                             repW, 1, (int [])null);
437
438
                while (wrY < endY) {
438
439
                    wr.setPixels(wrX, wrY, repW, 1, pixels);
440
441
                }
441
442
            }
442
443
        }
443
 
                                                        
 
444
 
444
445
        // Draw #3
445
446
        if (x < srcR.x) {
446
447
            // We are garunteed that we have a column of pixels down