Example usage for com.badlogic.gdx.graphics Pixmap drawPixmap

List of usage examples for com.badlogic.gdx.graphics Pixmap drawPixmap

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Pixmap drawPixmap.

Prototype

public void drawPixmap(Pixmap pixmap, int x, int y) 

Source Link

Document

Draws an area form another Pixmap to this Pixmap.

Usage

From source file:com.austinerb.project0.engine.SpriterLoader.java

License:Apache License

@Override
/**/*ww w .j  a  va  2s. com*/
 * This method is now responsible for creating the pixmaps and textures.
 */
public void finishLoading() {
    final Reference[] refs = super.getRefs();
    for (int i = 0; i < refs.length; i++) {
        final Pixmap image;
        Pixmap pix = this.pixmaps.get(refs[i]);
        if (!Gdx.graphics.isGL20Available()) {
            Pixmap temp = pix;
            image = new Pixmap(MathUtils.nextPowerOfTwo(temp.getWidth()),
                    MathUtils.nextPowerOfTwo(temp.getHeight()), temp.getFormat());
            image.drawPixmap(temp, 0, 0);
            this.pixmapsToDispose.put(temp, true);
        } else
            image = pix;
        final int index = i;
        this.pixmapsToDispose.put(image, false);
        this.createSprite(refs[index], image);

        if (this.packer != null)
            packer.pack(refs[i].fileName, image);
    }
    if (this.pack)
        generatePackedSprites();
    this.disposePixmaps();
}

From source file:com.heaven7.fantastictank.test.ScreenUtils.java

License:Apache License

/** Returns a portion of the default framebuffer contents specified by x, y, width and height as a {@link TextureRegion} with
 * the same dimensions. The base {@link Texture} always has {@link MathUtils#nextPowerOfTwo} dimensions and RGBA8888
 * {@link Format}. It can be accessed via {@link TextureRegion#getTexture}. This texture is not managed and has to be reloaded
 * manually on a context loss. If the width and height specified are larger than the framebuffer dimensions, the Texture will
 * be padded accordingly. Pixels that fall outside of the current screen will have RGBA values of 0.
 * // www .j  a va2  s .  c  o  m
 * @param x the x position of the framebuffer contents to capture
 * @param y the y position of the framebuffer contents to capture
 * @param w the width of the framebuffer contents to capture
 * @param h the height of the framebuffer contents to capture */
public static TextureRegion getFrameBufferTexture(int x, int y, int w, int h) {
    final int potW = MathUtils.nextPowerOfTwo(w);
    final int potH = MathUtils.nextPowerOfTwo(h);

    final Pixmap pixmap = getFrameBufferPixmap(x, y, w, h);
    final Pixmap potPixmap = new Pixmap(potW, potH, Format.RGBA8888);
    potPixmap.drawPixmap(pixmap, 0, 0);
    Texture texture = new Texture(potPixmap);
    TextureRegion textureRegion = new TextureRegion(texture, 0, h, w, -h);
    pixmap.dispose();

    return textureRegion;
}

From source file:com.intrepid.studio.animation.GenerateAnimationPackInfo.java

