1. printing in win

------=_NextPart_000_0028_01BEC7F2.9FB1DF40
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

i need some help does any one have a library/ solution on how to print =
in win32.
any help would be appreciated. thank you.
jesse m. kint
side message to David Cuny,
i'm writeing a program in win32lib that uses a zoom controll to zoom in =
on a picture/drawing i want to use scroll controlls to move around on =
the zoom drawing how would i use them to do this? any ideas would be =
useful.

------=_NextPart_000_0028_01BEC7F2.9FB1DF40
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 =
HTML//EN"><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>i need some help does any one have a =
library/=20
solution on how to print in win32.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>any help would be appreciated. thank =

you.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>jesse m. kint</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>side message to David =
Cuny,</FONT></DIV>
<DIV><FONT size=3D2>i'm writeing a program in win32lib that uses a zoom =
controll=20
to zoom in on a picture/drawing i want to use scroll controlls to move =
around on=20
the zoom drawing how would i use them to do this? any ideas would be=20

------=_NextPart_000_0028_01BEC7F2.9FB1DF40--

new topic     » topic index » view message » categorize

2. Re: printing in win

Jesse Kint  wrote:

> i need some help does any one have a library/ solution
> on how to print in win32.

Another thing on my to-do list. And it looks like I'll have to look into
postscript if I want to support it on the Linux platform. Bleah.

> i'm writing a program in win32lib that uses
> a zoom controll to zoom in on a picture/drawing
> i want to use scroll controlls to move around on the
> zoom drawing how would i use them to do this?

You should probably draw into an off-screen pixmap, and then bitblt the
image into the window. Changing the xSrc and ySrc values in bitblt make
scrolling trivial.

For zooming, I'd suggest using the Win32 routine StretchBlt. I haven't
written a wrapper for it yet, but you can probably write it yourself with
only minor modifications to the BitBlt wrapper.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: printing in win

>Jesse Kint  wrote:
>
>> i need some help does any one have a library/ solution
>> on how to print in win32.
>
>Another thing on my to-do list. And it looks like I'll have to look into
>postscript if I want to support it on the Linux platform. Bleah.
For text you can use the lately posted 'printdlg.ew'-routines [I don't knwo
who posted them] when you want to print bitmaps you may use the UNTESTED
code below. It needs win32lib.ew to run and you have probably to make same
routines / constant / vars in your win32lib.ew global. As soon as I have
time I will release the complete wrappers. To get the hdc you have to use
the PrintDialog in the 'printdlg.ew'-routines. I hope I've nothing left out.

Martin Schut

P.S. The code seems only to work for 1-bit bitmaps (monochrome bitmaps)

-------------- PARTIAL TESTED CODE -----------------

constant
    iCreateCompatibleDC = linkFunc(gdi32, "CreateCompatibleDC", {C_POINTER},
C_POINTER),
    iSelectObject = linkFunc(gdi32, "SelectObject", {C_POINTER, C_POINTER},
C_POINTER),
    iDeleteDC = linkFunc(gdi32, "DeleteDC", {C_POINTER}, C_POINTER),
    iStretchBlt = linkFunc(gdi32, "StretchBlt", {C_POINTER, C_INT, C_INT,
C_INT, C_INT, C_POINTER, C_INT, C_INT, C_INT, C_INT, C_LONG}, C_INT),
    iGetBitmapDimension = linkFunc(gdi32, "GetBitmapDimensionEx",
{C_POINTER, C_POINTER}, C_INT)

function CreateCompatibleDC(atom hdc)
    return c_func(iCreateCompatibleDC, {hdc})
end function

function SelectObject(atom hdc, atom object)
    return c_func(iSelectObject, {hdc, object})
end function

global function DeleteDC(atom hdc)
    return c_func(iDeleteDC, {hdc})
end function

function StretchBlt(atom hdcDest, integer nXOriginDest, integer
nYOriginDest,
    integer nWidthDest, integer nHeightDest, atom hdcSrc, integer
nXOriginSrc, integer nYOriginSrc,
    integer nWidthSrc, integer nHeightSrc, atom dwRop)

    return c_func(iStretchBlt, {hdcDest, nXOriginDest, nYOriginDest,
nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc,
nHeightSrc, dwRop})
end function

global procedure BitmapOut(atom hdc, integer x, integer y, integer width,
integer height, atom bmp)
    atom ok
    atom hdcMem, bmpInfo
    integer posX, posY

    bmpInfo = allocate_struct(SIZEOF_BITMAP)
    if not c_func(xGetObject, {bmp, SIZEOF_BITMAP, bmpInfo}) then
        return
    end if

    hdcMem = CreateCompatibleDC(hdc)
    posY = y
    posX = floor(x - (width / 2))

    ok = SelectObject(hdcMem, bmp)
    ok = StretchBlt(hdc, posX, posY, width, height, hdcMem, 0, 0,
fetch(bmpInfo, bmWidth), fetch(bmpInfo, bmHeight), SRCCOPY)

    ok = DeleteDC(hdcMem)
    free(bmpInfo)
end procedure

new topic     » goto parent     » topic index » view message » categorize

4. Re: printing in win

Martin Schut wrote:

> For text you can use the lately posted
> 'printdlg.ew'-routines [I don't know
> who posted them] when you want to print
> bitmaps you may use the UNTESTED
> code below.

I've got some basic PostScript printing support working in Llama (for
Linux), and I hope to hack a Win32 Printer class in the near future. If that
works well, I'll look into possibly adding printer support into Win32Lib as
well.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu