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

use x/yres_virtual #4

Open
ghost opened this issue Sep 12, 2020 · 1 comment
Open

use x/yres_virtual #4

ghost opened this issue Sep 12, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 12, 2020

`
png_init_io(png_ptr, pngfp);

png_set_IHDR(
    png_ptr,
    info_ptr,
    vinfo.xres_virtual,
    vinfo.yres_virtual,
    8,
    PNG_COLOR_TYPE_RGB,
    PNG_INTERLACE_NONE,
    PNG_COMPRESSION_TYPE_BASE,
    PNG_FILTER_TYPE_BASE);

png_write_info(png_ptr, info_ptr);

png_bytep png_buffer = malloc(vinfo.xres_virtual * 3 * sizeof(png_byte));

if (png_buffer == NULL)
{
    fprintf(stderr, "%s: Unable to allocate buffer\n", program);
    exit(EXIT_FAILURE);
}

//--------------------------------------------------------------------

int r_mask = (1 << vinfo.red.length) - 1;
int g_mask = (1 << vinfo.green.length) - 1;
int b_mask = (1 << vinfo.blue.length) - 1;

int bytes_per_pixel = vinfo.bits_per_pixel / 8;

int y = 0;

for (y = 0; y < vinfo.yres_virtual; y++)
{
    int x;

    for (x = 0; x < vinfo.xres_virtual; x++)
    {
        int pb_offset = 3 * x;

`

@ghost
Copy link
Author

ghost commented Sep 12, 2020

Your code only grabs the content of the smallest display which may be the internal graphics, not the bigger screen you use as the main screen. Use _virtual to fix this.

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

0 participants