Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 1814 → Rev 1815

/branches/Version13x/Scribus/scribus/navigator.cpp
36,7 → 36,7
pmx = LoadPDF(fn, 1, Size, &Breite, &Hoehe);
}
else
pmx = vie->PageToPixmap(Seite, Size);
pmx.convertFromImage(vie->PageToPixmap(Seite, Size));
resize(pmx.width(), pmx.height());
Xp = 0;
Yp = 0;
104,7 → 104,7
}
else
{
pmx = view->PageToPixmap(Seite, Size);
pmx.convertFromImage(view->PageToPixmap(Seite, Size));
ret = true;
}
resize(pmx.width(), pmx.height());
/branches/Version13x/Scribus/scribus/about.cpp
49,7 → 49,7
tabLayout1->addWidget( pixmapLabel1 );
buildID = new QLabel( tab, "BB" );
buildID->setAlignment(Qt::AlignCenter);
QString bu = tr("%1 %2 %3 ").arg("31").arg("March").arg("2005");
QString bu = tr("%1 %2 %3 ").arg("1").arg("April").arg("2005");
#ifdef HAVE_CMS
bu += "C";
#else
/branches/Version13x/Scribus/scribus/tabpdfoptions.cpp
1238,11 → 1238,15
{
disconnect(Pages, SIGNAL(highlighted(int)), this, SLOT(SetPgEff(int)));
QString tmp;
QPixmap pm;
int ci = Pages->currentItem();
if (PagePrev->isChecked())
{
for (uint pg = 0; pg < view->Doc->Pages.count(); ++pg)
Pages->changeItem(view->PageToPixmap(pg, 70), tr("Page")+" "+tmp.setNum(pg+1), pg);
{
pm.convertFromImage(view->PageToPixmap(pg, 70));
Pages->changeItem(pm, tr("Page")+" "+tmp.setNum(pg+1), pg);
}
}
else
{
/branches/Version13x/Scribus/scribus/scribusview.h
140,8 → 140,8
void ShowTemplate(int nr);
void HideTemplate();
int CountElements();
QPixmap PageToPixmap(int Nr, int maxGr);
QPixmap MPageToPixmap(QString name, int maxGr);
QImage PageToPixmap(int Nr, int maxGr);
QImage MPageToPixmap(QString name, int maxGr);
void RecalcPictures(ProfilesL *Pr, QProgressBar *dia = 0);
void FromHRuler(QMouseEvent *m);
void FromVRuler(QMouseEvent *m);
/branches/Version13x/Scribus/scribus/scribusXml.cpp
1019,14 → 1019,6
IT=IT.nextSibling();
}
OB.itemText = tmp;
if ((OB.PType == 5) && (OB.Height != 0))
{
OB.Rot += atan2(OB.Height,OB.Width)*(180.0/M_PI);
OB.Width = sqrt(pow(OB.Width,2)+pow(OB.Height,2));
OB.Height = 0;
OB.Clip.setPoints(4, -1,-1, static_cast<int>(OB.Width+1),-1, static_cast<int>(OB.Width+1),
static_cast<int>(OB.Height+1), -1, static_cast<int>(OB.Height+1));
}
view->PasteItem(&OB, true);
Neu = doc->Items.at(counter);
if (QStoInt(obj.attribute("NEXTPAGE")) == PageToLoad)
1518,7 → 1510,7
OB.itemText = "";
int docGc = doc->GroupCounter;
doc->GroupCounter = 0;
if ((OB.PType == 5) && (OB.Height != 0))
/* if ((OB.PType == 5) && (OB.Height != 0))
{
OB.Rot += atan2(OB.Height,OB.Width)*(180.0/M_PI);
OB.Width = sqrt(pow(OB.Width,2)+pow(OB.Height,2));
1525,7 → 1517,7
OB.Height = 0;
OB.Clip.setPoints(4, -1,-1, static_cast<int>(OB.Width+1),-1, static_cast<int>(OB.Width+1),
static_cast<int>(OB.Height+1), -1, static_cast<int>(OB.Height+1));
}
} */
uint last = doc->Items.count();
view->PasteItem(&OB, true);
doc->GroupCounter = docGc;
1989,14 → 1981,6
IT=IT.nextSibling();
}
OB.itemText = tmp;
if ((OB.PType == 5) && (OB.Height != 0))
{
OB.Rot += atan2(OB.Height,OB.Width)*(180.0/M_PI);
OB.Width = sqrt(pow(OB.Width,2)+pow(OB.Height,2));
OB.Height = 0;
OB.Clip.setPoints(4, -1,-1, static_cast<int>(OB.Width+1),-1, static_cast<int>(OB.Width+1),
static_cast<int>(OB.Height+1), -1, static_cast<int>(OB.Height+1));
}
OB.LayerNr = -1;
view->PasteItem(&OB, true, true);
PageItem* Neu = doc->Items.at(doc->Items.count()-1);
/branches/Version13x/Scribus/scribus/seiten.cpp
680,11 → 680,15
TemplList->clear();
if (Vie == 0)
return;
QPixmap pm;
QMap<QString,int>::Iterator it;
for (it = Vie->Doc->MasterNames.begin(); it != Vie->Doc->MasterNames.end(); ++it)
{
if (TemplList->Thumb)
TemplList->insertItem(Vie->MPageToPixmap(it.key(),60), it.key() == "Normal" ? tr("Normal") : it.key());
{
pm.convertFromImage(Vie->MPageToPixmap(it.key(),60));
TemplList->insertItem(pm, it.key() == "Normal" ? tr("Normal") : it.key());
}
else
TemplList->insertItem(it.key() == "Normal" ? tr("Normal") : it.key());
}
/branches/Version13x/Scribus/scribus/scpainter.cpp
94,6 → 94,7
fill_gradient = VGradient(VGradient::linear);
stroke_gradient = VGradient(VGradient::linear);
m_zoomFactor = 1;
imageMode = false;
#if defined(Q_WS_X11) && defined(SC_USE_PIXBUF)
xlib_rgb_init_with_depth( target->x11Display(), XScreenOfDisplay( target->x11Display(), target->x11Screen() ), target->x11Depth() );
gc = XCreateGC( target->x11Display(), target->handle(), 0, 0 );
100,14 → 101,50
#endif
}
 
