Creates a Bitmap which is a tile of the progress bar background

@param h the view height
@return a bitmap of the progress bar background
330475
private static Bitmap createTile(float h, Paint stripePaint, Paint progressPaint) {
        Bitmap bm = Bitmap.createBitmap((int) h * 2, (int) h, ARGB_8888);
        Canvas tile = new Canvas(bm);

        float x = 0;
        Path path = new Path();

        path.moveTo(x, 0);
        path.lineTo(x, h);
        path.lineTo(h, h);
        tile.drawPath(path, stripePaint); // draw striped triangle

        path.reset();
        path.moveTo(x, 0);
        path.lineTo(x + h, h);
        path.lineTo(x + (h * 2), h);
        path.lineTo(x + h, 0);
        tile.drawPath(path, progressPaint); // draw progress parallelogram

        x += h;
        path.reset();
        path.moveTo(x, 0);
        path.lineTo(x + h, 0);
        path.lineTo(x + h, h);
        tile.drawPath(path, stripePaint); // draw striped triangle (completing tile)

        return bm;
    }
259338
private Bitmap process() {
        PerformanceProfiler profiler = new PerformanceProfiler("blur image task [" + builderData.tag + "] started at " + BenchmarkUtil.getCurrentTime(), Dali.getConfig().debugMode);
        try {

            final String cacheKey = BuilderUtil.getCacheKey(builderData);

            if (builderData.shouldCache) {
                profiler.startTask(-3, "cache lookup (key:" + cacheKey + ")");
                Bitmap cache = builderData.diskCacheManager.get(cacheKey);
                profiler.endTask(-3, cache == null ? "miss" : "hit");
                if (cache != null) {
                    profiler.printResultToLog();
                    return cache;
                }
            } else {
                builderData.diskCacheManager.purge(cacheKey);
            }

            if (builderData.imageReference.getSourceType().equals(ImageReference.SourceType.VIEW)) {
                profiler.startTask(-2, "wait for view to be measured");
                View v = builderData.imageReference.getView();
                uiThreadHandler.post(new WaitForMeasurement(semaphore, v));

                Dali.logV(TAG, "aquire lock for waiting for the view to be measured");
                if (semaphore.tryAcquire(8000, TimeUnit.MILLISECONDS)) {
                    Dali.logV(TAG, "view seems measured, lock was released");
                } else {
                    throw new InterruptedException("Timeout while waiting for the view to be measured");
                }
                profiler.endTask(-2);
            }

//            Thread.sleep(1000);

            int width = 0, height = 0;
            if (builderData.options.inSampleSize > 1 && builderData.rescaleIfDownscaled) {
                profiler.startTask(-1, "measure image");
                Point p = builderData.imageReference.measureImage(builderData.contextWrapper.getResources());
                width = p.x;
                height = p.y;
                profiler.endTask(-1, height + "x" + width);
            }

            profiler.startTask(0, "load image");
            builderData.imageReference.setDecoderOptions(builderData.options);
            Bitmap bitmapToWorkWith = builderData.imageReference.synchronouslyLoadBitmap(builderData.contextWrapper.getResources());
            profiler.endTask(0, "source: " + builderData.imageReference.getSourceType() + ", insample: "
                    + builderData.options.inSampleSize + ", height:" + bitmapToWorkWith.getHeight() + ", width:" + bitmapToWorkWith.getWidth() +
                    ", memory usage " + BenchmarkUtil.getScalingUnitByteSize(LegacySDKUtil.byteSizeOf(bitmapToWorkWith)));

            if (builderData.copyBitmapBeforeBlur) {
                profiler.startTask(1, "copy bitmap");
                bitmapToWorkWith = bitmapToWorkWith.copy(bitmapToWorkWith.getConfig(), true);
                profiler.endTask(1);
            }

            int profileIdPreProcessor = 100;
            for (IBitmapProcessor postProcessor : builderData.preProcessors) {
                profiler.startTask(profileIdPreProcessor, postProcessor.getProcessorTag());
                bitmapToWorkWith = postProcessor.manipulate(bitmapToWorkWith);
                profiler.endTask(profileIdPreProcessor++);
            }

            profiler.startTask(10000, "blur with radius " + builderData.blurRadius + "px (" + builderData.blurRadius * builderData.options.inSampleSize + "spx) and algorithm " + builderData.blurAlgorithm.getClass().getSimpleName());
            bitmapToWorkWith = builderData.blurAlgorithm.blur(builderData.blurRadius, bitmapToWorkWith);
            profiler.endTask(10000);

            int profileIdPostProcessor = 20000;
            for (IBitmapProcessor postProcessor : builderData.postProcessors) {
                profiler.startTask(profileIdPostProcessor, postProcessor.getProcessorTag());
                bitmapToWorkWith = postProcessor.manipulate(bitmapToWorkWith);
                profiler.endTask(profileIdPostProcessor++);
            }

            if (builderData.options.inSampleSize > 1 && builderData.rescaleIfDownscaled && height > 0 && width > 0) {
                profiler.startTask(40000, "rescale to " + height + "x" + width);
                bitmapToWorkWith = Bitmap.createScaledBitmap(bitmapToWorkWith, width, height, false);
                profiler.endTask(40000, "memory usage " + BenchmarkUtil.getScalingUnitByteSize(LegacySDKUtil.byteSizeOf(bitmapToWorkWith)));
            }

            if (builderData.shouldCache) {
                profiler.startTask(40001, "async try to disk cache (ignore result)");
                Dali.getExecutorManager().executeOnFireAndForgetThreadPool(new AddToCacheTask(bitmapToWorkWith, builderData, cacheKey));
                profiler.endTask(40001);
            }

            return bitmapToWorkWith;
        } catch (Throwable t) {
            throw new BlurWorkerException(t);
        } finally {
            profiler.printResultToLog();
        }
    }
