Renamed many constants and fields according to Open BeOS coding style guide.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6434 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2f6e49a929
commit
d2c03b1bec
@ -26,7 +26,7 @@ using namespace std;
|
|||||||
LIPS3Driver::LIPS3Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
LIPS3Driver::LIPS3Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
: GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
__halftone = NULL;
|
fHalftone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS3Driver::startDoc()
|
bool LIPS3Driver::startDoc()
|
||||||
@ -41,7 +41,7 @@ bool LIPS3Driver::startDoc()
|
|||||||
paperFeedMode();
|
paperFeedMode();
|
||||||
disableAutoFF();
|
disableAutoFF();
|
||||||
setNumberOfCopies();
|
setNumberOfCopies();
|
||||||
__halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException &err) {
|
||||||
@ -52,8 +52,8 @@ bool LIPS3Driver::startDoc()
|
|||||||
bool LIPS3Driver::startPage(int)
|
bool LIPS3Driver::startPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
__current_x = 0;
|
fCurrentX = 0;
|
||||||
__current_y = 0;
|
fCurrentY = 0;
|
||||||
memorizedPosition();
|
memorizedPosition();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -76,8 +76,8 @@ bool LIPS3Driver::endPage(int)
|
|||||||
bool LIPS3Driver::endDoc(bool)
|
bool LIPS3Driver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (__halftone) {
|
if (fHalftone) {
|
||||||
delete __halftone;
|
delete fHalftone;
|
||||||
}
|
}
|
||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
@ -117,7 +117,7 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("x = %d\n", x));
|
DBGMSG(("x = %d\n", x));
|
||||||
DBGMSG(("y = %d\n", y));
|
DBGMSG(("y = %d\n", y));
|
||||||
|
|
||||||
if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) {
|
if (get_valid_rect(bitmap, &rc)) {
|
||||||
|
|
||||||
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
||||||
rc.left, rc.top, rc.right, rc.bottom));
|
rc.left, rc.top, rc.right, rc.bottom));
|
||||||
@ -138,11 +138,11 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("in_size = %d\n", in_size));
|
DBGMSG(("in_size = %d\n", in_size));
|
||||||
DBGMSG(("out_size = %d\n", out_size));
|
DBGMSG(("out_size = %d\n", out_size));
|
||||||
DBGMSG(("delta = %d\n", delta));
|
DBGMSG(("delta = %d\n", delta));
|
||||||
DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth()));
|
DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar *ptr = (uchar *)bitmap->Bits()
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * __halftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
@ -161,7 +161,7 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
move(x, y);
|
move(x, y);
|
||||||
|
|
||||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||||
__halftone->dither(ptr2, ptr, x, y, width);
|
fHalftone->dither(ptr2, ptr, x, y, width);
|
||||||
ptr += delta;
|
ptr += delta;
|
||||||
ptr2 += widthByte;
|
ptr2 += widthByte;
|
||||||
y++;
|
y++;
|
||||||
@ -247,47 +247,47 @@ void LIPS3Driver::selectPageFormat()
|
|||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
switch (getJobData()->getPaper()) {
|
switch (getJobData()->getPaper()) {
|
||||||
case JobData::A3:
|
case JobData::kA3:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::A4:
|
case JobData::kA4:
|
||||||
i = 14;
|
i = 14;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::A5:
|
case JobData::kA5:
|
||||||
i = 16;
|
i = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::JAPANESE_POSTCARD:
|
case JobData::kJapanesePostcard:
|
||||||
i = 18;
|
i = 18;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::B4:
|
case JobData::kB4:
|
||||||
i = 24;
|
i = 24;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::B5:
|
case JobData::kB5:
|
||||||
i = 26;
|
i = 26;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::LETTER:
|
case JobData::kLetter:
|
||||||
i = 30;
|
i = 30;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::LEGAL:
|
case JobData::kLegal:
|
||||||
i = 32;
|
i = 32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case JobData::EXECUTIVE:
|
// case JobData::kExecutive:
|
||||||
// i = 40;
|
// i = 40;
|
||||||
// break;
|
// break;
|
||||||
//
|
//
|
||||||
// case JobData::JENV_YOU4:
|
// case JobData::kJEnvYou4:
|
||||||
// i = 50;
|
// i = 50;
|
||||||
// break;
|
// break;
|
||||||
//
|
//
|
||||||
// case JobData::USER:
|
// case JobData::kUser:
|
||||||
// i = 90;
|
// i = 90;
|
||||||
// break;
|
// break;
|
||||||
//
|
//
|
||||||
@ -298,7 +298,7 @@ void LIPS3Driver::selectPageFormat()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobData::LANDSCAPE == getJobData()->getOrientation())
|
if (JobData::kLandscape == getJobData()->getOrientation())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (i < 80) {
|
if (i < 80) {
|
||||||
@ -328,16 +328,16 @@ void LIPS3Driver::paperFeedMode()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (getJobData()->getPaperSource()) {
|
switch (getJobData()->getPaperSource()) {
|
||||||
case JobData::MANUAL:
|
case JobData::kManual:
|
||||||
i = 1;
|
i = 1;
|
||||||
break;
|
break;
|
||||||
case JobData::LOWER:
|
case JobData::kLower:
|
||||||
i = 2;
|
i = 2;
|
||||||
break;
|
break;
|
||||||
case JobData::UPPER:
|
case JobData::kUpper:
|
||||||
i = 3;
|
i = 3;
|
||||||
break;
|
break;
|
||||||
case JobData::AUTO:
|
case JobData::kAuto:
|
||||||
default:
|
default:
|
||||||
i = 0;
|
i = 0;
|
||||||
break;
|
break;
|
||||||
@ -408,17 +408,17 @@ void LIPS3Driver::jobEnd()
|
|||||||
|
|
||||||
void LIPS3Driver::move(int x, int y)
|
void LIPS3Driver::move(int x, int y)
|
||||||
{
|
{
|
||||||
if (__current_x != x) {
|
if (fCurrentX != x) {
|
||||||
if (x) {
|
if (x) {
|
||||||
moveAbsoluteHorizontal(x);
|
moveAbsoluteHorizontal(x);
|
||||||
} else {
|
} else {
|
||||||
carriageReturn();
|
carriageReturn();
|
||||||
}
|
}
|
||||||
__current_x = x;
|
fCurrentX = x;
|
||||||
}
|
}
|
||||||
if (__current_y != y) {
|
if (fCurrentY != y) {
|
||||||
int dy = y - __current_y;
|
int dy = y - fCurrentY;
|
||||||
moveDown(dy);
|
moveDown(dy);
|
||||||
__current_y = y;
|
fCurrentY = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,9 @@ private:
|
|||||||
void formFeed();
|
void formFeed();
|
||||||
void jobEnd();
|
void jobEnd();
|
||||||
|
|
||||||
int __current_x;
|
int fCurrentX;
|
||||||
int __current_y;
|
int fCurrentY;
|
||||||
Halftone *__halftone;
|
Halftone *fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS3_H */
|
#endif /* __LIPS3_H */
|
||||||
|
@ -11,63 +11,63 @@
|
|||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
JobData::A3,
|
JobData::kA3,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
||||||
|
|
||||||
const PaperCap a4(
|
const PaperCap a4(
|
||||||
"A4",
|
"A4",
|
||||||
true,
|
true,
|
||||||
JobData::A4,
|
JobData::kA4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
||||||
|
|
||||||
const PaperCap a5(
|
const PaperCap a5(
|
||||||
"A5",
|
"A5",
|
||||||
false,
|
false,
|
||||||
JobData::A5,
|
JobData::kA5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
||||||
|
|
||||||
const PaperCap japanese_postcard(
|
const PaperCap japanese_postcard(
|
||||||
"Japanese Postcard",
|
"Japanese Postcard",
|
||||||
false,
|
false,
|
||||||
JobData::JAPANESE_POSTCARD,
|
JobData::kJapanesePostcard,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
||||||
|
|
||||||
const PaperCap b4(
|
const PaperCap b4(
|
||||||
"B4",
|
"B4",
|
||||||
false,
|
false,
|
||||||
JobData::B4,
|
JobData::kB4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
||||||
|
|
||||||
const PaperCap b5(
|
const PaperCap b5(
|
||||||
"B5",
|
"B5",
|
||||||
false,
|
false,
|
||||||
JobData::B5,
|
JobData::kB5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
||||||
|
|
||||||
const PaperCap letter(
|
const PaperCap letter(
|
||||||
"Letter",
|
"Letter",
|
||||||
false,
|
false,
|
||||||
JobData::LETTER,
|
JobData::kLetter,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
||||||
|
|
||||||
const PaperCap legal(
|
const PaperCap legal(
|
||||||
"Legal",
|
"Legal",
|
||||||
false,
|
false,
|
||||||
JobData::LEGAL,
|
JobData::kLegal,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
||||||
|
|
||||||
const PaperSourceCap autobin("Auto", true, JobData::AUTO);
|
const PaperSourceCap autobin("Auto", true, JobData::kAuto);
|
||||||
const PaperSourceCap manual("Manual", false, JobData::MANUAL);
|
const PaperSourceCap manual("Manual", false, JobData::kManual);
|
||||||
const PaperSourceCap upper("Upper", false, JobData::UPPER);
|
const PaperSourceCap upper("Upper", false, JobData::kUpper);
|
||||||
const PaperSourceCap lower("Lower", false, JobData::LOWER);
|
const PaperSourceCap lower("Lower", false, JobData::kLower);
|
||||||
|
|
||||||
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
||||||
|
|
||||||
@ -92,8 +92,8 @@ const ResolutionCap *resolutions[] = {
|
|||||||
&dpi300
|
&dpi300
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorCap color("Color", false, JobData::kCOLOR);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME);
|
const ColorCap monochrome("Monochrome", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap *colors[] = {
|
||||||
&color,
|
&color,
|
||||||
@ -105,45 +105,45 @@ Lips3Cap::Lips3Cap(const PrinterData *printer_data)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lips3Cap::countCap(CAPID capid) const
|
int Lips3Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case COLOR:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **Lips3Cap::enumCap(CAPID capid) const
|
const BaseCap **Lips3Cap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return (const BaseCap **)papers;
|
return (const BaseCap **)papers;
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return (const BaseCap **)papersources;
|
return (const BaseCap **)papersources;
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return (const BaseCap **)resolutions;
|
return (const BaseCap **)resolutions;
|
||||||
case COLOR:
|
case kColor:
|
||||||
return (const BaseCap **)colors;
|
return (const BaseCap **)colors;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lips3Cap::isSupport(CAPID capid) const
|
bool Lips3Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
case COLOR:
|
case kColor:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
class Lips3Cap : public PrinterCap {
|
class Lips3Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
Lips3Cap(const PrinterData *printer_data);
|
Lips3Cap(const PrinterData *printer_data);
|
||||||
virtual int countCap(CAPID) const;
|
virtual int countCap(CapID) const;
|
||||||
virtual bool isSupport(CAPID) const;
|
virtual bool isSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CAPID) const;
|
virtual const BaseCap **enumCap(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS3CAP_H */
|
#endif /* __LIPS3CAP_H */
|
||||||
|
@ -25,7 +25,7 @@ using namespace std;
|
|||||||
LIPS4Driver::LIPS4Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
LIPS4Driver::LIPS4Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
: GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
__halftone = NULL;
|
fHalftone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS4Driver::startDoc()
|
bool LIPS4Driver::startDoc()
|
||||||
@ -43,7 +43,7 @@ bool LIPS4Driver::startDoc()
|
|||||||
setNumberOfCopies();
|
setNumberOfCopies();
|
||||||
sidePrintingControl();
|
sidePrintingControl();
|
||||||
setBindingMargin();
|
setBindingMargin();
|
||||||
__halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException &err) {
|
||||||
@ -54,8 +54,8 @@ bool LIPS4Driver::startDoc()
|
|||||||
bool LIPS4Driver::startPage(int)
|
bool LIPS4Driver::startPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
__current_x = 0;
|
fCurrentX = 0;
|
||||||
__current_y = 0;
|
fCurrentY = 0;
|
||||||
memorizedPosition();
|
memorizedPosition();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -78,8 +78,8 @@ bool LIPS4Driver::endPage(int)
|
|||||||
bool LIPS4Driver::endDoc(bool)
|
bool LIPS4Driver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (__halftone) {
|
if (fHalftone) {
|
||||||
delete __halftone;
|
delete fHalftone;
|
||||||
}
|
}
|
||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
@ -128,7 +128,7 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("x = %d\n", x));
|
DBGMSG(("x = %d\n", x));
|
||||||
DBGMSG(("y = %d\n", y));
|
DBGMSG(("y = %d\n", y));
|
||||||
|
|
||||||
if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) {
|
if (get_valid_rect(bitmap, &rc)) {
|
||||||
|
|
||||||
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
||||||
rc.left, rc.top, rc.right, rc.bottom));
|
rc.left, rc.top, rc.right, rc.bottom));
|
||||||
@ -149,11 +149,11 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("in_size = %d\n", in_size));
|
DBGMSG(("in_size = %d\n", in_size));
|
||||||
DBGMSG(("out_size = %d\n", out_size));
|
DBGMSG(("out_size = %d\n", out_size));
|
||||||
DBGMSG(("delta = %d\n", delta));
|
DBGMSG(("delta = %d\n", delta));
|
||||||
DBGMSG(("__halftone_engine->get_pixel_depth() = %d\n", __halftone->getPixelDepth()));
|
DBGMSG(("fHalftone_engine->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar *ptr = (uchar *)bitmap->Bits()
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * __halftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
@ -172,7 +172,7 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
move(x, y);
|
move(x, y);
|
||||||
|
|
||||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||||
__halftone->dither(ptr2, ptr, x, y, width);
|
fHalftone->dither(ptr2, ptr, x, y, width);
|
||||||
ptr += delta;
|
ptr += delta;
|
||||||
ptr2 += widthByte;
|
ptr2 += widthByte;
|
||||||
y++;
|
y++;
|
||||||
@ -281,19 +281,19 @@ void LIPS4Driver::paperFeedMode()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (getJobData()->getPaperSource()) {
|
switch (getJobData()->getPaperSource()) {
|
||||||
case JobData::MANUAL:
|
case JobData::kManual:
|
||||||
i = 10;
|
i = 10;
|
||||||
break;
|
break;
|
||||||
case JobData::UPPER:
|
case JobData::kUpper:
|
||||||
i = 11;
|
i = 11;
|
||||||
break;
|
break;
|
||||||
case JobData::MIDDLE:
|
case JobData::kMiddle:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
case JobData::LOWER:
|
case JobData::kLower:
|
||||||
i = 13;
|
i = 13;
|
||||||
break;
|
break;
|
||||||
case JobData::AUTO:
|
case JobData::kAuto:
|
||||||
default:
|
default:
|
||||||
i = 0;
|
i = 0;
|
||||||
break;
|
break;
|
||||||
@ -307,47 +307,47 @@ void LIPS4Driver::selectPageFormat()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (getJobData()->getPaper()) {
|
switch (getJobData()->getPaper()) {
|
||||||
case JobData::A3:
|
case JobData::kA3:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::A4:
|
case JobData::kA4:
|
||||||
i = 14;
|
i = 14;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::A5:
|
case JobData::kA5:
|
||||||
i = 16;
|
i = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::JAPANESE_POSTCARD:
|
case JobData::kJapanesePostcard:
|
||||||
i = 18;
|
i = 18;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::B4:
|
case JobData::kB4:
|
||||||
i = 24;
|
i = 24;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::B5:
|
case JobData::kB5:
|
||||||
i = 26;
|
i = 26;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::LETTER:
|
case JobData::kLetter:
|
||||||
i = 30;
|
i = 30;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::LEGAL:
|
case JobData::kLegal:
|
||||||
i = 32;
|
i = 32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::EXECUTIVE:
|
case JobData::kExecutive:
|
||||||
i = 40;
|
i = 40;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::JENV_YOU4:
|
case JobData::kJEnvYou4:
|
||||||
i = 50;
|
i = 50;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::USER:
|
case JobData::kUser:
|
||||||
i = 90;
|
i = 90;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ void LIPS4Driver::selectPageFormat()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobData::LANDSCAPE == getJobData()->getOrientation())
|
if (JobData::kLandscape == getJobData()->getOrientation())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
writeSpoolString("\033[%d;;p", i);
|
writeSpoolString("\033[%d;;p", i);
|
||||||
@ -374,7 +374,7 @@ void LIPS4Driver::setNumberOfCopies()
|
|||||||
|
|
||||||
void LIPS4Driver::sidePrintingControl()
|
void LIPS4Driver::sidePrintingControl()
|
||||||
{
|
{
|
||||||
if (getJobData()->getPrintStyle() == JobData::SIMPLEX)
|
if (getJobData()->getPrintStyle() == JobData::kSimplex)
|
||||||
writeSpoolString("\033[0#x");
|
writeSpoolString("\033[0#x");
|
||||||
else
|
else
|
||||||
writeSpoolString("\033[2;0#x");
|
writeSpoolString("\033[2;0#x");
|
||||||
@ -382,19 +382,19 @@ void LIPS4Driver::sidePrintingControl()
|
|||||||
|
|
||||||
void LIPS4Driver::setBindingMargin()
|
void LIPS4Driver::setBindingMargin()
|
||||||
{
|
{
|
||||||
if (getJobData()->getPrintStyle() == JobData::DUPLEX) {
|
if (getJobData()->getPrintStyle() == JobData::kDuplex) {
|
||||||
int i;
|
int i;
|
||||||
// switch (job_data()->binding_location()) {
|
// switch (job_data()->binding_location()) {
|
||||||
// case LONG_EDGE_LEFT:
|
// case kLongEdgeLeft:
|
||||||
i = 0;
|
i = 0;
|
||||||
// break;
|
// break;
|
||||||
// case LONG_EDGE_RIGHT:
|
// case kLongEdgeRight:
|
||||||
// i = 1;
|
// i = 1;
|
||||||
// break;
|
// break;
|
||||||
// case SHORT_EDGE_TOP:
|
// case kShortEdgeTop:
|
||||||
// i = 2;
|
// i = 2;
|
||||||
// break;
|
// break;
|
||||||
// case SHORT_EDGE_BOTTOM:
|
// case kShortEdgeBottom:
|
||||||
// i = 3;
|
// i = 3;
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
@ -456,17 +456,17 @@ void LIPS4Driver::jobEnd()
|
|||||||
|
|
||||||
void LIPS4Driver::move(int x, int y)
|
void LIPS4Driver::move(int x, int y)
|
||||||
{
|
{
|
||||||
if (__current_x != x) {
|
if (fCurrentX != x) {
|
||||||
if (x) {
|
if (x) {
|
||||||
moveAbsoluteHorizontal(x);
|
moveAbsoluteHorizontal(x);
|
||||||
} else {
|
} else {
|
||||||
carriageReturn();
|
carriageReturn();
|
||||||
}
|
}
|
||||||
__current_x = x;
|
fCurrentX = x;
|
||||||
}
|
}
|
||||||
if (__current_y != y) {
|
if (fCurrentY != y) {
|
||||||
int dy = y - __current_y;
|
int dy = y - fCurrentY;
|
||||||
moveDown(dy);
|
moveDown(dy);
|
||||||
__current_y = y;
|
fCurrentY = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,9 @@ private:
|
|||||||
void formFeed();
|
void formFeed();
|
||||||
void jobEnd();
|
void jobEnd();
|
||||||
|
|
||||||
int __current_x;
|
int fCurrentX;
|
||||||
int __current_y;
|
int fCurrentY;
|
||||||
Halftone *__halftone;
|
Halftone *fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS4_H */
|
#endif /* __LIPS4_H */
|
||||||
|
@ -10,105 +10,105 @@
|
|||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
JobData::A3,
|
JobData::kA3,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
||||||
|
|
||||||
const PaperCap a4(
|
const PaperCap a4(
|
||||||
"A4",
|
"A4",
|
||||||
true,
|
true,
|
||||||
JobData::A4,
|
JobData::kA4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
||||||
|
|
||||||
const PaperCap a5(
|
const PaperCap a5(
|
||||||
"A5",
|
"A5",
|
||||||
false,
|
false,
|
||||||
JobData::A5,
|
JobData::kA5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
||||||
|
|
||||||
const PaperCap japanese_postcard(
|
const PaperCap japanese_postcard(
|
||||||
"Japanese Postcard",
|
"Japanese Postcard",
|
||||||
false,
|
false,
|
||||||
JobData::JAPANESE_POSTCARD,
|
JobData::kJapanesePostcard,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
||||||
|
|
||||||
const PaperCap b4(
|
const PaperCap b4(
|
||||||
"B4",
|
"B4",
|
||||||
false,
|
false,
|
||||||
JobData::B4,
|
JobData::kB4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
||||||
|
|
||||||
const PaperCap b5(
|
const PaperCap b5(
|
||||||
"B5",
|
"B5",
|
||||||
false,
|
false,
|
||||||
JobData::B5,
|
JobData::kB5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
||||||
|
|
||||||
const PaperCap letter(
|
const PaperCap letter(
|
||||||
"Letter",
|
"Letter",
|
||||||
false,
|
false,
|
||||||
JobData::LETTER,
|
JobData::kLetter,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
||||||
|
|
||||||
const PaperCap legal(
|
const PaperCap legal(
|
||||||
"Legal",
|
"Legal",
|
||||||
false,
|
false,
|
||||||
JobData::LEGAL,
|
JobData::kLegal,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
||||||
|
|
||||||
const PaperCap tabloid(
|
const PaperCap tabloid(
|
||||||
"Tabloid",
|
"Tabloid",
|
||||||
false,
|
false,
|
||||||
JobData::TABLOID,
|
JobData::kTabloid,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(6600.0), TO72DPI(10200.0)),
|
BRect(0.0f, 0.0f, TO72DPI(6600.0), TO72DPI(10200.0)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6480.0), TO72DPI(10080.0)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6480.0), TO72DPI(10080.0)));
|
||||||
|
|
||||||
const PaperCap executive(
|
const PaperCap executive(
|
||||||
"Executive",
|
"Executive",
|
||||||
false,
|
false,
|
||||||
JobData::EXECUTIVE,
|
JobData::kExecutive,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4350.0f), TO72DPI(6300.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4350.0f), TO72DPI(6300.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4230.0f), TO72DPI(6180.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4230.0f), TO72DPI(6180.0f)));
|
||||||
|
|
||||||
const PaperCap japanese_envelope_you4(
|
const PaperCap japanese_envelope_you4(
|
||||||
"Japanese Envelope You#4",
|
"Japanese Envelope You#4",
|
||||||
false,
|
false,
|
||||||
JobData::JENV_YOU4,
|
JobData::kJEnvYou4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(2480.0f), TO72DPI(5550.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(2480.0f), TO72DPI(5550.0f)),
|
||||||
BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(2244.0f), TO72DPI(5314.0f)));
|
BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(2244.0f), TO72DPI(5314.0f)));
|
||||||
/*
|
/*
|
||||||
const PaperCap japanese_envelope_kaku2(
|
const PaperCap japanese_envelope_kaku2(
|
||||||
"Japanese Envelope Kaku#2",
|
"Japanese Envelope Kaku#2",
|
||||||
false,
|
false,
|
||||||
JobData::JENV_KAKU2,
|
JobData::kJEnvKaku2,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5568.0f), TO72DPI(7842.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5568.0f), TO72DPI(7842.0f)),
|
||||||
BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(5432.0f), TO72DPI(7606.0f)));
|
BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(5432.0f), TO72DPI(7606.0f)));
|
||||||
*/
|
*/
|
||||||
const PaperSourceCap autobin("Auto", true, JobData::AUTO);
|
const PaperSourceCap autobin("Auto", true, JobData::kAuto);
|
||||||
const PaperSourceCap manual("Manual", false, JobData::MANUAL);
|
const PaperSourceCap manual("Manual", false, JobData::kManual);
|
||||||
const PaperSourceCap upper("Upper", false, JobData::UPPER);
|
const PaperSourceCap upper("Upper", false, JobData::kUpper);
|
||||||
const PaperSourceCap middle("Middle", false, JobData::MIDDLE);
|
const PaperSourceCap middle("Middle", false, JobData::kMiddle);
|
||||||
const PaperSourceCap lower("Lower", false, JobData::LOWER);
|
const PaperSourceCap lower("Lower", false, JobData::kLower);
|
||||||
|
|
||||||
const ResolutionCap dpi1200("1200dpi", false, 1200, 1200);
|
const ResolutionCap dpi1200("1200dpi", false, 1200, 1200);
|
||||||
const ResolutionCap dpi600("600dpi", true, 600, 600);
|
const ResolutionCap dpi600("600dpi", true, 600, 600);
|
||||||
const ResolutionCap dpi300("300dpi", false, 300, 300);
|
const ResolutionCap dpi300("300dpi", false, 300, 300);
|
||||||
|
|
||||||
const PrintStyleCap simplex("Simplex", true, JobData::SIMPLEX);
|
const PrintStyleCap simplex("Simplex", true, JobData::kSimplex);
|
||||||
const PrintStyleCap duplex("Duplex", false, JobData::DUPLEX);
|
const PrintStyleCap duplex("Duplex", false, JobData::kDuplex);
|
||||||
const PrintStyleCap booklet("Booklet", false, JobData::BOOKLET);
|
const PrintStyleCap booklet("Booklet", false, JobData::kBooklet);
|
||||||
|
|
||||||
const BindingLocationCap longedge1("Long Edge (left)", true, JobData::LONG_EDGE_LEFT);
|
const BindingLocationCap longedge1("Long Edge (left)", true, JobData::kLongEdgeLeft);
|
||||||
const BindingLocationCap longedge2("Long Edge (right)", false, JobData::LONG_EDGE_RIGHT);
|
const BindingLocationCap longedge2("Long Edge (right)", false, JobData::kLongEdgeRight);
|
||||||
const BindingLocationCap shortedge1("Short Edge (top)", false, JobData::SHORT_EDGE_TOP);
|
const BindingLocationCap shortedge1("Short Edge (top)", false, JobData::kShortEdgeTop);
|
||||||
const BindingLocationCap shortedge2("Short Edge (bottom)", false, JobData::SHORT_EDGE_BOTTOM);
|
const BindingLocationCap shortedge2("Short Edge (bottom)", false, JobData::kShortEdgeBottom);
|
||||||
|
|
||||||
const PaperCap *papers[] = {
|
const PaperCap *papers[] = {
|
||||||
&a4,
|
&a4,
|
||||||
@ -151,8 +151,8 @@ const BindingLocationCap *bindinglocations[] = {
|
|||||||
&shortedge2
|
&shortedge2
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorCap color("Color", false, JobData::kCOLOR);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME);
|
const ColorCap monochrome("Monochrome", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap *colors[] = {
|
||||||
&color,
|
&color,
|
||||||
@ -160,55 +160,55 @@ const ColorCap *colors[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int Lips4Cap::countCap(CAPID capid) const
|
int Lips4Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case PRINTSTYLE:
|
case kPrintStyle:
|
||||||
return sizeof(printstyles) / sizeof(printstyles[0]);
|
return sizeof(printstyles) / sizeof(printstyles[0]);
|
||||||
case BINDINGLOCATION:
|
case kBindingLocation:
|
||||||
return sizeof(bindinglocations) / sizeof(bindinglocations[0]);
|
return sizeof(bindinglocations) / sizeof(bindinglocations[0]);
|
||||||
case COLOR:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **Lips4Cap::enumCap(CAPID capid) const
|
const BaseCap **Lips4Cap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return (const BaseCap **)papers;
|
return (const BaseCap **)papers;
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return (const BaseCap **)papersources;
|
return (const BaseCap **)papersources;
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return (const BaseCap **)resolutions;
|
return (const BaseCap **)resolutions;
|
||||||
case PRINTSTYLE:
|
case kPrintStyle:
|
||||||
return (const BaseCap **)printstyles;
|
return (const BaseCap **)printstyles;
|
||||||
case BINDINGLOCATION:
|
case kBindingLocation:
|
||||||
return (const BaseCap **)bindinglocations;
|
return (const BaseCap **)bindinglocations;
|
||||||
case COLOR:
|
case kColor:
|
||||||
return (const BaseCap **)colors;
|
return (const BaseCap **)colors;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lips4Cap::isSupport(CAPID capid) const
|
bool Lips4Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
case PRINTSTYLE:
|
case kPrintStyle:
|
||||||
case BINDINGLOCATION:
|
case kBindingLocation:
|
||||||
case COLOR:
|
case kColor:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
class Lips4Cap : public PrinterCap {
|
class Lips4Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
Lips4Cap(const PrinterData *printer_data) : PrinterCap(printer_data) {}
|
Lips4Cap(const PrinterData *printer_data) : PrinterCap(printer_data) {}
|
||||||
virtual int countCap(CAPID) const;
|
virtual int countCap(CapID) const;
|
||||||
virtual bool isSupport(CAPID) const;
|
virtual bool isSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CAPID) const;
|
virtual const BaseCap **enumCap(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS4CAP_H */
|
#endif /* __LIPS4CAP_H */
|
||||||
|
@ -27,14 +27,14 @@ using namespace std;
|
|||||||
PCL5Driver::PCL5Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
PCL5Driver::PCL5Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
: GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
__halftone = NULL;
|
fHalftone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCL5Driver::startDoc()
|
bool PCL5Driver::startDoc()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
jobStart();
|
jobStart();
|
||||||
__halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException &err) {
|
||||||
@ -61,8 +61,8 @@ bool PCL5Driver::endPage(int)
|
|||||||
bool PCL5Driver::endDoc(bool)
|
bool PCL5Driver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (__halftone) {
|
if (fHalftone) {
|
||||||
delete __halftone;
|
delete fHalftone;
|
||||||
}
|
}
|
||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
@ -102,7 +102,7 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("x = %d\n", x));
|
DBGMSG(("x = %d\n", x));
|
||||||
DBGMSG(("y = %d\n", y));
|
DBGMSG(("y = %d\n", y));
|
||||||
|
|
||||||
if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) {
|
if (get_valid_rect(bitmap, &rc)) {
|
||||||
|
|
||||||
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
||||||
rc.left, rc.top, rc.right, rc.bottom));
|
rc.left, rc.top, rc.right, rc.bottom));
|
||||||
@ -123,11 +123,11 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("in_size = %d\n", in_size));
|
DBGMSG(("in_size = %d\n", in_size));
|
||||||
DBGMSG(("out_size = %d\n", out_size));
|
DBGMSG(("out_size = %d\n", out_size));
|
||||||
DBGMSG(("delta = %d\n", delta));
|
DBGMSG(("delta = %d\n", delta));
|
||||||
DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth()));
|
DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar *ptr = (uchar *)bitmap->Bits()
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * __halftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
@ -144,31 +144,21 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
move(x, y);
|
move(x, y);
|
||||||
startRasterGraphics(width, height);
|
startRasterGraphics(width, height);
|
||||||
|
|
||||||
const bool color = getJobData()->getColor() == JobData::kCOLOR;
|
const bool color = getJobData()->getColor() == JobData::kColor;
|
||||||
const int num_planes = color ? 3 : 1;
|
const int num_planes = color ? 3 : 1;
|
||||||
const int fill_bits = in_size * 8 - width;
|
const int fill_bits = in_size * 8 - width;
|
||||||
const uchar fill_mask = 0xff >> (8 - fill_bits);
|
const uchar fill_mask = 0xff >> (8 - fill_bits);
|
||||||
// ASSERT(0 <= fill_bits && fill_bits < 8);
|
// ASSERT(0 <= fill_bits && fill_bits < 8);
|
||||||
|
|
||||||
|
if (color) {
|
||||||
|
fHalftone->setPlanes(Halftone::kPlaneRGB1);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||||
|
|
||||||
for (int plane = 0; plane < num_planes; plane ++) {
|
for (int plane = 0; plane < num_planes; plane ++) {
|
||||||
|
|
||||||
if (color) {
|
fHalftone->dither(in_buffer, ptr, x, y, width);
|
||||||
switch (plane) {
|
|
||||||
// XXX maybe order should be red, green, blue. This could be
|
|
||||||
// a bug in __halftone dither where it passes rgb_color to
|
|
||||||
// a gray function in wrong order!
|
|
||||||
case 0: __halftone->setGrayFunction(Halftone::kBlueChannel);
|
|
||||||
break;
|
|
||||||
case 1: __halftone->setGrayFunction(Halftone::kGreenChannel);
|
|
||||||
break;
|
|
||||||
case 2: __halftone->setGrayFunction(Halftone::kRedChannel);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__halftone->dither(in_buffer, ptr, x, y, width);
|
|
||||||
|
|
||||||
if (color) {
|
if (color) {
|
||||||
// in color mode a value of 1 in all three planes means white
|
// in color mode a value of 1 in all three planes means white
|
||||||
@ -224,7 +214,7 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
|
|
||||||
void PCL5Driver::jobStart()
|
void PCL5Driver::jobStart()
|
||||||
{
|
{
|
||||||
const bool color = getJobData()->getColor() == JobData::kCOLOR;
|
const bool color = getJobData()->getColor() == JobData::kColor;
|
||||||
// enter PCL5
|
// enter PCL5
|
||||||
writeSpoolString("\033%%-12345X@PJL ENTER LANGUAGE=PCL\n");
|
writeSpoolString("\033%%-12345X@PJL ENTER LANGUAGE=PCL\n");
|
||||||
// reset
|
// reset
|
||||||
@ -259,7 +249,7 @@ void PCL5Driver::startRasterGraphics(int width, int height)
|
|||||||
writeSpoolString("\033*r%dT", height);
|
writeSpoolString("\033*r%dT", height);
|
||||||
// start raster graphics
|
// start raster graphics
|
||||||
writeSpoolString("\033*r1A");
|
writeSpoolString("\033*r1A");
|
||||||
__compression_method = -1;
|
fCompressionMethod = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCL5Driver::endRasterGraphics()
|
void PCL5Driver::endRasterGraphics()
|
||||||
@ -273,9 +263,9 @@ void PCL5Driver::rasterGraphics(
|
|||||||
int size,
|
int size,
|
||||||
bool lastPlane)
|
bool lastPlane)
|
||||||
{
|
{
|
||||||
if (__compression_method != compression_method) {
|
if (fCompressionMethod != compression_method) {
|
||||||
writeSpoolString("\033*b%dM", compression_method);
|
writeSpoolString("\033*b%dM", compression_method);
|
||||||
__compression_method = compression_method;
|
fCompressionMethod = compression_method;
|
||||||
}
|
}
|
||||||
writeSpoolString("\033*b%d", size);
|
writeSpoolString("\033*b%d", size);
|
||||||
if (lastPlane) {
|
if (lastPlane) {
|
||||||
@ -299,7 +289,7 @@ void PCL5Driver::move(int x, int y)
|
|||||||
|
|
||||||
int PCL5Driver::bytesToEnterCompressionMethod(int compression_method)
|
int PCL5Driver::bytesToEnterCompressionMethod(int compression_method)
|
||||||
{
|
{
|
||||||
if (__compression_method == compression_method) {
|
if (fCompressionMethod == compression_method) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 5;
|
return 5;
|
||||||
|
@ -34,8 +34,8 @@ private:
|
|||||||
void jobEnd();
|
void jobEnd();
|
||||||
int bytesToEnterCompressionMethod(int compression_method);
|
int bytesToEnterCompressionMethod(int compression_method);
|
||||||
|
|
||||||
int __compression_method;
|
int fCompressionMethod;
|
||||||
Halftone *__halftone;
|
Halftone *fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PCL5_H */
|
#endif /* __PCL5_H */
|
||||||
|
@ -11,60 +11,60 @@
|
|||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
JobData::A3,
|
JobData::kA3,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
||||||
|
|
||||||
const PaperCap a4(
|
const PaperCap a4(
|
||||||
"A4",
|
"A4",
|
||||||
true,
|
true,
|
||||||
JobData::A4,
|
JobData::kA4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
||||||
|
|
||||||
const PaperCap a5(
|
const PaperCap a5(
|
||||||
"A5",
|
"A5",
|
||||||
false,
|
false,
|
||||||
JobData::A5,
|
JobData::kA5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
||||||
|
|
||||||
const PaperCap japanese_postcard(
|
const PaperCap japanese_postcard(
|
||||||
"Japanese Postcard",
|
"Japanese Postcard",
|
||||||
false,
|
false,
|
||||||
JobData::JAPANESE_POSTCARD,
|
JobData::kJapanesePostcard,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
||||||
|
|
||||||
const PaperCap b4(
|
const PaperCap b4(
|
||||||
"B4",
|
"B4",
|
||||||
false,
|
false,
|
||||||
JobData::B4,
|
JobData::kB4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
||||||
|
|
||||||
const PaperCap b5(
|
const PaperCap b5(
|
||||||
"B5",
|
"B5",
|
||||||
false,
|
false,
|
||||||
JobData::B5,
|
JobData::kB5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
||||||
|
|
||||||
const PaperCap letter(
|
const PaperCap letter(
|
||||||
"Letter",
|
"Letter",
|
||||||
false,
|
false,
|
||||||
JobData::LETTER,
|
JobData::kLetter,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
||||||
|
|
||||||
const PaperCap legal(
|
const PaperCap legal(
|
||||||
"Legal",
|
"Legal",
|
||||||
false,
|
false,
|
||||||
JobData::LEGAL,
|
JobData::kLegal,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
||||||
|
|
||||||
const PaperSourceCap autobin("Auto", true, JobData::AUTO);
|
const PaperSourceCap autobin("Auto", true, JobData::kAuto);
|
||||||
|
|
||||||
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
||||||
const ResolutionCap dpi600("600dpi", false, 600, 600);
|
const ResolutionCap dpi600("600dpi", false, 600, 600);
|
||||||
@ -90,8 +90,8 @@ const ResolutionCap *resolutions[] = {
|
|||||||
&dpi1200,
|
&dpi1200,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorCap color("Color", false, JobData::kCOLOR);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME);
|
const ColorCap monochrome("Monochrome", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap *colors[] = {
|
||||||
&color,
|
&color,
|
||||||
@ -103,45 +103,45 @@ PCL5Cap::PCL5Cap(const PrinterData *printer_data)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int PCL5Cap::countCap(CAPID capid) const
|
int PCL5Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case COLOR:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **PCL5Cap::enumCap(CAPID capid) const
|
const BaseCap **PCL5Cap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return (const BaseCap **)papers;
|
return (const BaseCap **)papers;
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return (const BaseCap **)papersources;
|
return (const BaseCap **)papersources;
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return (const BaseCap **)resolutions;
|
return (const BaseCap **)resolutions;
|
||||||
case COLOR:
|
case kColor:
|
||||||
return (const BaseCap **)colors;
|
return (const BaseCap **)colors;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCL5Cap::isSupport(CAPID capid) const
|
bool PCL5Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
case COLOR:
|
case kColor:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
class PCL5Cap : public PrinterCap {
|
class PCL5Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
PCL5Cap(const PrinterData *printer_data);
|
PCL5Cap(const PrinterData *printer_data);
|
||||||
virtual int countCap(CAPID) const;
|
virtual int countCap(CapID) const;
|
||||||
virtual bool isSupport(CAPID) const;
|
virtual bool isSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CAPID) const;
|
virtual const BaseCap **enumCap(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PCL5CAP_H */
|
#endif /* __PCL5CAP_H */
|
||||||
|
@ -44,6 +44,16 @@ Job Separation Command
|
|||||||
|
|
||||||
Image Transfer
|
Image Transfer
|
||||||
|
|
||||||
|
Simple Color Command
|
||||||
|
Esc*r<mode>U
|
||||||
|
mode:
|
||||||
|
-3 ... 3 planes, device CMY palette
|
||||||
|
(0 = white, 1 = cyan, 2 = magenta, 3 = blue, 4 = yellow, 5 = green, 6 = red, 7 = black)
|
||||||
|
1 ... single plane K (black) palette (default)
|
||||||
|
(0 = white, 1 = black)
|
||||||
|
3 ... 3 planes, device RGB palette
|
||||||
|
(0 = black, 1 = red, 2 = green, 3 = yellow, 4 = blue, 5 = magenta, 6 = cyan, 7 = white)
|
||||||
|
|
||||||
Raster Presentation
|
Raster Presentation
|
||||||
Esc*r<mode>F
|
Esc*r<mode>F
|
||||||
mode ... 0 in orientation of logical page
|
mode ... 0 in orientation of logical page
|
||||||
@ -67,14 +77,16 @@ Start Raster Graphics
|
|||||||
lines ... number of raster lines of vertical movement
|
lines ... number of raster lines of vertical movement
|
||||||
Raster Compression
|
Raster Compression
|
||||||
Esc*b<mode>M
|
Esc*b<mode>M
|
||||||
mode ... 0 unencoded
|
mode
|
||||||
|
... 0 unencoded (default)
|
||||||
... 1 run length encoding
|
... 1 run length encoding
|
||||||
... 2 tagged image file format (TIFF) rev. 4.0
|
... 2 tagged image file format (TIFF) rev. 4.0
|
||||||
... 3 delta row compression
|
... 3 delta row compression
|
||||||
... 4 reserved
|
... 4 reserved
|
||||||
... 5 adaptie compression
|
... 5 adaptie compression
|
||||||
{Transfer Raster Data
|
{Transfer Raster Data
|
||||||
Esc*b<length>W<data>
|
[Esc*b<length>V<data> # ]
|
||||||
|
Esc*b<length>W<data> # for last plane moves cursor X pos to 0
|
||||||
length ... 0 to 32767
|
length ... 0 to 32767
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ using namespace std;
|
|||||||
PCL6Driver::PCL6Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
PCL6Driver::PCL6Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
: GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
__halftone = NULL;
|
fHalftone = NULL;
|
||||||
__stream = NULL;
|
fStream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCL6Driver::FlushOutBuffer(HP_StreamHandleType pStream, unsigned long cookie, HP_pUByte pOutBuffer, HP_SInt32 currentBufferLen)
|
void PCL6Driver::FlushOutBuffer(HP_StreamHandleType pStream, unsigned long cookie, HP_pUByte pOutBuffer, HP_SInt32 currentBufferLen)
|
||||||
@ -41,7 +41,7 @@ bool PCL6Driver::startDoc()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
jobStart();
|
jobStart();
|
||||||
__halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException &err) {
|
||||||
@ -52,8 +52,8 @@ bool PCL6Driver::startDoc()
|
|||||||
bool PCL6Driver::endDoc(bool)
|
bool PCL6Driver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (__halftone) {
|
if (fHalftone) {
|
||||||
delete __halftone;
|
delete fHalftone;
|
||||||
}
|
}
|
||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
@ -93,7 +93,7 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("x = %d\n", x));
|
DBGMSG(("x = %d\n", x));
|
||||||
DBGMSG(("y = %d\n", y));
|
DBGMSG(("y = %d\n", y));
|
||||||
|
|
||||||
if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) {
|
if (get_valid_rect(bitmap, &rc)) {
|
||||||
|
|
||||||
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
||||||
rc.left, rc.top, rc.right, rc.bottom));
|
rc.left, rc.top, rc.right, rc.bottom));
|
||||||
@ -110,7 +110,7 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
int out_size;
|
int out_size;
|
||||||
int delta;
|
int delta;
|
||||||
|
|
||||||
color = getJobData()->getColor() == JobData::kCOLOR;
|
color = getJobData()->getColor() == JobData::kColor;
|
||||||
|
|
||||||
width = rc.right - rc.left + 1;
|
width = rc.right - rc.left + 1;
|
||||||
height = rc.bottom - rc.top + 1;
|
height = rc.bottom - rc.top + 1;
|
||||||
@ -132,11 +132,11 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("height = %d\n", height));
|
DBGMSG(("height = %d\n", height));
|
||||||
DBGMSG(("out_size = %d\n", out_size));
|
DBGMSG(("out_size = %d\n", out_size));
|
||||||
DBGMSG(("delta = %d\n", delta));
|
DBGMSG(("delta = %d\n", delta));
|
||||||
DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth()));
|
DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar *ptr = (uchar *)bitmap->Bits()
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * __halftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
@ -169,7 +169,7 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
in += 4;
|
in += 4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__halftone->dither(out_ptr, ptr, x, y, width);
|
fHalftone->dither(out_ptr, ptr, x, y, width);
|
||||||
// invert pixels
|
// invert pixels
|
||||||
for (int w = widthByte; w > 0; w --, out ++) {
|
for (int w = widthByte; w > 0; w --, out ++) {
|
||||||
*out = ~*out;
|
*out = ~*out;
|
||||||
@ -223,38 +223,38 @@ void PCL6Driver::jobStart()
|
|||||||
"Comment Copyright (c) 2003 OBOS\n",
|
"Comment Copyright (c) 2003 OBOS\n",
|
||||||
getJobData()->getXres());
|
getJobData()->getXres());
|
||||||
// PCL6 begin
|
// PCL6 begin
|
||||||
__stream = HP_NewStream(16 * 1024, this);
|
fStream = HP_NewStream(16 * 1024, this);
|
||||||
HP_BeginSession_2(__stream, getJobData()->getXres(), getJobData()->getYres(), HP_eInch, HP_eBackChAndErrPage);
|
HP_BeginSession_2(fStream, getJobData()->getXres(), getJobData()->getYres(), HP_eInch, HP_eBackChAndErrPage);
|
||||||
HP_OpenDataSource_1(__stream, HP_eDefaultDataSource, HP_eBinaryLowByteFirst);
|
HP_OpenDataSource_1(fStream, HP_eDefaultDataSource, HP_eBinaryLowByteFirst);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCL6Driver::startPage(int)
|
bool PCL6Driver::startPage(int)
|
||||||
{
|
{
|
||||||
// XXX orientation
|
// XXX orientation
|
||||||
HP_BeginPage_3(__stream, HP_ePortraitOrientation, mediaSize(getJobData()->getPaper()), HP_eAutoSelect);
|
HP_BeginPage_3(fStream, HP_ePortraitOrientation, mediaSize(getJobData()->getPaper()), HP_eAutoSelect);
|
||||||
// PageOrigin from Windows NT printer driver
|
// PageOrigin from Windows NT printer driver
|
||||||
int x = 142 * getJobData()->getXres() / 600;
|
int x = 142 * getJobData()->getXres() / 600;
|
||||||
int y = 100 * getJobData()->getYres() / 600;
|
int y = 100 * getJobData()->getYres() / 600;
|
||||||
bool color = getJobData()->getColor() == JobData::kCOLOR;
|
bool color = getJobData()->getColor() == JobData::kColor;
|
||||||
HP_SetPageOrigin_1(__stream, x, y);
|
HP_SetPageOrigin_1(fStream, x, y);
|
||||||
HP_SetColorSpace_1(__stream, color ? HP_eRGB : HP_eGray);
|
HP_SetColorSpace_1(fStream, color ? HP_eRGB : HP_eGray);
|
||||||
HP_SetPaintTxMode_1(__stream, HP_eOpaque);
|
HP_SetPaintTxMode_1(fStream, HP_eOpaque);
|
||||||
HP_SetSourceTxMode_1(__stream, HP_eOpaque);
|
HP_SetSourceTxMode_1(fStream, HP_eOpaque);
|
||||||
HP_SetROP_1(__stream, 204);
|
HP_SetROP_1(fStream, 204);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCL6Driver::startRasterGraphics(int x, int y, int width, int height)
|
void PCL6Driver::startRasterGraphics(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
bool color = getJobData()->getColor() == JobData::kCOLOR;
|
bool color = getJobData()->getColor() == JobData::kColor;
|
||||||
__compression_method = -1;
|
fCompressionMethod = -1;
|
||||||
HP_BeginImage_1(__stream, HP_eDirectPixel, color ? HP_e8Bit : HP_e1Bit, width, height, width, height);
|
HP_BeginImage_1(fStream, HP_eDirectPixel, color ? HP_e8Bit : HP_e1Bit, width, height, width, height);
|
||||||
HP_ReadImage_1(__stream, 0, height, HP_eNoCompression);
|
HP_ReadImage_1(fStream, 0, height, HP_eNoCompression);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCL6Driver::endRasterGraphics()
|
void PCL6Driver::endRasterGraphics()
|
||||||
{
|
{
|
||||||
HP_EndImage_1(__stream);
|
HP_EndImage_1(fStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCL6Driver::rasterGraphics(
|
void PCL6Driver::rasterGraphics(
|
||||||
@ -262,17 +262,17 @@ void PCL6Driver::rasterGraphics(
|
|||||||
const uchar *buffer,
|
const uchar *buffer,
|
||||||
int size)
|
int size)
|
||||||
{
|
{
|
||||||
if (__compression_method != compression_method) {
|
if (fCompressionMethod != compression_method) {
|
||||||
__compression_method = compression_method;
|
fCompressionMethod = compression_method;
|
||||||
}
|
}
|
||||||
HP_EmbeddedDataPrefix32(__stream, size);
|
HP_EmbeddedDataPrefix32(fStream, size);
|
||||||
HP_RawUByteArray(__stream, (uchar*)buffer, size);
|
HP_RawUByteArray(fStream, (uchar*)buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCL6Driver::endPage(int)
|
bool PCL6Driver::endPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
HP_EndPage_2(__stream, getJobData()->getCopies());
|
HP_EndPage_2(fStream, getJobData()->getCopies());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException &err) {
|
||||||
@ -282,9 +282,9 @@ bool PCL6Driver::endPage(int)
|
|||||||
|
|
||||||
void PCL6Driver::jobEnd()
|
void PCL6Driver::jobEnd()
|
||||||
{
|
{
|
||||||
HP_CloseDataSource_1(__stream);
|
HP_CloseDataSource_1(fStream);
|
||||||
HP_EndSession_1(__stream);
|
HP_EndSession_1(fStream);
|
||||||
HP_FinishStream(__stream);
|
HP_FinishStream(fStream);
|
||||||
// PJL footer
|
// PJL footer
|
||||||
writeSpoolString("\033%%-12345X@PJL EOJ\n"
|
writeSpoolString("\033%%-12345X@PJL EOJ\n"
|
||||||
"\033%%-12345X");
|
"\033%%-12345X");
|
||||||
@ -292,18 +292,18 @@ void PCL6Driver::jobEnd()
|
|||||||
|
|
||||||
void PCL6Driver::move(int x, int y)
|
void PCL6Driver::move(int x, int y)
|
||||||
{
|
{
|
||||||
HP_SetCursor_1(__stream, x, y);
|
HP_SetCursor_1(fStream, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
HP_UByte PCL6Driver::mediaSize(JobData::PAPER paper)
|
HP_UByte PCL6Driver::mediaSize(JobData::Paper paper)
|
||||||
{
|
{
|
||||||
switch (paper) {
|
switch (paper) {
|
||||||
case JobData::LETTER: return HP_eLetterPaper;
|
case JobData::kLetter: return HP_eLetterPaper;
|
||||||
case JobData::LEGAL: return HP_eLegalPaper;
|
case JobData::kLegal: return HP_eLegalPaper;
|
||||||
case JobData::A4: return HP_eA4Paper;
|
case JobData::kA4: return HP_eA4Paper;
|
||||||
case JobData::EXECUTIVE: return HP_eExecPaper;
|
case JobData::kExecutive: return HP_eExecPaper;
|
||||||
case JobData::LEDGER: return HP_eLedgerPaper;
|
case JobData::kLedger: return HP_eLedgerPaper;
|
||||||
case JobData::A3: return HP_eA3Paper;
|
case JobData::kA3: return HP_eA3Paper;
|
||||||
/*
|
/*
|
||||||
case : return HP_eCOM10Envelope;
|
case : return HP_eCOM10Envelope;
|
||||||
case : return HP_eMonarchEnvelope;
|
case : return HP_eMonarchEnvelope;
|
||||||
@ -322,7 +322,8 @@ HP_UByte PCL6Driver::mediaSize(JobData::PAPER paper)
|
|||||||
case : return HP_eJIS16KPaper;
|
case : return HP_eJIS16KPaper;
|
||||||
case : return HP_eJISExecPaper;
|
case : return HP_eJISExecPaper;
|
||||||
*/
|
*/
|
||||||
default: HP_eLegalPaper;
|
default:
|
||||||
|
return HP_eLegalPaper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* PCL5.h
|
* PCL6.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
|
* Copyright 2003 Michael Pfeiffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PCL6_H
|
#ifndef __PCL6_H
|
||||||
@ -28,7 +29,7 @@ protected:
|
|||||||
virtual bool endDoc(bool success);
|
virtual bool endDoc(bool success);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HP_UByte mediaSize(JobData::PAPER paper);
|
HP_UByte mediaSize(JobData::Paper paper);
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
void jobStart();
|
void jobStart();
|
||||||
void startRasterGraphics(int x, int y, int width, int height);
|
void startRasterGraphics(int x, int y, int width, int height);
|
||||||
@ -39,9 +40,9 @@ private:
|
|||||||
int size);
|
int size);
|
||||||
void jobEnd();
|
void jobEnd();
|
||||||
|
|
||||||
HP_StreamHandleType __stream;
|
HP_StreamHandleType fStream;
|
||||||
int __compression_method;
|
int fCompressionMethod;
|
||||||
Halftone *__halftone;
|
Halftone *fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PCL5_H */
|
#endif /* __PCL6_H */
|
||||||
|
@ -11,60 +11,60 @@
|
|||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
JobData::A3,
|
JobData::kA3,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
||||||
|
|
||||||
const PaperCap a4(
|
const PaperCap a4(
|
||||||
"A4",
|
"A4",
|
||||||
true,
|
true,
|
||||||
JobData::A4,
|
JobData::kA4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
||||||
|
|
||||||
const PaperCap a5(
|
const PaperCap a5(
|
||||||
"A5",
|
"A5",
|
||||||
false,
|
false,
|
||||||
JobData::A5,
|
JobData::kA5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
||||||
|
|
||||||
const PaperCap japanese_postcard(
|
const PaperCap japanese_postcard(
|
||||||
"Japanese Postcard",
|
"Japanese Postcard",
|
||||||
false,
|
false,
|
||||||
JobData::JAPANESE_POSTCARD,
|
JobData::kJapanesePostcard,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
||||||
|
|
||||||
const PaperCap b4(
|
const PaperCap b4(
|
||||||
"B4",
|
"B4",
|
||||||
false,
|
false,
|
||||||
JobData::B4,
|
JobData::kB4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
||||||
|
|
||||||
const PaperCap b5(
|
const PaperCap b5(
|
||||||
"B5",
|
"B5",
|
||||||
false,
|
false,
|
||||||
JobData::B5,
|
JobData::kB5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
||||||
|
|
||||||
const PaperCap letter(
|
const PaperCap letter(
|
||||||
"Letter",
|
"Letter",
|
||||||
false,
|
false,
|
||||||
JobData::LETTER,
|
JobData::kLetter,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
||||||
|
|
||||||
const PaperCap legal(
|
const PaperCap legal(
|
||||||
"Legal",
|
"Legal",
|
||||||
false,
|
false,
|
||||||
JobData::LEGAL,
|
JobData::kLegal,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
||||||
|
|
||||||
const PaperSourceCap autobin("Auto", true, JobData::AUTO);
|
const PaperSourceCap autobin("Auto", true, JobData::kAuto);
|
||||||
|
|
||||||
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
||||||
const ResolutionCap dpi600("600dpi", false, 600, 600);
|
const ResolutionCap dpi600("600dpi", false, 600, 600);
|
||||||
@ -90,8 +90,8 @@ const ResolutionCap *resolutions[] = {
|
|||||||
&dpi1200,
|
&dpi1200,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorCap color("Color", false, JobData::kCOLOR);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME);
|
const ColorCap monochrome("Monochrome", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap *colors[] = {
|
||||||
&color,
|
&color,
|
||||||
@ -103,45 +103,45 @@ PCL6Cap::PCL6Cap(const PrinterData *printer_data)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int PCL6Cap::countCap(CAPID capid) const
|
int PCL6Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case COLOR:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **PCL6Cap::enumCap(CAPID capid) const
|
const BaseCap **PCL6Cap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return (const BaseCap **)papers;
|
return (const BaseCap **)papers;
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return (const BaseCap **)papersources;
|
return (const BaseCap **)papersources;
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return (const BaseCap **)resolutions;
|
return (const BaseCap **)resolutions;
|
||||||
case COLOR:
|
case kColor:
|
||||||
return (const BaseCap **)colors;
|
return (const BaseCap **)colors;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCL6Cap::isSupport(CAPID capid) const
|
bool PCL6Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
case COLOR:
|
case kColor:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* PCL5Cap.h
|
* PCL6Cap.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PCL5CAP_H
|
#ifndef __PCL6CAP_H
|
||||||
#define __PCL5CAP_H
|
#define __PCL6CAP_H
|
||||||
|
|
||||||
#include "PrinterCap.h"
|
#include "PrinterCap.h"
|
||||||
|
|
||||||
class PCL6Cap : public PrinterCap {
|
class PCL6Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
PCL6Cap(const PrinterData *printer_data);
|
PCL6Cap(const PrinterData *printer_data);
|
||||||
virtual int countCap(CAPID) const;
|
virtual int countCap(CapID) const;
|
||||||
virtual bool isSupport(CAPID) const;
|
virtual bool isSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CAPID) const;
|
virtual const BaseCap **enumCap(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PCL5CAP_H */
|
#endif /* __PCL6CAP_H */
|
||||||
|
@ -28,15 +28,15 @@ using namespace std;
|
|||||||
PSDriver::PSDriver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
PSDriver::PSDriver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
: GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
__printed_pages = 0;
|
fPrintedPages = 0;
|
||||||
__halftone = NULL;
|
fHalftone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PSDriver::startDoc()
|
bool PSDriver::startDoc()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
jobStart();
|
jobStart();
|
||||||
__halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException &err) {
|
||||||
@ -54,7 +54,7 @@ bool PSDriver::startPage(int page)
|
|||||||
bool PSDriver::endPage(int)
|
bool PSDriver::endPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
__printed_pages ++;
|
fPrintedPages ++;
|
||||||
writeSpoolString("showpage\n");
|
writeSpoolString("showpage\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -66,8 +66,8 @@ bool PSDriver::endPage(int)
|
|||||||
bool PSDriver::endDoc(bool)
|
bool PSDriver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (__halftone) {
|
if (fHalftone) {
|
||||||
delete __halftone;
|
delete fHalftone;
|
||||||
}
|
}
|
||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
@ -113,7 +113,7 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("x = %d\n", x));
|
DBGMSG(("x = %d\n", x));
|
||||||
DBGMSG(("y = %d\n", y));
|
DBGMSG(("y = %d\n", y));
|
||||||
|
|
||||||
if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) {
|
if (get_valid_rect(bitmap, &rc)) {
|
||||||
|
|
||||||
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
DBGMSG(("validate rect = %d, %d, %d, %d\n",
|
||||||
rc.left, rc.top, rc.right, rc.bottom));
|
rc.left, rc.top, rc.right, rc.bottom));
|
||||||
@ -121,7 +121,7 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
x = rc.left;
|
x = rc.left;
|
||||||
y += rc.top;
|
y += rc.top;
|
||||||
|
|
||||||
bool color = getJobData()->getColor() == JobData::kCOLOR;
|
bool color = getJobData()->getColor() == JobData::kColor;
|
||||||
int width = rc.right - rc.left + 1;
|
int width = rc.right - rc.left + 1;
|
||||||
int widthByte = (width + 7) / 8; /* byte boundary */
|
int widthByte = (width + 7) / 8; /* byte boundary */
|
||||||
int height = rc.bottom - rc.top + 1;
|
int height = rc.bottom - rc.top + 1;
|
||||||
@ -134,11 +134,11 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("height = %d\n", height));
|
DBGMSG(("height = %d\n", height));
|
||||||
DBGMSG(("out_size = %d\n", out_size));
|
DBGMSG(("out_size = %d\n", out_size));
|
||||||
DBGMSG(("delta = %d\n", delta));
|
DBGMSG(("delta = %d\n", delta));
|
||||||
DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth()));
|
DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar *ptr = (uchar *)bitmap->Bits()
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * __halftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
@ -169,7 +169,7 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
in += 4;
|
in += 4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__halftone->dither(in_buffer, ptr, x, y, width);
|
fHalftone->dither(in_buffer, ptr, x, y, width);
|
||||||
|
|
||||||
uchar* in = in_buffer;
|
uchar* in = in_buffer;
|
||||||
uchar* out = out_buffer;
|
uchar* out = out_buffer;
|
||||||
@ -248,8 +248,8 @@ void PSDriver::jobStart()
|
|||||||
|
|
||||||
void PSDriver::startRasterGraphics(int x, int y, int width, int height, int widthByte)
|
void PSDriver::startRasterGraphics(int x, int y, int width, int height, int widthByte)
|
||||||
{
|
{
|
||||||
bool color = getJobData()->getColor() == JobData::kCOLOR;
|
bool color = getJobData()->getColor() == JobData::kColor;
|
||||||
__compression_method = -1;
|
fCompressionMethod = -1;
|
||||||
writeSpoolString("gsave\n");
|
writeSpoolString("gsave\n");
|
||||||
writeSpoolString("/s %d string def\n", widthByte);
|
writeSpoolString("/s %d string def\n", widthByte);
|
||||||
writeSpoolString("%d %d translate\n", x, y);
|
writeSpoolString("%d %d translate\n", x, y);
|
||||||
@ -279,8 +279,8 @@ void PSDriver::rasterGraphics(
|
|||||||
const uchar *buffer,
|
const uchar *buffer,
|
||||||
int size)
|
int size)
|
||||||
{
|
{
|
||||||
if (__compression_method != compression_method) {
|
if (fCompressionMethod != compression_method) {
|
||||||
__compression_method = compression_method;
|
fCompressionMethod = compression_method;
|
||||||
}
|
}
|
||||||
writeSpoolData(buffer, size);
|
writeSpoolData(buffer, size);
|
||||||
writeSpoolString("\n");
|
writeSpoolString("\n");
|
||||||
@ -288,6 +288,6 @@ void PSDriver::rasterGraphics(
|
|||||||
|
|
||||||
void PSDriver::jobEnd()
|
void PSDriver::jobEnd()
|
||||||
{
|
{
|
||||||
writeSpoolString("%%%%Pages: %d\n", __printed_pages);
|
writeSpoolString("%%%%Pages: %d\n", fPrintedPages);
|
||||||
writeSpoolString("%%%%EOF\n");
|
writeSpoolString("%%%%EOF\n");
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ private:
|
|||||||
int size);
|
int size);
|
||||||
void jobEnd();
|
void jobEnd();
|
||||||
|
|
||||||
int __printed_pages;
|
int fPrintedPages;
|
||||||
int __compression_method;
|
int fCompressionMethod;
|
||||||
Halftone *__halftone;
|
Halftone *fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PS_H */
|
#endif /* __PS_H */
|
||||||
|
@ -11,60 +11,60 @@
|
|||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
JobData::A3,
|
JobData::kA3,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
|
||||||
|
|
||||||
const PaperCap a4(
|
const PaperCap a4(
|
||||||
"A4",
|
"A4",
|
||||||
true,
|
true,
|
||||||
JobData::A4,
|
JobData::kA4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
|
||||||
|
|
||||||
const PaperCap a5(
|
const PaperCap a5(
|
||||||
"A5",
|
"A5",
|
||||||
false,
|
false,
|
||||||
JobData::A5,
|
JobData::kA5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
|
||||||
|
|
||||||
const PaperCap japanese_postcard(
|
const PaperCap japanese_postcard(
|
||||||
"Japanese Postcard",
|
"Japanese Postcard",
|
||||||
false,
|
false,
|
||||||
JobData::JAPANESE_POSTCARD,
|
JobData::kJapanesePostcard,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
|
||||||
|
|
||||||
const PaperCap b4(
|
const PaperCap b4(
|
||||||
"B4",
|
"B4",
|
||||||
false,
|
false,
|
||||||
JobData::B4,
|
JobData::kB4,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
|
||||||
|
|
||||||
const PaperCap b5(
|
const PaperCap b5(
|
||||||
"B5",
|
"B5",
|
||||||
false,
|
false,
|
||||||
JobData::B5,
|
JobData::kB5,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
|
||||||
|
|
||||||
const PaperCap letter(
|
const PaperCap letter(
|
||||||
"Letter",
|
"Letter",
|
||||||
false,
|
false,
|
||||||
JobData::LETTER,
|
JobData::kLetter,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
|
||||||
|
|
||||||
const PaperCap legal(
|
const PaperCap legal(
|
||||||
"Legal",
|
"Legal",
|
||||||
false,
|
false,
|
||||||
JobData::LEGAL,
|
JobData::kLegal,
|
||||||
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)),
|
||||||
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
|
||||||
|
|
||||||
const PaperSourceCap autobin("Auto", true, JobData::AUTO);
|
const PaperSourceCap autobin("Auto", true, JobData::kAuto);
|
||||||
|
|
||||||
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
||||||
const ResolutionCap dpi600("600dpi", false, 600, 600);
|
const ResolutionCap dpi600("600dpi", false, 600, 600);
|
||||||
@ -90,8 +90,8 @@ const ResolutionCap *resolutions[] = {
|
|||||||
&dpi1200,
|
&dpi1200,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorCap color("Color", false, JobData::kCOLOR);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME);
|
const ColorCap monochrome("Monochrome", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap *colors[] = {
|
||||||
&color,
|
&color,
|
||||||
@ -103,45 +103,45 @@ PSCap::PSCap(const PrinterData *printer_data)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int PSCap::countCap(CAPID capid) const
|
int PSCap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case COLOR:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **PSCap::enumCap(CAPID capid) const
|
const BaseCap **PSCap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
return (const BaseCap **)papers;
|
return (const BaseCap **)papers;
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
return (const BaseCap **)papersources;
|
return (const BaseCap **)papersources;
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
return (const BaseCap **)resolutions;
|
return (const BaseCap **)resolutions;
|
||||||
case COLOR:
|
case kColor:
|
||||||
return (const BaseCap **)colors;
|
return (const BaseCap **)colors;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PSCap::isSupport(CAPID capid) const
|
bool PSCap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case PAPER:
|
case kPaper:
|
||||||
case PAPERSOURCE:
|
case kPaperSource:
|
||||||
case RESOLUTION:
|
case kResolution:
|
||||||
case COLOR:
|
case kColor:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
class PSCap : public PrinterCap {
|
class PSCap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
PSCap(const PrinterData *printer_data);
|
PSCap(const PrinterData *printer_data);
|
||||||
virtual int countCap(CAPID) const;
|
virtual int countCap(CapID) const;
|
||||||
virtual bool isSupport(CAPID) const;
|
virtual bool isSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CAPID) const;
|
virtual const BaseCap **enumCap(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PSCAP_H */
|
#endif /* __PSCAP_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user