Various changes.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6368 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2004-01-27 21:22:16 +00:00
parent 393fb10d6e
commit 9198afa23d
6 changed files with 74 additions and 8 deletions

View File

@ -8,6 +8,7 @@
#include "JobData.h"
#include "PrintProcess.h"
#include "SpoolMetaData.h"
#include "Transport.h"
class BView;
@ -35,9 +36,13 @@ protected:
void writeSpoolString(const char *buffer, ...) throw(TransportException);
void writeSpoolChar(char c) throw(TransportException);
static void convert_to_rgb24(void* src, void* dst, int width, color_space cs);
static void convert_to_gray(void* src, void* dst, int width, color_space cs);
const JobData *getJobData() const;
const PrinterData *getPrinterData() const;
const PrinterCap *getPrinterCap() const;
const SpoolMetaData *getSpoolMetaData() const;
int getPageWidth() const;
int getPageHeight() const;
@ -56,6 +61,11 @@ private:
bool printPage(PageDataList *pages);
bool printDocument(SpoolData *spool_data);
bool printJob(BFile *file);
static void rgb32_to_rgb24(void* src, void* dst, int width);
static void cmap8_to_rgb24(void* src, void* dst, int width);
static uint8 gray(uint8 r, uint8 g, uint8 b);
static void rgb32_to_gray(void* src, void* dst, int width);
static void cmap8_to_gray(void* src, void* dst, int width);
uint32 __flags;
BMessage *__msg;
@ -66,6 +76,7 @@ private:
JobData *__real_job_data;
PrinterData *__printer_data;
const PrinterCap *__printer_cap;
SpoolMetaData *__spool_meta_data;
int __page_width;
int __page_height;
@ -91,6 +102,11 @@ inline const PrinterCap *GraphicsDriver::getPrinterCap() const
return __printer_cap;
}
inline const SpoolMetaData *GraphicsDriver::getSpoolMetaData() const
{
return __spool_meta_data;
}
inline int GraphicsDriver::getPageWidth() const
{
return __page_width;

View File

@ -200,12 +200,12 @@ public:
MEDIUM = -3,
HIGH = -4
};
enum COLOR {
MONOCHROME = 1,
COLOR
};
*/
enum COLOR {
kMONOCHROME = 1,
kCOLOR
};
private:
PAPER __paper;
@ -228,6 +228,7 @@ private:
BINDINGLOCATION __binding_location;
PAGEORDER __page_order;
BMessage *__msg;
bool __color;
public:
JobData(BMessage *msg, const PrinterCap *cap);
@ -272,7 +273,7 @@ public:
int32 getLastPage() const { return __last_page; }
void setLastPage(int32 last_page) { __last_page = last_page; }
color_space getSurfaceType() const { return __surface_type; }
color_space getSurfaceType() const { return B_RGB32; /* __surface_type;*/ }
void setSurfaceType(color_space surface_type) { __surface_type = surface_type; }
float getGamma() const { return __gamma; }
@ -295,6 +296,9 @@ public:
PAGEORDER getPageOrder() const { return __page_order; }
void setPageOrder(PAGEORDER page_order) { __page_order = page_order; }
COLOR getColor() const { return __color ? kCOLOR : kMONOCHROME; }
void setColor(COLOR color) { __color = color == kCOLOR; }
/*
protected:
JobData(const JobData &job_data);

View File

@ -37,7 +37,7 @@ private:
BRadioButton *__all;
BCheckBox *__collate;
BCheckBox *__reverse;
BPopUpMenu *__surface_type;
BPopUpMenu *__color_type;
BPopUpMenu *__paper_feed;
BCheckBox *__duplex;
BPopUpMenu *__nup;

View File

@ -0,0 +1,11 @@
/*
* PackBits.h
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/
#ifndef __PACKBITS_H
#define __PACKBITS_H
int pack_bits(unsigned char *out, unsigned char *in, int bytes);
#endif /* __PACKBITS_H */

View File

@ -63,6 +63,12 @@ struct BindingLocationCap : public BaseCap {
: BaseCap(n, d), binding_location(b) {}
};
struct ColorCap : public BaseCap {
JobData::COLOR color;
ColorCap(const string &n, bool d, JobData::COLOR c)
: BaseCap(n, d), color(c) {}
};
class PrinterData;
class PrinterCap {
@ -79,7 +85,8 @@ public:
RESOLUTION,
ORIENTATION,
PRINTSTYLE,
BINDINGLOCATION
BINDINGLOCATION,
COLOR
};
virtual int countCap(CAPID) const = 0;

View File

@ -0,0 +1,28 @@
/*
* SpoolMetaData.h
* Copyright 2003 Michael Pfeiffer. All Rights Reserved.
*/
#ifndef __SPOOLMETADATA_H
#define __SPOOLMETADATA_H
#include <SupportDefs.h>
#include <File.h>
#include <string>
class SpoolMetaData {
private:
string __description;
string __mime_type;
string __creation_time;
public:
SpoolMetaData(BFile* spool_file);
~SpoolMetaData();
const string& getDescription() const { return __description; }
const string& getMimeType() const { return __mime_type; }
const string& getCreationTime() const { return __creation_time; }
};
#endif /* __SpoolMetaData_H */