395272
public static Bitmap loadBitmap(String fileName, int scale) throws ImageLoadException {
        return loadBitmap(new FileSource(fileName), scale);
    }
204909
private BufferedImage create_HORIZON_Image(final int WIDTH) {
        if (WIDTH <= 0) {
            return UTIL.createImage(1, 1, Transparency.TRANSLUCENT);
        }

        final int HORIZON_HEIGHT = (int) (Math.PI * WIDTH);

        final BufferedImage IMAGE = UTIL.createImage(WIDTH, HORIZON_HEIGHT, Transparency.TRANSLUCENT);
        final Graphics2D G2 = IMAGE.createGraphics();
        G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

        final int IMAGE_WIDTH = IMAGE.getWidth();
        final int IMAGE_HEIGHT = IMAGE.getHeight();

        final Rectangle2D HORIZON = new Rectangle2D.Double(0, 0, IMAGE_WIDTH, HORIZON_HEIGHT);
        final Point2D HORIZON_START = new Point2D.Double(0, HORIZON.getBounds2D().getMinY());
        final Point2D HORIZON_STOP = new Point2D.Double(0, HORIZON.getBounds2D().getMaxY());
        final float[] HORIZON_FRACTIONS = {
            0.0f,
            0.49999f,
            0.5f,
            1.0f
        };
        final Color[] HORIZON_COLORS;
        if (customColors) {
            HORIZON_COLORS = new Color[]{
                customSkyColor,
                customSkyColor,
                customGroundColor,
                customGroundColor
            };
        } else {
            HORIZON_COLORS = new Color[]{
                new Color(127, 213, 240, 255),
                new Color(127, 213, 240, 255),
                new Color(60, 68, 57, 255),
                new Color(60, 68, 57, 255)
            };
        }

        final LinearGradientPaint HORIZON_GRADIENT = new LinearGradientPaint(HORIZON_START, HORIZON_STOP, HORIZON_FRACTIONS, HORIZON_COLORS);
        G2.setPaint(HORIZON_GRADIENT);
        G2.fill(HORIZON);

        // Draw horizontal lines
        G2.setColor(UTIL.setBrightness(HORIZON_COLORS[0], 0.5f));
        final Line2D LINE = new Line2D.Double();
        final double STEPSIZE_Y = HORIZON_HEIGHT / 360.0 * 5.0;
        boolean stepTen = false;
        int step = 0;
        G2.setFont(new Font("Verdana", Font.PLAIN, (int) (WIDTH * 0.04)));
        final FontRenderContext RENDER_CONTEXT = new FontRenderContext(null, true, true);
        TextLayout valueLayout;
        final Rectangle2D VALUE_BOUNDARY = new Rectangle2D.Double();
        for (double y = IMAGE_HEIGHT / 2.0 - STEPSIZE_Y; y > 0; y -= STEPSIZE_Y) {
            if (step <= 80) {
                if (stepTen) {
                    LINE.setLine((IMAGE_WIDTH - (IMAGE_WIDTH * 0.2)) / 2, y, IMAGE_WIDTH - (IMAGE_WIDTH - (IMAGE_WIDTH * 0.2)) / 2, y);
                    step += 10;
                    valueLayout = new TextLayout(Integer.toString(step), G2.getFont(), RENDER_CONTEXT);
                    VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
                    G2.drawString(Integer.toString(step), (float) (LINE.getX1() - VALUE_BOUNDARY.getWidth() - 5), (float) (y + VALUE_BOUNDARY.getHeight() / 2));
                    G2.drawString(Integer.toString(step), (float) (LINE.getX2() + 5), (float) (y + VALUE_BOUNDARY.getHeight() / 2));
                } else {
                    LINE.setLine((IMAGE_WIDTH - (IMAGE_WIDTH * 0.1)) / 2, y, IMAGE_WIDTH - (IMAGE_WIDTH - (IMAGE_WIDTH * 0.1)) / 2, y);
                }
                G2.draw(LINE);
            }
            stepTen ^= true;
        }
        stepTen = false;
        step = 0;
        G2.setColor(Color.WHITE);
        final Stroke FORMER_STROKE = G2.getStroke();
        G2.setStroke(new BasicStroke(1.5f));
        LINE.setLine(0, IMAGE_HEIGHT / 2.0, IMAGE_WIDTH, IMAGE_HEIGHT / 2.0);
        G2.draw(LINE);
        G2.setStroke(FORMER_STROKE);
        for (double y = IMAGE_HEIGHT / 2.0 + STEPSIZE_Y; y <= IMAGE_HEIGHT; y += STEPSIZE_Y) {
            if (step >= -80) {
                if (stepTen) {
                    LINE.setLine((IMAGE_WIDTH - (IMAGE_WIDTH * 0.2)) / 2, y, IMAGE_WIDTH - (IMAGE_WIDTH - (IMAGE_WIDTH * 0.2)) / 2, y);
                    step -= 10;
                    valueLayout = new TextLayout(Integer.toString(step), G2.getFont(), RENDER_CONTEXT);
                    VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
                    G2.drawString(Integer.toString(step), (float) (LINE.getX1() - VALUE_BOUNDARY.getWidth() - 5), (float) (y + VALUE_BOUNDARY.getHeight() / 2));
                    G2.drawString(Integer.toString(step), (float) (LINE.getX2() + 5), (float) (y + VALUE_BOUNDARY.getHeight() / 2));
                } else {
                    LINE.setLine((IMAGE_WIDTH - (IMAGE_WIDTH * 0.1)) / 2, y, IMAGE_WIDTH - (IMAGE_WIDTH - (IMAGE_WIDTH * 0.1)) / 2, y);
                }
                G2.draw(LINE);
            }
            stepTen ^= true;
        }

        G2.dispose();

        return IMAGE;
    }
