Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get raster data by calling API in printer driver



Hi Roger,
 
Appreciate your help. Maybe I didn't mention my questions very clearly. Let me show you my issue.
 
The printer is a PCL printer which owns several printer resolution, so I need to send some commands which like
 
Set Cursor Horizontial Position(PCL Units)  Esc*p#X
Set Cursor Vertical Position(PCL Units)     Esc*p#Y
(#means left-top PCL UNIT coordinate of the image, not page )
Raster Height        Esc*r#T  
Raster Width         Esc*r#S
 (# means the dots printer will output)
 
and raster data. Becuse that, I have to know the image size(inch), then I can tell
the printer the amount of Width/Height dots by multipling the printer DPI and image width/height(inch)  .  
 
For example, I open a BMP image with Preview which will show me the information:
image DPI:72
pixels: 62 X 84
size: 0.86 X 1.17 inch
RGB
And my printer DPI is 508(DPI), the Raster Width  is 437(0.86X508) and Height is 594(1.17X508). So I will send Esc*r 594T and Esc*r437S to printer. So, in the printer driver, my question are:
 
1.How can I get the image size, pixels and DPI(not printer DPI)? Because they can make me calculate the Raster H/W.
 
2.How can I get the correct raster data which matchs the printer's resolution?
In other word, let cgpdftoraster to generate the raster data I needed.
 
3.In order to set cursor position, how to get the left-top coordinate(PCL UNIT) of the image?
 
Thanks,
--Henry

email@hidden 說:
Send Printing mailing list submissions to
email@hidden

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/printing
or, via email, send a message with subject or body 'help' to
email@hidden

You can reach the person managing the list at
email@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Printing digest..."


Today's Topics:

1. Re: How to get raster data by calling API in printer driver
(Roger Long)


----------------------------------------------------------------------

Message: 1
Date: Wed, 28 Sep 2005 14:02:57 -0700
From: Roger Long
Subject: Re: How to get raster data by calling API in printer driver
To: Henry Lai
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1


On Wednesday, September 28, 2005, at 02:04AM, Henry Lai wrote:

> 1.How can I know cgpdftoraster use which cupsBitsPerColor,
> cupsColorSpace and cupsBitsPerPixel to transfer image to raster
> data? Below is what I call in the driver. Are they enough?
>
> ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
> ...
> cupsRasterReadHeader(ras, &header);
> ...
> cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine);

Each header that you read will contain cupsBitsPerColor, cupsColorSpace, and cupsBitsPerPixel. that were used to rasterize the page.

> 2.For the file I print, how can I know the picture size(inch), DPI
> and ColorSpace in my driver?

The header also contains a PageSize! array, which defines the page dimensions in points. The resolution (DPI) is another array, HWResolution, in the header..

> 3.In my driver , I get the cupsBitsPerColor, cupsColorSpace and
> cupsBitsPerPixel from my PPD file. Is it correct?

You get them from the header in the raster data that you read. The printing system gets them from the PPD in order to determine how to rasterize each page.

--
Roger L Long
email@hidden


------------------------------

_______________________________________________
Printing mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/printing

End of Printing Digest, Vol 2, Issue 135
****************************************

___________________________________________________ 郔陔唳 Yahoo!✽藻撈�r籵�� 7.0 betaㄛ轎愐鋒繚����¦斕湖ㄐ http://messenger.yahoo.com.tw/beta.html

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Printing mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/printing/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.