printing the mirror image. - Programmer

This is a discussion on printing the mirror image. - Programmer ; I've been asked to make changes to a graphics application that currently build output and sends it to the printer using a print library. I've been asked to add functionality that will allow a user to print the mirror image ...

+ Reply to Thread
Results 1 to 16 of 16

Thread: printing the mirror image.

  1. printing the mirror image.

    I've been asked to make changes to a graphics application that
    currently build output and sends it to the printer using a print
    library. I've been asked to add functionality that will allow a user
    to print the mirror image of the text, graphics, and shapes. I thought
    the easiest way to do this was to allow the program to print the text,
    graphics, and shapes to the print device context as it currently does.
    Then create a dib from the printer device context, create a mirror
    image of the bitmap, and print the mirrored bitmap. Does this sound
    reasonable? If so, does anyone have sample code?

  2. Re: printing the mirror image.


    "Mark Perona" wrote in message
    news:5111bb05.0310211930.18797cc1@posting.google.c om...
    > I've been asked to make changes to a graphics application that
    > currently build output and sends it to the printer using a print
    > library. I've been asked to add functionality that will allow a user
    > to print the mirror image of the text, graphics, and shapes. I thought
    > the easiest way to do this was to allow the program to print the text,
    > graphics, and shapes to the print device context as it currently does.
    > Then create a dib from the printer device context, create a mirror
    > image of the bitmap, and print the mirrored bitmap. Does this sound
    > reasonable? If so, does anyone have sample code?


    you might want to look at the free utility IrfanView



  3. Re: printing the mirror image.

    "philo" wrote in message news:...
    > "Mark Perona" wrote in message
    > news:5111bb05.0310211930.18797cc1@posting.google.c om...
    > > I've been asked to make changes to a graphics application that
    > > currently build output and sends it to the printer using a print
    > > library. I've been asked to add functionality that will allow a user
    > > to print the mirror image of the text, graphics, and shapes. I thought
    > > the easiest way to do this was to allow the program to print the text,
    > > graphics, and shapes to the print device context as it currently does.
    > > Then create a dib from the printer device context, create a mirror
    > > image of the bitmap, and print the mirrored bitmap. Does this sound
    > > reasonable? If so, does anyone have sample code?

    >
    > you might want to look at the free utility IrfanView


    I took a look at that utility, but I'm not sure how it would help. To
    put it simply I was asked to change a program to give the user the
    ability to print the mirror image of what the application would
    normally print. I was thinking one way to do this would be allow the
    program to print as it normally would but just before actually
    finishing I would change the program to copy the contents of the print
    device context to a bit map, create a mirror image of the bitmap, and
    actually send the mirrored bitmap to the printer. I've been goofing
    around with gdi calls to this with much success. Another thought I had
    was an imposition type utility that could intercept the print job and
    print the mirror image of the job. Any guidance would be appreciated

  4. Re: printing the mirror image.

    No. No. No.

    Render into a bitmap first and then mirror the bitmap is unacceptible for
    application printing, because of the high device resolution. You will run
    into unlimited number of troubles.

    For images and vector graphics, you can simply add a mirroring
    transformation to the DC, everything will just follow. Text in compatible
    mapping mode will not follow the direction. If you're on NT-based systems,
    you can use world transformation to make text work too.

    If you're on Win9X, it's tricky. Another reason to move to WinXP.

    --
    Feng Yuan (www.fengyuan.com)

    This posting is provided "AS IS" with no warranties, and confers no rights.



  5. Re: printing the mirror image.

    On 21 Oct 2003 20:30:03 -0700, mperona@earthlink.net (Mark Perona)
    wrote:

    >I've been asked to make changes to a graphics application that
    >currently build output and sends it to the printer using a print
    >library. I've been asked to add functionality that will allow a user
    >to print the mirror image of the text, graphics, and shapes. I thought
    >the easiest way to do this was to allow the program to print the text,
    >graphics, and shapes to the print device context as it currently does.
    > Then create a dib from the printer device context, create a mirror
    >image of the bitmap, and print the mirrored bitmap. Does this sound
    >reasonable? If so, does anyone have sample code?


    I believe StretchBlt will create a mirror image if you make one of the
    arguments negative. See the Remarks section of the MSDN Library
    reference for the function.

    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret
    PenFact, Inc.
    500 Harrison Ave., Suite 3R
    Boston, MA 02118
    www.penfact.com

  6. Re: printing the mirror image.

    "Feng Yuan [MSFT]" wrote in message news:...
    > No. No. No.
    >
    > Render into a bitmap first and then mirror the bitmap is unacceptible for
    > application printing, because of the high device resolution. You will run
    > into unlimited number of troubles.
    >
    > For images and vector graphics, you can simply add a mirroring
    > transformation to the DC, everything will just follow. Text in compatible
    > mapping mode will not follow the direction. If you're on NT-based systems,
    > you can use world transformation to make text work too.
    >
    > If you're on Win9X, it's tricky. Another reason to move to WinXP.



    Thanks for the help

  7. Re: printing the mirror image.

    r_z_aret@pen_fact.com wrote in message news:<3f9800c9.178324807@nntp.theworld.com>...
    > On 21 Oct 2003 20:30:03 -0700, mperona@earthlink.net (Mark Perona)
    > wrote:
    >
    > >I've been asked to make changes to a graphics application that
    > >currently build output and sends it to the printer using a print
    > >library. I've been asked to add functionality that will allow a user
    > >to print the mirror image of the text, graphics, and shapes. I thought
    > >the easiest way to do this was to allow the program to print the text,
    > >graphics, and shapes to the print device context as it currently does.
    > > Then create a dib from the printer device context, create a mirror
    > >image of the bitmap, and print the mirrored bitmap. Does this sound
    > >reasonable? If so, does anyone have sample code?

    >
    > I believe StretchBlt will create a mirror image if you make one of the
    > arguments negative. See the Remarks section of the MSDN Library
    > reference for the function.
    >
    > -----------------------------------------
    > To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
    >
    > Robert E. Zaret
    > PenFact, Inc.
    > 500 Harrison Ave., Suite 3R
    > Boston, MA 02118
    > www.penfact.com


    I can create the mirror image of a bitmap using StrechBlt. The problem
    I've now have spent over two weeks on, revolves around creating the
    mirror image of a printer device context.

  8. Re: printing the mirror image.

    mperona@earthlink.net (Mark Perona) wrote in message news:<5111bb05.0310271204.67d7325c@posting.google.com>...
    > r_z_aret@pen_fact.com wrote in message news:<3f9800c9.178324807@nntp.theworld.com>...
    > > On 21 Oct 2003 20:30:03 -0700, mperona@earthlink.net (Mark Perona)
    > > wrote:
    > >
    > > >I've been asked to make changes to a graphics application that
    > > >currently build output and sends it to the printer using a print
    > > >library. I've been asked to add functionality that will allow a user
    > > >to print the mirror image of the text, graphics, and shapes. I thought
    > > >the easiest way to do this was to allow the program to print the text,
    > > >graphics, and shapes to the print device context as it currently does.
    > > > Then create a dib from the printer device context, create a mirror
    > > >image of the bitmap, and print the mirrored bitmap. Does this sound
    > > >reasonable? If so, does anyone have sample code?

    > >
    > > I believe StretchBlt will create a mirror image if you make one of the
    > > arguments negative. See the Remarks section of the MSDN Library
    > > reference for the function.
    > >
    > > -----------------------------------------
    > > To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
    > >
    > > Robert E. Zaret
    > > PenFact, Inc.
    > > 500 Harrison Ave., Suite 3R
    > > Boston, MA 02118
    > > www.penfact.com

    >
    > I can create the mirror image of a bitmap using StrechBlt. The problem
    > I've now have spent over two weeks on, revolves around creating the
    > mirror image of a printer device context.


    I would pay someone to help me.

  9. Re: printing the mirror image.

    On 27 Oct 2003 12:04:19 -0800, mperona@earthlink.net (Mark Perona)
    wrote:

    >r_z_aret@pen_fact.com wrote in message news:<3f9800c9.178324807@nntp.theworld.com>...
    >> On 21 Oct 2003 20:30:03 -0700, mperona@earthlink.net (Mark Perona)
    >> wrote:
    >>
    >> >I've been asked to make changes to a graphics application that
    >> >currently build output and sends it to the printer using a print
    >> >library. I've been asked to add functionality that will allow a user
    >> >to print the mirror image of the text, graphics, and shapes. I thought
    >> >the easiest way to do this was to allow the program to print the text,
    >> >graphics, and shapes to the print device context as it currently does.
    >> > Then create a dib from the printer device context, create a mirror
    >> >image of the bitmap, and print the mirrored bitmap. Does this sound
    >> >reasonable? If so, does anyone have sample code?

    >>
    >> I believe StretchBlt will create a mirror image if you make one of the
    >> arguments negative. See the Remarks section of the MSDN Library
    >> reference for the function.
    >>
    >> -----------------------------------------
    >> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
    >>
    >> Robert E. Zaret
    >> PenFact, Inc.
    >> 500 Harrison Ave., Suite 3R
    >> Boston, MA 02118
    >> www.penfact.com

    >
    >I can create the mirror image of a bitmap using StrechBlt. The problem
    >I've now have spent over two weeks on, revolves around creating the
    >mirror image of a printer device context.


    I may be missing something. StrechBlt copies from DC to DC, so I
    assume it will work with any sort of DC, including a printer DC. Thus,
    I figured you could do something like:
    a) "draw" on a hidden DC instead of the actual printer DC, then use
    StrecthBlt to copy and rotate everything to the actual printer DC
    or
    b) "draw" on the original printer DC, but copy to and from a
    temporary, hidden DC, so you can rotate once.

    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret
    PenFact, Inc.
    500 Harrison Ave., Suite 3R
    Boston, MA 02118
    www.penfact.com

  10. Re: printing the mirror image.

    wrote in message
    news:3fa01746.19333329@nntp.theworld.com...
    > I may be missing something. StrechBlt copies from DC to DC, so I
    > assume it will work with any sort of DC, including a printer DC. Thus,
    > I figured you could do something like:
    > a) "draw" on a hidden DC instead of the actual printer DC, then use
    > StrecthBlt to copy and rotate everything to the actual printer DC
    > or
    > b) "draw" on the original printer DC, but copy to and from a
    > temporary, hidden DC, so you can rotate once.


    I don't believe this, or any solution involving blitting, will work, and I
    think Feng Yuan (who is more qualified than me on GDI) agrees.

    Consider the amount of data involved if you treat a page of A4 as a bitmap
    when targetting a 300dpi printer -- far more than one screen's worth. Trying
    to use StretchBlt on this would involve creating a memory DC the size of the
    page, bringing the whole page (that the application printed) into memory,
    and copying from one to the other. Then copying the whole lot back to the
    printer. Printer drivers avoid dealing with all this data at once by banding
    their output; that is, dividing it into strips and processing each strip at
    once. The solutions in this thread have tried to deal with everything at
    once which, even on current PCs, is a heck of a lot.

    In my opinion, the best ways of dealing with this are:
    1. Inserting a transform into the printer DC before the application sends
    any data
    2. Hooking into the printer driver somehow to reverse all the coordinates
    3. Printing onto transparent acetate and turning it round, then photocopying
    that onto a sheet of paper

    --
    Tim Robinson (MVP, Windows SDK)
    http://www.themobius.co.uk/



  11. Re: printing the mirror image.

    On Thu, 23 Oct 2003 06:38:11 GMT, "Feng Yuan [MSFT]"
    wrote:

    >No. No. No.
    >
    >Render into a bitmap first and then mirror the bitmap is unacceptible for
    >application printing, because of the high device resolution. You will run
    >into unlimited number of troubles.
    >
    >For images and vector graphics, you can simply add a mirroring
    >transformation to the DC, everything will just follow. Text in compatible


    I would like a few more hints about applying transformations to a DC.
    I couldn't come up with a good search string for google or on-line
    help.

    Thank you.

    clip
    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret
    PenFact, Inc.
    500 Harrison Ave., Suite 3R
    Boston, MA 02118
    www.penfact.com

  12. Re: printing the mirror image.

    On Wed, 29 Oct 2003 22:53:50 -0000, "Tim Robinson"
    wrote:

    > wrote in message
    >news:3fa01746.19333329@nntp.theworld.com...
    >> I may be missing something. StrechBlt copies from DC to DC, so I
    >> assume it will work with any sort of DC, including a printer DC. Thus,
    >> I figured you could do something like:
    >> a) "draw" on a hidden DC instead of the actual printer DC, then use
    >> StrecthBlt to copy and rotate everything to the actual printer DC
    >> or
    >> b) "draw" on the original printer DC, but copy to and from a
    >> temporary, hidden DC, so you can rotate once.

    >
    >I don't believe this, or any solution involving blitting, will work, and I
    >think Feng Yuan (who is more qualified than me on GDI) agrees.
    >
    >Consider the amount of data involved if you treat a page of A4 as a bitmap
    >when targetting a 300dpi printer -- far more than one screen's worth. Trying
    >to use StretchBlt on this would involve creating a memory DC the size of the
    >page, bringing the whole page (that the application printed) into memory,
    >and copying from one to the other. Then copying the whole lot back to the
    >printer. Printer drivers avoid dealing with all this data at once by banding
    >their output; that is, dividing it into strips and processing each strip at
    >once. The solutions in this thread have tried to deal with everything at
    >once which, even on current PCs, is a heck of a lot.


    Thank you. I hope/assume no one followed my suggestion. Another case
    where a little bit of knowledge is dangerous. And now that I've reread
    Feng Yuan's earlier note, I can see that he wrote pretty much what you
    just wrote.


    >
    >In my opinion, the best ways of dealing with this are:
    >1. Inserting a transform into the printer DC before the application sends
    >any data
    >2. Hooking into the printer driver somehow to reverse all the coordinates
    >3. Printing onto transparent acetate and turning it round, then photocopying
    >that onto a sheet of paper
    >
    >--
    >Tim Robinson (MVP, Windows SDK)
    >http://www.themobius.co.uk/
    >
    >


    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret
    PenFact, Inc.
    500 Harrison Ave., Suite 3R
    Boston, MA 02118
    www.penfact.com

  13. Re: printing the mirror image.

    r_z_aret@pen_fact.com wrote:
    >I would like a few more hints about applying transformations to a DC.
    >I couldn't come up with a good search string for google or on-line
    >help.


    Maybe he was talking about SetWorldTransform function?

    My advice is to open up the chapter on GDI in MSDN, and read it
    through! it's not long, and you can skip the reference section.

    --
    Lucian

  14. Re: printing the mirror image.

    "Tim Robinson" wrote in message news:...
    > wrote in message
    > news:3fa01746.19333329@nntp.theworld.com...
    > > I may be missing something. StrechBlt copies from DC to DC, so I
    > > assume it will work with any sort of DC, including a printer DC. Thus,
    > > I figured you could do something like:
    > > a) "draw" on a hidden DC instead of the actual printer DC, then use
    > > StrecthBlt to copy and rotate everything to the actual printer DC
    > > or
    > > b) "draw" on the original printer DC, but copy to and from a
    > > temporary, hidden DC, so you can rotate once.

    >
    > I don't believe this, or any solution involving blitting, will work, and I
    > think Feng Yuan (who is more qualified than me on GDI) agrees.
    >
    > Consider the amount of data involved if you treat a page of A4 as a bitmap
    > when targetting a 300dpi printer -- far more than one screen's worth. Trying
    > to use StretchBlt on this would involve creating a memory DC the size of the
    > page, bringing the whole page (that the application printed) into memory,
    > and copying from one to the other. Then copying the whole lot back to the
    > printer. Printer drivers avoid dealing with all this data at once by banding
    > their output; that is, dividing it into strips and processing each strip at
    > once. The solutions in this thread have tried to deal with everything at
    > once which, even on current PCs, is a heck of a lot.
    >
    > In my opinion, the best ways of dealing with this are:
    > 1. Inserting a transform into the printer DC before the application sends
    > any data
    > 2. Hooking into the printer driver somehow to reverse all the coordinates
    > 3. Printing onto transparent acetate and turning it round, then photocopying
    > that onto a sheet of paper


    I'm pretty sure you are not developing in vb, and haven't used the
    pegasus print pro object, but should the SetWorldTransform function as
    used bellow cause the text to print as a mirror image. The
    PrintPro1.hdc is a printer device context.

    Public Type XFORM
    eM11 As Double
    eM12 As Double
    eM21 As Double
    eM22 As Double
    eDx As Double
    eDy As Double
    End Type


    Dim w, h
    Dim x As XFORM
    PrintPRO1.StartPrintDoc
    x.eM11 = 1
    x.eM12 = 0
    x.eM21 = 0
    x.eM22 = -1
    x.eDx = 0
    x.eDy = 0
    SetGraphicsMode PrintPRO1.hdc, GM_ADVANCED
    SetMapMode PrintPRO1.hdc, MM_LOENGLISH
    SetWorldTransform PrintPRO1.hdc, x

    w = PrintPRO1.PWidth
    h = 1010
    PrintPRO1.BackStyle = 1 'Opaque
    PrintPRO1.ForeColor = RGB(255, 255, 255) 'White text
    PrintPRO1.BackColor = RGB(0, 0, 0) 'Black background
    PrintPRO1.Font.Name = "arial"
    PrintPRO1.Font.Bold = True
    PrintPRO1.Font.Size = 24
    PrintPRO1.Alignment = ALIGN_CenterJustifyMiddle
    PrintPRO1.PrintTextAligned " Hello! Check out PrintPRO 2.0 ",
    1000, PrintPRO1.TMargin, w - 1000, 1100


    PrintPRO1.EndPrintDoc

  15. Re: printing the mirror image.

    "Mark Perona" wrote in message
    news:5111bb05.0310301347.65df45e7@posting.google.c om...
    > I'm pretty sure you are not developing in vb, and haven't used the
    > pegasus print pro object, but should the SetWorldTransform function as
    > used bellow cause the text to print as a mirror image. The
    > PrintPro1.hdc is a printer device context.


    A quick bit of mental matrix maths says yes; this inverts the y axis.

    Another thing to try, which will work on Win9x as well as NT, is the
    SetViewportExtEx function. A negative nYExtent should produce the same
    effect as your world transform code.

    --
    Tim Robinson (MVP, Windows SDK)
    http://www.themobius.co.uk/



  16. Re: printing the mirror image.

    On Thu, 30 Oct 2003 22:21:17 +0100, Lucian Wischik
    wrote:

    >r_z_aret@pen_fact.com wrote:
    >>I would like a few more hints about applying transformations to a DC.
    >>I couldn't come up with a good search string for google or on-line
    >>help.

    >
    >Maybe he was talking about SetWorldTransform function?


    Sure looks relevant.

    >
    >My advice is to open up the chapter on GDI in MSDN, and read it
    >through! it's not long, and you can skip the reference section.


    Good advice, thank you.

    >
    >--
    >Lucian


    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret
    PenFact, Inc.
    500 Harrison Ave., Suite 3R
    Boston, MA 02118
    www.penfact.com

+ Reply to Thread