~stefan-schwarzburg/qreator/touch-reorganized-colortheme

« back to all changes in this revision

Viewing changes to qreator/QrCodeThemeStandard.qml

  • Committer: Stefan Schwarzburg
  • Date: 2013-06-13 15:01:29 UTC
  • Revision ID: stefan.schwarzburg@gmail.com-20130613150129-bsn57qfvr49idikw
themes now handle border size

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
    
7
7
    property color background: "white"
8
8
    property color foreground: "black"
9
 
    
 
9
 
 
10
    property int borderSize: 2
 
11
 
10
12
    function drawDots (qr, ctx, pixel_size) {
11
 
        for (var row = 0; row < qr.getModuleCount(); row++) {
12
 
            for (var col = 0; col < qr.getModuleCount(); col++) {
 
13
        for (var row = 0 - borderSize; row < qr.getModuleCount() + borderSize; row++) {
 
14
            for (var col = 0 - borderSize; col < qr.getModuleCount() + borderSize; col++) {
13
15
                if (qr.isDark(row, col) ) {
14
16
                    ctx.fillStyle = foreground;
15
17
                } else {
16
18
                    ctx.fillStyle = background;  
17
19
                }
18
 
                drawPixelShape(ctx, 1, col*pixel_size, row*pixel_size, pixel_size, pixel_size);
 
20
                drawPixelShape(ctx, 1, (borderSize + col)*pixel_size, (borderSize + row)*pixel_size, pixel_size, pixel_size);
19
21
            }
20
22
        }       
21
23
    }