private void fitResourcesAndCreateAnimationPackInfo() {
    for (String groupTagName : mapGroupTagResource.keySet()) {
        GroupTag groupTag = mapGroupTagResource.get(groupTagName);

        List<FreeSpace> freeSpaceList = new LinkedList<>();
        int gTagPixmapWidth = groupTag.getPixmap().getWidth();
        int gTagPixmapHeight = groupTag.getPixmap().getHeight();
        freeSpaceList.add(new FreeSpace(0, 0, gTagPixmapWidth, gTagPixmapHeight));

        for (TagResource tagRes : groupTag.getResources()) {

            FreeSpace freeSpaceToDelete = null;
            FreeSpace freeSpaceAtSide = null;
            FreeSpace freeSpaceAbove = null;

            for (FreeSpace freeSpace : freeSpaceList) {
                boolean fitWidth = tagRes.getPixmap().getWidth() <= freeSpace.width;
                boolean fitHeight = tagRes.getPixmap().getHeight() <= freeSpace.height;

                if (fitWidth && fitHeight) {
                    tagRes.getAnimationInfo().setOrigin(freeSpace.x, freeSpace.y);

                    Pixmap basePixmap = groupTag.getPixmap();
                    Pixmap tagResPixmap = tagRes.getPixmap();
                    basePixmap.drawPixmap(tagResPixmap, freeSpace.x, freeSpace.y);

                    int tagResWidth = tagRes.getPixmap().getWidth();
                    int tagResHeight = tagRes.getPixmap().getHeight();

                    freeSpaceToDelete = freeSpace;
                    if ((freeSpace.x + tagResWidth) > 0) {
                        freeSpaceAtSide = new FreeSpace(freeSpace.x + tagResWidth, freeSpace.y,
                                freeSpace.width - tagResWidth, tagResHeight);
                    }//from   w w  w  .  j  a  v a 2s  .co  m

                    if ((freeSpace.y + tagResHeight) > 0) {
                        freeSpaceAbove = new FreeSpace(freeSpace.x, freeSpace.y + tagResHeight, freeSpace.width,
                                freeSpace.height - tagResHeight);
                    }

                    break;
                }
            }

            if (freeSpaceToDelete != null) {
                freeSpaceList.remove(freeSpaceToDelete);
                if (freeSpaceAtSide != null)
                    freeSpaceList.add(freeSpaceAtSide);
                if (freeSpaceAbove != null)
                    freeSpaceList.add(freeSpaceAbove);
            } else {
                System.out.println("ON: " + groupTag.getName() + "; CANNOT FIT: " + tagRes.getPng().name());
            }

            Collections.sort(freeSpaceList);
        }

        float maxSize = gTagPixmapWidth * gTagPixmapHeight;
        float freeSpaceSize = 0f;
        for (FreeSpace freeSpace : freeSpaceList) {
            freeSpaceSize += freeSpace.width * freeSpace.height;
        }
        String p = new DecimalFormat("#.00").format(100.0f * (1.0f - freeSpaceSize / maxSize));
        System.out.println("  space used: " + p + "%[ " + groupTag.getName() + " ]");

        groupTag.createAnimationPackInfo();
    }
}

From source file:com.mekomidev.gdxengine.utils.loaders.GifDecoder.java

License:Open Source License

public Animation<TextureRegion> getAnimation(PlayMode playType) {
    int nrFrames = getFrameCount();

    //        if(nrFrames > 100)
    //        {// ww  w .jav a 2s  . com
    //           nrFrames=100;
    //        }

    advance();
    Pixmap frame = getNextFrame();

    int width = frame.getWidth();
    int height = frame.getHeight();
    int vzones = (int) Math.sqrt((double) nrFrames);
    int hzones = vzones;
    while (vzones * hzones < nrFrames)
        vzones++;
    int v, h;
    Pixmap target = new Pixmap(width * hzones, height * vzones, Pixmap.Format.RGBA8888);
    int frameCountCurrent = 0;
    for (h = 0; h < hzones; h++) {
        for (v = 0; v < vzones; v++) {

            if (frameCountCurrent < nrFrames) {
                frameCountCurrent++;
                advance();
                frame = getNextFrame();
                target.drawPixmap(frame, h * width, v * height);

                int pixelSize = (int) (frame.getWidth() * 0.025f);
                target.setColor(Color.BLACK);

                int xPos, yPos;
                xPos = h * width;
                yPos = v * height;

                //                    target.fillRectangle(xPos, yPos, frame.getWidth(), pixelSize);
                //                    target.fillRectangle(xPos + frame.getWidth()-pixelSize, yPos, pixelSize, frame.getHeight());   
                //                    target.fillRectangle(xPos, yPos + frame.getHeight()-pixelSize, frame.getWidth(), pixelSize);      
                //                    target.fillRectangle(xPos, yPos,pixelSize, frame.getHeight());          
            }
        }
    }

    Texture texture = new Texture(target);
    //target.dispose();
    target = null;

    Array<TextureRegion> texReg = new Array<TextureRegion>();
    TextureRegion tr = new TextureRegion(texture);
    for (h = 0; h < hzones; h++) {
        for (v = 0; v < vzones; v++) {
            int frameID = v + h * vzones;
            if (frameID < nrFrames) {
                tr = new TextureRegion(texture, h * width, v * height, width, height);
                texReg.add(tr);
            }
        }
    }

    float frameDuration = (float) getDelay(0);
    frameDuration /= 500; // convert milliseconds into seconds

    Animation<TextureRegion> result = new Animation<>(frameDuration, texReg, playType);

    texReg.clear();
    frames.clear();
    prefix = null;
    suffix = null;
    pixelStack = null;
    mainPixels = null;
    mainScratch = null;
    copyScratch = null;

    return result; //return animation object
}

