Thread: Look it i can't cope....

  1. #1
    Registered User planet_abhi's Avatar
    Join Date
    Oct 2002
    Posts
    92

    Look it i can't cope....

    Below is the code to print graphics output for 8-pin epson printer
    but i want it to for 24 pins but it can't work while i change the pins as follows



    Code:
    //Here we start
    
    
    
    # include<graphics.h>
    # include<stdio.h>
    # include<io.h>
    # define ESC 27
    # define LPT1 0
    # define LPT2 1
    # define write_to_prn(x) biosprint(0,x,LPT1)
    int main()
    {
    int gd=0,gm=0;
    initgraph(&gd,&gm,"..\\bgi");
    circle(120,100,80);
    printimage(0,0,getmaxx(),getmaxy());
    return(0);
    }
    printimage(int x1,int y1,int x2,int y2)
    {
    int x,y,width;
    width=x2-x1;
    write_to_prn(ESC);
    write_to_prn('1');
    for(y=y1;y<y2;y+=4)
    {
    set_bit_image_mode(width);
    for(x=x1;x<x2;x++)
    write_to_prn(getpins(x,y));
    write_to_prn("\n");
    }
    return;
    }
    set_bit_image_mode(int num)
    {
    int n1,n2;
    n1=num%256;
    n2=num/256;
    write_to_prn(ESC);
    write_to_prn('*');
    write_to_prn('4');
    write_to_prn(n1);
    write_to_prn(n2);
    return;
    }
    getpins(int x,int y)
    {
    // The 24 pins i want but it return negative values
    unsigned char pins;
    pins=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:0;
    
    pins=(getpixel(x,y++)==0)?0:0;
    pins|=(getpixel(x,y++)==0)?0:-32768;
    pins|=(getpixel(x,y++)==0)?0:16384;
    pins|=(getpixel(x,y++)==0)?0:8192;
    pins|=(getpixel(x,y++)==0)?0:2048;
    pins|=(getpixel(x,y++)==0)?0:1024;
    pins|=(getpixel(x,y++)==0)?0:512;
    pins|=(getpixel(x,y++)==0)?0:256;
    
    pins=(getpixel(x,y++)==0)?0:128;
    pins|=(getpixel(x,y++)==0)?0:64;
    pins|=(getpixel(x,y++)==0)?0:32;
    pins|=(getpixel(x,y++)==0)?0:16;
    pins|=(getpixel(x,y++)==0)?0:8;
    pins|=(getpixel(x,y++)==0)?0:4;
    pins|=(getpixel(x,y++)==0)?0:2;
    pins|=(getpixel(x,y)==0)?0:1;
    return pins;
    }


    what gonna i have to change?
    i want graphics output by my source code

    this code print image twice although print accurate but twice what is the problem?
    Last edited by planet_abhi; 12-10-2003 at 07:46 AM.
    AbHHinaay

Popular pages Recent additions subscribe to a feed