ScPainter::ScPainter( QImage *target, unsigned int w, unsigned int h, unsigned int x, unsigned int y )
{
m_target = 0L;
m_width = w;
m_height= h;
m_x = x;
m_y = y;
m_buffer = 0L;
m_path = 0L;
m_index = 0;
resize( m_width, m_height );
clear();
m_stroke = QColor(0,0,0);
m_fill = QColor(0,0,0);
fill_trans = 1.0;
stroke_trans = 1.0;
m_fillRule = true;
fillMode = 1;
LineWidth = 1.0;
m_offset = 0;
m_array.clear();
mf_underline = false;
mf_strikeout = false;
mf_shadow = false;
mf_outlined = false;
PLineEnd = Qt::SquareCap;
PLineJoin = Qt::RoundJoin;
fill_gradient = VGradient(VGradient::linear);
stroke_gradient = VGradient(VGradient::linear);
m_zoomFactor = 1;
imageMode = true;
m_image = target;
}
 
ScPainter::~ScPainter()
{
// If we are in target mode, we created a buffer, else if we used the other ctor
// we didnt.
if( m_target )
if (( m_target ) || ( imageMode))
art_free( m_buffer );
if( m_path )
art_free( m_path );
if (imageMode)
return;
#if defined(Q_WS_X11) && defined(SC_USE_PIXBUF)
if( gc )
XFreeGC( m_target->x11Display(), gc );
135,24 → 172,41
 
void ScPainter::end()
{
if (imageMode)
{
QRgb * bits = (QRgb *) m_image->bits();
int words = m_image->numBytes() / 4;
art_u8 * p = m_buffer;;
for (int i=0; i < words; ++i)
{
art_u8 r = *p++;
art_u8 g = *p++;
art_u8 b = *p++;
art_u8 a = *p++;
*bits++ = qRgba(r,g,b,a);
}
}
else
{
#if defined(Q_WS_X11) && defined(SC_USE_PIXBUF)
// Use the original gdk-pixbuf based bitblit on X11
xlib_draw_rgb_32_image( m_target->handle(), gc, m_x, m_y, m_width, m_height, XLIB_RGB_DITHER_NONE, m_buffer, m_width * 4 );
// Use the original gdk-pixbuf based bitblit on X11
xlib_draw_rgb_32_image( m_target->handle(), gc, m_x, m_y, m_width, m_height, XLIB_RGB_DITHER_NONE, m_buffer, m_width * 4 );
#else
// Portable copying onto the canvas with no X11 dependency by Andreas Vox
QImage qimg(m_width, m_height, 32, QImage::BigEndian);
QRgb * bits = (QRgb *) qimg.bits();
int words = qimg.numBytes() / 4;
art_u8 * p = m_buffer;;
for (int i=0; i < words; ++i) {
art_u8 r = *p++;
art_u8 g = *p++;
art_u8 b = *p++;
art_u8 a = *p++;
*bits++ = qRgba(r,g,b,a);
// Portable copying onto the canvas with no X11 dependency by Andreas Vox
QImage qimg(m_width, m_height, 32, QImage::BigEndian);
QRgb * bits = (QRgb *) qimg.bits();
int words = qimg.numBytes() / 4;
art_u8 * p = m_buffer;;
for (int i=0; i < words; ++i) {
art_u8 r = *p++;
art_u8 g = *p++;
art_u8 b = *p++;
art_u8 a = *p++;
*bits++ = qRgba(r,g,b,a);
}
bitBlt(m_target, m_x, m_y, &qimg);
#endif
}
bitBlt(m_target, m_x, m_y, &qimg);
#endif
}
 
void ScPainter::clear()
/branches/Version13x/Scribus/scribus/scribusview.cpp
8896,9 → 8896,10
}
}
 