From source file:com.pogs.runpogsrun.util.SpriterLoader.java

License:Apache License

@Override
public void load(final Reference ref, String path) {
    FileHandle f;/*from  ww w  .  java 2  s.c o  m*/
    switch (Gdx.app.getType()) {
    case iOS:
        f = Gdx.files.absolute(path);
        break;
    default:
        f = Gdx.files.internal(path);
        break;
    }

    if (!f.exists())
        throw new GdxRuntimeException("Could not find file handle " + path + "! Please check your paths.");
    if (this.packer == null && this.pack)
        this.packer = new PixmapPacker(this.atlasWidth, this.atlasHeight, Pixmap.Format.RGBA8888, 2, true);
    final Pixmap pix;
    Texture tex;
    TextureRegion texRegion;
    if (!Gdx.graphics.isGL20Available()) {
        Pixmap temp = new Pixmap(f);
        pix = new Pixmap(MathUtils.nextPowerOfTwo(temp.getWidth()), MathUtils.nextPowerOfTwo(temp.getHeight()),
                temp.getFormat());
        pix.drawPixmap(temp, 0, 0);
        tex = new Texture(pix);
        texRegion = new TextureRegion(tex, temp.getWidth(), temp.getHeight());
        temp.dispose();
    } else {
        pix = new Pixmap(f);
        tex = new Texture(pix);
        texRegion = new TextureRegion(tex, pix.getWidth(), pix.getHeight());
    }

    tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    if (this.packer != null)
        packer.pack(ref.fileName, pix);

    this.files.put(ref, new Sprite(texRegion));
    pix.dispose();
}

From source file:darkyenus.resourcepacker.util.FreeTypePacker.java

License:Apache License

