Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 5603 → Rev 5604

/branches/Version13x/Scribus/scribus/pdflib.cpp
1645,6 → 1645,33
uint PgNr = ActPageP->pageNr();
Seite.ObjNum = ObjCounter;
WritePDFStream(Inhalt);
int Gobj;
if ((Options.Version >= 14) && (Transpar.count() != 0))
{
StartObj(ObjCounter);
Gobj = ObjCounter;
ObjCounter++;
PutDoc("<< /S /Transparency\n");
if (Options.UseRGB)
PutDoc("/CS /DeviceRGB\n");
else
{
if (Options.isGrayscale)
PutDoc("/CS /DeviceGray\n");
else
#ifdef HAVE_CMS
{
if ((CMSuse) && (Options.UseProfiles))
PutDoc("/CS "+ICCProfiles[Options.SolidProf].ICCArray+"\n");
else
#endif
PutDoc("/CS /DeviceCMYK\n");
#ifdef HAVE_CMS
}
#endif
}
PutDoc(">>\nendobj\n");
}
StartObj(ObjCounter);
PutDoc("<<\n/Type /Page\n/Parent 4 0 R\n");
PutDoc("/MediaBox [0 0 "+FToStr(ActPageP->width())+" "+FToStr(ActPageP->height())+"]\n");
1652,6 → 1679,8
" "+FToStr(ActPageP->width()-Options.BleedRight)+" "+FToStr(ActPageP->height()-Options.BleedTop)+"]\n");
PutDoc("/Rotate "+QString::number(Options.RotateDeg)+"\n");
PutDoc("/Contents "+QString::number(Seite.ObjNum)+" 0 R\n");
if ((Options.Version >= 14) && (Transpar.count() != 0))
PutDoc("/Group "+QString::number(Gobj)+" 0 R\n");
if (Options.Thumbnails)
PutDoc("/Thumb "+QString::number(Seite.Thumb)+" 0 R\n");
if (Seite.AObjects.count() != 0)
/branches/Version13x/Scribus/scribus/scpainter.cpp
310,10 → 310,35
#ifdef HAVE_CAIRO
void ScPainter::beginLayer(double transparency, int blendmode)
{
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 6)
layerProp la;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 8)
la.data = cairo_get_group_target(m_cr);
#endif
la.blendmode = m_blendMode;
la.tranparency = m_layerTransparency;
Layers.push(la);
m_layerTransparency = transparency;
m_blendMode = blendmode;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 6)
cairo_push_group(m_cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 8)
cairo_surface_t *tmp2 = cairo_get_group_target(m_cr);
if (tmp2 != NULL)
{
if (cairo_surface_get_type(tmp2) == CAIRO_SURFACE_TYPE_IMAGE)
{
int stride = cairo_image_surface_get_stride(tmp2);
unsigned char *s = cairo_image_surface_get_data(tmp2);
int h = m_image->height();
for( int yi=0; yi < h; ++yi )
{
memset( s, 0, stride );
s += stride;
}
}
cairo_surface_mark_dirty(tmp2);
}
#endif
#else
tmp_image.fill( qRgba(255, 255, 255, 0) );
#endif
329,21 → 354,23
{
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 6)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 8)
if (m_blendMode != 0)
if ((m_blendMode != 0) && (Layers.count() != 1))
{
cairo_surface_t *tmp = cairo_get_group_target(m_cr);
if (tmp != NULL)
cairo_surface_t *tmpB = Layers.top().data;
if ((tmp != NULL) && (tmpB != NULL))
{
if (cairo_surface_get_type(tmp) == CAIRO_SURFACE_TYPE_IMAGE)
if ((cairo_surface_get_type(tmp) == CAIRO_SURFACE_TYPE_IMAGE) && (cairo_surface_get_type(tmpB) == CAIRO_SURFACE_TYPE_IMAGE))
{
cairo_surface_flush(tmp);
int stride = cairo_image_surface_get_stride(tmp);
unsigned char *s = cairo_image_surface_get_data(tmp);
unsigned char *d = cairo_image_surface_get_data(tmpB);
int h = m_image->height();
int w = m_image->width();
for( int yi=0; yi < h; ++yi )
{
QRgb *dst = (QRgb*)m_image->scanLine( yi );
QRgb *dst = (QRgb*)d;
QRgb *src = (QRgb*)s;
for( int xi=0; xi < w; ++xi )
{
365,7 → 392,7
}
else if (m_blendMode == 2)
{
src_r = dst_r < src_r ? src_r : dst_r;
src_r = dst_r < src_r ? src_r : dst_r;
src_g = dst_g < src_g ? src_g : dst_g;
src_b = dst_b < src_b ? src_b : dst_b;
}
444,6 → 471,7
dst++;
}
s += stride;
d += stride;
}
cairo_surface_mark_dirty(tmp);
}
450,9 → 478,13
}
}
#endif
layerProp la;
la = Layers.pop();
cairo_pop_group_to_source (m_cr);
cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
cairo_paint_with_alpha (m_cr, m_layerTransparency);
m_layerTransparency = la.tranparency;
m_blendMode = la.blendmode;
#else
cairo_surface_flush(cairo_get_target(m_cr));
int words = m_image->numBytes() / 4;
/branches/Version13x/Scribus/scribus/scribusview.cpp
399,31 → 399,21
painter->endLayer();
#endif
}
DrawMasterItems(painter, Doc->Pages->at(a), QRect(clipx, clipy, clipw, cliph));
// DrawMasterItems(painter, Doc->Pages->at(a), QRect(clipx, clipy, clipw, cliph));
}
/*
#ifdef HAVE_CAIRO
painter->end();
psx->drawImage(clipx, clipy, img);
delete painter;
img = QImage(clipw, cliph, 32);
img.setAlphaBuffer( true );
if ((Doc->layerCount() > 1) || (la.transparency != 1.0))
painter = new ScPainter(&img, img.width(), img.height(), 1.0, 0);
else
painter = new ScPainter(&img, img.width(), img.height());
painter->translate(-Doc->minCanvasCoordinate.x()*Scale, -Doc->minCanvasCoordinate.y()*Scale);
painter->translate(-clipx, -clipy);
painter->setLineWidth(1);
painter->setFillMode(ScPainter::Solid);
painter->setZoomFactor(1.0);
painter->beginLayer(1.0, 0);
for (uint a = 0; a < docPagesCount; ++a)
{
DrawMasterItems(painter, Doc->Pages->at(a), QRect(clipx, clipy, clipw, cliph));
}
#endif
*/
DrawPageItems(painter, QRect(clipx, clipy, clipw, cliph));
#ifdef HAVE_CAIRO
if ((Doc->layerCount() > 1) || (la.transparency != 1.0))
painter->endLayer();
#endif
if ((!Doc->guidesSettings.before) && (!viewAsPreview))
{
for (uint a = 0; a < docPagesCount; ++a)
467,7 → 457,15
painter->endLayer();
#endif
}
#ifdef HAVE_CAIRO
if ((Doc->layerCount() > 1) || (la.transparency != 1.0))
painter->beginLayer(1.0, 0);
#endif
DrawPageItems(painter, QRect(clipx, clipy, clipw, cliph));
#ifdef HAVE_CAIRO
if ((Doc->layerCount() > 1) || (la.transparency != 1.0))
painter->endLayer();
#endif
if ((!Doc->guidesSettings.before) && (drawRect.intersects(QRect(clipx, clipy, clipw, cliph))))
DrawPageMarks(painter, Doc->currentPage(), QRect(clipx, clipy, clipw, cliph));
}
/branches/Version13x/Scribus/scribus/scpainter.h
60,6 → 60,7
class QPainter;
#ifdef HAVE_CAIRO
typedef struct _cairo cairo_t;
typedef struct _cairo_surface cairo_surface_t;
#else
struct _ArtVpath;
struct _ArtBpath;
212,6 → 213,13
#if defined(Q_WS_X11) && defined(SC_USE_PIXBUF)
#ifdef HAVE_CAIRO
cairo_t *m_cr;
struct layerProp
{
cairo_surface_t *data;
int blendmode;
double tranparency;
};
QValueStack<layerProp> Layers;
#else
GC gc;
#endif