Skip to main content

Black and White printing

5 replies [Last post]
diverdad
Offline
Joined: 2005-01-28

I only know about printing from the tutorial and using it as a service. I want to add to the print menu : Black and White to the picks already there of Monochrome and Color. What is best way to do this.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
diverdad
Offline
Joined: 2005-01-28

Phil,

I'm still puzzled. It isn't clear how to accomplish what I want. If I was in a color lookup world I would do something like: set 0 - white and colors 1-256 to black. The problem with monochrome printing is the user has a yellow line drawn and wants to print it on a black and white printer. If I use grayscale it comes out as a faint line on the paper. When it copys this or puts it on a viewfoil it is very faint and noone can read it. So the need for Black and White.

Phil Race

Perhaps you could create a BufferedImage.TYPE_BYTE_BINARY with a 2 color
IndexColorModel
and have all the printing go into there. Then all rendering will have to
be one of those two colours
which I assume you would select as B&W.

The drawbacks to this are that to get printer resolution graphics
(something you also
were seeing problems with already) that BufferedImage will need to be
big and you
will have to scale it appropriately and the resulting spool file will
also be huge.
Another drawback is that it may not look very pretty.

In any case I don't see a way to do this via the printing APIs.

-phil.

java2d@javadesktop.org wrote:

>Phil,
>
>I'm still puzzled. It isn't clear how to accomplish what I want. If I was in a color lookup world I would do something like: set 0 - white and colors 1-256 to black. The problem with monochrome printing is the user has a yellow line drawn and wants to print it on a black and white printer. If I use grayscale it comes out as a faint line on the paper. When it copys this or puts it on a viewfoil it is very faint and noone can read it. So the need for Black and White.
>[Message sent by forum member 'diverdad' (diverdad)]
>
>http://forums.java.net/jive/thread.jspa?messageID=116324
>
>===========================================================================
>To unsubscribe, send email to listserv@java.sun.com and include in the body
>of the message "signoff JAVA2D-INTEREST". For general help, send email to
>listserv@java.sun.com and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

diverdad
Offline
Joined: 2005-01-28

Yes I understand that I need to display a new dialog. Black and white is not the same as monchrome. With monochrome you get shades of gray. I want the background to be white and all drawings to be black.

Phil Race

>I want the background to be white and all drawings to be black

So you need to proceed as I advised but the new dialog seems like a lot
of work
for little gain. We can't add it in our dialog as we can't control the
colours you use.

-phil.

>Yes I understand that I need to display a new dialog. Black and white is not the same as monchrome. With monochrome you get shades of gray. I want the background to be white and all drawings to be black.
>[Message sent by forum member 'diverdad' (diverdad)]
>
>http://forums.java.net/jive/thread.jspa?messageID=116301
>
>===========================================================================
>To unsubscribe, send email to listserv@java.sun.com and include in the body
>of the message "signoff JAVA2D-INTEREST". For general help, send email to
>listserv@java.sun.com and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Phil Race

Do you mean you want to update the list of choices the user sees for
some reason?
The dialog is not customisable in this way so you'd have to write your
own dialog.

Also I wonder how you expect to communicate this intent to the printing
API and ultimately
to the printer driver
For example, on windows you can tell the printer driver to use either
Monochrome
or Color (assuming its color capable) via a GDI DEVMODE setting. There's
no additional B&W setting.
So if for some reason your purpose is to have a purely bilevel output
rather than printing
in shades of grey via half-toning or the like, then I don't see how to
do this except to
control the actual colors that are used and limit them to black and white

So monochrome *IS* B&W - ie use only black ink and the printer just
dithers the black ink
to achieve the perception of grey levels (unless you have a rare printer
which has grey inks)

-phil.

java2d@javadesktop.org wrote:

>I only know about printing from the tutorial and using it as a service. I want to add to the print menu : Black and White to the picks already there of Monochrome and Color. What is best way to do this.
>[Message sent by forum member 'diverdad' (diverdad)]
>
>http://forums.java.net/jive/thread.jspa?messageID=116265
>
>===========================================================================
>To unsubscribe, send email to listserv@java.sun.com and include in the body
>of the message "signoff JAVA2D-INTEREST". For general help, send email to
>listserv@java.sun.com and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".