/** @return null if glyph was not found. */
CharacterData createGlyph(int codePoint, int glyphIndex, FreeTypeFontParameter parameter,
        FreeType.Stroker stroker) {// ww w.  j  a va2s  .  c o m
    if (!face.loadGlyph(glyphIndex, parameter.loadingFlags))
        return null;

    FreeType.GlyphSlot slot = face.getGlyph();
    FreeType.Glyph mainGlyph = slot.getGlyph();
    try {
        mainGlyph.toBitmap(parameter.mono ? FreeType.FT_RENDER_MODE_MONO : FreeType.FT_RENDER_MODE_NORMAL);
    } catch (GdxRuntimeException e) {
        mainGlyph.dispose();
        Gdx.app.log("FreeTypeFontGenerator", "Couldn't render char: " + codePoint);
        return null;
    }
    FreeType.Bitmap mainBitmap = mainGlyph.getBitmap();
    Pixmap mainPixmap = mainBitmap.getPixmap(Pixmap.Format.RGBA8888, parameter.color, parameter.gamma);

    if (mainBitmap.getWidth() != 0 && mainBitmap.getRows() != 0) {
        int offsetX, offsetY;
        if (parameter.borderWidth > 0) {
            // execute stroker; this generates a glyph "extended" along the outline
            int top = mainGlyph.getTop(), left = mainGlyph.getLeft();
            FreeType.Glyph borderGlyph = slot.getGlyph();
            borderGlyph.strokeBorder(stroker, false);
            borderGlyph
                    .toBitmap(parameter.mono ? FreeType.FT_RENDER_MODE_MONO : FreeType.FT_RENDER_MODE_NORMAL);
            offsetX = left - borderGlyph.getLeft();
            offsetY = -(top - borderGlyph.getTop());

            // Render border (pixmap is bigger than main).
            FreeType.Bitmap borderBitmap = borderGlyph.getBitmap();
            Pixmap borderPixmap = borderBitmap.getPixmap(Pixmap.Format.RGBA8888, parameter.borderColor,
                    parameter.borderGamma);

            // Draw main glyph on top of border.
            for (int i = 0, n = parameter.renderCount; i < n; i++)
                borderPixmap.drawPixmap(mainPixmap, offsetX, offsetY);

            mainPixmap.dispose();
            mainGlyph.dispose();
            mainPixmap = borderPixmap;
            mainGlyph = borderGlyph;
        }

        if (parameter.shadowOffsetX != 0 || parameter.shadowOffsetY != 0) {
            int mainW = mainPixmap.getWidth(), mainH = mainPixmap.getHeight();
            int shadowOffsetX = Math.max(parameter.shadowOffsetX, 0),
                    shadowOffsetY = Math.max(parameter.shadowOffsetY, 0);
            int shadowW = mainW + Math.abs(parameter.shadowOffsetX),
                    shadowH = mainH + Math.abs(parameter.shadowOffsetY);
            Pixmap shadowPixmap = new Pixmap(shadowW, shadowH, mainPixmap.getFormat());

            Color shadowColor = parameter.shadowColor;
            byte r = (byte) (shadowColor.r * 255), g = (byte) (shadowColor.g * 255),
                    b = (byte) (shadowColor.b * 255);
            float a = shadowColor.a;

            ByteBuffer mainPixels = mainPixmap.getPixels();
            ByteBuffer shadowPixels = shadowPixmap.getPixels();
            for (int y = 0; y < mainH; y++) {
                int shadowRow = shadowW * (y + shadowOffsetY) + shadowOffsetX;
                for (int x = 0; x < mainW; x++) {
                    int mainPixel = (mainW * y + x) * 4;
                    byte mainA = mainPixels.get(mainPixel + 3);
                    if (mainA == 0)
                        continue;
                    int shadowPixel = (shadowRow + x) * 4;
                    shadowPixels.put(shadowPixel, r);
                    shadowPixels.put(shadowPixel + 1, g);
                    shadowPixels.put(shadowPixel + 2, b);
                    shadowPixels.put(shadowPixel + 3, (byte) ((mainA & 0xff) * a));
                }
            }

            // Draw main glyph (with any border) on top of shadow.
            for (int i = 0, n = parameter.renderCount; i < n; i++)
                shadowPixmap.drawPixmap(mainPixmap, Math.max(-parameter.shadowOffsetX, 0),
                        Math.max(-parameter.shadowOffsetY, 0));
            mainPixmap.dispose();
            mainPixmap = shadowPixmap;
        } else if (parameter.borderWidth == 0) {
            // No shadow and no border, draw glyph additional times.
            for (int i = 0, n = parameter.renderCount - 1; i < n; i++)
                mainPixmap.drawPixmap(mainPixmap, 0, 0);
        }
    }

    final CharacterData data = new CharacterData(glyphIndex, codePoint);
    data.pixmap = mainPixmap;
    data.advanceX = FreeType.toInt(slot.getAdvanceX());
    data.offsetX = mainGlyph.getLeft();
    data.offsetY = mainGlyph.getTop();

    mainGlyph.dispose();

    return data;
}

From source file:es.eucm.ead.editor.control.background.PixmapsToFile.java

License:Open Source License

@Override
public String call() throws Exception {
    int height = 0;
    int width = 0;
    for (Pixmap pixmap : pixmaps) {
        height = Math.max(height, pixmap.getHeight());
        width += pixmap.getWidth();//  w w w .ja v  a 2s.com
    }

    Pixmap pixmap = new Pixmap(width, height, Format.RGB888);
    int xOffset = 0;
    for (Pixmap p : pixmaps) {
        pixmap.drawPixmap(p, xOffset, 0);
        xOffset += p.getWidth();
        p.dispose();
    }

    PixmapIO.writePNG(path, pixmap);
    pixmap.dispose();

    return path.path();
}

From source file:me.dumfing.gdxtools.GifDecoderOptimized.java

License:Open Source License