923811
public static Bitmap drawViewToBitmap(Bitmap dest, View view, int downSampling, Bitmap.Config bitmapConfig) {
        float scale = 1f / downSampling;
        int viewWidth = view.getWidth();
        int viewHeight = view.getHeight();
        int bmpWidth = Math.round(viewWidth * scale);
        int bmpHeight = Math.round(viewHeight * scale);

        if (dest == null || dest.getWidth() != bmpWidth || dest.getHeight() != bmpHeight) {
            dest = Bitmap.createBitmap(bmpWidth, bmpHeight, bitmapConfig);
        }

        Canvas c = new Canvas(dest);
        if (downSampling > 1) {
            c.scale(scale, scale);
        }

        view.draw(c);
        return dest;
    }
879943
public BufferedImage drawTile(int[][] unsignedPixelValues) {

		int tileWidth = unsignedPixelValues[0].length;
		int tileHeight = unsignedPixelValues.length;

		BufferedImage image = createImage(tileWidth, tileHeight);
		WritableRaster raster = image.getRaster();
		for (int x = 0; x < tileWidth; x++) {
			for (int y = 0; y < tileHeight; y++) {
				int unsignedPixelValue = unsignedPixelValues[y][x];
				setPixelValue(raster, x, y, unsignedPixelValue);
			}
		}

		return image;
	}
229957
public Canvas draw (Drawable image, float x, float y, float w, float h) {
    image.draw(gc(), x, y, w, h);
    isDirty = true;
    return this;
  }