QPixmap ScribusView::MPageToPixmap(QString name, int maxGr)
QImage ScribusView::MPageToPixmap(QString name, int maxGr)
{
QPixmap pm = QPixmap();
QImage pm;
QImage im;
int Nr = Doc->MasterNames[name];
int clipx = static_cast<int>(Doc->ScratchLeft);
int clipy = static_cast<int>(Doc->ScratchTop);
8909,7 → 8910,6
double sca = Scale;
bool frs = Doc->guidesSettings.framesShown;
bool mas = Doc->MasterP;
// Doc->MasterP = true;
Page* act = Doc->currentPage;
Doc->currentPage = Doc->MasterPages.at(Nr);
if (!mas)
8919,7 → 8919,7
}
Doc->guidesSettings.framesShown = false;
Scale = 1;
pm = QPixmap(clipw, cliph);
pm = QImage(clipw, cliph, 32, QImage::BigEndian);
ScPainter *painter = new ScPainter(&pm, pm.width(), pm.height());
painter->clear(white);
painter->translate(-clipx, -clipy);
8937,24 → 8937,21
}
Doc->MasterP = mas;
painter->end();
QImage im2;
QImage im = pm.convertToImage();
double sx = im.width() / static_cast<double>(maxGr);
double sy = im.height() / static_cast<double>(maxGr);
if (sy < sx)
im2 = im.smoothScale(static_cast<int>(im.width() / sx), static_cast<int>(im.height() / sx));
im = pm.smoothScale(static_cast<int>(pm.width() / sx), static_cast<int>(pm.height() / sx));
else
im2 = im.smoothScale(static_cast<int>(im.width() / sy), static_cast<int>(im.height() / sy));
pm.convertFromImage(im2);
im2.detach();
im = pm.smoothScale(static_cast<int>(pm.width() / sy), static_cast<int>(pm.height() / sy));
delete painter;
}
return pm;
return im;
}
 