public Animation getAnimation(PlayMode playType) {
    int nrFrames = getFrameCount();

    //        if(nrFrames > 100)
    //        {/*from w  w  w  .j  av  a 2 s  .com*/
    //           nrFrames=100;
    //        }

    advance();
    Pixmap frame = getNextFrame();

    int width = frame.getWidth();
    int height = frame.getHeight();
    int vzones = (int) Math.sqrt((double) nrFrames);
    int hzones = vzones;
    while (vzones * hzones < nrFrames)
        vzones++;
    int v, h;
    Pixmap target = new Pixmap(width * hzones, height * vzones, Pixmap.Format.RGBA8888);
    int frameCountCurrent = 0;
    for (h = 0; h < hzones; h++) {
        for (v = 0; v < vzones; v++) {

            if (frameCountCurrent < nrFrames) {
                frameCountCurrent++;
                advance();
                frame = getNextFrame();
                target.drawPixmap(frame, h * width, v * height);

                int pixelSize = (int) (frame.getWidth() * 0.025f);
                target.setColor(Color.BLACK);

                int xPos, yPos;
                xPos = h * width;
                yPos = v * height;

                //                    target.fillRectangle(xPos, yPos, frame.getWidth(), pixelSize);
                //                    target.fillRectangle(xPos + frame.getWidth()-pixelSize, yPos, pixelSize, frame.getHeight());
                //                    target.fillRectangle(xPos, yPos + frame.getHeight()-pixelSize, frame.getWidth(), pixelSize);
                //                    target.fillRectangle(xPos, yPos,pixelSize, frame.getHeight());
            }
        }
    }

    Texture texture = new Texture(target);
    target.dispose();
    target = null;

    Array<TextureRegion> texReg = new Array<TextureRegion>();
    TextureRegion tr = new TextureRegion(texture);
    for (h = 0; h < hzones; h++) {
        for (v = 0; v < vzones; v++) {
            int frameID = v + h * vzones;
            if (frameID < nrFrames) {
                tr = new TextureRegion(texture, h * width, v * height, width, height);
                texReg.add(tr);
            }
        }
    }

    float frameDuration = (float) getDelay(0);
    frameDuration /= 500; // convert milliseconds into seconds

    Animation result = new Animation(frameDuration, texReg, playType);

    texReg.clear();
    frames.clear();
    prefix = null;
    suffix = null;
    pixelStack = null;
    mainPixels = null;
    mainScratch = null;
    copyScratch = null;

    return result; //return animation object
}

From source file:mobi.shad.s3lib.gfx.pixmap.disort.Disort.java

License:Apache License

/**
 *
 * @param pixmapDest/*  w w  w. j a  v a2s.  co  m*/
 * @param pixmapMask
 * @param power
 */
public static void generate(final Pixmap pixmapDest, final Pixmap pixmapMask, float power) {

    int widthDest = pixmapDest.getWidth();
    int heightDest = pixmapDest.getHeight();

    int widthMask = pixmapMask.getWidth();
    int heightMask = pixmapMask.getHeight();

    int rgb = 0;
    int r = 0;
    int g = 0;
    int b = 0;
    int a = 0;

    Pixmap dstPixmap = new Pixmap(widthDest, widthDest, pixmapDest.getFormat());

    Vector3 norm = new Vector3();

    for (int y = 0; y < heightDest; y++) {
        for (int x = 0; x < widthDest; x++) {

            rgb = pixmapMask.getPixel(x % widthMask, y % heightMask);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;
            a = (rgb & 0x000000ff);

            norm.x = r - 127;
            norm.y = g - 127;
            norm.z = b - 127;
            norm.nor();

            float v = (x + (norm.x * power)) % widthDest;
            float u = (y + (norm.y * power)) % heightDest;

            int vt = v >= 0 ? (int) v : (int) v - 1;
            int ut = u >= 0 ? (int) u : (int) u - 1;

            //
            // Texel1
            //
            rgb = pixmapDest.getPixel(vt, ut);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            int outR = r;
            int outG = g;
            int outB = b;
            int outA = 255;

            //
            // Texel2
            //
            rgb = pixmapDest.getPixel(vt, ut + heightDest);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            outR += r;
            outG += g;
            outB += b;

            //
            // Texel3
            //
            rgb = pixmapDest.getPixel((vt + widthDest), ut);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            outR += r;
            outG += g;
            outB += b;

            //
            // Texel 4
            //
            rgb = pixmapDest.getPixel(vt + widthDest, ut + heightDest);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            outR += r;
            outG += g;
            outB += b;

            //
            // Clamp
            //
            outR = (outR < 255) ? outR : 255;
            outR = (outR > 0) ? outR : 0;
            outG = (outG < 255) ? outG : 255;
            outG = (outG > 0) ? outG : 0;
            outB = (outB < 255) ? outB : 255;
            outB = (outB > 0) ? outB : 0;

            dstPixmap.drawPixel(x, y, ((int) outR << 24) | ((int) outG << 16) | ((int) outB << 8) | outA);
        }
    }
    pixmapDest.drawPixmap(dstPixmap, 0, 0);
}

