Style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37364 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define DBG_CON_STREAM
|
|
||||||
|
// #define DBG_CON_STREAM
|
||||||
|
|
||||||
#ifdef DBG_CON_STREAM
|
#ifdef DBG_CON_STREAM
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -14,12 +15,14 @@ using namespace std;
|
|||||||
|
|
||||||
#define PACK_TYPE 2
|
#define PACK_TYPE 2
|
||||||
|
|
||||||
int compress3(unsigned char *pOut, unsigned char *pIn, int n)
|
|
||||||
|
int
|
||||||
|
compress3(unsigned char* pOut, unsigned char* pIn, int n)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
int count_byte;
|
int count_byte;
|
||||||
unsigned char *pBase;
|
unsigned char* pBase;
|
||||||
unsigned char *pLast;
|
unsigned char* pLast;
|
||||||
unsigned char keep;
|
unsigned char keep;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
@@ -56,32 +59,32 @@ int compress3(unsigned char *pOut, unsigned char *pIn, int n)
|
|||||||
*pOut++ = keep;
|
*pOut++ = keep;
|
||||||
*pOut++ = count - PACK_TYPE;
|
*pOut++ = count - PACK_TYPE;
|
||||||
count_byte += 2;
|
count_byte += 2;
|
||||||
} else {
|
} else
|
||||||
count_byte = n;
|
count_byte = n;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return count_byte;
|
return count_byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef DBG_CON_STREAM
|
#ifdef DBG_CON_STREAM
|
||||||
int main(int argc, char **argv)
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc < 2) {
|
if (argc < 2)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
ifstream ifs(*++argv, ios::binary | ios::nocreate);
|
ifstream ifs(*++argv, ios::binary | ios::nocreate);
|
||||||
if (!ifs) {
|
if (!ifs)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
ifs.seekg(0, ios::end);
|
ifs.seekg(0, ios::end);
|
||||||
long size = ifs.tellg();
|
long size = ifs.tellg();
|
||||||
ifs.seekg(0, ios::beg);
|
ifs.seekg(0, ios::beg);
|
||||||
|
|
||||||
unsigned char *pIn = new unsigned char[size];
|
unsigned char* pIn = new unsigned char[size];
|
||||||
unsigned char *pOut = new unsigned char[size * 3];
|
unsigned char* pOut = new unsigned char[size * 3];
|
||||||
|
|
||||||
ifs.read(pIn, size);
|
ifs.read(pIn, size);
|
||||||
|
|
||||||
@@ -94,4 +97,5 @@ int main(int argc, char **argv)
|
|||||||
delete [] pOut;
|
delete [] pOut;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
* Compress3.h
|
* Compress3.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __COMPRESS3_H
|
#ifndef __COMPRESS3_H
|
||||||
#define __COMPRESS3_H
|
#define __COMPRESS3_H
|
||||||
|
|
||||||
int compress3(unsigned char *out, unsigned char *in, int bytes);
|
|
||||||
|
int compress3(unsigned char* out, unsigned char* in, int bytes);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __COMPRESS3_H */
|
#endif /* __COMPRESS3_H */
|
||||||
|
|||||||
@@ -3,19 +3,24 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "Lips3.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <memory>
|
|
||||||
#include "Lips3.h"
|
|
||||||
#include "UIDriver.h"
|
|
||||||
#include "Compress3.h"
|
#include "Compress3.h"
|
||||||
#include "JobData.h"
|
|
||||||
#include "PrinterData.h"
|
|
||||||
#include "Lips3Cap.h"
|
|
||||||
#include "Halftone.h"
|
|
||||||
#include "ValidRect.h"
|
|
||||||
#include "DbgMsg.h"
|
#include "DbgMsg.h"
|
||||||
|
#include "Halftone.h"
|
||||||
|
#include "JobData.h"
|
||||||
|
#include "Lips3Cap.h"
|
||||||
|
#include "PrinterData.h"
|
||||||
|
#include "UIDriver.h"
|
||||||
|
#include "ValidRect.h"
|
||||||
|
|
||||||
|
|
||||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -23,13 +28,18 @@ using namespace std;
|
|||||||
#define std
|
#define std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LIPS3Driver::LIPS3Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
LIPS3Driver::LIPS3Driver(BMessage *msg, PrinterData *printer_data,
|
||||||
|
const PrinterCap *printer_cap)
|
||||||
|
:
|
||||||
|
GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
fHalftone = NULL;
|
fHalftone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS3Driver::startDoc()
|
|
||||||
|
bool
|
||||||
|
LIPS3Driver::startDoc()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
beginTextMode();
|
beginTextMode();
|
||||||
@@ -41,15 +51,19 @@ bool LIPS3Driver::startDoc()
|
|||||||
paperFeedMode();
|
paperFeedMode();
|
||||||
disableAutoFF();
|
disableAutoFF();
|
||||||
setNumberOfCopies();
|
setNumberOfCopies();
|
||||||
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma(), getJobData()->getInkDensity(), getJobData()->getDitherType());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(),
|
||||||
|
getJobData()->getGamma(), getJobData()->getInkDensity(),
|
||||||
|
getJobData()->getDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS3Driver::startPage(int)
|
|
||||||
|
bool
|
||||||
|
LIPS3Driver::startPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
fCurrentX = 0;
|
fCurrentX = 0;
|
||||||
@@ -57,23 +71,27 @@ bool LIPS3Driver::startPage(int)
|
|||||||
memorizedPosition();
|
memorizedPosition();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS3Driver::endPage(int)
|
|
||||||
|
bool
|
||||||
|
LIPS3Driver::endPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
formFeed();
|
formFeed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS3Driver::endDoc(bool)
|
|
||||||
|
bool
|
||||||
|
LIPS3Driver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (fHalftone) {
|
if (fHalftone) {
|
||||||
@@ -82,12 +100,14 @@ bool LIPS3Driver::endDoc(bool)
|
|||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|
||||||
|
bool
|
||||||
|
LIPS3Driver::nextBand(BBitmap* bitmap, BPoint* offset)
|
||||||
{
|
{
|
||||||
DBGMSG(("> nextBand\n"));
|
DBGMSG(("> nextBand\n"));
|
||||||
|
|
||||||
@@ -107,9 +127,8 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
|
|
||||||
int page_height = getPageHeight();
|
int page_height = getPageHeight();
|
||||||
|
|
||||||
if (y + height > page_height) {
|
if (y + height > page_height)
|
||||||
height = page_height - y;
|
height = page_height - y;
|
||||||
}
|
|
||||||
|
|
||||||
rc.bottom = height - 1;
|
rc.bottom = height - 1;
|
||||||
|
|
||||||
@@ -126,7 +145,8 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
y += rc.top;
|
y += rc.top;
|
||||||
|
|
||||||
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;
|
||||||
int in_size = widthByte * height;
|
int in_size = widthByte * height;
|
||||||
int out_size = (in_size * 6 + 4) / 5;
|
int out_size = (in_size * 6 + 4) / 5;
|
||||||
@@ -138,23 +158,24 @@ 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", fHalftone->getPixelDepth()));
|
DBGMSG(("renderobj->get_pixel_depth() = %d\n",
|
||||||
|
fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar* ptr = static_cast<uchar*>(bitmap->Bits())
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
const uchar *buffer;
|
const uchar* buffer;
|
||||||
|
|
||||||
uchar *in_buffer = new uchar[in_size];
|
uchar* in_buffer = new uchar[in_size];
|
||||||
uchar *out_buffer = new uchar[out_size];
|
uchar* out_buffer = new uchar[out_size];
|
||||||
|
|
||||||
auto_ptr<uchar> _in_buffer (in_buffer);
|
auto_ptr<uchar> _in_buffer (in_buffer);
|
||||||
auto_ptr<uchar> _out_buffer(out_buffer);
|
auto_ptr<uchar> _out_buffer(out_buffer);
|
||||||
|
|
||||||
uchar *ptr2 = (uchar *)in_buffer;
|
uchar* ptr2 = static_cast<uchar*>(in_buffer);
|
||||||
|
|
||||||
DBGMSG(("move\n"));
|
DBGMSG(("move\n"));
|
||||||
|
|
||||||
@@ -170,10 +191,12 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
compressed_size = compress3(out_buffer, in_buffer, in_size);
|
compressed_size = compress3(out_buffer, in_buffer, in_size);
|
||||||
|
|
||||||
if (compressed_size < in_size) {
|
if (compressed_size < in_size) {
|
||||||
compression_method = 9; /* compress3 */
|
compression_method = 9;
|
||||||
|
// compress3
|
||||||
buffer = out_buffer;
|
buffer = out_buffer;
|
||||||
} else if (compressed_size > out_size) {
|
} else if (compressed_size > out_size) {
|
||||||
BAlert *alert = new BAlert("memory overrun!!!", "warning", "OK");
|
BAlert* alert = new BAlert("memory overrun!!!", "warning",
|
||||||
|
"OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -194,53 +217,63 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
compression_method,
|
compression_method,
|
||||||
buffer);
|
buffer);
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
DBGMSG(("band bitmap is clean.\n"));
|
DBGMSG(("band bitmap is clean.\n"));
|
||||||
}
|
|
||||||
|
|
||||||
if (y >= page_height) {
|
if (y >= page_height) {
|
||||||
offset->x = -1.0;
|
offset->x = -1.0;
|
||||||
offset->y = -1.0;
|
offset->y = -1.0;
|
||||||
} else {
|
} else
|
||||||
offset->y += height;
|
offset->y += height;
|
||||||
}
|
|
||||||
|
|
||||||
DBGMSG(("< nextBand\n"));
|
DBGMSG(("< nextBand\n"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
BAlert *alert = new BAlert("", err.what(), "OK");
|
BAlert* alert = new BAlert("", err.what(), "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::beginTextMode()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::beginTextMode()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033%%@");
|
writeSpoolString("\033%%@");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::jobStart()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::jobStart()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033P31;300;1J\033\\");
|
writeSpoolString("\033P31;300;1J\033\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::softReset()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::softReset()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033<");
|
writeSpoolString("\033<");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::sizeUnitMode()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::sizeUnitMode()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[11h");
|
writeSpoolString("\033[11h");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::selectSizeUnit()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::selectSizeUnit()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[7 I");
|
writeSpoolString("\033[7 I");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::selectPageFormat()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::selectPageFormat()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
@@ -301,14 +334,15 @@ void LIPS3Driver::selectPageFormat()
|
|||||||
if (JobData::kLandscape == getJobData()->getOrientation())
|
if (JobData::kLandscape == getJobData()->getOrientation())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (i < 80) {
|
if (i < 80)
|
||||||
writeSpoolString("\033[%d;;p", i);
|
writeSpoolString("\033[%d;;p", i);
|
||||||
} else {
|
else
|
||||||
writeSpoolString("\033[%d;%d;%dp", i, height, width);
|
writeSpoolString("\033[%d;%d;%dp", i, height, width);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::paperFeedMode()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::paperFeedMode()
|
||||||
{
|
{
|
||||||
// 0 auto
|
// 0 auto
|
||||||
// --------------
|
// --------------
|
||||||
@@ -346,74 +380,85 @@ void LIPS3Driver::paperFeedMode()
|
|||||||
writeSpoolString("\033[%dq", i);
|
writeSpoolString("\033[%dq", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::disableAutoFF()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::disableAutoFF()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[?2h");
|
writeSpoolString("\033[?2h");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::setNumberOfCopies()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::setNumberOfCopies()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[%ldv", getJobData()->getCopies());
|
writeSpoolString("\033[%ldv", getJobData()->getCopies());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::memorizedPosition()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::memorizedPosition()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[0;1;0x");
|
writeSpoolString("\033[0;1;0x");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::moveAbsoluteHorizontal(int x)
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::moveAbsoluteHorizontal(int x)
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[%d`", x);
|
writeSpoolString("\033[%d`", x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::carriageReturn()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::carriageReturn()
|
||||||
{
|
{
|
||||||
writeSpoolChar('\x0d');
|
writeSpoolChar('\x0d');
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::moveDown(int dy)
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::moveDown(int dy)
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[%de", dy);
|
writeSpoolString("\033[%de", dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::rasterGraphics(
|
|
||||||
int compression_size,
|
void
|
||||||
int widthbyte,
|
LIPS3Driver::rasterGraphics( int compression_size, int widthbyte, int height,
|
||||||
int height,
|
int compression_method, const uchar *buffer)
|
||||||
int compression_method,
|
|
||||||
const uchar *buffer)
|
|
||||||
{
|
{
|
||||||
// 0 RAW
|
// 0 RAW
|
||||||
// 9 compress-3
|
// 9 compress-3
|
||||||
writeSpoolString(
|
writeSpoolString("\033[%d;%d;%d;%d;%d.r", compression_size, widthbyte,
|
||||||
"\033[%d;%d;%d;%d;%d.r",
|
getJobData()->getXres(), compression_method, height);
|
||||||
compression_size,
|
|
||||||
widthbyte,
|
|
||||||
getJobData()->getXres(),
|
|
||||||
compression_method,
|
|
||||||
height);
|
|
||||||
|
|
||||||
writeSpoolData(buffer, compression_size);
|
writeSpoolData(buffer, compression_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::formFeed()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::formFeed()
|
||||||
{
|
{
|
||||||
writeSpoolChar('\014');
|
writeSpoolChar('\014');
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::jobEnd()
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::jobEnd()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033P0J\033\\");
|
writeSpoolString("\033P0J\033\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS3Driver::move(int x, int y)
|
|
||||||
|
void
|
||||||
|
LIPS3Driver::move(int x, int y)
|
||||||
{
|
{
|
||||||
if (fCurrentX != x) {
|
if (fCurrentX != x) {
|
||||||
if (x) {
|
if (x)
|
||||||
moveAbsoluteHorizontal(x);
|
moveAbsoluteHorizontal(x);
|
||||||
} else {
|
else
|
||||||
carriageReturn();
|
carriageReturn();
|
||||||
}
|
|
||||||
fCurrentX = x;
|
fCurrentX = x;
|
||||||
}
|
}
|
||||||
if (fCurrentY != y) {
|
if (fCurrentY != y) {
|
||||||
|
|||||||
@@ -2,17 +2,20 @@
|
|||||||
* Lips3.h
|
* Lips3.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LIPS3_H
|
#ifndef __LIPS3_H
|
||||||
#define __LIPS3_H
|
#define __LIPS3_H
|
||||||
|
|
||||||
|
|
||||||
#include "GraphicsDriver.h"
|
#include "GraphicsDriver.h"
|
||||||
|
|
||||||
|
|
||||||
class Halftone;
|
class Halftone;
|
||||||
|
|
||||||
|
|
||||||
class LIPS3Driver : public GraphicsDriver {
|
class LIPS3Driver : public GraphicsDriver {
|
||||||
public:
|
public:
|
||||||
LIPS3Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap);
|
LIPS3Driver(BMessage* msg, PrinterData* printer_data,
|
||||||
|
const PrinterCap* printer_cap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool startDoc();
|
virtual bool startDoc();
|
||||||
@@ -41,13 +44,13 @@ private:
|
|||||||
int widthbyte,
|
int widthbyte,
|
||||||
int height,
|
int height,
|
||||||
int compression_method,
|
int compression_method,
|
||||||
const uchar *buffer);
|
const uchar* buffer);
|
||||||
void formFeed();
|
void formFeed();
|
||||||
void jobEnd();
|
void jobEnd();
|
||||||
|
|
||||||
int fCurrentX;
|
int fCurrentX;
|
||||||
int fCurrentY;
|
int fCurrentY;
|
||||||
Halftone *fHalftone;
|
Halftone* fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS3_H */
|
#endif // __LIPS3_H
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PrinterData.h"
|
|
||||||
#include "Lips3Cap.h"
|
#include "Lips3Cap.h"
|
||||||
|
|
||||||
|
#include "PrinterData.h"
|
||||||
|
|
||||||
#define TO72DPI(a) (a * 72.0f / 600.0f)
|
#define TO72DPI(a) (a * 72.0f / 600.0f)
|
||||||
|
|
||||||
|
|
||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
@@ -71,7 +73,7 @@ const PaperSourceCap lower("Lower", false, JobData::kLower);
|
|||||||
|
|
||||||
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
const ResolutionCap dpi300("300dpi", true, 300, 300);
|
||||||
|
|
||||||
const PaperCap *papers[] = {
|
const PaperCap* papers[] = {
|
||||||
&a4,
|
&a4,
|
||||||
&a3,
|
&a3,
|
||||||
&a5,
|
&a5,
|
||||||
@@ -81,31 +83,35 @@ const PaperCap *papers[] = {
|
|||||||
&legal
|
&legal
|
||||||
};
|
};
|
||||||
|
|
||||||
const PaperSourceCap *papersources[] = {
|
const PaperSourceCap* papersources[] = {
|
||||||
&autobin,
|
&autobin,
|
||||||
&manual,
|
&manual,
|
||||||
&upper,
|
&upper,
|
||||||
&lower
|
&lower
|
||||||
};
|
};
|
||||||
|
|
||||||
const ResolutionCap *resolutions[] = {
|
const ResolutionCap* resolutions[] = {
|
||||||
&dpi300
|
&dpi300
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorCap color("Color", false, JobData::kColor);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Shades of Gray", true, JobData::kMonochrome);
|
const ColorCap monochrome("Shades of Gray", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap* colors[] = {
|
||||||
&color,
|
&color,
|
||||||
&monochrome
|
&monochrome
|
||||||
};
|
};
|
||||||
|
|
||||||
Lips3Cap::Lips3Cap(const PrinterData *printer_data)
|
|
||||||
: PrinterCap(printer_data)
|
Lips3Cap::Lips3Cap(const PrinterData* printer_data)
|
||||||
|
:
|
||||||
|
PrinterCap(printer_data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lips3Cap::countCap(CapID capid) const
|
|
||||||
|
int
|
||||||
|
Lips3Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -121,7 +127,9 @@ int Lips3Cap::countCap(CapID capid) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **Lips3Cap::enumCap(CapID capid) const
|
|
||||||
|
const
|
||||||
|
BaseCap **Lips3Cap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -137,7 +145,9 @@ const BaseCap **Lips3Cap::enumCap(CapID capid) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lips3Cap::isSupport(CapID capid) const
|
|
||||||
|
bool
|
||||||
|
Lips3Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
|
|||||||
@@ -2,18 +2,19 @@
|
|||||||
* Lips3Cap.h
|
* Lips3Cap.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LIPS3CAP_H
|
#ifndef __LIPS3CAP_H
|
||||||
#define __LIPS3CAP_H
|
#define __LIPS3CAP_H
|
||||||
|
|
||||||
|
|
||||||
#include "PrinterCap.h"
|
#include "PrinterCap.h"
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Lips3.h"
|
#include "Lips3.h"
|
||||||
#include "Lips3Cap.h"
|
#include "Lips3Cap.h"
|
||||||
#include "PrinterDriver.h"
|
#include "PrinterDriver.h"
|
||||||
|
|
||||||
|
|
||||||
class Lips3PrinterDriver : public PrinterDriver
|
class Lips3PrinterDriver : public PrinterDriver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -37,14 +39,15 @@ public:
|
|||||||
return new Lips3Cap(printerData);
|
return new Lips3Cap(printerData);
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
|
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings,
|
||||||
|
PrinterData* printerData, PrinterCap* printerCap)
|
||||||
{
|
{
|
||||||
return new LIPS3Driver(settings, printerData, printerCap);
|
return new LIPS3Driver(settings, printerData, printerCap);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
|
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
|
||||||
{
|
{
|
||||||
return new Lips3PrinterDriver(printerFolder);
|
return new Lips3PrinterDriver(printerFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user