QPixmap ScribusView::PageToPixmap(int Nr, int maxGr)
QImage ScribusView::PageToPixmap(int Nr, int maxGr)
{
QPixmap pm = QPixmap();
QImage pm;
QImage im;
int clipx = static_cast<int>(Doc->Pages.at(Nr)->Xoffset);
int clipy = static_cast<int>(Doc->Pages.at(Nr)->Yoffset);
int clipw = qRound(Doc->Pages.at(Nr)->Width);
8967,7 → 8964,7
Scale = 1;
Page* act = Doc->currentPage;
Doc->currentPage = Doc->Pages.at(Nr);
pm = QPixmap(clipw, cliph);
pm = QImage(clipw, cliph, 32, QImage::BigEndian);
ScPainter *painter = new ScPainter(&pm, pm.width(), pm.height());
painter->clear(Doc->papColor);
painter->translate(-clipx, -clipy);
8982,19 → 8979,15
Doc->guidesSettings.framesShown = frs;
Scale = sca;
Doc->currentPage = act;
QImage im2;
QImage im = pm.convertToImage();
double sx = im.width() / static_cast<double>(maxGr);
double sy = im.height() / static_cast<double>(maxGr);
double sx = pm.width() / static_cast<double>(maxGr);
double sy = pm.height() / static_cast<double>(maxGr);
if (sy < sx)
im2 = im.smoothScale(static_cast<int>(im.width() / sx), static_cast<int>(im.height() / sx));
im = pm.smoothScale(static_cast<int>(pm.width() / sx), static_cast<int>(pm.height() / sx));
else
im2 = im.smoothScale(static_cast<int>(im.width() / sy), static_cast<int>(im.height() / sy));
pm.convertFromImage(im2);
im2.detach();
im = pm.smoothScale(static_cast<int>(pm.width() / sy), static_cast<int>(pm.height() / sy));
delete painter;
}
return pm;
return im;
}
 
void ScribusView::FromHRuler(QMouseEvent *m)
10640,7 → 10633,7
Doc->Items.at(z)->convertTo(Buffer->PType);
break;
case PageItem::Line:
z = PaintLine(x, y, w, h, pw, Buffer->Pcolor2);
z = PaintLine(x, y, w, 0, pw, Buffer->Pcolor2);
break;
case PageItem::Polygon:
z = PaintPoly(x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2);
/branches/Version13x/Scribus/scribus/libpostscript/pslib.cpp
1940,7 → 1940,7
if ((c->NamedLStyle == "") && (c->Pwidth != 0.0))
{
PS_moveto(0, 0);
PS_lineto(c->Width, -c->Height);
PS_lineto(c->Width, 0);
PS_stroke();
}
else
1954,7 → 1954,7
PS_setcapjoin(static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
PS_setdash(static_cast<Qt::PenStyle>(ml[it].Dash), 0, dum);
PS_moveto(0, 0);
PS_lineto(c->Width, -c->Height);
PS_lineto(c->Width, 0);
PS_stroke();
}
}
/branches/Version13x/Scribus/scribus/scribus.cpp
8644,7 → 8644,7
{
QPixmap pm(10,10);
if (doc->PDF_Options.Thumbnails)
pm = view->PageToPixmap(pageNs[ap]-1, 100);
pm.convertFromImage(view->PageToPixmap(pageNs[ap]-1, 100));
thumbs.insert(pageNs[ap], pm);
}
ReOrderText(doc, view);
/branches/Version13x/Scribus/scribus/plugins/pixmapexport/export.cpp
132,8 → 132,7
if (!carrier->doc->Pages.at(pageNr))
return FALSE;
 