From source file:mobi.shad.s3lib.gfx.pixmap.disort.RotoZoom.java

License:Apache License

/**
 *
 * @param pixmap//from  w  w  w.j  a v a  2  s .  com
 * @param amplify - The bulge value
 */
public static void generate(final Pixmap pixmap, float centerX, float centerY, float rotate, float zoomX,
        float zoomY) {

    int width = pixmap.getWidth();
    int height = pixmap.getHeight();

    //
    // Rotate
    //
    rotate = rotate * S3Math.PI2;

    //
    // Zoom
    //
    zoomX = (float) Math.pow(.5f, zoomX - 1);
    zoomY = (float) Math.pow(.5f, zoomY - 1);

    float c = (float) (Math.cos(rotate));
    float s = (float) (Math.sin(rotate));

    float tw2 = (float) width / 2.0f;
    float th2 = (float) height / 2.0f;

    float ys = s * -th2;
    float yc = c * -th2;

    Pixmap dstPixmap = new Pixmap(width, height, pixmap.getFormat());
    dstPixmap.setColor(Color.RED);
    dstPixmap.fill();

    for (int y = 0; y < height; y++) {

        //
        // x' = cos(x)-sin(y) + Center X;
        //
        float u = (((c * -tw2) - ys) * zoomX) + centerX;

        //
        // y' = sin(x)+cos(y) + Center Y;
        //
        float v = (((s * -tw2) + yc) * zoomY) + centerY;

        for (int x = 0; x < width; x++) {

            int ut = u >= 0 ? (int) u : (int) u - 1;
            int vt = v >= 0 ? (int) v : (int) v - 1;

            //
            // Texels
            // 1 | 2
            // -------
            // 3 | 4
            //

            //
            // Texel1
            //
            int rgb = pixmap.getPixel(vt, ut);
            int r = (rgb & 0xff000000) >>> 24;
            int g = (rgb & 0x00ff0000) >>> 16;
            int b = (rgb & 0x0000ff00) >>> 8;
            int a = (rgb & 0x000000ff);

            int outR = r;
            int outG = g;
            int outB = b;
            int outA = 255;

            //
            // Texel2
            //
            rgb = pixmap.getPixel(vt, ut + height);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            outR += r;
            outG += g;
            outB += b;

            //
            // Texel3
            //
            rgb = pixmap.getPixel((vt + width), ut);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            outR += r;
            outG += g;
            outB += b;

            //
            // Texel 4
            //
            rgb = pixmap.getPixel(vt + width, ut + height);
            r = (rgb & 0xff000000) >>> 24;
            g = (rgb & 0x00ff0000) >>> 16;
            b = (rgb & 0x0000ff00) >>> 8;

            outR += r;
            outG += g;
            outB += b;

            //
            // Clamp
            //
            outR = (outR < 255) ? outR : 255;
            outR = (outR > 0) ? outR : 0;
            outG = (outG < 255) ? outG : 255;
            outG = (outG > 0) ? outG : 0;
            outB = (outB < 255) ? outB : 255;
            outB = (outB > 0) ? outB : 0;

            dstPixmap.drawPixel(x, y, ((int) outR << 24) | ((int) outG << 16) | ((int) outB << 8) | outA);

            //
            // Vectors X
            //
            u += c * zoomX;
            v += s * zoomY;
        }
        //
        // Vectors Y
        //
        ys += s;
        yc += c;
    }
    pixmap.drawPixmap(dstPixmap, 0, 0);
}