Tile the windowskin instead of stretching

Discussion in 'Javascript/Plugin Support' started by Amy Pond, Oct 29, 2015.

  1. Amy Pond

    Amy Pond Veteran Veteran

    Messages:
    667
    Likes Received:
    1,359
    First Language:
    English (UK)
    I have narrowed the code that creates the borders of a windowskin down to this:

            bitmap.blt(skin, p+m, 0+0, p-m*2, m, m, 0, w-m*2, m);        bitmap.blt(skin, p+m, 0+q-m, p-m*2, m, m, h-m, w-m*2, m);        bitmap.blt(skin, p+0, 0+m, m, p-m*2, 0, m, m, h-m*2);        bitmap.blt(skin, p+q-m, 0+m, m, p-m*2, w-m, m, m, h-m*2);But my head is spinning at all the variables there.

    Context:

        if (w > 0 && h > 0 && this._windowskin) {        var skin = this._windowskin;        var p = 96;        var q = 96;        bitmap.blt(skin, p+m, 0+0, p-m*2, m, m, 0, w-m*2, m);        bitmap.blt(skin, p+m, 0+q-m, p-m*2, m, m, h-m, w-m*2, m);        bitmap.blt(skin, p+0, 0+m, m, p-m*2, 0, m, m, h-m*2);        bitmap.blt(skin, p+q-m, 0+m, m, p-m*2, w-m, m, m, h-m*2);        bitmap.blt(skin, p+0, 0+0, m, m, 0, 0, m, m);               //frame corner        bitmap.blt(skin, p+q-m, 0+0, m, m, w-m, 0, m, m);          //frame corner        bitmap.blt(skin, p+0, 0+q-m, m, m, 0, h-m, m, m);         //frame corner        bitmap.blt(skin, p+q-m, 0+q-m, m, m, w-m, h-m, m, m);    //frame corner    }What do you reckon I need to change here to tile the frame image instead of stretching to fill?

    var m is just an integer, 24; var p and q are both the integer 96. h and w are actually variable.

    Bitmap.prototype.blt = function(source, sx, sy, sw, sh, dx, dy, dw, dh)
    sx sy sw sh - must be the source. dx dy dw dh must be the designated area to fill.

    Is there actually a way to do this or will I need to make an entirely new function?
     
    #1

Share This Page