QPixmap pixmap = carrier->view->PageToPixmap(pageNr, qRound(carrier->doc->PageH * enlargement / 100));
QImage im = pixmap.convertToImage();
QImage im = carrier->view->PageToPixmap(pageNr, qRound(carrier->doc->PageH * enlargement / 100));
int dpi = qRound(100.0 / 2.54 * pageSize);
im.setDotsPerMeterY(dpi);
im.setDotsPerMeterX(dpi);
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/objimageexport.cpp
125,8 → 125,7
{
if(!checkHaveDocument())
return NULL;
QPixmap pixmap = Carrier->view->PageToPixmap(Carrier->doc->currentPage->PageNr, qRound(Carrier->doc->PageH * self->scale / 100));
QImage im = pixmap.convertToImage();
QImage im = Carrier->view->PageToPixmap(Carrier->doc->currentPage->PageNr, qRound(Carrier->doc->PageH * self->scale / 100));
int dpi = qRound(100.0 / 2.54 * self->dpi);
im.setDotsPerMeterY(dpi);
im.setDotsPerMeterX(dpi);
/branches/Version13x/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
189,8 → 189,8
pageSizeSmall = static_cast<int>(pagew / 10);
pageSizeLarge = static_cast<int>(pagew / 3);
}
QPixmap tnsmall = sapp->view->PageToPixmap(0,pageSizeSmall);
QPixmap tnlarge = sapp->view->PageToPixmap(0,pageSizeLarge);
QImage tnsmall = sapp->view->PageToPixmap(0,pageSizeSmall);
QImage tnlarge = sapp->view->PageToPixmap(0,pageSizeLarge);
tnsmall.save(dir+"/"+tnsmallName,"PNG",70);
tnlarge.save(dir+"/"+tnlargeName, "PNG", 70);
}
/branches/Version13x/Scribus/scribus/libpdf/pdflib.cpp
1125,7 → 1125,7
if (ite->NamedLStyle == "")
{
PutPage("0 0 m\n");
PutPage(FToStr(ite->Width)+" "+FToStr(-ite->Height)+" l\n");
PutPage(FToStr(ite->Width)+" 0 l\n");
PutPage("S\n");
}
else
1135,7 → 1135,7
{
PutPage(setStrokeMulti(&ml[it]));
PutPage("0 0 m\n");
PutPage(FToStr(ite->Width)+" "+FToStr(-ite->Height)+" l\n");
PutPage(FToStr(ite->Width)+" 0 l\n");
PutPage("S\n");
}
}
2077,7 → 2077,7
if (ite->NamedLStyle == "")
{
PutPage("0 0 m\n");
PutPage(FToStr(ite->Width)+" "+FToStr(-ite->Height)+" l\n");
PutPage(FToStr(ite->Width)+" 0 l\n");
PutPage("S\n");
}
else
2087,7 → 2087,7
{
PutPage(setStrokeMulti(&ml[it]));
PutPage("0 0 m\n");
PutPage(FToStr(ite->Width)+" "+FToStr(-ite->Height)+" l\n");
PutPage(FToStr(ite->Width)+" 0 l\n");
PutPage("S\n");
}
}
/branches/Version13x/Scribus/scribus/scpainter.h
50,6 → 50,7
{
public:
ScPainter( QPaintDevice *target, unsigned int w = 0, unsigned int h = 0, unsigned int x = 0, unsigned int y = 0 );
ScPainter( QImage *target, unsigned int w = 0, unsigned int h = 0, unsigned int x = 0, unsigned int y = 0 );
virtual ~ScPainter();
enum FillMode { None, Solid, Gradient };
virtual void resize( unsigned int w, unsigned int h );
122,8 → 123,6
void clampToViewport( const _ArtSVP &, int &, int &, int &, int & );
void clampToViewport( int &, int &, int &, int & );
void ensureSpace( unsigned int );
 
private:
struct _ArtBpath *m_path;
struct _ArtBpath *m_path2;
unsigned int m_index;
130,6 → 129,7
unsigned int m_alloccount;
unsigned char *m_buffer;
QPaintDevice *m_target;
QImage *m_image;
unsigned int m_width;
unsigned int m_height;
unsigned int m_x;
163,7 → 163,7
/* Zoom Factor of the Painter */
double m_zoomFactor;
struct _ArtSVP *m_clipPath;
 
bool imageMode;
#if defined(Q_WS_X11) && defined(SC_USE_PIXBUF)
GC gc;
#endif