867547
protected BufferedImage stampTileImage (Object stamp, BufferedImage ftimg, int width,
        int height)
    {
        // create the target image if necessary
        if (ftimg == null) {
            ftimg = _imgr.createImage(width, height, Transparency.BITMASK);
        }
        Graphics2D gfx = (Graphics2D)ftimg.getGraphics();
        try {
            if (stamp instanceof Tile) {
                ((Tile)stamp).paint(gfx, 0, 0);
            } else {
                gfx.drawImage((BufferedImage)stamp, 0, 0, null);
            }
        } finally {
            gfx.dispose();
        }
        return ftimg;
    }
1098337
public Surface draw (Tile tile, float x, float y, float w, float h) {
    if (!checkIntersection || intersects(x, y, w, h)) {
      tile.addToBatch(batch, tint, tx(), x, y, w, h);
    }
    return this;
  }
459288
private void generatePatternBitmap() {
    if (getBounds().width() <= 0 || getBounds().height() <= 0) {
      return;
    }

    bitmap = Bitmap.createBitmap(getBounds().width(), getBounds().height(), Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    Rect r = new Rect();
    boolean verticalStartWhite = true;
    for (int i = 0; i <= numRectanglesVertical; i++) {
      boolean isWhite = verticalStartWhite;
      for (int j = 0; j <= numRectanglesHorizontal; j++) {
        r.top = i * rectangleSize;
        r.left = j * rectangleSize;
        r.bottom = r.top + rectangleSize;
        r.right = r.left + rectangleSize;
        canvas.drawRect(r, isWhite ? paintWhite : paintGray);
        isWhite = !isWhite;
      }
      verticalStartWhite = !verticalStartWhite;
    }
  }
486771
public SpriteSheet getSpriteSheet(String name) {
		Image image = getSprite(name);
		Section section = (Section) sections.get(name);
		
		return new SpriteSheet(image, section.width / section.tilesx, section.height / section.tilesy);
	}
1258385
function( level ) {

        if(this.emulateLegacyImagePyramid) {
            return $.TileSource.prototype.getTileHeight.call(this, level);
        }

        var scaleFactor = Math.pow(2, this.maxLevel - level);

        if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
            return this.tileSizePerScaleFactor[scaleFactor].height;
        }
        return this._tileHeight;
    }
1174940
public java.awt.Graphics2D createGraphics(float width, float height) {
        return new PdfGraphics2D(this, width, height, null, false, false, 0);
    }
866289
protected BufferedImage create_FOREGROUND_Image(final int WIDTH) {
        switch (getFrameType()) {
            case ROUND:
                return FOREGROUND_FACTORY.createRadialForeground(WIDTH);
            case SQUARE:
                return FOREGROUND_FACTORY.createLinearForeground(WIDTH, WIDTH);
            default:
                return FOREGROUND_FACTORY.createRadialForeground(WIDTH);
        }
    }
337416
public BufferedImage createImage (int width, int height, int transparency)
    {
        return _icreator.createImage(width, height, transparency);
    }
1242487
private Bitmap savePixels(int x, int y, int w, int h) {
		int b[] = new int[w * (y + h)];
		int bt[] = new int[w * h];
		IntBuffer ib = IntBuffer.wrap(b);
		ib.position(0);
		GLES20.glReadPixels(x, 0, w, y + h, GLES20.GL_RGBA,
				GLES20.GL_UNSIGNED_BYTE, ib);

		for (int i = 0, k = 0; i < h; i++, k++) {
			// remember, that OpenGL bitmap is incompatible with Android bitmap
			// and so, some correction need.
			for (int j = 0; j < w; j++) {
				int pix = b[i * w + j];
				int pb = (pix >> 16) & 0xff;
				int pr = (pix << 16) & 0x00ff0000;
				int pix1 = (pix & 0xff00ff00) | pr | pb;
				bt[(h - k - 1) * w + j] = pix1;
			}
		}

		Bitmap sb = Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888);
		return sb;
	}
1350403
public Bitmap getBitmap(int backgroundColor) {
        // create new bitmap
        Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
        Canvas bitmapCanvas = new Canvas(bitmap);

        // draw background if not transparent
        if (backgroundColor != 0) {
            bitmapCanvas.drawColor(backgroundColor);
        }

        // draw bitmap
        bitmapCanvas.drawBitmap(this.bitmap, 0, 0, null);

        return bitmap;
    }