Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

putImageData results in odd transparent grid on right side of 1920x1080 screen #10

Open
pixelami opened this issue Mar 8, 2013 · 1 comment

Comments

@pixelami
Copy link

pixelami commented Mar 8, 2013

Hi I think I found an issue with putImageData, certainly I have only seen this just now when placing an image that was the full width of the screen.

Code to reproduce.

#!/usr/bin/env node-canvas
/*jslint indent: 2, node: true */
/*global Image: true */
"use strict";

var Canvas = require('../lib/canvas');
var Image = Canvas.Image;
var canvas = new Canvas(1920, 1080);
var ctx = canvas.getContext('2d');
var fs = require('fs');

var eu = require('./util');

var grid = fs.readFileSync(__dirname + '/imgs/january-11-space_unicorn-nocal-1920x1080.jpg');
var img = new Image();
img.src = grid;

ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.imageSmoothingEnabled = false;

ctx.drawImage(img); // Default to image width, height

var imgdata = ctx.getImageData(0,580,1920,500);
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.putImageData(imgdata, 0, 580);

canvas.vgSwapBuffers();

eu.saveScreenshot(ctx, 0, 0, 1920, 1080,
    'examples/screenshots/putImageData.png');

eu.waitForInput();

I have reproduced with a composited image grabbed from the context via getImageData,
and also with a simple 1920x1080 jpg (as in the test above).

Screenshot
putImageData

@pixelami
Copy link
Author

pixelami commented Mar 8, 2013

More Info,
The problem seems to happen after ImageData width > 1919.

i.e.
This is fine when used with put data.
var imgdata = ctx.getImageData(0, 0, 1919, h);

this breaks.
var imgdata = ctx.getImageData(0, 0, 1920, h);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant