Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 67 → Rev 68

/trunk/Scribus/configure.in
13,7 → 13,7
AC_ARG_PROGRAM
 
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(scribus,1.0.1)
AM_INIT_AUTOMAKE(scribus,1.1.1)
 
dnl KDE_SET_PREFIX
 
27,21 → 27,47
[if test "x$enable_debug" = "xyes"; then
AC_DEFINE_UNQUOTED(DEBUG, 1, [Debug Messages])
fi])
 
LIBART_LIBS=""
LIBART_CFLAGS=""
LIBART_CONFIG=""
AC_PATH_PROG(LIBART_CONFIG, libart2-config,[AC_MSG_ERROR([Could not find libart anywhere, check http://www.levien.com/libart/], [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin])
])
if test -n "$LIBART_CONFIG"; then
vers=`$LIBART_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test -n "$vers" && test "$vers" -ge 2003008
then
LIBART_LIBS="`$LIBART_CONFIG --libs`"
LIBART_CFLAGS="`$LIBART_CONFIG --cflags`"
AC_DEFINE_UNQUOTED(HAVE_LIBART, 1, [Defines if your system has the libart library])
else
AC_MSG_ERROR([You need at least libart 2.3.8])
fi
fi
AC_SUBST(LIBART_LIBS)
AC_SUBST(LIBART_CFLAGS)
 
LIBFREETYPE_LIBS=""
LIBFREETYPE_CFLAGS=""
 
FREETYPE_CONFIG=""
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, [AC_MSG_WARN([Could not find libfreetype anywhere, check http://www.freetype.org/])], [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/X11/bin])
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, [AC_MSG_ERROR([Could not find libfreetype anywhere, check http://www.freetype.org/])], [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/X11/bin])
 
hafree=yes
hafree=no
if test -n "$FREETYPE_CONFIG"; then
LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
AC_CHECK_LIB(freetype, FT_Get_First_Char, [AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])],[hafree=no])
AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no])
AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no])
if test $hafree = yes; then
AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
else
AC_MSG_ERROR([You need at least freetype 2.1.0])
fi
AC_SUBST(LIBFREETYPE_LIBS)
AC_SUBST(LIBFREETYPE_CFLAGS)
else
AC_MSG_WARN([You need at least libfreetype 5.0])
AC_MSG_ERROR([You need at least freetype 2.1.0])
fi
 
AC_CHECK_LIB(socket,socket,
118,6 → 144,7
AC_CONFIG_FILES([scribus/libprefs/Makefile])
AC_CONFIG_FILES([scribus/plugins/libchar/Makefile])
AC_CONFIG_FILES([scribus/plugins/svgexplugin/Makefile])
AC_CONFIG_FILES([scribus/plugins/svgimplugin/Makefile])
AC_CONFIG_FILES([scribus/plugins/printpreview/Makefile])
AC_CONFIG_FILES([scribus/plugins/Makefile])
AC_CONFIG_FILES([scribus/libpostscript/Makefile])
/trunk/Scribus/ChangeLog
1,3 → 1,43
Changes since Version 1.0.1
06.09.2003 Unterlining doesn't cut the decents of the Glyphs anymore.
 
04.09.2003 Added new Type Style Outlined.
 
02.09.2003 Fixed Segfault when cutting Text when there is no Text.
 
31.08.2003 Added a Zoom for Characters, if you click the Right Mouse Button
over a Character a Zoom Window pops up.
Added the possibility to have different Transparencys for Strokes
and Fills.
 
22.08.2003 Made first Steps to replace the old rendering Engine
with libart.
 
13.08.2003 Added Greek Hyphenation.
 
12.08.2003 Changed behaviour of the Save-Button in the Toolbar.
 
11.08.2003 Added an SVG-Import Plugin.
 
10.08.2003 Added PDF-Keywords.
Enabled the Black Point Compensation in the Color-
Management when lcms-1.11 is used.
09.08.2003 Added a History Function to the Help Viewer.
 
08.08.2003 Templates are now reapplied to the Pages when
they where changed.
Templates can now applied to more than one Page.
Changes since Version 1.0
07.08.2003 Added Indonesian Translation.
 
25.07.2003 Fixed Bug with the Picture Preview.
Added Dutch, Ukrainian and Portuguese Hyphenation.
 
18.07.2003 Fixed Bug which caused Pictures to disappear when the actual
Application Directory isn't the users Home Directory.
 
Changes since Version 0.9.11.1
21.06.2003 Fixed the Radial Gradients in the SVG-Export.
Fixed Bug with rounded Rectangles.
/trunk/Scribus/README
1,29 → 1,23
This is Scribus Version 1.0RC1, the first Release Candiate for Scribus 1.0.
This is Scribus Version 1.1.1, the second Developers Relase after Scribus 1.0.1
 
This Version adds complete Support for Unicode. In order to use it, you
must have Freetype2 installed (of course the Devel Package too).
This Version introduces a complete rewrite of the rendering Engine. All rendering
is now done via libart and freetype2. This requires that libart and freetype2 are
present.
 
There is also a new Build-ID String in the About Box. This is mainly for
me to see which libs where used when Scribus was compiled. Please include
this String to any Bugreports you are submitting. His will help a lot.
Additionally Scribus uses now a different way to find Fonts, sadly this gives
some changes in the Fontnames Scribus uses. To convert old Documents follow the
procedure below:
 
1) Create a Document with the old Version of Scribus containing all your Fonts.
2) Open the new Scribus and go to the Font Substitution List.
3) Clear out all current Substitutions.
4) Open the Document created in 1) and substitute all the Fonts with the correct
new Fonts.
When you open now old Documents Scribus will convert all Font Names automatically.
 
For Changes please see the ChangeLog.
 
If Scribus won't start complaining about No Fonts do the following:
 
1) Make sure that your XF86Config contains a line Load Type1 in the Section Modules
2) Make sure that you have Postscript-Fonts.
3) Make sure that the Path to your Postscript-Fonts contains a Type1 or type1.
4) Make sure that all Fonts listed in fonts.dir and fonts.scale are present.
5) Verify that the Fonts have an encoding that matches your local encoding.
 
If this is all true, but Scribus won't start do the following:
1) Create a Textfile containing your Fontpaths.
e.g:
/usr/share/fonts/Type1,
/usr/X11/lib/X11/fonts/Type1
2) Save this file as scribusfont.rc in the .scribus Folder in your Home Directory.
 
To use Scribus in your native language be sure that the
environment variable LANG is set correctly.
 
32,4 → 26,4
were not installed.
 
Franz Schmid
in June 2003
in September 2003
/trunk/Scribus/config.h.in
21,6 → 21,9
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
 
/* Defines if your system has the libart library */
#undef HAVE_LIBART
 
/* Define if you have libjpeg */
#undef HAVE_LIBJPEG
 
/trunk/Scribus/ChangeLogCVS
1,7 → 1,54
Changes since Version 1.0
25.07.2003 page.cpp Fixed Bug with the Picture Preview.
Added Dutch, Ukrainian and Portuguese Hyphenation.
Changes since Version 1.1.0
30.09.2003 Every Textbox can have now it's own Language for
Hyphenation.
 
18.07.2003 scpreview.cpp Fixed Clipping Bug
scrap.cpp Fixed Bug which caused Pictures to disappear when the actual
Application Directory isn't the users Home Directory.
29.09.2003 Added a Catalan Hyphenation Dictionary.
 
28.09.2003 Subsetting Fonts and OpenType Fonts works now in PDF and Postscript.
Updated the CharSelect Plugin.
Added a User defineable Directory for ICC-Profiles in the Preferences.
 
27.09.2003 Replaced the LineEdit for the Zoom-Factor in the lower left Corner of
the Working Window by a SpinBox.
Updated the Welsh Translation.
 
26.09.2003 Export of OpenType Fonts to Postscript works now too.
You can now optionally subset every Font in the Postscript Output,
OpenType Fonts are always subsetted.
 
23.09.2003 Export of OpenType Fonts to PDF works now, but you need
Acrobat Reader to view or print PDF's containing OpenType Fonts.
 
22.09.2003 First Support for OpenType Fonts.
fonts.dir or fonts.scale are no longer needed to find Fonts.
See the Readme for some changes regarding Fontnames.
 
21.09.2003 Removed the "Modify Object" Dialog since all of it's functionality
in now in the former "Measurement" Palette, which is now called
"Properties" Palette.
 
20.09.2003 Made handling of Text-Properties more consistent.
 
19.09.2003 Scaling Glyphs in the X-Direction works now in PS and PDF.
 
18.09.2003 Now you can scale Glyphs in the X-Direction.
Works only on Screen for now.
 
17.09.2003 pageitem.cpp Removed all occurences of QFont in the rendering Code
scribusXml.cpp Added Version Info to Scribus Files.
 
16.09.2003 Improved Redraw of linked Textframes.
The PS-Exporter does now support Text with Fill & Stroke.
Removed all Font Encoding Stuff from the PS-Exporter, all
Text Rendering is now done with "glyphshow".
 
15.09.2003 Text with Fill & Stroke can now exported to PDF and SVG.
Fixed Crash when deleting Pages containing linked Textframes.
Fixed Crash after Drag-Copying Elements.
 
14.09.2003 Added the possibility to set the fill and stroke of Glyphs.
 
12.09.2003 Added a Welsh Translation.
 
11.09.2003 svgplugin.cpp Fixed some Bugs.
pageitem.cpp Fixed Bug with linked Textframes.
/trunk/Scribus/scribus/iso8859-3ps.enc
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/modify.h
===================================================================
--- trunk/Scribus/scribus/modify.h (revision 67)
+++ trunk/Scribus/scribus/modify.h (nonexistent)
@@ -1,157 +0,0 @@
-/****************************************************************************
-** Form interface generated from reading ui file 'Modify.ui'
-**
-** Created: Sat Jun 16 18:08:30 2001
-** by: The User Interface Compiler (uic)
-**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
-#ifndef MODOBJ_H
-#define MODOBJ_H
-
-#include <qdialog.h>
-#include <qbuttongroup.h>
-#include <qcheckbox.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qtoolbutton.h>
-#include <qspinbox.h>
-#include <qlayout.h>
-#include <qtooltip.h>
-#include <qcombobox.h>
-#include <qpixmap.h>
-#include <qlineedit.h>
-#include "mspinbox.h"
-#include "pageitem.h"
-#include "page.h"
-#include "scribusdoc.h"
-#include "scribusview.h"
-#include "linkbutton.h"
-#include "linecombo.h"
-
-class NameWidget : public QLineEdit
-{
- Q_OBJECT
-
-public:
- NameWidget(QWidget* parent);
- ~NameWidget() {};
-
-signals:
- void Leaved();
-
-protected:
- virtual void focusOutEvent(QFocusEvent *);
-};
-
-class ModObj : public QDialog
-{
- Q_OBJECT
-
-public:
- ModObj( QWidget* parent, PageItem *b, CListe Farben, ScribusDoc *docu, ScribusView *vie, ProfilesL *InputProfiles);
- ~ModObj() {};
-
- QGroupBox* GroupSpecial;
- QGroupBox* GroupPos;
- QCheckBox* Printable;
- QCheckBox* FlippedV;
- QCheckBox* FlippedH;
- QCheckBox* Textflow;
- QCheckBox* Textflow2;
- QCheckBox* Visible;
- QPushButton* OK;
- QPushButton* Cancel;
- QPushButton* Apply;
- LinkButton* Kette;
- QLabel* TextLabel1_3_2;
- QLabel* TextLabel2_2;
- QLabel* TextLabel1_3_3;
- QLabel* TextLabel2_3;
- QLabel* TextLabel2_3b;
- QLabel* TextLabel1_2;
- QLabel* TextLabel1_2_2_2;
- QLabel* TextLabel1_2_2_2_2;
- QLabel* TextLabel1;
- QLabel* TextLabel1_2_2;
- QLabel* TextLabel2;
- QLabel* TextLabel1_3;
- QLabel* TextLabel3;
- QLabel* TextLabel3_2;
- QLabel* TextLabel3_2_2;
- QLabel* TextLabel3_2_2_2;
- QLabel* TextLabel3_2_2_2_2;
- QLabel* Text1;
- QLabel* Text2;
- QLabel* TextName;
- NameWidget* NameEdit;
- MSpinBox* Ypos;
- MSpinBox* Width;
- MSpinBox* Xpos;
- MSpinBox* Angle;
- MSpinBox* Height;
- QSpinBox* Radius;
- MSpinBox* Distance;
- MSpinBox* LXpos;
- MSpinBox* LYpos;
- MSpinBox* HScale;
- MSpinBox* VScale;
- QSpinBox* Shade;
- QSpinBox* Shade2;
- QSpinBox* LineW;
- QButtonGroup* Props;
- QRadioButton* NormText;
- QCheckBox* NormText2;
- QRadioButton* Bookmark;
- QRadioButton* Annotation;
- QComboBox* Background;
- QComboBox* Foreground;
- QComboBox* InputP;
- QComboBox* MonitorI;
- LineCombo* Linestyle;
- PageItem* CurMod;
- ScribusDoc* doc;
- ScribusView* view;
- int origWidth;
- int origHeight;
- bool EmbedP;
- QButtonGroup* ScaleGroup;
- QRadioButton* FreeScale;
- QRadioButton* FrameScale;
- QCheckBox* Aspect;
-
-public slots:
- bool DoModify();
- void DoModifyExit();
- void NoModifyExit();
- void ChangeScaling();
- void ToggleFlow();
- void ToggleKette();
- void HChange();
- void VChange();
- void UnitChange();
- void EmProf(const QString& prn);
- bool NewName();
-
-signals:
- void DocChanged();
-
-protected:
- QVBoxLayout* ModObjLayout;
- QGridLayout* Layout5;
- QHBoxLayout* GroupSpecialLayout;
- QVBoxLayout* Layout2;
- QHBoxLayout* GroupPosLayout;
- QGridLayout* Layout1;
- QHBoxLayout* PropsLayout;
- QGridLayout* Layout4;
- QHBoxLayout* Layout3;
- QVBoxLayout* ScaleGroupLayout;
- QHBoxLayout* ScaleLayout2;
- QGridLayout* ScaleLayout1;
- QHBoxLayout* ScaleLayout3;
-};
-
-#endif // MODOBJ_H
/trunk/Scribus/scribus/modify.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/koi8ps.enc
===================================================================
--- trunk/Scribus/scribus/koi8ps.enc (revision 67)
+++ trunk/Scribus/scribus/koi8ps.enc (nonexistent)
@@ -1,124 +0,0 @@
-16#84 /guillmotleft
-16#85 /gullmotright
-16#86 /afii61352
-16#87 /.notdef
-16#88 /.notdef
-16#89 /.notdef
-16#8A /.notdef
-16#8B /.notdef
-16#8C /.notdef
-16#8D /.notdef
-16#8E /.notdef
-16#8F /.notdef
-16#90 /.notdef
-16#91 /.notdef
-16#92 /.notdef
-16#93 /.notdef
-16#94 /.notdef
-16#95 /.notdef
-16#96 /.notdef
-16#97 /.notdef
-16#98 /.notdef
-16#99 /.notdef
-16#9A /.notdef
-16#9B /.notdef
-16#9C /.notdef
-16#9D /.notdef
-16#9E /.notdef
-16#9F /.notdef
-16#A0 /space
-16#A1 /exclamdown
-16#A2 /cent
-16#A3 /afii10071
-16#A4 /currency
-16#A5 /yen
-16#A6 /brokenbar
-16#A7 /section
-16#A8 /dieresis
-16#A9 /copyright
-16#AA /ordfeminine
-16#AB /guillemotleft
-16#AC /logicalnot
-16#AD /hyphen
-16#AE /registered
-16#AF /macron
-16#B0 /degree
-16#B1 /plusminus
-16#B2 /twosuperior
-16#B3 /afii10023
-16#B4 /acute
-16#B5 /mu
-16#B6 /paragraph
-16#B7 /bullet
-16#B8 /cedilla
-16#B9 /dotlessi
-16#BA /ordmasculine
-16#BB /guillemotright
-16#BC /onequarter
-16#BD /onehalf
-16#BE /threequarters
-16#BF /questiondown
-16#C0 /afii10096
-16#C1 /afii10065
-16#C2 /afii10066
-16#C3 /afii10088
-16#C4 /afii10069
-16#C5 /afii10070
-16#C6 /afii10086
-16#C7 /afii10068
-16#C8 /afii10087
-16#C9 /afii10074
-16#CA /afii10075
-16#CB /afii10076
-16#CC /afii10077
-16#CD /afii10078
-16#CE /afii10079
-16#CF /afii10080
-16#D0 /afii10081
-16#D1 /afii10097
-16#D2 /afii10082
-16#D3 /afii10083
-16#D4 /afii10084
-16#D5 /afii10085
-16#D6 /afii10072
-16#D7 /afii10067
-16#D8 /afii10094
-16#D9 /afii10093
-16#DA /afii10073
-16#DB /afii10090
-16#DC /afii10095
-16#DD /afii10091
-16#DE /afii10089
-16#DF /afii10092
-16#E0 /afii10048
-16#E1 /afii10017
-16#E2 /afii10018
-16#E3 /afii10040
-16#E4 /afii10021
-16#E5 /afii10022
-16#E6 /afii10038
-16#E7 /afii10020
-16#E8 /afii10039
-16#E9 /afii10026
-16#EA /afii10027
-16#EB /afii10028
-16#EC /afii10029
-16#ED /afii10030
-16#EE /afii10031
-16#EF /afii10032
-16#F0 /afii10033
-16#F1 /afii10049
-16#F2 /afii10034
-16#F3 /afii10035
-16#F4 /afii10036
-16#F5 /afii10037
-16#F6 /afii10024
-16#F7 /afii10019
-16#F8 /afii10046
-16#F9 /afii10045
-16#FA /afii10025
-16#FB /afii10042
-16#FC /afii10047
-16#FD /afii10043
-16#FE /afii10041
-16#FF /afii10044
/trunk/Scribus/scribus/koi8ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-2.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-2.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-2.enc (nonexistent)
@@ -1,35 +0,0 @@
-0 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /space /exclam /quotedbl /numbersign
-/dollar /percent /ampersand /quotesingle /parenleft
-/parenright /asterisk /plus /comma /hyphen /period
-/slash /zero /one /two /three /four /five /six /seven
-/eight /nine /colon /semicolon /less /equal /greater
-/question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N
-/O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash
-/bracketright /asciicircum /underscore /grave /a /b /c /d
-/e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w
-/x /y /z /braceleft /bar /braceright /asciitilde /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /space /Aogonek /breve /Lslash /currency
-/Lcaron /Sacute /section /dieresis /Scaron /Scedilla /Tcaron
-/Zacute /hyphen /Zcaron /Zdotaccent /degree /aogonek /ogonek
-/lslash /acute /lcaron /sacute /caron /cedilla /scaron /scedilla
-/tcaron /zacute /hungarumlaut /zcaron /zdotaccent /Racute /Aacute
-/Acircumflex /Abreve /Adieresis /Lacute /Cacute /Ccedilla /Ccaron
-/Eacute /Eogonek /Edieresis /Ecaron /Iacute /Icircumflex /Dcaron
-/Eth /Nacute /Ncaron /Oacute /Ocircumflex /Ohungarumlaut
-/Odieresis /multiply /Rcaron /Uring /Uacute /Uhungarumlaut
-/Udieresis /Yacute /Tcommaaccent /germandbls /racute /aacute
-/acircumflex /abreve /adieresis /lacute /cacute /ccedilla
-/ccaron /eacute /eogonek /edieresis /ecaron /iacute /icircumflex
-/dcaron /eth /nacute /ncaron /oacute /ocircumflex /ohungarumlaut
-/odieresis /divide /rcaron /uring /uacute /uhungarumlaut
-/udieresis /yacute /tcommaaccent /dotaccent
/trunk/Scribus/scribus/iso8859-2.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/scfonts_encoding.h
===================================================================
--- trunk/Scribus/scribus/scfonts_encoding.h (revision 67)
+++ trunk/Scribus/scribus/scfonts_encoding.h (nonexistent)
@@ -1,52 +0,0 @@
-#ifndef SCFONTS_ENCODING_H
-#define SCFONTS_ENCODING_H
-
-#include <qstring.h>
-#include <qmap.h>
-
-class SCFonts_Encoding
-{
- public:
- SCFonts_Encoding()
- {
- }
- SCFonts_Encoding(QString name);
- bool read(QString name);
- bool present(int code)
- {
- return(Names.find(code)!=Names.end());
- }
- bool present(QString &name)
- {
- return(Codes.find(name)!=Codes.end());
- }
- QString &operator[](int code)
- {
- return(Names[code]);
- }
- int &operator[](QString &name)
- {
- return(Codes[name]);
- }
- QMap<int,QString>::Iterator beginByCode()
- {
- return(Names.begin());
- }
- QMap<int,QString>::Iterator endByCode()
- {
- return(Names.end());
- }
- QMap<QString,int>::Iterator beginByName()
- {
- return(Codes.begin());
- }
- QMap<QString,int>::Iterator endByName()
- {
- return(Codes.end());
- }
- private:
- QMap<QString,int> Codes;
- QMap<int,QString> Names;
-};
-
-#endif
/trunk/Scribus/scribus/scfonts_encoding.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-9ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-9ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-9ps.enc (nonexistent)
@@ -1,96 +0,0 @@
-16#A0 /space
-16#A1 /exclamdown
-16#A2 /cent
-16#A3 /sterling
-16#A4 /currency
-16#A5 /yen
-16#A6 /brokenbar
-16#A7 /section
-16#A8 /dieresis
-16#A9 /copyright
-16#AA /ordfeminine
-16#AB /guillemotleft
-16#AC /logicalnot
-16#AD /hyphen
-16#AE /registered
-16#AF /macron
-16#B0 /degree
-16#B1 /plusminus
-16#B2 /twosuperior
-16#B3 /threesuperior
-16#B4 /acute
-16#B5 /mu
-16#B6 /paragraph
-16#B7 /bullet
-16#B8 /cedilla
-16#B9 /onesuperior
-16#BA /ordmasculine
-16#BB /guillemotright
-16#BC /onequarter
-16#BD /onehalf
-16#BE /threequarters
-16#BF /questiondown
-16#C0 /Agrave
-16#C1 /Aacute
-16#C2 /Acircumflex
-16#C3 /Atilde
-16#C4 /Adieresis
-16#C5 /Aring
-16#C6 /AE
-16#C7 /Ccedilla
-16#C8 /Egrave
-16#C9 /Eacute
-16#CA /Ecircumflex
-16#CB /Edieresis
-16#CC /Igrave
-16#CD /Iacute
-16#CE /Icircumflex
-16#CF /Idieresis
-16#D0 /Gbreve
-16#D1 /Ntilde
-16#D2 /Ograve
-16#D3 /Oacute
-16#D4 /Ocircumflex
-16#D5 /Otilde
-16#D6 /Odieresis
-16#D7 /multiply
-16#D8 /Oslash
-16#D9 /Ugrave
-16#DA /Uacute
-16#DB /Ucircumflex
-16#DC /Udieresis
-16#DD /Idotaccent
-16#DE /Scedilla
-16#DF /germandbls
-16#E0 /agrave
-16#E1 /aacute
-16#E2 /acircumflex
-16#E3 /atilde
-16#E4 /adieresis
-16#E5 /aring
-16#E6 /ae
-16#E7 /ccedilla
-16#E8 /egrave
-16#E9 /eacute
-16#EA /ecircumflex
-16#EB /edieresis
-16#EC /igrave
-16#ED /iacute
-16#EE /icircumflex
-16#EF /idieresis
-16#F0 /gbreve
-16#F1 /ntilde
-16#F2 /ograve
-16#F3 /oacute
-16#F4 /ocircumflex
-16#F5 /otilde
-16#F6 /odieresis
-16#F7 /divide
-16#F8 /oslash
-16#F9 /ugrave
-16#FA /uacute
-16#FB /ucircumflex
-16#FC /udieresis
-16#FD /dotlessi
-16#FE /scedilla
-16#FF /ydieresis
/trunk/Scribus/scribus/iso8859-9ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/kimageeffect.h
===================================================================
--- trunk/Scribus/scribus/kimageeffect.h (revision 67)
+++ trunk/Scribus/scribus/kimageeffect.h (nonexistent)
@@ -1,555 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com>
- (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
- (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-// $Id$
-
-#ifndef __KIMAGE_EFFECT_H
-#define __KIMAGE_EFFECT_H
-
-class QImage;
-class QSize;
-class QColor;
-
-/**
- * This class includes various @ref QImage based graphical effects.
- *
- * Everything is
- * static, so there is no need to create an instance of this class. You can
- * just call the static methods. They are encapsulated here merely to provide
- * a common namespace.
- */
-
-class KImageEffect
-{
-public:
- enum GradientType { VerticalGradient, HorizontalGradient,
- DiagonalGradient, CrossDiagonalGradient,
- PyramidGradient, RectangleGradient,
- PipeCrossGradient, EllipticGradient };
- enum RGBComponent { Red, Green, Blue, Gray, All };
-
- enum Lighting {NorthLite, NWLite, WestLite, SWLite,
- SouthLite, SELite, EastLite, NELite};
-
- enum ModulationType { Intensity, Saturation, HueShift, Contrast };
-
- enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise,
- ImpulseNoise, LaplacianNoise, PoissonNoise};
-
- enum RotateDirection{ Rotate90, Rotate180, Rotate270 };
-
- /**
- * Create a gradient from color a to color b of the specified type.
- *
- * @param size The desired size of the gradient.
- * @param ca Color a
- * @param cb Color b
- * @param type The type of gradient.
- * @param ncols The number of colors to use when not running on a
- * truecolor display. The gradient will be dithered to this number of
- * colors. Pass 0 to prevent dithering.
- */
- static QImage gradient(const QSize &size, const QColor &ca,
- const QColor &cb, GradientType type, int ncols=3);
-
- /**
- * Create an unbalanced gradient.
-
- * An unbalanced gradient is a gradient where the transition from
- * color a to color b is not linear, but in this case, exponential.
- *
- * @param size The desired size of the gradient.
- * @param ca Color a
- * @param cb Color b
- * @param type The type of gradient.
- * @param xfactor The x decay length. Use a value between -200 and 200.
- * @param yfactor The y decay length.
- * @param ncols The number of colors. See KPixmapEffect:gradient.
- */
- static QImage unbalancedGradient(const QSize &size, const QColor &ca,
- const QColor &cb, GradientType type, int xfactor = 100,
- int yfactor = 100, int ncols = 3);
-
- /**
- * Blends a color into the destination image, using an opacity
- * value for blending one into another. Very fast direct pixel
- * manipulation is used.
- *
- * @author Karol Szwed (gallium@kde.org)
- * @param clr source color to be blended into the destination image.
- * @param dst destination image in which the source will be blended into.
- * @param opacity opacity (in percent) which determines how much the source
- * color will be blended into the destination image.
- * @return The destination image (dst) containing the result.
- */
- static QImage& blend(const QColor& clr, QImage& dst, float opacity);
-
- /**
- * Blend the src image into the destination image, using an opacity
- * value for blending one into another. Very fast direct pixel
- * manipulation is used.
- *
- * @author Karol Szwed (gallium@kde.org)
- * @param src source image to be blended into the destination image.
- * @param dst destination image in which the source will be blended into.
- * @param opacity opacity (in percent) which determines how much the source
- * image will be blended into the destination image.
- * @return The destination image (dst) containing the result.
- */
- static QImage& blend(QImage& src, QImage& dst, float opacity);
-
- /**
- * Blend the provided image into a background of the indicated color.
- *
- * @param initial_intensity this parameter takes values from -1 to 1:
- * a) if positive: how much to fade the image in its
- * less affected spot
- * b) if negative: roughly indicates how much of the image
- * remains unaffected
- * @param bgnd indicates the color of the background to blend in
- * @param eff lets you choose what kind of blending you like
- * @param anti_dir blend in the opposite direction (makes no much sense
- * with concentric blending effects)
- * @param image must be 32bpp
- */
- static QImage& blend(QImage &image, float initial_intensity,
- const QColor &bgnd, GradientType eff,
- bool anti_dir=false);
-
- /**
- * Blend an image into another one, using a gradient type
- * for blending from one to another.
- *
- * @param image1 source1 and result of blending
- * @param image2 source2 of blending
- * @param gt gradient type for blending between source1 and source2
- * @param xf x decay length for unbalanced gradient tpye
- * @param yf y decay length for unbalanced gradient tpye
- */
- static QImage& blend(QImage &image1,QImage &image2,
- GradientType gt, int xf=100, int yf=100);
-
- /**
- * Blend an image into another one, using a color channel of a
- * third image for the decision of blending from one to another.
- *
- * @param image1 Source 1 and result of blending
- * @param image2 Source 2 of blending
- * @param blendImage If the gray value of of pixel is 0, the result
- * for this pixel is that of image1; for a gray value
- * of 1, the pixel of image2 is used; for a value
- * inbetween, a corresponding blending is used.
- * @param channel The RBG channel to use for the blending decision.
- */
- static QImage& blend(QImage &image1, QImage &image2,
- QImage &blendImage, RGBComponent channel);
-
- /**
- * Blend an image into another one, using alpha in the expected way.
- * @author Rik Hemsley (rikkus) <rik@kde.org>
- */
- static bool blend(const QImage & upper, const QImage & lower, QImage & output);
-// Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect);
-
- /**
- * Blend an image into another one, using alpha in the expected way and
- * over coordinates @p x and @p y with respect to the lower image.
- * The output is a QImage which is the @p upper image already blended
- * with the @p lower one, so its size will be (in general) the same than
- * @p upper instead of the same size than @p lower like the method above.
- * In fact, the size of @p output is like upper's one only when it can be
- * painted on lower, if there has to be some clipping, output's size will
- * be the clipped area and x and y will be set to the correct up-left corner
- * where the clipped rectangle begins.
- */
- static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output);
- /**
- * Blend an image into another one, using alpha in the expected way and
- * over coordinates @p x and @p y with respect to the lower image.
- * The output is painted in the own @p lower image. This is an optimization
- * of the @ref blend method above provided by convenience.
- */
- static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower);
-
- /**
- * Modifies the intensity of a pixmap's RGB channel component.
- *
- * @author Daniel M. Duley (mosfet)
- * @param image The QImage to process.
- * @param percent Percent value. Use a negative value to dim.
- * @param channel Which channel(s) should be modified
- * @return The @p image, provided for convenience.
- */
- static QImage& channelIntensity(QImage &image, float percent,
- RGBComponent channel);
-
- /**
- * Fade an image to a certain background color.
- *
- * The number of colors will not be changed.
- *
- * @param image The QImage to process.
- * @param val The strength of the effect. 0 <= val <= 1.
- * @param color The background color.
- * @return Returns the @ref image(), provided for convenience.
- */
- static QImage& fade(QImage &img, float val, const QColor &color);
-
-
- /**
- * This recolors a pixmap. The most dark color will become color a,
- * the most bright one color b, and in between.
- *
- * @param image A QImage to process.
- * @param ca Color a
- * @param cb Color b
- */
- static QImage& flatten(QImage &image, const QColor &ca,
- const QColor &cb, int ncols=0);
-
- /**
- * Build a hash on any given @ref QImage
- *
- * @param image The QImage to process
- * @param lite The hash faces the indicated lighting (cardinal poles).
- * @param spacing How many unmodified pixels inbetween hashes.
- * @return Returns the @ref image(), provided for convenience.
- */
- static QImage& hash(QImage &image, Lighting lite=NorthLite,
- unsigned int spacing=0);
-
- /**
- * Either brighten or dim the image by a specified percent.
- * For example, .50 will modify the colors by 50%.
- *
- * @author Daniel M. Duley (mosfet)
- * @param image The QImage to process.
- * @param percent The percent value. Use a negative value to dim.
- * @return Returns The @ref image(), provided for convenience.
- */
- static QImage& intensity(QImage &image, float percent);
-
- /**
- * Modulate the image with a color channel of another image.
- *
- * @param image The QImage to modulate and result.
- * @param modImage The QImage to use for modulation.
- * @param reverse Invert the meaning of image/modImage; result is image!
- * @param type The modulation Type to use.
- * @param factor The modulation amplitude; with 0 no effect [-200;200].
- * @param channel The RBG channel of image2 to use for modulation.
- * @return Returns the @ref image(), provided for convenience.
- */
- static QImage& modulate(QImage &image, QImage &modImage, bool reverse,
- ModulationType type, int factor, RGBComponent channel);
-
- /**
- * Convert an image to grayscale.
- *
- * @author Daniel M. Duley (mosfet)
- * @param image The @ref QImage to process.
- * @param fast Set to @p true in order to use a faster but non-photographic
- * quality algorithm. Appropriate for things such as toolbar icons.
- * @return Returns the @ref image(), provided for convenience.
- */
- static QImage& toGray(QImage &image, bool fast = false);
-
- /**
- * Desaturate an image evenly.
- *
- * @param image The QImage to process.
- * @param desat A value between 0 and 1 setting the degree of desaturation
- * @return Returns the @ref image(), provided for convenience.
- */
- static QImage& desaturate(QImage &image, float desat = 0.3);
-
- /**
- * Fast, but low quality contrast of an image. Also see contrastHSV.
- *
- * @author Daniel M. Duley (mosfet)
- * @param image The QImage to process.
- * @param c A contrast value between -255 to 255.
- * @return The @ref image(), provided for convenience.
- */
- static QImage& contrast(QImage &image, int c);
-
- /**
- * Dither an image using Floyd-Steinberg dithering for low-color
- * situations.
- *
- * @param image The QImage to process.
- * @param palette The color palette to use
- * @param size The size of the palette
- * @return Returns the @ref image(), provided for convenience.
- */
- static QImage& dither(QImage &img, const QColor *palette, int size);
-
- /**
- * Calculate the image for a selected image, for instance a selected icon
- * on the desktop.
- * @param img the QImage to select
- * @param col the selected color, usually from QColorGroup::highlight().
- */
- static QImage& selectedImage( QImage &img, const QColor &col );
-
- /**
- * High quality, expensive HSV contrast. You can do a faster one by just
- * taking a intensity threshold (ie: 128) and incrementing RGB color
- * channels above it and decrementing those below it, but this gives much
- * better results.
- *
- * @author Daniel M. Duley (mosfet)
- * @param img The QImage to process.
- * @param sharpen If true sharpness is increase, (spiffed). Otherwise
- * it is decreased, (dulled).
- */
- static void contrastHSV(QImage &img, bool sharpen=true);
-
- /**
- * Normalizes the pixel values to span the full range of color values.
- * This is a contrast enhancement technique.
- * @author Daniel M. Duley (mosfet)
- */
- static void normalize(QImage &img);
-
- /**
- * Performs histogram equalization on the reference
- * image.
- * @author Daniel M. Duley (mosfet)
- */
- static void equalize(QImage &img);
-
- /**
- * Thresholds the reference image. You can also threshold images by using
- * ThresholdDither in the various QPixmap/QImage convert methods, but this
- * lets you specify a threshold value.
- *
- * @author Daniel M. Duley (mosfet)
- * @param img The QImage to process.
- * @param value The threshold value.
- */
- static void threshold(QImage &img, unsigned int value=128);
-
- /**
- * Produces a 'solarization' effect seen when exposing a photographic
- * film to light during the development process.
- *
- * @author Daniel M. Duley (mosfet)
- * @param img The QImage to process.
- * @param factor The extent of the solarization (0-99.9)
- */
- static void solarize(QImage &img, double factor=50.0);
-
- /**
- * Embosses the source image. This involves highlighting the edges
- * and applying various other enhancements in order to get a metal
- * effect.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @return The embossed image. The original is not changed.
- */
- static QImage emboss(QImage &src);
-
- /**
- * Minimizes speckle noise in the source image using the 8 hull
- * algorithm.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @return The despeckled image. The original is not changed.
- */
- static QImage despeckle(QImage &src);
-
- /**
- * Produces a neat little "charcoal" effect.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param factor The factor for detecting lines (0-99.0).
- * @return The charcoal image. The original is not changed.
- */
- static QImage charcoal(QImage &src, double factor=50.0);
-
- /**
- * Rotates the image by the specified amount
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param r The rotate direction.
- * @return The rotated image. The original is not changed.
- */
- static QImage rotate(QImage &src, RotateDirection r);
-
- /**
- * Scales an image using simple pixel sampling. This does not produce
- * nearly as nice a result as QImage::smoothScale(), but has the
- * advantage of being much faster - only a few milliseconds.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param w The new width.
- * @param h The new height.
- * @return The scaled image. The original is not changed.
- */
- static QImage sample(QImage &src, int w, int h);
-
- /**
- * Adds noise to an image.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param type The algorithm used to generate the noise.
- * @return The image with noise added. The original is not changed.
- */
- static QImage addNoise(QImage &src, NoiseType type = GaussianNoise);
-
- /**
- * Blurs an image by convolving pixel neighborhoods.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param factor The percent weight to give to the center pixel.
- * @return The blurred image. The original is not changed.
- */
- static QImage blur(QImage &src, double factor=50.0);
-
- /**
- * Detects edges in an image using pixel neighborhoods and an edge
- * detection mask.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param factor The percent weight to give to the center pixel.
- * @return The image with edges detected. The original is not changed.
- */
- static QImage edge(QImage &src, double factor=50.0);
-
- /**
- * Implodes an image by a specified percent.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param factor The extent of the implosion.
- * @param background An RGBA value to use for the background. After the
- * effect some pixels may be "empty". This value is used for those pixels.
- * @return The imploded image. The original is not changed.
- */
- static QImage implode(QImage &src, double factor=30.0,
- unsigned int background = 0xFFFFFFFF);
- /**
- * Produces an oil painting effect.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param radius The radius of the pixel neighborhood used in applying the
- * effect.
- * @return The new image. The original is not changed.
- */
- static QImage oilPaint(QImage &src, int radius=3);
-
- /**
- * Sharpens the pixels in the image using pixel neighborhoods.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param factor The percent weight to give to the center pixel.
- * @return The sharpened image. The original is not changed.
- */
- static QImage sharpen(QImage &src, double factor=30.0);
-
- /**
- * Randomly displaces pixels.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param amount The vicinity for choosing a random pixel to swap.
- * @return The image with pixels displaced. The original is not changed.
- */
- static QImage spread(QImage &src, unsigned int amount=3);
-
- /**
- * Shades the image using a distance light source.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param color_shading If true do color shading, otherwise do grayscale.
- * @param azimuth Determines the light source and direction.
- * @param elevation Determines the light source and direction.
- * @return The shaded image. The original is not changed.
- */
- static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0,
- double elevation=30.0);
- /**
- * Swirls the image by a specified amount
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param degrees The tightness of the swirl.
- * @param background An RGBA value to use for the background. After the
- * effect some pixels may be "empty". This value is used for those pixels.
- * @return The swirled image. The original is not changed.
- */
- static QImage swirl(QImage &src, double degrees=50.0, unsigned int background =
- 0xFFFFFFFF);
-
- /**
- * Modifies the pixels along a sine wave.
- *
- * @author Daniel M. Duley (mosfet)
- * @param src The QImage to process.
- * @param amplitude The amplitude of the sine wave.
- * @param wavelength The frequency of the sine wave.
- * @return The new image. The original is not changed.
- */
- static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0,
- unsigned int background = 0xFFFFFFFF);
-
-private:
-
- /**
- * Helper function to fast calc some altered (lighten, shaded) colors
- *
- */
- static unsigned int lHash(unsigned int c);
- static unsigned int uHash(unsigned int c);
-
- /**
- * Helper function to find the nearest color to the RBG triplet
- */
- static int nearestColor( int r, int g, int b, const QColor *pal, int size );
-
- static void hull(const int x_offset, const int y_offset, const int polarity,
- const int width, const int height,
- unsigned int *f, unsigned int *g);
- static unsigned int generateNoise(unsigned int pixel, NoiseType type);
- static unsigned int interpolateColor(QImage *image, double x, double y,
- unsigned int background);
-};
-
-#endif
/trunk/Scribus/scribus/kimageeffect.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/Stdenc.txt
===================================================================
--- trunk/Scribus/scribus/Stdenc.txt (revision 67)
+++ trunk/Scribus/scribus/Stdenc.txt (nonexistent)
@@ -1,149 +0,0 @@
-space 040
-exclam 041
-quotedbl 042
-numbersign 043
-dollar 044
-percent 045
-ampersand 046
-quoteright 047
-parenleft 050
-parenright 051
-asterisk 052
-plus 053
-comma 054
-hyphen 055
-period 056
-slash 057
-zero 060
-one 061
-two 062
-three 063
-four 064
-five 065
-six 066
-seven 067
-eight 070
-nine 071
-colon 072
-semicolon 073
-less 074
-equal 075
-greater 076
-question 077
-at 0100
-A 0101
-B 0102
-C 0103
-D 0104
-E 0105
-F 0106
-G 0107
-H 0110
-I 0111
-J 0112
-K 0113
-L 0114
-M 0115
-N 0116
-O 0117
-P 0120
-Q 0121
-R 0122
-S 0123
-T 0124
-U 0125
-V 0126
-W 0127
-X 0130
-Y 0131
-Z 0132
-bracketleft 0133
-backslash 0134
-bracketright 0135
-asciicircum 0136
-underscore 0137
-quoteleft 0140
-a 0141
-b 0142
-c 0143
-d 0144
-e 0145
-f 0146
-g 0147
-h 0150
-i 0151
-j 0152
-k 0153
-l 0154
-m 0155
-n 0156
-o 0157
-p 0160
-q 0161
-r 0162
-s 0163
-t 0164
-u 0165
-v 0166
-w 0167
-x 0170
-y 0171
-z 0172
-braceleft 0173
-bar 0174
-braceright 0175
-asciitilde 0176
-exclamdown 0241
-cent 0242
-sterling 0243
-fraction 0244
-yen 0245
-florin 0246
-section 0247
-currency 0250
-quotesingle 0251
-quotedblleft 0252
-guillemotleft 0253
-guilsinglleft 0254
-guilsinglright 0255
-fi 0256
-fl 0257
-endash 0261
-dagger 0262
-daggerdbl 0263
-periodcentered 0264
-paragraph 0266
-bullet 0267
-quotesinglbase 0270
-quotedblbase 0271
-quotedblright 0272
-guillemotright 0273
-ellipsis 0274
-perthousand 0275
-questiondown 0277
-grave 0301
-acute 0302
-circumflex 0303
-tilde 0304
-macron 0305
-breve 0306
-dotaccent 0307
-dieresis 0310
-ring 0312
-cedilla 0313
-hungarumlaut 0315
-ogonek 0316
-caron 0317
-emdash 0320
-AE 0341
-ordfeminine 0343
-Lslash 0350
-Oslash 0351
-OE 0352
-ordmasculine 0353
-ae 0361
-dotlessi 0365
-islash 0370
-oslash 0371
-oe 0372
-germandbls 0373
/trunk/Scribus/scribus/Stdenc.txt
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-4ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-4ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-4ps.enc (nonexistent)
@@ -1,96 +0,0 @@
-16#A0 /space
-16#A1 /Aogonek
-16#A2 /kra
-16#A3 /Rcedilla
-16#A4 /currency
-16#A5 /Itilde
-16#A6 /Lcedilla
-16#A7 /section
-16#A8 /dieresis
-16#A9 /Scaron
-16#AA /Emacron
-16#AB /Gcedilla
-16#AC /Tbar
-16#AD /hyphen
-16#AE /Zcaron
-16#AF /macron
-16#B0 /degree
-16#B1 /aogonek
-16#B2 /ogonek
-16#B3 /rcedilla
-16#B4 /acute
-16#B5 /itilde
-16#B6 /lcedilla
-16#B7 /caron
-16#B8 /cedilla
-16#B9 /scaron
-16#BA /emacron
-16#BB /gcedilla
-16#BC /tbar
-16#BD /Eng
-16#BE /zcaron
-16#BF /eng
-16#C0 /Amacron
-16#C1 /Aacute
-16#C2 /Acircumflex
-16#C3 /Atilde
-16#C4 /Adieresis
-16#C5 /Aring
-16#C6 /AE
-16#C7 /Iogonek
-16#C8 /Ccaron
-16#C9 /Eacute
-16#CA /Eogonek
-16#CB /Edieresis
-16#CC /Edotaccent
-16#CD /Iacute
-16#CE /Icircumflex
-16#CF /Imacron
-16#D0 /Eth
-16#D1 /Ncedilla
-16#D2 /Omacron
-16#D3 /Kcedilla
-16#D4 /Ocircumflex
-16#D5 /Otilde
-16#D6 /Odieresis
-16#D7 /multiply
-16#D8 /Oslash
-16#D9 /Uogonek
-16#DA /Uacute
-16#DB /Ucircumflex
-16#DC /Udieresis
-16#DD /Utilde
-16#DE /Umacron
-16#DF /germandbls
-16#E0 /amacron
-16#E1 /aacute
-16#E2 /acircumflex
-16#E3 /atilde
-16#E4 /adieresis
-16#E5 /aring
-16#E6 /ae
-16#E7 /iogonek
-16#E8 /ccaron
-16#E9 /eacute
-16#EA /eogonek
-16#EB /edieresis
-16#EC /edotaccent
-16#ED /iacute
-16#EE /icircumflex
-16#EF /imacron
-16#F0 /dbar
-16#F1 /ncedilla
-16#F2 /omacron
-16#F3 /kcedilla
-16#F4 /ocircumflex
-16#F5 /otilde
-16#F6 /odieresis
-16#F7 /divide
-16#F8 /oslash
-16#F9 /uogonek
-16#FA /uacute
-16#FB /ucircumflex
-16#FC /udieresis
-16#FD /utilde
-16#FE /umacron
-16#FF /dotaccent
/trunk/Scribus/scribus/iso8859-4ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/modify.cpp
===================================================================
--- trunk/Scribus/scribus/modify.cpp (revision 67)
+++ trunk/Scribus/scribus/modify.cpp (nonexistent)
@@ -1,998 +0,0 @@
-#include "modify.h"
-#include "modify.moc"
-#include "config.h"
-#include <qmessagebox.h>
-#ifdef HAVE_CMS
- #include CMS_INC
-extern bool SoftProofing;
-extern bool Gamut;
-extern bool CMSuse;
-#endif
-extern bool CMSavail;
-extern float UmReFaktor;
-extern QPixmap loadIcon(QString nam);
-
-NameWidget::NameWidget(QWidget* parent) : QLineEdit(parent)
-{
-}
-
-void NameWidget::focusOutEvent(QFocusEvent *)
-{
- emit Leaved();
-}
-
-ModObj::ModObj( QWidget* parent, PageItem *b, CListe Farben, ScribusDoc *docu, ScribusView *vie, ProfilesL *InputProfiles)
- : QDialog( parent, "Mod", true, 0 )
-{
- setIcon(loadIcon("AppIcon.xpm"));
- CurMod = b;
- doc = docu;
- view = vie;
- bool embed = false;
- ModObjLayout = new QVBoxLayout( this );
- ModObjLayout->setSpacing( 6 );
- ModObjLayout->setMargin( 0 );
- Layout5 = new QGridLayout;
- Layout5->setSpacing( 6 );
- Layout5->setMargin( 10 );
- GroupSpecial = new QGroupBox( this, "GroupSpecial" );
- GroupSpecial->setTitle( tr( "Other" ) );
- GroupSpecial->setColumnLayout(0, Qt::Vertical );
- GroupSpecial->layout()->setSpacing( 0 );
- GroupSpecial->layout()->setMargin( 0 );
- GroupSpecialLayout = new QHBoxLayout( GroupSpecial->layout() );
- GroupSpecialLayout->setAlignment( Qt::AlignTop );
- GroupSpecialLayout->setSpacing( 6 );
- GroupSpecialLayout->setMargin( 10 );
- Layout2 = new QVBoxLayout;
- Layout2->setSpacing( 6 );
- Layout2->setMargin( 0 );
- FlippedH = new QCheckBox( GroupSpecial, "FlippedH" );
- FlippedH->setMinimumSize( QSize( 150, 22 ) );
- FlippedH->setText( tr( "Horizontal flipped" ) );
- FlippedH->setChecked(b->flippedH % 2 != 0);
- Layout2->addWidget( FlippedH );
- FlippedV = new QCheckBox( GroupSpecial, "FlippedV" );
- FlippedV->setMinimumSize( QSize( 150, 22 ) );
- FlippedV->setText( tr( "Vertical flipped" ) );
- FlippedV->setChecked(b->flippedV % 2 != 0);
- Layout2->addWidget( FlippedV );
- Textflow = new QCheckBox( GroupSpecial, "Textflow" );
- Textflow->setMinimumSize( QSize( 150, 22 ) );
- Textflow->setText( tr( "Text flows around Box" ) );
- Textflow->setChecked(b->Textflow);
- Layout2->addWidget( Textflow );
- Textflow2 = new QCheckBox( GroupSpecial, "Textflow2" );
- Textflow2->setMinimumSize( QSize( 150, 22 ) );
- Textflow2->setText( tr( "Use Bounding Box" ) );
- Textflow2->setChecked(b->Textflow2);
- Layout2->addWidget( Textflow2 );
- ToggleFlow();
- Printable = new QCheckBox( GroupSpecial, "Printable" );
- Printable->setMinimumSize( QSize( 150, 22 ) );
- Printable->setText( tr( "Don't print" ) );
- Printable->setChecked(!b->isPrintable);
- Layout2->addWidget( Printable );
- GroupSpecialLayout->addLayout( Layout2 );
- Layout5->addWidget( GroupSpecial, 1, 0 );
-
- GroupPos = new QGroupBox( this, "GroupPos" );
- GroupPos->setTitle( tr( "Position" ) );
- GroupPos->setColumnLayout(0, Qt::Vertical );
- GroupPos->layout()->setSpacing( 0 );
- GroupPos->layout()->setMargin( 0 );
- GroupPosLayout = new QHBoxLayout( GroupPos->layout() );
- GroupPosLayout->setAlignment( Qt::AlignTop );
- GroupPosLayout->setSpacing( 6 );
- GroupPosLayout->setMargin( 11 );
- Layout1 = new QGridLayout;
- Layout1->setSpacing( 3 );
- Layout1->setMargin( 0 );
- TextLabel1 = new QLabel( GroupPos, "TextLabel1" );
- TextLabel1->setText( tr( "X-Pos:" ) );
- Layout1->addWidget( TextLabel1, 0, 0 );
- TextLabel1_2 = new QLabel( GroupPos, "TextLabel1_2" );
- TextLabel1_2->setText( tr( "Y-Pos:" ) );
- Layout1->addWidget( TextLabel1_2, 1, 0 );
- TextLabel1_2_2 = new QLabel( GroupPos, "TextLabel1_2_2" );
- TextLabel1_2_2->setText( tr( "Width:" ) );
- Layout1->addWidget( TextLabel1_2_2, 2, 0 );
- TextLabel1_2_2_2 = new QLabel( GroupPos, "TextLabel1_2_2_2" );
- TextLabel1_2_2_2->setText( tr( "Height:" ) );
- Layout1->addWidget( TextLabel1_2_2_2, 3, 0 );
- TextLabel1_2_2_2_2 = new QLabel( GroupPos, "TextLabel1_2_2_2_2" );
- TextLabel1_2_2_2_2->setText( tr( "Angle:" ) );
- Layout1->addWidget( TextLabel1_2_2_2_2, 4, 0 );
- Xpos = new MSpinBox(GroupPos, 2);
- Xpos->setMinimumSize( QSize( 85, 22 ) );
- Xpos->setSuffix( tr( " pt" ) );
- Xpos->setMaxValue( 300000 );
- Xpos->setMinValue( -300000 );
- Xpos->setValue(qRound(b->Xpos*UmReFaktor*100));
- Xpos->setLineStep(100);
- Layout1->addWidget( Xpos, 0, 1 );
- Ypos = new MSpinBox( GroupPos, 2);
- Ypos->setMinimumSize( QSize( 85, 22 ) );
- Ypos->setSuffix( tr( " pt" ) );
- Ypos->setMaxValue( 300000 );
- Ypos->setMinValue( -300000 );
- Ypos->setValue(qRound(b->Ypos*UmReFaktor*100));
- Ypos->setLineStep(100);
- Layout1->addWidget( Ypos, 1, 1 );
- Width = new MSpinBox( GroupPos, 2 );
- Width->setMinimumSize( QSize( 85, 22 ) );
- Width->setSuffix( tr( " pt" ) );
- Width->setMaxValue( 300000 );
- Width->setMinValue( 0 );
- origWidth = qRound(b->Width*UmReFaktor*100);
- Width->setValue(origWidth);
- Width->setLineStep(100);
- Layout1->addWidget( Width, 2, 1 );
- Height = new MSpinBox( GroupPos, 2 );
- Height->setMinimumSize( QSize( 85, 22 ) );
- Height->setSuffix( tr( " pt" ) );
- Height->setMaxValue( 300000 );
- Height->setMinValue( 0 );
- origHeight = qRound(b->Height*UmReFaktor*100);
- Height->setValue(origHeight);
- Height->setLineStep(100);
- Layout1->addWidget( Height, 3, 1 );
- Angle = new MSpinBox( GroupPos, 2 );
- Angle->setMinimumSize( QSize( 85, 22 ) );
- Angle->setSuffix(" °");
- Angle->setMaxValue( 300000 );
- Angle->setMinValue( -300000 );
- Angle->setValue(qRound(b->Rot*-100));
- Angle->setLineStep(100);
- Layout1->addWidget( Angle, 4, 1 );
- GroupPosLayout->addLayout( Layout1 );
- Layout5->addWidget( GroupPos, 0, 0 );
- Props = new QButtonGroup( this, "Props" );
- Props->setTitle( tr( "Properties" ) );
- Props->setColumnLayout(0, Qt::Vertical );
- Props->layout()->setSpacing( 0 );
- Props->layout()->setMargin( 0 );
- PropsLayout = new QHBoxLayout( Props->layout() );
- PropsLayout->setAlignment( Qt::AlignTop );
- PropsLayout->setSpacing( 6 );
- PropsLayout->setMargin( 11 );
- Layout4 = new QGridLayout;
- Layout4->setSpacing( 6 );
- Layout4->setMargin( 0 );
- CListe::Iterator it;
- ProfilesL::Iterator itP;
- QPixmap pm;
- Height->setEnabled(true);
- QSpacerItem* spacerSC1 = new QSpacerItem( 30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
- QSpacerItem* spacerSC2 = new QSpacerItem( 30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
- switch (b->PType)
- {
- case 8:
- setCaption(tr("Modify Pathtext"));
- NormText2 = new QCheckBox( Props, "NormText" );
- NormText2->setMinimumSize(QSize(140, 22));
- NormText2->setText( tr( "Show Curve" ) );
- Layout4->addMultiCellWidget( NormText2, 0, 0, 0, 1 );
- NormText2->setChecked(b->PoShow);
- TextLabel3 = new QLabel( Props, "TextLabel3" );
- TextLabel3->setMinimumSize(QSize(110, 22));
- TextLabel3->setText( tr( "Startoffset:" ) );
- Layout4->addWidget( TextLabel3, 1, 0);
- Distance = new MSpinBox( Props, 1 );
- Distance->setMinimumSize(QSize(65, 22));
- Distance->setSuffix( tr( " pts" ) );
- Distance->setMaxValue( 3000 );
- Distance->setMinValue( 0 );
- Distance->setValue(static_cast<int>(b->Extra*10));
- Distance->setLineStep(10);
- Layout4->addWidget( Distance, 1, 1);
- TextLabel2 = new QLabel( Props, "TextLabel2" );
- TextLabel2->setMinimumSize(QSize(110, 22));
- TextLabel2->setText( tr( "Distance from Curve:" ) );
- Layout4->addWidget( TextLabel2, 2, 0);
- LineW = new MSpinBox( Props, 1 );
- LineW->setMinimumSize( QSize( 65, 22 ) );
- LineW->setSuffix( tr( " pts" ) );
- LineW->setMaxValue( 3000 );
- LineW->setMinValue( -3000 );
- LineW->setLineStep(10);
- LineW->setValue( qRound(b->BaseOffs * -10) );
- Layout4->addWidget( LineW, 2, 1);
- break;
- case 4:
- setCaption(tr("Modify Textframe"));
- NormText = new QRadioButton( Props, "NormText" );
- NormText->setMinimumSize(QSize(140, 22));
- NormText->setText( tr( "Ordinary Text" ) );
- Layout4->addMultiCellWidget( NormText, 0, 0, 0, 1 );
- Bookmark = new QRadioButton( Props, "Bookmark" );
- Bookmark->setMinimumSize(QSize(140, 22));
- Bookmark->setText( tr( "Is PDF-Bookmark" ) );
- Layout4->addMultiCellWidget( Bookmark, 1, 1, 0, 1 );
- Annotation = new QRadioButton( Props, "Annotation" );
- Annotation->setMinimumSize(QSize(140, 22));
- Annotation->setText( tr( "Is PDF-Annotation" ) );
- Layout4->addMultiCellWidget( Annotation, 2, 2, 0, 1 );
- NormText->setChecked(true);
- if (b->isBookmark)
- {
- Bookmark->setChecked(true);
- }
- if (b->isAnnotation)
- {
- Annotation->setChecked(true);
- }
- TextLabel3 = new QLabel( Props, "TextLabel3" );
- TextLabel3->setMinimumSize(QSize(110, 22));
- TextLabel3->setText( tr( "Textdistance:" ) );
- Layout4->addWidget( TextLabel3, 3, 0);
- TextLabel1_3 = new QLabel( Props, "TextLabel1_3" );
- TextLabel1_3->setMinimumSize(QSize(110, 22));
- TextLabel1_3->setText( tr( "Background Color:" ) );
- Layout4->addWidget( TextLabel1_3, 4, 0);
- TextLabel2 = new QLabel( Props, "TextLabel2" );
- TextLabel2->setMinimumSize(QSize(110, 22));
- TextLabel2->setText( tr( "Shading:" ) );
- Layout4->addWidget( TextLabel2, 5, 0);
- Distance = new MSpinBox( Props, 1 );
- Distance->setMinimumSize(QSize(65, 22));
- Distance->setSuffix( tr( " pt" ) );
- Distance->setMaxValue( 3000 );
- Distance->setMinValue( 0 );
- Distance->setValue(static_cast<int>(b->Extra*10));
- Distance->setLineStep(10);
- Layout4->addWidget( Distance, 3, 1, Qt::AlignLeft);
- Background = new QComboBox( true, Props, "Background" );
- Background->setMinimumSize(QSize(95, 21));
- Background->setEditable(false);
- Background->insertItem(tr("None"));
- if (b->Pcolor == "None")
- Background->setCurrentItem(Background->count()-1);
- pm = QPixmap(15, 15);
- for (it = Farben.begin(); it != Farben.end(); ++it)
- {
- pm.fill(Farben[it.key()].getRGBColor());
- Background->insertItem(pm, it.key());
- if (it.key() == b->Pcolor)
- {
- Background->setCurrentItem(Background->count()-1);
- }
- }
- Layout4->addWidget( Background, 4, 1);
- Shade = new QSpinBox( Props, "Distance_2" );
- Shade->setMinimumSize(QSize(65, 22));
- Shade->setSuffix( tr( " %" ) );
- Shade->setMaxValue( 100 );
- Shade->setMinValue( 0 );
- Shade->setValue( b->Shade );
- Layout4->addWidget( Shade, 5, 1, Qt::AlignLeft);
- TextLabel2_3b = new QLabel( Props, "TextLabel2_3b" );
- TextLabel2_3b->setText( tr( "Corner Radius:" ) );
- Layout4->addWidget( TextLabel2_3b, 6, 0 );
- Radius = new QSpinBox(Props, "RR");
- Radius->setMinimumSize( QSize( 65, 22 ) );
- Radius->setSuffix( tr( " pt" ) );
- Radius->setMaxValue(QMIN(static_cast<int>(b->Width),static_cast<int>(b->Height))/2 );
- Radius->setMinValue(QMIN(static_cast<int>(b->Width),static_cast<int>(b->Height))/2 * -1);
- Radius->setValue(qRound(b->RadRect));
- if (b->ClipEdited)
- Radius->setEnabled(false);
- Layout4->addWidget( Radius, 6, 1, Qt::AlignLeft );
- break;
- case 2:
- setCaption(tr("Modify Pictureframe"));
-
- ScaleGroup = new QButtonGroup( Props, "ScaleGroup" );
- ScaleGroup->setTitle( tr( "Scaling" ) );
- ScaleGroup->setExclusive( false );
- ScaleGroup->setRadioButtonExclusive(true);
- ScaleGroup->setColumnLayout(0, Qt::Vertical );
- ScaleGroup->layout()->setSpacing( 5 );
- ScaleGroup->layout()->setMargin( 10 );
- ScaleGroupLayout = new QVBoxLayout( ScaleGroup->layout() );
- ScaleGroupLayout->setAlignment( Qt::AlignTop );
- FreeScale = new QRadioButton( ScaleGroup, "FreeScale" );
- FreeScale->setText( tr( "Free Scaling" ) );
- ScaleGroupLayout->addWidget( FreeScale );
- ScaleLayout2 = new QHBoxLayout( 0, 0, 5, "ScaleLayout2");
- ScaleLayout2->addItem( spacerSC1 );
- ScaleLayout1 = new QGridLayout( 0, 1, 1, 0, 5, "ScaleLayout1");
- TextLabel3_2 = new QLabel( ScaleGroup, "TextLabel3_2" );
- TextLabel3_2->setMinimumSize(QSize(110, 22));
- TextLabel3_2->setText( tr( "Local X-Pos:" ) );
- ScaleLayout1->addWidget( TextLabel3_2, 0, 0);
- TextLabel3_2_2 = new QLabel( ScaleGroup, "TextLabel3_2_2" );
- TextLabel3_2_2->setMinimumSize(QSize(110, 22));
- TextLabel3_2_2->setText( tr( "Local Y-Pos:" ) );
- ScaleLayout1->addWidget( TextLabel3_2_2, 1, 0);
- TextLabel3_2_2_2 = new QLabel( ScaleGroup, "TextLabel3_2_2_2" );
- TextLabel3_2_2_2->setMinimumSize(QSize(110, 22));
- TextLabel3_2_2_2->setText( tr( "Horizontal Scaling" ) );
- ScaleLayout1->addWidget( TextLabel3_2_2_2, 2, 0);
- TextLabel3_2_2_2_2 = new QLabel( ScaleGroup, "TextLabel3_2_2_2_2" );
- TextLabel3_2_2_2_2->setMinimumSize(QSize(110, 22));
- TextLabel3_2_2_2_2->setText( tr( "Vertical Scaling" ) );
- ScaleLayout1->addWidget( TextLabel3_2_2_2_2, 3, 0);
- LXpos = new MSpinBox( ScaleGroup, 2 );
- LXpos->setMinimumSize(QSize(90, 22));
- LXpos->setSuffix( tr( " pt" ) );
- LXpos->setMaxValue( 300000 );
- LXpos->setMinValue( -300000 );
- LXpos->setLineStep(100);
- LXpos->setValue(qRound(b->LocalX*UmReFaktor*100));
- ScaleLayout1->addWidget(LXpos, 0, 1);
- LYpos = new MSpinBox( ScaleGroup, 2 );
- LYpos->setMinimumSize(QSize(90, 22));
- LYpos->setSuffix( tr( " pt" ) );
- LYpos->setMaxValue( 300000 );
- LYpos->setMinValue( -300000 );
- LYpos->setLineStep(100);
- LYpos->setValue(qRound(b->LocalY*UmReFaktor*100));
- ScaleLayout1->addWidget(LYpos, 1, 1);
- HScale = new MSpinBox( ScaleGroup, 1 );
- HScale->setMinimumSize(QSize(70, 22));
- HScale->setSuffix( tr( " %" ) );
- HScale->setMaxValue( 10000 );
- HScale->setMinValue( 1 );
- HScale->setLineStep(10);
- HScale->setValue( static_cast<int>(b->LocalScX*1000) );
- ScaleLayout1->addWidget(HScale, 2, 1);
- VScale = new MSpinBox( ScaleGroup, 1 );
- VScale->setMinimumSize(QSize(70, 22));
- VScale->setSuffix( tr( " %" ) );
- VScale->setMaxValue( 10000 );
- VScale->setMinValue( 1 );
- VScale->setLineStep(10);
- VScale->setValue( static_cast<int>(b->LocalScY*1000) );
- ScaleLayout1->addWidget(VScale, 3, 1);
- Kette = new LinkButton( ScaleGroup );
- Kette->setMinimumSize(QSize(16, 50));
- Kette->setToggleButton( true );
- Kette->setAutoRaise(true);
- ScaleLayout1->addMultiCellWidget(Kette, 2, 3, 2, 2, Qt::AlignLeft);
- ScaleLayout2->addLayout( ScaleLayout1 );
- ScaleGroupLayout->addLayout( ScaleLayout2 );
- FrameScale = new QRadioButton( ScaleGroup, "FrameScale" );
- FrameScale->setText( tr( "Scale Picture to Frame Size" ) );
- ScaleGroupLayout->addWidget( FrameScale );
- ScaleLayout3 = new QHBoxLayout( 0, 0, 6, "ScaleLayout3");
- ScaleLayout3->addItem( spacerSC2 );
- Aspect = new QCheckBox( ScaleGroup, "Aspect" );
- Aspect->setText( tr( "Keep Aspect Ratio" ) );
- Aspect->setChecked(b->AspectRatio);
- ScaleLayout3->addWidget( Aspect );
- ScaleGroupLayout->addLayout( ScaleLayout3 );
- Layout4->addMultiCellWidget(ScaleGroup, 0, 0, 0, 2);
- if (b->ScaleType)
- {
- FreeScale->setChecked(true);
- FrameScale->setChecked(false);
- }
- else
- {
- FreeScale->setChecked(false);
- FrameScale->setChecked(true);
- }
- Visible = new QCheckBox( Props, "Visible" );
- Visible->setText( tr( "Image visible" ) );
- Visible->setChecked(b->PicArt);
- Layout4->addMultiCellWidget(Visible, 4, 4, 0, 2);
- TextLabel1_3 = new QLabel( Props, "TextLabel1_3" );
- TextLabel1_3->setMinimumSize(QSize(110, 22));
- TextLabel1_3->setText( tr( "Background Color:" ) );
- Layout4->addWidget( TextLabel1_3, 5, 0);
- TextLabel2 = new QLabel( Props, "TextLabel2" );
- TextLabel2->setMinimumSize(QSize(110, 22));
- TextLabel2->setText( tr( "Shading:" ) );
- Layout4->addWidget( TextLabel2, 6, 0);
- Background = new QComboBox( true, Props, "Background" );
- Background->setMinimumSize(QSize(95,21));
- Background->setEditable(false);
- pm = QPixmap(15, 15);
- Background->insertItem(tr("None"));
- if (b->Pcolor == "None")
- Background->setCurrentItem(Background->count()-1);
- for (it = Farben.begin(); it != Farben.end(); ++it)
- {
- pm.fill(Farben[it.key()].getRGBColor());
- Background->insertItem(pm, it.key());
- if (it.key() == b->Pcolor)
- {
- Background->setCurrentItem(Background->count()-1);
- }
- }
- Layout4->addMultiCellWidget(Background, 5, 5, 1, 2);
- Shade = new QSpinBox( Props, "Shade" );
- Shade->setMinimumSize(QSize(65, 22));
- Shade->setSuffix( tr( " %" ) );
- Shade->setMaxValue( 100 );
- Shade->setMinValue( 0 );
- Shade->setValue( b->Shade );
- Layout4->addMultiCellWidget(Shade, 6, 6, 1, 2, Qt::AlignLeft);
- TextLabel2_3b = new QLabel( Props, "TextLabel2_3b" );
- TextLabel2_3b->setText( tr( "Corner Radius:" ) );
- Layout4->addWidget( TextLabel2_3b, 7, 0 );
- Radius = new QSpinBox(Props, "RR");
- Radius->setMinimumSize( QSize( 65, 22 ) );
- Radius->setSuffix( tr( " pt" ) );
- Radius->setMaxValue(QMIN(static_cast<int>(b->Width),static_cast<int>(b->Height))/2 );
- Radius->setMinValue(QMIN(static_cast<int>(b->Width),static_cast<int>(b->Height))/2 * -1);
- Radius->setValue(qRound(b->RadRect));
- if (b->ClipEdited)
- Radius->setEnabled(false);
- Layout4->addWidget( Radius, 7, 1, Qt::AlignLeft );
-#ifdef HAVE_CMS
- if ((CMSuse) && (CMSavail))
- {
- Text1 = new QLabel( Props, "Text1" );
- Text1->setText( tr( "Input Profile:" ) );
- Layout4->addWidget( Text1, 8, 0 );
- InputP = new QComboBox( true, Props, "InputP" );
- InputP->setMinimumSize( QSize( 190, 22 ) );
- InputP->setEditable(false);
- for (itP = InputProfiles->begin(); itP != InputProfiles->end(); ++itP)
- {
- InputP->insertItem(itP.key());
- if (itP.key() == b->IProfile)
- {
- InputP->setCurrentItem(InputP->count()-1);
- }
- }
- if (!InputProfiles->contains(b->IProfile))
- {
- InputP->insertItem(b->IProfile);
- InputP->setCurrentItem(InputP->count()-1);
- embed = true;
- }
- else
- {
- if (b->EmProfile != "")
- InputP->insertItem(b->EmProfile);
- embed = false;
- }
- EmbedP = embed;
- Layout4->addMultiCellWidget(InputP, 8, 8, 1, 3, Qt::AlignLeft);
- Text2 = new QLabel( Props, "Text2" );
- Text2->setText( tr( "Rendering Intent:" ) );
- Layout4->addWidget( Text2, 9, 0 );
- MonitorI = new QComboBox( true, Props, "MonitorI" );
- MonitorI->insertItem( tr( "Perceptual" ) );
- MonitorI->insertItem( tr( "Relative Colorimetric" ) );
- MonitorI->insertItem( tr( "Saturation" ) );
- MonitorI->insertItem( tr( "Absolute Colorimetric" ) );
- MonitorI->setMinimumSize( QSize( 190, 22 ) );
- MonitorI->setEditable(false);
- MonitorI->setCurrentItem(b->IRender);
- Layout4->addMultiCellWidget(MonitorI, 9, 9, 1, 3, Qt::AlignLeft);
- connect(InputP, SIGNAL(activated(const QString&)), this, SLOT(EmProf(const QString&)));
- }
-#endif
- connect(Kette, SIGNAL(clicked()), this, SLOT(ToggleKette()));
- connect(HScale, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
- connect(VScale, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
- ChangeScaling();
- break;
- default:
- setCaption( tr( "Modify Frame" ) );
- TextLabel1_3_2 = new QLabel( Props, "TextLabel1_3_2" );
- TextLabel1_3_2->setText( tr( "Line Color:" ) );
- Layout4->addWidget( TextLabel1_3_2, 2, 0 );
- TextLabel2_2 = new QLabel( Props, "TextLabel2_2" );
- TextLabel2_2->setText( tr( "Shading:" ) );
- Layout4->addWidget( TextLabel2_2, 3, 0 );
- TextLabel1_3 = new QLabel( Props, "TextLabel1_3" );
- TextLabel1_3->setText( tr( "Fill Color:" ) );
- Layout4->addWidget( TextLabel1_3, 0, 0 );
- TextLabel1_3_3 = new QLabel( Props, "TextLabel1_3_3" );
- TextLabel1_3_3->setText( tr( "Linestyle:" ) );
- Layout4->addWidget( TextLabel1_3_3, 4, 0 );
- TextLabel2 = new QLabel( Props, "TextLabel2" );
- TextLabel2->setText( tr( "Shading:" ) );
- Layout4->addWidget( TextLabel2, 1, 0 );
- TextLabel2_3 = new QLabel( Props, "TextLabel2_3" );
- TextLabel2_3->setText( tr( "Linewidth:" ) );
- Layout4->addWidget( TextLabel2_3, 5, 0 );
- Foreground = new QComboBox( true, Props, "ComboBox1" );
- Foreground->setMinimumSize( QSize( 95, 21 ) );
- Foreground->setEditable(false);
- pm = QPixmap(15, 15);
- if ((b->PType != 5) || (b->PType != 7))
- {
- Foreground->insertItem(tr("None"));
- if (b->Pcolor2 == "None")
- Foreground->setCurrentItem(Foreground->count()-1);
- }
- for (it = Farben.begin(); it != Farben.end(); ++it)
- {
- pm.fill(Farben[it.key()].getRGBColor());
- Foreground->insertItem(pm, it.key());
- if (it.key() == b->Pcolor2)
- Foreground->setCurrentItem(Foreground->count()-1);
- }
- Layout4->addWidget( Foreground, 2, 1 );
- Shade2 = new QSpinBox( Props, "Shade2" );
- Shade2->setMinimumSize( QSize( 65, 22 ) );
- Shade2->setSuffix( tr( " %" ) );
- Shade2->setMaxValue( 100 );
- Shade2->setMinValue( 0 );
- Shade2->setValue( b->Shade2 );
- Layout4->addWidget( Shade2, 3, 1, Qt::AlignLeft );
- Background = new QComboBox( true, Props, "Background" );
- Background->setMinimumSize( QSize( 95, 21 ) );
- Background->setEditable(false);
- pm = QPixmap(15, 15);
- Background->insertItem(tr("None"));
- if (b->Pcolor == "None")
- Background->setCurrentItem(Background->count()-1);
- for (it = Farben.begin(); it != Farben.end(); ++it)
- {
- pm.fill(Farben[it.key()].getRGBColor());
- Background->insertItem(pm, it.key());
- if (it.key() == b->Pcolor)
- {
- Background->setCurrentItem(Background->count()-1);
- }
- }
- Layout4->addWidget( Background, 0, 1 );
- Shade = new QSpinBox( Props, "Shade" );
- Shade->setMinimumSize( QSize( 65, 22 ) );
- Shade->setSuffix( tr( " %" ) );
- Shade->setMaxValue( 100 );
- Shade->setMinValue( 0 );
- Shade->setValue( b->Shade );
- Layout4->addWidget( Shade, 1, 1, Qt::AlignLeft );
- Linestyle = new LineCombo(Props);
- Linestyle->setMinimumSize( QSize( 95, 21 ) );
- switch (b->PLineArt)
- {
- case SolidLine:
- Linestyle->setCurrentItem(0);
- break;
- case DashLine:
- Linestyle->setCurrentItem(1);
- break;
- case DotLine:
- Linestyle->setCurrentItem(2);
- break;
- case DashDotLine:
- Linestyle->setCurrentItem(3);
- break;
- case DashDotDotLine:
- Linestyle->setCurrentItem(4);
- break;
- default:
- Linestyle->setCurrentItem(0);
- break;
- }
- Layout4->addWidget( Linestyle, 4, 1 );
- LineW = new MSpinBox( Props, 1 );
- LineW->setMinimumSize( QSize( 65, 22 ) );
- LineW->setSuffix( tr( " pts" ) );
- LineW->setMaxValue( 120 );
- LineW->setMinValue( 1 ); // hopefull - PFJ
- // No, linewidth 0 is handled by setting the Linecolor to None
- // due to some obscure Bugs in Qt. F.S.
- LineW->setLineStep(10);
- LineW->setValue( qRound(b->Pwidth * 10) );
- Layout4->addWidget( LineW, 5, 1, Qt::AlignLeft );
- if ((b->PType == 5) || (b->PType == 7))
- {
- LineW->setMinValue( 1 );
- Background->setEnabled(false);
- Shade->setEnabled(false);
- TextLabel1_3->setEnabled(false);
- TextLabel2->setEnabled(false);
- if (b->PType == 5)
- Height->setEnabled(false);
- }
- FlippedH->setEnabled(false);
- FlippedV->setEnabled(false);
- if (b->PType == 3)
- {
- TextLabel2_3b = new QLabel( Props, "TextLabel2_3b" );
- TextLabel2_3b->setText( tr( "Corner Radius:" ) );
- Layout4->addWidget( TextLabel2_3b, 6, 0 );
- Radius = new QSpinBox(Props, "RR");
- Radius->setMinimumSize( QSize( 65, 22 ) );
- Radius->setSuffix( tr( " pt" ) );
- Radius->setMaxValue(QMIN(static_cast<int>(b->Width),static_cast<int>(b->Height))/2 );
- Radius->setMinValue(0);
- Radius->setValue(qRound(b->RadRect));
- Layout4->addWidget( Radius, 6, 1, Qt::AlignLeft );
- }
- break;
- }
- TextName = new QLabel( Props, "TextName" );
- TextName->setText( tr( "Name:" ) );
- Layout4->addWidget( TextName, 10, 0 );
- NameEdit = new NameWidget(Props);
- NameEdit->setText(b->AnName);
- Layout4->addWidget( NameEdit, 10, 1 );
- PropsLayout->addLayout( Layout4 );
- Layout5->addMultiCellWidget( Props, 0, 1, 1, 1 );
- Layout5->addColSpacing(0, GroupSpecial->layout()->minimumSize().width()+20);
- ModObjLayout->addLayout( Layout5 );
-
- Layout3 = new QHBoxLayout;
- Layout3->setSpacing( 6 );
- Layout3->setMargin( 10 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- Layout3->addItem( spacer );
- OK = new QPushButton( this, "OK" );
- OK->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, OK->sizePolicy().hasHeightForWidth() ) );
- OK->setText( tr( "OK" ) );
- OK->setDefault( true );
- Layout3->addWidget( OK );
- QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- Layout3->addItem( spacer_2 );
- Apply = new QPushButton( this, "Apply" );
- Apply->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, Apply->sizePolicy().hasHeightForWidth() ) );
- Apply->setText( tr( "Apply" ) );
- Layout3->addWidget( Apply );
- QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- Layout3->addItem( spacer_3 );
- Cancel = new QPushButton( this, "Cancel" );
- Cancel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, Cancel->sizePolicy().hasHeightForWidth() ) );
- Cancel->setText( tr( "Cancel" ) );
- Layout3->addWidget( Cancel );
- QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- Layout3->addItem( spacer_4 );
- ModObjLayout->addLayout( Layout3 );
- if (b->Locked)
- {
- Xpos->setEnabled(false);
- Ypos->setEnabled(false);
- Width->setEnabled(false);
- Height->setEnabled(false);
- Angle->setEnabled(false);
- }
- UnitChange();
- setMinimumSize(ModObjLayout->minimumSize());
- setFocus();
- // signals and slots connections
- connect(Cancel, SIGNAL(clicked()), this, SLOT(NoModifyExit()));
- connect(OK, SIGNAL(clicked()), this, SLOT(DoModifyExit()));
- connect(Apply, SIGNAL(clicked()), this, SLOT(DoModify()));
- connect(Textflow, SIGNAL(clicked()), this, SLOT(ToggleFlow()));
- connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
- if (CurMod->PType == 2)
- {
- connect(FreeScale, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
- connect(FrameScale, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
- }
-}
-
-
-void ModObj::DoModifyExit()
-{
- if (!DoModify())
- return;
- accept();
-}
-
-void ModObj::NoModifyExit()
-{
- disconnect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
- reject();
-}
-
-bool ModObj::DoModify()
-{
- float oldx, oldy;
- disconnect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
- if (NewName())
- {
- connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
- return false;
- }
- connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
- CurMod->AnName = NameEdit->text();
- int itNr = CurMod->ItemNr;
- doc->ActPage->MoveItem(static_cast<float>(Xpos->value())/UmReFaktor/100-CurMod->Xpos, 0, CurMod);
- doc->ActPage->MoveItem(0, static_cast<float>(Ypos->value())/UmReFaktor/100-CurMod->Ypos, CurMod);
- if (origWidth != Width->value())
- doc->ActPage->SizeItem(static_cast<float>(Width->value())/UmReFaktor/100, CurMod->Height, itNr);
- origWidth = Width->value();
- if (origHeight != Height->value())
- doc->ActPage->SizeItem(CurMod->Width, static_cast<float>(Height->value())/UmReFaktor/100, itNr);
- origHeight = Height->value();
- doc->ActPage->RotateItem(static_cast<float>(Angle->value())/-100, itNr);
- CurMod->isPrintable = !Printable->isChecked();
- CurMod->Textflow = Textflow->isChecked();
- CurMod->Textflow2 = Textflow2->isChecked();
- CurMod->flippedH = static_cast<int>(FlippedH->isChecked());
- CurMod->flippedV = static_cast<int>(FlippedV->isChecked());
- switch (CurMod->PType)
- {
- case 8:
- CurMod->Extra = static_cast<float>(Distance->value()) / 10;
- CurMod->BaseOffs = static_cast<float>(-LineW->value()) / 10;
- CurMod->PoShow = NormText2->isChecked();
- doc->ActPage->UpdatePolyClip(CurMod);
- doc->ActPage->AdjustItemSize(CurMod);
- break;
- case 4:
- if (Bookmark->isChecked() != CurMod->isBookmark)
- doc->ActPage->ToggleBookmark();
- if (Annotation->isChecked() != CurMod->isAnnotation)
- doc->ActPage->ToggleAnnotation();
- CurMod->Extra = static_cast<float>(Distance->value()) / 10;
- CurMod->Pcolor = Background->currentText();
- if (CurMod->Pcolor == tr("None"))
- CurMod->Pcolor = "None";
- CurMod->Shade = Shade->value();
- CurMod->Dirty = true;
- if (!CurMod->ClipEdited)
- {
- CurMod->RadRect = static_cast<float>(Radius->value());
- if (Radius->value() != 0)
- {
- CurMod->FrameType = 2;
- CurMod->PLineJoin = RoundJoin;
- }
- else
- {
- CurMod->FrameType = 0;
- CurMod->PLineJoin = MiterJoin;
- }
- doc->ActPage->UpdateClip(CurMod);
- }
- break;
- case 2:
- CurMod->Pcolor = Background->currentText();
- if (CurMod->Pcolor == tr("None"))
- CurMod->Pcolor = "None";
- CurMod->Shade = Shade->value();
- CurMod->PicArt = Visible->isChecked();
- CurMod->LocalX = static_cast<float>(LXpos->value())/ UmReFaktor / 100;
- CurMod->LocalY = static_cast<float>(LYpos->value())/ UmReFaktor / 100;
- oldx = CurMod->LocalViewX / CurMod->LocalScX;
- oldy = CurMod->LocalViewY / CurMod->LocalScY;
- CurMod->LocalScX = static_cast<float>(HScale->value()) / 1000;
- CurMod->LocalScY = static_cast<float>(VScale->value()) / 1000;
- CurMod->LocalViewX = oldy * CurMod->LocalScX;
- CurMod->LocalViewY = oldy * CurMod->LocalScY;
- CurMod->ScaleType = FreeScale->isChecked();
- CurMod->AspectRatio = Aspect->isChecked();
- if (!CurMod->ScaleType)
- {
- doc->ActPage->AdjustPictScale(CurMod);
- doc->ActPage->AdjustPreview(CurMod);
- }
- if (!CurMod->ClipEdited)
- {
- CurMod->RadRect = static_cast<float>(Radius->value());
- if (Radius->value() != 0)
- {
- CurMod->FrameType = 2;
- CurMod->PLineJoin = RoundJoin;
- }
- else
- {
- CurMod->FrameType = 0;
- CurMod->PLineJoin = MiterJoin;
- }
- doc->ActPage->UpdateClip(CurMod);
- }
-#ifdef HAVE_CMS
- if ((CMSuse) && (CMSavail))
- {
- bool CMchange = false;
- if (CurMod->IProfile != InputP->currentText())
- {
- CurMod->IProfile = InputP->currentText();
- CMchange = true;
- }
- if (CurMod->IRender != MonitorI->currentItem())
- {
- CurMod->IRender = MonitorI->currentItem();
- CMchange = true;
- }
- if (CurMod->UseEmbedded != EmbedP)
- {
- CurMod->UseEmbedded = EmbedP;
- CMchange = true;
- }
- if (CMchange)
- doc->ActPage->LoadPict(CurMod->Pfile, CurMod->ItemNr);
- }
-#endif
- break;
- default:
- if ((CurMod->PType != 5) || (CurMod->PType != 7))
- {
- CurMod->Pcolor = Background->currentText();
- if (CurMod->Pcolor == tr("None"))
- CurMod->Pcolor = "None";
- CurMod->Shade = Shade->value();
- }
- if (CurMod->PType == 3)
- {
- if (!CurMod->ClipEdited)
- {
- CurMod->RadRect = static_cast<float>(Radius->value());
- if (Radius->value() != 0)
- CurMod->PLineJoin = RoundJoin;
- else
- CurMod->PLineJoin = MiterJoin;
- }
- }
- CurMod->Pcolor2 = Foreground->currentText();
- if (CurMod->Pcolor2 == tr("None"))
- CurMod->Pcolor2 = "None";
- CurMod->Shade2 = Shade2->value();
- doc->ActPage->ChLineWidth(static_cast<float>(LineW->value()) / 10.0);
- switch (Linestyle->currentItem())
- {
- case 0:
- CurMod->PLineArt = SolidLine;
- break;
- case 1:
- CurMod->PLineArt = DashLine;
- break;
- case 2:
- CurMod->PLineArt = DotLine;
- break;
- case 3:
- CurMod->PLineArt = DashDotLine;
- break;
- case 4:
- CurMod->PLineArt = DashDotDotLine;
- break;
- }
- break;
- }
- doc->ActPage->repaint();
- emit DocChanged();
- return true;
-}
-
-void ModObj::ChangeScaling()
-{
- if (FreeScale->isChecked())
- {
- TextLabel3_2->setEnabled(true);
- TextLabel3_2_2->setEnabled(true);
- TextLabel3_2_2_2->setEnabled(true);
- TextLabel3_2_2_2_2->setEnabled(true);
- LXpos->setEnabled(true);
- LYpos->setEnabled(true);
- HScale->setEnabled(true);
- VScale->setEnabled(true);
- Kette->setEnabled(true);
- Aspect->setEnabled(false);
- }
- else
- {
- TextLabel3_2->setEnabled(false);
- TextLabel3_2_2->setEnabled(false);
- TextLabel3_2_2_2->setEnabled(false);
- TextLabel3_2_2_2_2->setEnabled(false);
- LXpos->setEnabled(false);
- LYpos->setEnabled(false);
- HScale->setEnabled(false);
- VScale->setEnabled(false);
- Kette->setEnabled(false);
- Aspect->setEnabled(true);
- }
-}
-
-void ModObj::ToggleFlow()
-{
- if (Textflow->isChecked())
- Textflow2->setEnabled(true);
- else
- Textflow2->setEnabled(false);
-}
-
-void ModObj::ToggleKette()
-{
- if (Kette->isOn())
- VScale->setValue(HScale->value());
-}
-
-void ModObj::HChange()
-{
- if (Kette->isOn())
- VScale->setValue(HScale->value());
-}
-
-void ModObj::VChange()
-{
- if (Kette->isOn())
- HScale->setValue(VScale->value());
-}
-
-void ModObj::UnitChange()
-{
- switch (doc->Einheit)
- {
- case 0:
- Xpos->setSuffix( tr( " pt" ) );
- Ypos->setSuffix( tr( " pt" ) );
- Width->setSuffix( tr( " pt" ) );
- Height->setSuffix( tr( " pt" ) );
- if (CurMod->PType == 2)
- {
- LXpos->setSuffix( tr( " pt" ) );
- LYpos->setSuffix( tr( " pt" ) );
- }
- if (CurMod->PType == 3)
- Radius->setSuffix( tr( " pt" ) );
- break;
- case 1:
- Xpos->setSuffix( tr( " mm" ) );
- Ypos->setSuffix( tr( " mm" ) );
- Width->setSuffix( tr( " mm" ) );
- Height->setSuffix( tr( " mm" ) );
- if (CurMod->PType == 2)
- {
- LXpos->setSuffix( tr( " mm" ) );
- LYpos->setSuffix( tr( " mm" ) );
- }
- if (CurMod->PType == 3)
- Radius->setSuffix( tr( " mm" ) );
- break;
- case 2:
- Xpos->setSuffix( tr( " in" ) );
- Ypos->setSuffix( tr( " in" ) );
- Width->setSuffix( tr( " in" ) );
- Height->setSuffix( tr( " in" ) );
- if (CurMod->PType == 2)
- {
- LXpos->setSuffix( tr( " in" ) );
- LYpos->setSuffix( tr( " in" ) );
- }
- if (CurMod->PType == 3)
- Radius->setSuffix( tr( " in" ) );
- break;
- case 3:
- Xpos->setSuffix( tr( " p" ) );
- Ypos->setSuffix( tr( " p" ) );
- Width->setSuffix( tr( " p" ) );
- Height->setSuffix( tr( " p" ) );
- if (CurMod->PType == 2)
- {
- LXpos->setSuffix( tr( " p" ) );
- LYpos->setSuffix( tr( " p" ) );
- }
- if (CurMod->PType == 3)
- Radius->setSuffix( tr( " p" ) );
- break;
- }
-}
-
-bool ModObj::NewName()
-{
- QString NameOld = CurMod->AnName;
- QString NameNew = NameEdit->text();
- bool found = false;
- for (uint a = 0; a < view->Pages.count(); ++a)
- {
- for (uint b = 0; b < view->Pages.at(a)->Items.count(); ++b)
- {
- if ((NameNew == view->Pages.at(a)->Items.at(b)->AnName) && (view->Pages.at(a)->Items.at(b) != CurMod))
- {
- found = true;
- break;
- }
- }
- if (found)
- break;
- }
- if (found)
- {
- QMessageBox::warning(this, tr("Warning"), tr("Name \"%1\" isn't unique.\nPlease choose another.").arg(NameNew), tr("OK"));
- NameEdit->setText(NameOld);
- NameEdit->setFocus();
- }
- return found;
-}
-
-void ModObj::EmProf(const QString& prn)
-{
- if (prn.startsWith("Embedded"))
- EmbedP = true;
- else
- EmbedP = false;
-}
/trunk/Scribus/scribus/modify.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-7ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-7ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-7ps.enc (nonexistent)
@@ -1,96 +0,0 @@
-16#A0 /space
-16#A1 /quoteleft
-16#A2 /quoteright
-16#A3 /sterling
-16#A4 /.notdef
-16#A5 /.notdef
-16#A6 /brokenbar
-16#A7 /section
-16#A8 /dieresis
-16#A9 /copyright
-16#AA /.notdef
-16#AB /guillemotleft
-16#AC /logicalnot
-16#AD /hyphen
-16#AE /.notdef
-16#AF /endash
-16#B0 /degree
-16#B1 /plusminus
-16#B2 /twosuperior
-16#B3 /threesuperior
-16#B4 /acute
-16#B5 /dieresisacute
-16#B6 /afii9936
-16#B7 /periodcentered
-16#B8 /afii9937
-16#B9 /afii9938
-16#BA /afii9939
-16#BB /guillemotright
-16#BC /afii9940
-16#BD /onehalf
-16#BE /afii9941
-16#BF /afii9942
-16#C0 /afii9977
-16#C1 /afii9793
-16#C2 /afii9794
-16#C3 /afii9796
-16#C4 /afii9797
-16#C5 /afii9798
-16#C6 /afii9801
-16#C7 /afii9802
-16#C8 /afii9803
-16#C9 /afii9804
-16#CA /afii9805
-16#CB /afii9806
-16#CC /afii9807
-16#CD /afii9808
-16#CE /afii9809
-16#CF /afii9810
-16#D0 /afii9811
-16#D1 /afii9813
-16#D2 /.notdef
-16#D3 /afii9814
-16#D4 /afii9816
-16#D5 /afii9817
-16#D6 /afii9818
-16#D7 /afii9819
-16#D8 /afii9820
-16#D9 /afii9821
-16#DA /afii9943
-16#DB /afii9944
-16#DC /afii9968
-16#DD /afii9969
-16#DE /afii9970
-16#DF /afii9971
-16#E0 /afii9978
-16#E1 /afii9825
-16#E2 /afii9826
-16#E3 /afii9828
-16#E4 /afii9829
-16#E5 /afii9830
-16#E6 /afii9833
-16#E7 /afii9834
-16#E8 /afii9835
-16#E9 /afii9836
-16#EA /afii9837
-16#EB /afii9838
-16#EC /afii9839
-16#ED /afii9840
-16#EE /afii9841
-16#EF /afii9842
-16#F0 /afii9843
-16#F1 /afii9845
-16#F2 /afii9847
-16#F3 /afii9846
-16#F4 /afii9848
-16#F5 /afii9849
-16#F6 /afii9850
-16#F7 /afii9851
-16#F8 /afii9852
-16#F9 /afii9853
-16#FA /afii9975
-16#FB /afii9976
-16#FC /afii9972
-16#FD /afii9973
-16#FE /afii9974
-16#FF /.notdef
/trunk/Scribus/scribus/iso8859-7ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/ISOenc.txt
===================================================================
--- trunk/Scribus/scribus/ISOenc.txt (revision 67)
+++ trunk/Scribus/scribus/ISOenc.txt (nonexistent)
@@ -1,200 +0,0 @@
-A 0101
-AE 0306
-Aacute 0301
-Acircumflex 0302
-Adieresis 0304
-Agrave 0300
-Aring 0305
-Atilde 0303
-B 0102
-C 0103
-Ccedilla 0307
-D 0104
-E 0105
-Eacute 0311
-Ecircumflex 0312
-Edieresis 0313
-Egrave 0310
-Eth 0320
-F 0106
-G 0107
-H 0110
-I 0111
-Iacute 0315
-Icircumflex 0316
-Idieresis 0317
-Igrave 0314
-J 0112
-K 0113
-L 0114
-M 0115
-N 0116
-Ntilde 0321
-O 0117
-Oacute 0323
-Ocircumflex 0324
-Odieresis 0326
-Ograve 0322
-Oslash 0330
-Otilde 0325
-P 0120
-Q 0121
-R 0122
-S 0123
-T 0124
-Thorn 0336
-U 0125
-Uacute 0332
-Ucircumflex 0333
-Udieresis 0334
-Ugrave 0331
-V 0126
-W 0127
-X 0130
-Y 0131
-Yacute 0335
-Z 0132
-a 0141
-aacute 0341
-acircumflex 0342
-acute 0264
-adieresis 0344
-ae 0346
-agrave 0340
-ampersand 046
-aring 0345
-asciicircum 0136
-asciitilde 0176
-asterisk 052
-at 0100
-atilde 0343
-b 0142
-backslash 0134
-bar 0174
-braceleft 0173
-braceright 0175
-bracketleft 0133
-bracketright 0135
-breve 0226
-brokenbar 0246
-c 0143
-caron 0237
-ccedilla 0347
-cedilla 0270
-cent 0242
-circumflex 0223
-colon 072
-comma 054
-copyright 0251
-currency 0244
-d 0144
-degree 0260
-dieresis 0250
-divide 0367
-dollar 044
-dotaccent 0227
-dotlessi 0220
-e 0145
-eacute 0351
-ecircumflex 0352
-edieresis 0353
-egrave 0350
-eight 070
-equal 075
-eth 0360
-exclam 041
-exclamdown 0241
-f 0146
-five 065
-four 064
-g 0147
-germandbls 0337
-grave 0221
-greater 076
-guillemotleft 0253
-guillemotright 0273
-h 0150
-hungarumlaut 0235
-hyphen 0255
-hyphen 055
-i 0151
-iacute 0355
-icircumflex 0356
-idieresis 0357
-igrave 0354
-j 0152
-k 0153
-l 0154
-less 074
-logicalnot 0254
-m 0155
-macron 0257
-mu 0265
-multiply 0327
-n 0156
-nine 071
-ntilde 0361
-numbersign 043
-o 0157
-oacute 0363
-ocircumflex 0364
-odieresis 0366
-ogonek 0236
-ograve 0362
-one 061
-onehalf 0275
-onequarter 0274
-onesuperior 0271
-ordfeminine 0252
-ordmasculine 0272
-oslash 0370
-otilde 0365
-p 0160
-paragraph 0266
-parenleft 050
-parenright 051
-percent 045
-period 056
-periodcentered 0267
-plus 053
-plusminus 0261
-q 0161
-question 077
-questiondown 0277
-quotedbl 042
-quoteleft 0140
-quoteright 047
-r 0162
-registered 0256
-ring 0232
-s 0163
-section 0247
-semicolon 073
-seven 067
-six 066
-slash 057
-space 040
-sterling 0243
-t 0164
-thorn 0376
-three 063
-threequarters 0276
-threesuperior 0263
-tilde 0224
-two 062
-twosuperior 0262
-u 0165
-uacute 0372
-ucircumflex 0373
-udieresis 0374
-ugrave 0371
-underscore 0137
-v 0166
-w 0167
-x 0170
-y 0171
-yacute 0375
-ydieresis 0377
-yen 0245
-z 0172
-zero 060
/trunk/Scribus/scribus/ISOenc.txt
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-2ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-2ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-2ps.enc (nonexistent)
@@ -1,95 +0,0 @@
-16#A1 /Aogonek
-16#A2 /breve
-16#A3 /Lslash
-16#A4 /currency
-16#A5 /Lcaron
-16#A6 /Sacute
-16#A7 /section
-16#A8 /dieresis
-16#A9 /Scaron
-16#AA /Scedilla
-16#AB /Tcaron
-16#AC /Zacute
-16#AD /hyphen
-16#AE /Zcaron
-16#AF /Zdotaccent
-16#B0 /degree
-16#B1 /aogonek
-16#B2 /ogonek
-16#B3 /lslash
-16#B4 /acute
-16#B5 /lcaron
-16#B6 /sacute
-16#B7 /caron
-16#B8 /cedilla
-16#B9 /scaron
-16#BA /scedilla
-16#BB /tcaron
-16#BC /zacute
-16#BD /hungarumlaut
-16#BE /zcaron
-16#BF /zdotaccent
-16#C0 /Racute
-16#C1 /Aacute
-16#C2 /Acircumflex
-16#C3 /Abreve
-16#C4 /Adieresis
-16#C5 /Lacute
-16#C6 /Cacute
-16#C7 /Ccedilla
-16#C8 /Ccaron
-16#C9 /Eacute
-16#CA /Eogonek
-16#CB /Edieresis
-16#CC /Ecaron
-16#CD /Iacute
-16#CE /Icircumflex
-16#CF /Dcaron
-16#D0 /Eth
-16#D1 /Nacute
-16#D2 /Ncaron
-16#D3 /Oacute
-16#D4 /Ocircumflex
-16#D5 /Ohungarumlaut
-16#D6 /Odieresis
-16#D7 /multiply
-16#D8 /Rcaron
-16#D9 /Uring
-16#DA /Uacute
-16#DB /Uhungarumlaut
-16#DC /Udieresis
-16#DD /Yacute
-16#DE /Tcommaaccent
-16#DF /germandbls
-16#E0 /racute
-16#E1 /aacute
-16#E2 /acircumflex
-16#E3 /abreve
-16#E4 /adieresis
-16#E5 /lacute
-16#E6 /cacute
-16#E7 /ccedilla
-16#E8 /ccaron
-16#E9 /eacute
-16#EA /eogonek
-16#EB /edieresis
-16#EC /ecaron
-16#ED /iacute
-16#EE /icircumflex
-16#EF /dcaron
-16#F0 /eth
-16#F1 /nacute
-16#F2 /ncaron
-16#F3 /oacute
-16#F4 /ocircumflex
-16#F5 /ohungarumlaut
-16#F6 /odieresis
-16#F7 /divide
-16#F8 /rcaron
-16#F9 /uring
-16#FA /uacute
-16#FB /uhungarumlaut
-16#FC /udieresis
-16#FD /yacute
-16#FE /tcommaaccent
-16#FF /dotaccent
/trunk/Scribus/scribus/iso8859-2ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/scfonts_ttftypes.h
===================================================================
--- trunk/Scribus/scribus/scfonts_ttftypes.h (revision 67)
+++ trunk/Scribus/scribus/scfonts_ttftypes.h (nonexistent)
@@ -1,220 +0,0 @@
-#ifndef SCFONTS_TTFTYPES_H
-#define SCFONTS_TTFTYPES_H
-
-#if defined(__hpux)
- typedef unsigned char u_int8_t;
- typedef unsigned short u_int16_t;
- typedef unsigned int u_int32_t;
-#endif
-
-#include "config.h"
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#include <sys/types.h>
-
-#ifndef MAKE_ID
-#define MAKE_ID(a,b,c,d) (a<<24|b<<16|c<<8|d)
-#endif
-
-struct fxp16_16_t
-{
- int16_t mantissa;
- uint16_t fraction;
-};
-
-struct tt_datetime_t
-{
- char data[8];
-};
-
-typedef uint16_t fxp14_2_t;
-
-
-struct OffsetTable
-{
- fxp16_16_t version;
- uint16_t numTables;
- uint16_t searchRange;
- uint16_t entrySelector;
- uint16_t rangeShift;
-}; // 12 bytes
-
-
-struct TableDirEntry
-{
- uint32_t tag;
- uint32_t checkSum;
- uint32_t offset;
- uint32_t length;
-}; // 16 bytes
-
-
-struct HeadTable
-{
- fxp16_16_t version;
- fxp16_16_t fontRevision;
- uint32_t checkSumAdjustment;
- uint32_t magicNumber;
- uint16_t flags;
- uint16_t unitsPerEm;
- tt_datetime_t created;
- tt_datetime_t modified;
- int16_t xMin;
- int16_t yMin;
- int16_t xMax;
- int16_t yMax;
- uint16_t macStyle;
- uint16_t lowestRecPPEM;
- uint16_t fontDirectionHint;
- int16_t indexToLocFormat;
- int16_t glyphDataFormat;
-};
-
-/*------------------------------------------------------------*/
-
-struct NameRecord
-{
- uint16_t platformID;
- uint16_t encodingID;
- uint16_t languageID;
- uint16_t nameID;
- uint16_t length;
- uint16_t offset;
-};
-
-/*------------------------------------------------------------*/
-
-struct PostTable
-{
- fxp16_16_t formatType;
- fxp16_16_t italicAngle;
- int16_t underlinePosition;
- int16_t underlineThickness;
- int32_t isFixedPitch;
- int32_t minMemType42;
- uint32_t maxMemType42;
- uint32_t minMemType1;
- uint32_t maxMemType1;
-};
-
-struct Post_GlyphName
-{
- int type;
- int index;
- QString *name;
-};
-
-
-/*-----------------------------------------------------------------*/
-
-
-struct CmapTable
-{
- uint16_t version;
- uint16_t numTables;
-};
-
-struct CmapHeader
-{
- uint16_t platformID;
- uint16_t encodingID;
- uint32_t offset;
-};
-
-struct CmapFormat0
-{
- uint16_t format;
- uint16_t length;
- uint16_t language;
- char glyphIdArray[256];
-};
-
-struct CmapFormat4
-{
- uint16_t format;
- uint16_t length;
- uint16_t language;
- uint16_t segCountX2;
- uint16_t searchRange;
- uint16_t entrySelector;
- uint16_t rangeShift;
- uint16_t *endCount;
- uint16_t reservedPad;
- uint16_t *startCount;
- uint16_t *idDelta;
- uint16_t *idRangeOffset;
- uint16_t *glyphIdArray;
-};
-
-/*-----------------------------------------------------------------*/
-
-struct HheaTable
-{
- fxp16_16_t version;
- int16_t Ascender;
- int16_t Descender;
- int16_t LineGap;
- uint16_t advanceWidthMax;
- int16_t minLeftSideBearing;
- int16_t minRightSideBearing;
- int16_t xMaxExtent;
- int16_t caretSlopeRise;
- int16_t caretSlopeRun;
- int16_t reserved[5];
- int16_t metricDataFormat;
- uint16_t numberOfHMetrics;
-};
-
-struct tt_Box
-{
- int16_t xMin;
- int16_t yMin;
- int16_t xMax;
- int16_t yMax;
-};
-
-struct tt_longHorMetric
-{
- uint16_t advanceWidth;
- int16_t lsb;
-};
-
-/*------------------------------------------------------------*/
-
-struct KernTable
-{
- uint16_t version;
- uint16_t nTables;
-};
-
-struct KernSubTableHeader
-{
- uint16_t version;
- uint16_t length;
- uint16_t coverage;
-};
-
-#define kernHorizontal 0x0001
-#define kernMinimum 0x0002
-#define kernCrossStream 0x0004
-#define kernOverride 0x0008
-#define kernFormat(coverage) ((coverage)>>8)
-
-struct KernSubTable
-{
- uint16_t nPairs;
- uint16_t searchRange;
- uint16_t entrySelector;
- uint16_t rangeShift;
-};
-
-struct KernEntry
-{
- uint16_t left;
- uint16_t right;
- int16_t value;
-};
-
-#endif
/trunk/Scribus/scribus/scfonts_ttftypes.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/kimageeffect.cpp
===================================================================
--- trunk/Scribus/scribus/kimageeffect.cpp (revision 67)
+++ trunk/Scribus/scribus/kimageeffect.cpp (nonexistent)
@@ -1,3841 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@kde.org>
- (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
- (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
- (C) 2000 Josef Weidendorfer <weidendo@in.tum.de>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-// $Id$
-
-#include <cmath>
-
-#include <qimage.h>
-#include <cstdlib>
-#include <iostream>
-
-#include "kimageeffect.h"
-
-#define MaxRGB 255L
-#define DegreesToRadians(x) ((x)*M_PI/180.0)
-
-using namespace std;
-
-inline unsigned int intensityValue(unsigned int color)
-{
- return((unsigned int)((0.299*qRed(color) +
- 0.587*qGreen(color) +
- 0.1140000000000001*qBlue(color))));
-}
-
-//======================================================================
-//
-// Gradient effects
-//
-//======================================================================
-
-QImage KImageEffect::gradient(const QSize &size, const QColor &ca,
- const QColor &cb, GradientType eff, int ncols)
-{
- int rDiff, gDiff, bDiff;
- int rca, gca, bca, rcb, gcb, bcb;
-
- QImage image(size, 32);
-
- if (size.width() == 0 || size.height() == 0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::gradient: invalid image" << endl;
-#endif
- return image;
- }
-
- register int x, y;
-
- rDiff = (rcb = cb.red()) - (rca = ca.red());
- gDiff = (gcb = cb.green()) - (gca = ca.green());
- bDiff = (bcb = cb.blue()) - (bca = ca.blue());
-
- if( eff == VerticalGradient || eff == HorizontalGradient ){
-
- uint *p;
- uint rgb;
-
- register int rl = rca << 16;
- register int gl = gca << 16;
- register int bl = bca << 16;
-
- if( eff == VerticalGradient ) {
-
- int rcdelta = ((1<<16) / size.height()) * rDiff;
- int gcdelta = ((1<<16) / size.height()) * gDiff;
- int bcdelta = ((1<<16) / size.height()) * bDiff;
-
- for ( y = 0; y < size.height(); y++ ) {
- p = (uint *) image.scanLine(y);
-
- rl += rcdelta;
- gl += gcdelta;
- bl += bcdelta;
-
- rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) );
-
- for( x = 0; x < size.width(); x++ ) {
- *p = rgb;
- p++;
- }
- }
-
- }
- else { // must be HorizontalGradient
-
- unsigned int *o_src = (unsigned int *)image.scanLine(0);
- unsigned int *src = o_src;
-
- int rcdelta = ((1<<16) / size.width()) * rDiff;
- int gcdelta = ((1<<16) / size.width()) * gDiff;
- int bcdelta = ((1<<16) / size.width()) * bDiff;
-
- for( x = 0; x < size.width(); x++) {
-
- rl += rcdelta;
- gl += gcdelta;
- bl += bcdelta;
-
- *src++ = qRgb( (rl>>16), (gl>>16), (bl>>16));
- }
-
- src = o_src;
-
- // Believe it or not, manually copying in a for loop is faster
- // than calling memcpy for each scanline (on the order of ms...).
- // I think this is due to the function call overhead (mosfet).
-
- for (y = 1; y < size.height(); ++y) {
-
- p = (unsigned int *)image.scanLine(y);
- src = o_src;
- for(x=0; x < size.width(); ++x)
- *p++ = *src++;
- }
- }
- }
-
- else {
-
- float rfd, gfd, bfd;
- float rd = rca, gd = gca, bd = bca;
-
- unsigned char *xtable[3];
- unsigned char *ytable[3];
-
- unsigned int w = size.width(), h = size.height();
- xtable[0] = new unsigned char[w];
- xtable[1] = new unsigned char[w];
- xtable[2] = new unsigned char[w];
- ytable[0] = new unsigned char[h];
- ytable[1] = new unsigned char[h];
- ytable[2] = new unsigned char[h];
- w*=2, h*=2;
-
- if ( eff == DiagonalGradient || eff == CrossDiagonalGradient) {
- // Diagonal dgradient code inspired by BlackBox (mosfet)
- // BlackBox dgradient is (C) Brad Hughes, <bhughes@tcac.net> and
- // Mike Cole <mike@mydot.com>.
-
- rfd = (float)rDiff/w;
- gfd = (float)gDiff/w;
- bfd = (float)bDiff/w;
-
- int dir;
- for (x = 0; x < size.width(); x++, rd+=rfd, gd+=gfd, bd+=bfd) {
- dir = eff == DiagonalGradient? x : size.width() - x - 1;
- xtable[0][dir] = (unsigned char) rd;
- xtable[1][dir] = (unsigned char) gd;
- xtable[2][dir] = (unsigned char) bd;
- }
- rfd = (float)rDiff/h;
- gfd = (float)gDiff/h;
- bfd = (float)bDiff/h;
- rd = gd = bd = 0;
- for (y = 0; y < size.height(); y++, rd+=rfd, gd+=gfd, bd+=bfd) {
- ytable[0][y] = (unsigned char) rd;
- ytable[1][y] = (unsigned char) gd;
- ytable[2][y] = (unsigned char) bd;
- }
-
- for (y = 0; y < size.height(); y++) {
- unsigned int *scanline = (unsigned int *)image.scanLine(y);
- for (x = 0; x < size.width(); x++) {
- scanline[x] = qRgb(xtable[0][x] + ytable[0][y],
- xtable[1][x] + ytable[1][y],
- xtable[2][x] + ytable[2][y]);
- }
- }
- }
-
- else if (eff == RectangleGradient ||
- eff == PyramidGradient ||
- eff == PipeCrossGradient ||
- eff == EllipticGradient)
- {
- int rSign = rDiff>0? 1: -1;
- int gSign = gDiff>0? 1: -1;
- int bSign = bDiff>0? 1: -1;
-
- rfd = (float)rDiff / size.width();
- gfd = (float)gDiff / size.width();
- bfd = (float)bDiff / size.width();
-
- rd = (float)rDiff/2;
- gd = (float)gDiff/2;
- bd = (float)bDiff/2;
-
- for (x = 0; x < size.width(); x++, rd-=rfd, gd-=gfd, bd-=bfd)
- {
- xtable[0][x] = (unsigned char) abs((int)rd);
- xtable[1][x] = (unsigned char) abs((int)gd);
- xtable[2][x] = (unsigned char) abs((int)bd);
- }
-
- rfd = (float)rDiff/size.height();
- gfd = (float)gDiff/size.height();
- bfd = (float)bDiff/size.height();
-
- rd = (float)rDiff/2;
- gd = (float)gDiff/2;
- bd = (float)bDiff/2;
-
- for (y = 0; y < size.height(); y++, rd-=rfd, gd-=gfd, bd-=bfd)
- {
- ytable[0][y] = (unsigned char) abs((int)rd);
- ytable[1][y] = (unsigned char) abs((int)gd);
- ytable[2][y] = (unsigned char) abs((int)bd);
- }
- unsigned int rgb;
- int h = (size.height()+1)>>1;
- for (y = 0; y < h; y++) {
- unsigned int *sl1 = (unsigned int *)image.scanLine(y);
- unsigned int *sl2 = (unsigned int *)image.scanLine(QMAX(size.height()-y-1, y));
-
- int w = (size.width()+1)>>1;
- int x2 = size.width()-1;
-
- for (x = 0; x < w; x++, x2--) {
- rgb = 0;
- if (eff == PyramidGradient) {
- rgb = qRgb(rcb-rSign*(xtable[0][x]+ytable[0][y]),
- gcb-gSign*(xtable[1][x]+ytable[1][y]),
- bcb-bSign*(xtable[2][x]+ytable[2][y]));
- }
- if (eff == RectangleGradient) {
- rgb = qRgb(rcb - rSign *
- QMAX(xtable[0][x], ytable[0][y]) * 2,
- gcb - gSign *
- QMAX(xtable[1][x], ytable[1][y]) * 2,
- bcb - bSign *
- QMAX(xtable[2][x], ytable[2][y]) * 2);
- }
- if (eff == PipeCrossGradient) {
- rgb = qRgb(rcb - rSign *
- QMIN(xtable[0][x], ytable[0][y]) * 2,
- gcb - gSign *
- QMIN(xtable[1][x], ytable[1][y]) * 2,
- bcb - bSign *
- QMIN(xtable[2][x], ytable[2][y]) * 2);
- }
- if (eff == EllipticGradient) {
- rgb = qRgb(rcb - rSign *
- (int)sqrt((xtable[0][x]*xtable[0][x] +
- ytable[0][y]*ytable[0][y])*2.0),
- gcb - gSign *
- (int)sqrt((xtable[1][x]*xtable[1][x] +
- ytable[1][y]*ytable[1][y])*2.0),
- bcb - bSign *
- (int)sqrt((xtable[2][x]*xtable[2][x] +
- ytable[2][y]*ytable[2][y])*2.0));
- }
-
- sl1[x] = sl2[x] = rgb;
- sl1[x2] = sl2[x2] = rgb;
- }
- }
- }
-
- delete [] xtable[0];
- delete [] xtable[1];
- delete [] xtable[2];
- delete [] ytable[0];
- delete [] ytable[1];
- delete [] ytable[2];
- }
-
- // dither if necessary
- if (ncols && (QPixmap::defaultDepth() < 15 )) {
- if ( ncols < 2 || ncols > 256 )
- ncols = 3;
- QColor *dPal = new QColor[ncols];
- for (int i=0; i<ncols; i++) {
- dPal[i].setRgb ( rca + rDiff * i / ( ncols - 1 ),
- gca + gDiff * i / ( ncols - 1 ),
- bca + bDiff * i / ( ncols - 1 ) );
- }
- dither(image, dPal, ncols);
- delete [] dPal;
- }
-
- return image;
-}
-
-
-// -----------------------------------------------------------------------------
-
-//CT this was (before Dirk A. Mueller's speedup changes)
-// merely the same code as in the above method, but it's supposedly
-// way less performant since it introduces a lot of supplementary tests
-// and simple math operations for the calculus of the balance.
-// (surprizingly, it isn't less performant, in the contrary :-)
-// Yes, I could have merged them, but then the excellent performance of
-// the balanced code would suffer with no other gain than a mere
-// source code and byte code size economy.
-
-QImage KImageEffect::unbalancedGradient(const QSize &size, const QColor &ca,
- const QColor &cb, GradientType eff, int xfactor, int yfactor,
- int ncols)
-{
- int dir; // general parameter used for direction switches
-
- bool _xanti = false , _yanti = false;
-
- if (xfactor < 0) _xanti = true; // negative on X direction
- if (yfactor < 0) _yanti = true; // negative on Y direction
-
- xfactor = abs(xfactor);
- yfactor = abs(yfactor);
-
- if (!xfactor) xfactor = 1;
- if (!yfactor) yfactor = 1;
-
- if (xfactor > 200 ) xfactor = 200;
- if (yfactor > 200 ) yfactor = 200;
-
-
- // float xbal = xfactor/5000.;
- // float ybal = yfactor/5000.;
- float xbal = xfactor/30./size.width();
- float ybal = yfactor/30./size.height();
- float rat;
-
- int rDiff, gDiff, bDiff;
- int rca, gca, bca, rcb, gcb, bcb;
-
- QImage image(size, 32);
-
- if (size.width() == 0 || size.height() == 0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::unbalancedGradient : invalid image\n";
-#endif
- return image;
- }
-
- register int x, y;
- unsigned int *scanline;
-
- rDiff = (rcb = cb.red()) - (rca = ca.red());
- gDiff = (gcb = cb.green()) - (gca = ca.green());
- bDiff = (bcb = cb.blue()) - (bca = ca.blue());
-
- if( eff == VerticalGradient || eff == HorizontalGradient){
- QColor cRow;
-
- uint *p;
- uint rgbRow;
-
- if( eff == VerticalGradient) {
- for ( y = 0; y < size.height(); y++ ) {
- dir = _yanti ? y : size.height() - 1 - y;
- p = (uint *) image.scanLine(dir);
- rat = 1 - exp( - (float)y * ybal );
-
- cRow.setRgb( rcb - (int) ( rDiff * rat ),
- gcb - (int) ( gDiff * rat ),
- bcb - (int) ( bDiff * rat ) );
-
- rgbRow = cRow.rgb();
-
- for( x = 0; x < size.width(); x++ ) {
- *p = rgbRow;
- p++;
- }
- }
- }
- else {
-
- unsigned int *src = (unsigned int *)image.scanLine(0);
- for(x = 0; x < size.width(); x++ )
- {
- dir = _xanti ? x : size.width() - 1 - x;
- rat = 1 - exp( - (float)x * xbal );
-
- src[dir] = qRgb(rcb - (int) ( rDiff * rat ),
- gcb - (int) ( gDiff * rat ),
- bcb - (int) ( bDiff * rat ));
- }
-
- // Believe it or not, manually copying in a for loop is faster
- // than calling memcpy for each scanline (on the order of ms...).
- // I think this is due to the function call overhead (mosfet).
-
- for(y = 1; y < size.height(); ++y)
- {
- scanline = (unsigned int *)image.scanLine(y);
- for(x=0; x < size.width(); ++x)
- scanline[x] = src[x];
- }
- }
- }
-
- else {
- int w=size.width(), h=size.height();
-
- unsigned char *xtable[3];
- unsigned char *ytable[3];
- xtable[0] = new unsigned char[w];
- xtable[1] = new unsigned char[w];
- xtable[2] = new unsigned char[w];
- ytable[0] = new unsigned char[h];
- ytable[1] = new unsigned char[h];
- ytable[2] = new unsigned char[h];
-
- if ( eff == DiagonalGradient || eff == CrossDiagonalGradient)
- {
- for (x = 0; x < w; x++) {
- dir = _xanti ? x : w - 1 - x;
- rat = 1 - exp( - (float)x * xbal );
-
- xtable[0][dir] = (unsigned char) ( rDiff/2 * rat );
- xtable[1][dir] = (unsigned char) ( gDiff/2 * rat );
- xtable[2][dir] = (unsigned char) ( bDiff/2 * rat );
- }
-
- for (y = 0; y < h; y++) {
- dir = _yanti ? y : h - 1 - y;
- rat = 1 - exp( - (float)y * ybal );
-
- ytable[0][dir] = (unsigned char) ( rDiff/2 * rat );
- ytable[1][dir] = (unsigned char) ( gDiff/2 * rat );
- ytable[2][dir] = (unsigned char) ( bDiff/2 * rat );
- }
-
- for (y = 0; y < h; y++) {
- unsigned int *scanline = (unsigned int *)image.scanLine(y);
- for (x = 0; x < w; x++) {
- scanline[x] = qRgb(rcb - (xtable[0][x] + ytable[0][y]),
- gcb - (xtable[1][x] + ytable[1][y]),
- bcb - (xtable[2][x] + ytable[2][y]));
- }
- }
- }
-
- else if (eff == RectangleGradient ||
- eff == PyramidGradient ||
- eff == PipeCrossGradient ||
- eff == EllipticGradient)
- {
- int rSign = rDiff>0? 1: -1;
- int gSign = gDiff>0? 1: -1;
- int bSign = bDiff>0? 1: -1;
-
- for (x = 0; x < w; x++)
- {
- dir = _xanti ? x : w - 1 - x;
- rat = 1 - exp( - (float)x * xbal );
-
- xtable[0][dir] = (unsigned char) abs((int)(rDiff*(0.5-rat)));
- xtable[1][dir] = (unsigned char) abs((int)(gDiff*(0.5-rat)));
- xtable[2][dir] = (unsigned char) abs((int)(bDiff*(0.5-rat)));
- }
-
- for (y = 0; y < h; y++)
- {
- dir = _yanti ? y : h - 1 - y;
-
- rat = 1 - exp( - (float)y * ybal );
-
- ytable[0][dir] = (unsigned char) abs((int)(rDiff*(0.5-rat)));
- ytable[1][dir] = (unsigned char) abs((int)(gDiff*(0.5-rat)));
- ytable[2][dir] = (unsigned char) abs((int)(bDiff*(0.5-rat)));
- }
-
- for (y = 0; y < h; y++) {
- unsigned int *scanline = (unsigned int *)image.scanLine(y);
- for (x = 0; x < w; x++) {
- if (eff == PyramidGradient)
- {
- scanline[x] = qRgb(rcb-rSign*(xtable[0][x]+ytable[0][y]),
- gcb-gSign*(xtable[1][x]+ytable[1][y]),
- bcb-bSign*(xtable[2][x]+ytable[2][y]));
- }
- if (eff == RectangleGradient)
- {
- scanline[x] = qRgb(rcb - rSign *
- QMAX(xtable[0][x], ytable[0][y]) * 2,
- gcb - gSign *
- QMAX(xtable[1][x], ytable[1][y]) * 2,
- bcb - bSign *
- QMAX(xtable[2][x], ytable[2][y]) * 2);
- }
- if (eff == PipeCrossGradient)
- {
- scanline[x] = qRgb(rcb - rSign *
- QMIN(xtable[0][x], ytable[0][y]) * 2,
- gcb - gSign *
- QMIN(xtable[1][x], ytable[1][y]) * 2,
- bcb - bSign *
- QMIN(xtable[2][x], ytable[2][y]) * 2);
- }
- if (eff == EllipticGradient)
- {
- scanline[x] = qRgb(rcb - rSign *
- (int)sqrt((xtable[0][x]*xtable[0][x] +
- ytable[0][y]*ytable[0][y])*2.0),
- gcb - gSign *
- (int)sqrt((xtable[1][x]*xtable[1][x] +
- ytable[1][y]*ytable[1][y])*2.0),
- bcb - bSign *
- (int)sqrt((xtable[2][x]*xtable[2][x] +
- ytable[2][y]*ytable[2][y])*2.0));
- }
- }
- }
- }
-
- if (ncols && (QPixmap::defaultDepth() < 15 )) {
- if ( ncols < 2 || ncols > 256 )
- ncols = 3;
- QColor *dPal = new QColor[ncols];
- for (int i=0; i<ncols; i++) {
- dPal[i].setRgb ( rca + rDiff * i / ( ncols - 1 ),
- gca + gDiff * i / ( ncols - 1 ),
- bca + bDiff * i / ( ncols - 1 ) );
- }
- dither(image, dPal, ncols);
- delete [] dPal;
- }
-
- delete [] xtable[0];
- delete [] xtable[1];
- delete [] xtable[2];
- delete [] ytable[0];
- delete [] ytable[1];
- delete [] ytable[2];
-
- }
-
- return image;
-}
-
-
-//======================================================================
-//
-// Intensity effects
-//
-//======================================================================
-
-
-/* This builds a 256 byte unsigned char lookup table with all
- * the possible percent values prior to applying the effect, then uses
- * integer math for the pixels. For any image larger than 9x9 this will be
- * less expensive than doing a float operation on the 3 color components of
- * each pixel. (mosfet)
- */
-
-QImage& KImageEffect::intensity(QImage &image, float percent)
-{
- if (image.width() == 0 || image.height() == 0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::intensity : invalid image\n";
-#endif
- return image;
- }
-
- int segColors = image.depth() > 8 ? 256 : image.numColors();
- unsigned char *segTbl = new unsigned char[segColors];
- int pixels = image.depth() > 8 ? image.width()*image.height() :
- image.numColors();
- unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() :
- (unsigned int *)image.colorTable();
-
- bool brighten = (percent >= 0);
- if(percent < 0)
- percent = -percent;
-
- if(brighten){ // keep overflow check out of loops
- for(int i=0; i < segColors; ++i){
- int tmp = (int)(i*percent);
- if(tmp > 255)
- tmp = 255;
- segTbl[i] = tmp;
- }
- }
- else{
- for(int i=0; i < segColors; ++i){
- int tmp = (int)(i*percent);
- if(tmp < 0)
- tmp = 0;
- segTbl[i] = tmp;
- }
- }
-
- if(brighten){ // same here
- for(int i=0; i < pixels; ++i){
- int r = qRed(data[i]);
- int g = qGreen(data[i]);
- int b = qBlue(data[i]);
- int a = qAlpha(data[i]);
- r = r + segTbl[r] > 255 ? 255 : r + segTbl[r];
- g = g + segTbl[g] > 255 ? 255 : g + segTbl[g];
- b = b + segTbl[b] > 255 ? 255 : b + segTbl[b];
- data[i] = qRgba(r, g, b,a);
- }
- }
- else{
- for(int i=0; i < pixels; ++i){
- int r = qRed(data[i]);
- int g = qGreen(data[i]);
- int b = qBlue(data[i]);
- int a = qAlpha(data[i]);
- r = r - segTbl[r] < 0 ? 0 : r - segTbl[r];
- g = g - segTbl[g] < 0 ? 0 : g - segTbl[g];
- b = b - segTbl[b] < 0 ? 0 : b - segTbl[b];
- data[i] = qRgba(r, g, b, a);
- }
- }
- delete [] segTbl;
-
- return image;
-}
-
-QImage& KImageEffect::channelIntensity(QImage &image, float percent,
- RGBComponent channel)
-{
- if (image.width() == 0 || image.height() == 0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::channelIntensity : invalid image\n";
-#endif
- return image;
- }
-
- int segColors = image.depth() > 8 ? 256 : image.numColors();
- unsigned char *segTbl = new unsigned char[segColors];
- int pixels = image.depth() > 8 ? image.width()*image.height() :
- image.numColors();
- unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() :
- (unsigned int *)image.colorTable();
- bool brighten = (percent >= 0);
- if(percent < 0)
- percent = -percent;
-
- if(brighten){ // keep overflow check out of loops
- for(int i=0; i < segColors; ++i){
- int tmp = (int)(i*percent);
- if(tmp > 255)
- tmp = 255;
- segTbl[i] = tmp;
- }
- }
- else{
- for(int i=0; i < segColors; ++i){
- int tmp = (int)(i*percent);
- if(tmp < 0)
- tmp = 0;
- segTbl[i] = tmp;
- }
- }
-
- if(brighten){ // same here
- if(channel == Red){ // and here ;-)
- for(int i=0; i < pixels; ++i){
- int c = qRed(data[i]);
- c = c + segTbl[c] > 255 ? 255 : c + segTbl[c];
- data[i] = qRgba(c, qGreen(data[i]), qBlue(data[i]), qAlpha(data[i]));
- }
- }
- if(channel == Green){
- for(int i=0; i < pixels; ++i){
- int c = qGreen(data[i]);
- c = c + segTbl[c] > 255 ? 255 : c + segTbl[c];
- data[i] = qRgba(qRed(data[i]), c, qBlue(data[i]), qAlpha(data[i]));
- }
- }
- else{
- for(int i=0; i < pixels; ++i){
- int c = qBlue(data[i]);
- c = c + segTbl[c] > 255 ? 255 : c + segTbl[c];
- data[i] = qRgba(qRed(data[i]), qGreen(data[i]), c, qAlpha(data[i]));
- }
- }
-
- }
- else{
- if(channel == Red){
- for(int i=0; i < pixels; ++i){
- int c = qRed(data[i]);
- c = c - segTbl[c] < 0 ? 0 : c - segTbl[c];
- data[i] = qRgba(c, qGreen(data[i]), qBlue(data[i]), qAlpha(data[i]));
- }
- }
- if(channel == Green){
- for(int i=0; i < pixels; ++i){
- int c = qGreen(data[i]);
- c = c - segTbl[c] < 0 ? 0 : c - segTbl[c];
- data[i] = qRgba(qRed(data[i]), c, qBlue(data[i]), qAlpha(data[i]));
- }
- }
- else{
- for(int i=0; i < pixels; ++i){
- int c = qBlue(data[i]);
- c = c - segTbl[c] < 0 ? 0 : c - segTbl[c];
- data[i] = qRgba(qRed(data[i]), qGreen(data[i]), c, qAlpha(data[i]));
- }
- }
- }
- delete [] segTbl;
-
- return image;
-}
-
-// Modulate an image with an RBG channel of another image
-//
-QImage& KImageEffect::modulate(QImage &image, QImage &modImage, bool reverse,
- ModulationType type, int factor, RGBComponent channel)
-{
- if (image.width() == 0 || image.height() == 0 ||
- modImage.width() == 0 || modImage.height() == 0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::modulate : invalid image\n";
-#endif
- return image;
- }
-
- int r, g, b, h, s, v, a;
- QColor clr;
- int mod=0;
- unsigned int x1, x2, y1, y2;
- register int x, y;
-
- // for image, we handle only depth 32
- if (image.depth()<32) image = image.convertDepth(32);
-
- // for modImage, we handle depth 8 and 32
- if (modImage.depth()<8) modImage = modImage.convertDepth(8);
-
- unsigned int *colorTable2 = (modImage.depth()==8) ?
- modImage.colorTable():0;
- unsigned int *data1, *data2;
- unsigned char *data2b;
- unsigned int color1, color2;
-
- x1 = image.width(); y1 = image.height();
- x2 = modImage.width(); y2 = modImage.height();
-
- for (y = 0; y < (int)y1; y++) {
- data1 = (unsigned int *) image.scanLine(y);
- data2 = (unsigned int *) modImage.scanLine( y%y2 );
- data2b = (unsigned char *) modImage.scanLine( y%y2 );
-
- x=0;
- while(x < (int)x1) {
- color2 = (colorTable2) ? colorTable2[*data2b] : *data2;
- if (reverse) {
- color1 = color2;
- color2 = *data1;
- }
- else
- color1 = *data1;
-
- if (type == Intensity || type == Contrast) {
- r = qRed(color1);
- g = qGreen(color1);
- b = qBlue(color1);
- if (channel != All) {
- mod = (channel == Red) ? qRed(color2) :
- (channel == Green) ? qGreen(color2) :
- (channel == Blue) ? qBlue(color2) :
- (channel == Gray) ? qGray(color2) : 0;
- mod = mod*factor/50;
- }
-
- if (type == Intensity) {
- if (channel == All) {
- r += r * factor/50 * qRed(color2)/256;
- g += g * factor/50 * qGreen(color2)/256;
- b += b * factor/50 * qBlue(color2)/256;
- }
- else {
- r += r * mod/256;
- g += g * mod/256;
- b += b * mod/256;
- }
- }
- else { // Contrast
- if (channel == All) {
- r += (r-128) * factor/50 * qRed(color2)/128;
- g += (g-128) * factor/50 * qGreen(color2)/128;
- b += (b-128) * factor/50 * qBlue(color2)/128;
- }
- else {
- r += (r-128) * mod/128;
- g += (g-128) * mod/128;
- b += (b-128) * mod/128;
- }
- }
-
- if (r<0) r=0; if (r>255) r=255;
- if (g<0) g=0; if (g>255) g=255;
- if (b<0) b=0; if (b>255) b=255;
- a = qAlpha(*data1);
- *data1 = qRgba(r, g, b, a);
- }
- else if (type == Saturation || type == HueShift) {
- clr.setRgb(color1);
- clr.hsv(&h, &s, &v);
- mod = (channel == Red) ? qRed(color2) :
- (channel == Green) ? qGreen(color2) :
- (channel == Blue) ? qBlue(color2) :
- (channel == Gray) ? qGray(color2) : 0;
- mod = mod*factor/50;
-
- if (type == Saturation) {
- s -= s * mod/256;
- if (s<0) s=0; if (s>255) s=255;
- }
- else { // HueShift
- h += mod;
- while(h<0) h+=360;
- h %= 360;
- }
-
- clr.setHsv(h, s, v);
- a = qAlpha(*data1);
- *data1 = clr.rgb() | ((uint)(a & 0xff) << 24);
- }
- data1++; data2++; data2b++; x++;
- if ( (x%x2) ==0) { data2 -= x2; data2b -= x2; }
- }
- }
- return image;
-}
-
-
-
-//======================================================================
-//
-// Blend effects
-//
-//======================================================================
-
-
-// Nice and fast direct pixel manipulation
-QImage& KImageEffect::blend(const QColor& clr, QImage& dst, float opacity)
-{
- if (dst.width() <= 0 || dst.height() <= 0)
- return dst;
-
- if (opacity < 0.0 || opacity > 1.0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::blend : invalid opacity. Range [0, 1]\n";
-#endif
- return dst;
- }
-
- int depth = dst.depth();
- if (depth != 32)
- dst = dst.convertDepth(32);
-
- int pixels = dst.width() * dst.height();
- int rcol, gcol, bcol;
- clr.rgb(&rcol, &gcol, &bcol);
-
-#ifdef WORDS_BIGENDIAN // ARGB (skip alpha)
- register unsigned char *data = (unsigned char *)dst.bits() + 1;
-#else // BGRA
- register unsigned char *data = (unsigned char *)dst.bits();
-#endif
-
- for (register int i=0; i<pixels; i++)
- {
-#ifdef WORDS_BIGENDIAN
- *(data++) += (unsigned char)((rcol - *data) * opacity);
- *(data++) += (unsigned char)((gcol - *data) * opacity);
- *(data++) += (unsigned char)((bcol - *data) * opacity);
-#else
- *(data++) += (unsigned char)((bcol - *data) * opacity);
- *(data++) += (unsigned char)((gcol - *data) * opacity);
- *(data++) += (unsigned char)((rcol - *data) * opacity);
-#endif
- data++; // skip alpha
- }
- return dst;
-}
-
-// Nice and fast direct pixel manipulation
-QImage& KImageEffect::blend(QImage& src, QImage& dst, float opacity)
-{
- if (src.width() <= 0 || src.height() <= 0)
- return dst;
- if (dst.width() <= 0 || dst.height() <= 0)
- return dst;
-
- if (src.width() != dst.width() || src.height() != dst.height()) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::blend : src and destination images are not the same size\n";
-#endif
- return dst;
- }
-
- if (opacity < 0.0 || opacity > 1.0) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::blend : invalid opacity. Range [0, 1]\n";
-#endif
- return dst;
- }
-
- if (src.depth() != 32) src = src.convertDepth(32);
- if (dst.depth() != 32) dst = dst.convertDepth(32);
-
- int pixels = src.width() * src.height();
-#ifdef WORDS_BIGENDIAN // ARGB (skip alpha)
- register unsigned char *data1 = (unsigned char *)dst.bits() + 1;
- register unsigned char *data2 = (unsigned char *)src.bits() + 1;
-#else // BGRA
- register unsigned char *data1 = (unsigned char *)dst.bits();
- register unsigned char *data2 = (unsigned char *)src.bits();
-#endif
-
- for (register int i=0; i<pixels; i++)
- {
-#ifdef WORDS_BIGENDIAN
- *(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
- *(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
- *(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
-#else
- *(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
- *(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
- *(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
-#endif
- data1++; // skip alpha
- data2++;
- }
-
- return dst;
-}
-
-
-QImage& KImageEffect::blend(QImage &image, float initial_intensity,
- const QColor &bgnd, GradientType eff,
- bool anti_dir)
-{
- if (image.width() == 0 || image.height() == 0 || image.depth()!=32 ) {
-#ifndef NDEBUG
- cerr << "WARNING: KImageEffect::blend : invalid image\n";
-#endif
- return image;
- }
-
- int r_bgnd = bgnd.red(), g_bgnd = bgnd.green(), b_bgnd = bgnd.blue();
- int r, g, b;
- int ind;
-
- unsigned int xi, xf, yi, yf;
- unsigned int a;
-
- // check the boundaries of the initial intesity param
- float unaffected = 1;
- if (initial_intensity > 1) initial_intensity = 1;
- if (initial_intensity < -1) initial_intensity = -1;
- if (initial_intensity < 0) {
- unaffected = 1. + initial_intensity;
- initial_intensity = 0;
- }
-
-
- float intensity = initial_intensity;
- float var = 1. - initial_intensity;
-
- if (anti_dir) {
- initial_intensity = intensity = 1.;
- var = -var;
- }
-
- register int x, y;
-
- unsigned int *data = (unsigned int *)image.bits();
-
- int image_width = image.width(); //Those can't change
- int image_height = image.height();
-
-
- if( eff == VerticalGradient || eff == HorizontalGradient ) {
-
- // set the image domain to apply the effect to
- xi = 0, xf = image_width;
- yi = 0, yf = image_height;
- if (eff == VerticalGradient) {
- if (anti_dir) yf = (int)(image_height * unaffected);
- else yi = (int)(image_height * (1 - unaffected));
- }
- else {
- if (anti_dir) xf = (int)(image_width * unaffected);
- else xi = (int)(image_height * (1 - unaffected));
- }
-
- var /= (eff == VerticalGradient?yf-yi:xf-xi);
-
- int ind_base;
- for (y = yi; y < (int)yf; y++) {
- intensity = eff == VerticalGradient? intensity + var :
- initial_intensity;
- ind_base = image_width * y ;
- for (x = xi; x < (int)xf ; x++) {
- if (eff == HorizontalGradient) intensity += var;
- ind = x + ind_base;
- r = qRed (data[ind]) + (int)(intensity *
- (r_bgnd - qRed (data[ind])));
- g = qGreen(data[ind]) + (int)(intensity *
- (g_bgnd - qGreen(data[ind])));
- b = qBlue (data[ind]) + (int)(intensity *
- (b_bgnd - qBlue (data[ind])));
- if (r > 255) r = 255; if (r < 0 ) r = 0;
- if (g > 255) g = 255; if (g < 0 ) g = 0;
- if (b > 255) b = 255; if (b < 0 ) b = 0;
- a = qAlpha(data[ind]);
- data[ind] = qRgba(r, g, b, a);
- }
- }
- }
- else if (eff == DiagonalGradient || eff == CrossDiagonalGradient) {
- float xvar = var / 2 / image_width; // / unaffected;
- float yvar = var / 2 / image_height; // / unaffected;
- float tmp;
-
- for (x = 0; x < image_width ; x++) {
- tmp = xvar * (eff == DiagonalGradient? x : image.width()-x-1);
- ind = x;
- for (y = 0; y < image_height ; y++) {
- intensity = initial_intensity + tmp + yvar * y;
-
- r = qRed (data[ind]) + (int)(intensity *
- (r_bgnd - qRed (data[ind])));
- g = qGreen(data[ind]) + (int)(intensity *
- (g_bgnd - qGreen(data[ind])));
- b = qBlue (data[ind]) + (int)(intensity *
- (b_bgnd - qBlue (data[ind])));
- if (r > 255) r = 255; if (r < 0 ) r = 0;
- if (g > 255) g = 255; if (g < 0 ) g = 0;
- if (b > 255) b = 255; if (b < 0 ) b = 0;
- a = qAlpha(data[ind]);
- data[ind] = qRgba(r, g, b, a);
-
- ind += image_width;
- }
- }
- }
-
- else if (eff == RectangleGradient || eff == EllipticGradient) {
- float xvar;
- float yvar;
-
- for (x = 0; x < image_width / 2 + image_width % 2; x++) {
- xvar = var / image_width * (image_width - x*2/unaffected-1);
- for (y = 0; y < image_height / 2 + image_height % 2; y++) {
- yvar = var / image_height * (image_height - y*2/unaffected -1);
-
- if (eff == RectangleGradient)
- intensity = initial_intensity + QMAX(xvar, yvar);
- else
- intensity = initial_intensity + sqrt(xvar * xvar + yvar * yvar);
- if (intensity > 1) intensity = 1;
- if (intensity < 0) intensity = 0;
-
- //NW
- ind = x + image_width * y ;
- r = qRed (data[ind]) + (int)(intensity *
- (r_bgnd - qRed (data[ind])));
- g = qGreen(data[ind]) + (int)(intensity *
- (g_bgnd - qGreen(data[ind])));
- b = qBlue (data[ind]) + (int)(intensity *
- (b_bgnd - qBlue (data[ind])));
- if (r > 255) r = 255; if (r < 0 ) r = 0;
- if (g > 255) g = 255; if (g < 0 ) g = 0;
- if (b > 255) b = 255; if (b < 0 ) b = 0;
- a = qAlpha(data[ind]);
- data[ind] = qRgba(r, g, b, a);
-
- //NE
- ind = image_width - x - 1 + image_width * y ;
- r = qRed (data[ind]) + (int)(intensity *
- (r_bgnd - qRed (data[ind])));
- g = qGreen(data[ind]) + (int)(intensity *
- (g_bgnd - qGreen(data[ind])));
- b = qBlue (data[ind]) + (int)(intensity *
- (b_bgnd - qBlue (data[ind])));
- if (r > 255) r = 255; if (r < 0 ) r = 0;
- if (g > 255) g = 255; if (g < 0 ) g = 0;
- if (b > 255) b = 255; if (b < 0 ) b = 0;
- a = qAlpha(data[ind]);
- data[ind] = qRgba(r, g, b, a);
- }
- }
-
- //CT loop is doubled because of stupid central row/column issue.
- // other solution?
- for (x = 0; x < image_width / 2; x++) {
- xvar = var / image_width * (image_width - x*2/unaffected-1);
- for (y = 0; y < image_height / 2; y++) {
- yvar = var / image_height * (image_height - y*2/unaffected -1);
-
- if (eff == RectangleGradient)
- intensity = initial_intensity + QMAX(xvar, yvar);
- else
- intensity = initial_intensity + sqrt(xvar * xvar + yvar * yvar);
- if (intensity > 1) intensity = 1;
- if (intensity < 0) intensity = 0;
-
- //SW
- ind = x + image_width * (image_height - y -1) ;
- r = qRed (data[ind]) + (int)(intensity *
- (r_bgnd - qRed (data[ind])));
- g = qGreen(data[ind]) + (int)(intensity *
- (g_bgnd - qGreen(data[ind])));
- b = qBlue (data[ind]) + (int)(intensity *
- (b_bgnd - qBlue (data[ind])));
- if (r > 255) r = 255; if (r < 0 ) r = 0;
- if (g > 255) g = 255; if (g < 0 ) g = 0;
- if (b > 255) b = 255; if (b < 0 ) b = 0;
- a = qAlpha(data[ind]);
- data[ind] = qRgba(r, g, b, a);
-
- //SE
- ind = image_width-x-1 + image_width * (image_height - y - 1) ;
- r = qRed (data[ind]) + (int)(intensity *
- (r_bgnd - qRed (data[ind])));
- g = qGreen(data[ind]) + (int)(intensity *
- (g_bgnd - qGreen(data[ind])));
- b = qBlue (data[ind]) + (int)(intensity *
- (b_bgnd - qBlue (data[ind])));
- if (r > 255) r = 255; if (r < 0 ) r = 0;
- if (g > 255) g = 255; if (g < 0 ) g = 0;
- if (b > 255) b = 255; if (b < 0 ) b = 0;
- a = qAlpha(data[ind]);
- data[ind] = qRgba(r, g, b, a);
- }
- }
- }
-#ifndef NDEBUG
- else cerr << "KImageEffect::blend effect not implemented" << endl;
-#endif
- return image;
-}
-
-// Not very efficient as we create a third big image...
-//
-QImage& KImageEffect::blend(QImage &image1, QImage &image2,
- GradientType gt, int xf, int yf)
-{
- if (image1.width() == 0 || image1.height() == 0 ||
- image2.width() == 0 || image2.height() == 0)
- return image1;
-
- QImage image3;
-
- image3 = KImageEffect::unbalancedGradient(image1.size(),
- QColor(0,0,0), QColor(255,255,255),
- gt, xf, yf, 0);
-
- return blend(image1,image2,image3, Red); // Channel to use is arbitrary
-}
-
-// Blend image2 into image1, using an RBG channel of blendImage
-//
-QImage& KImageEffect::blend(QImage &image1, QImage &image2,
- QImage &blendImage, RGBComponent channel)
-{
- if (image1.width() == 0 || image1.height() == 0 ||
- image2.width() == 0 || image2.height() == 0 ||
- blendImage.width() == 0 || blendImage.height() == 0) {
-#ifndef NDEBUG
- cerr << "KImageEffect::blend effect invalid image" << endl;
-#endif
- return image1;
- }
-
- int r, g, b;
- int ind1, ind2, ind3;
-
- unsigned int x1, x2, x3, y1, y2, y3;
- unsigned int a;
-
- register int x, y;
-
- // for image1 and image2, we only handle depth 32
- if (image1.depth()<32) image1 = image1.convertDepth(32);
- if (image2.depth()<32) image2 = image2.convertDepth(32);
-
- // for blendImage, we handle depth 8 and 32
- if (blendImage.depth()<8) blendImage = blendImage.convertDepth(8);
-
- unsigned int *colorTable3 = (blendImage.depth()==8) ?
- blendImage.colorTable():0;
-
- unsigned int *data1 = (unsigned int *)image1.bits();
- unsigned int *data2 = (unsigned int *)image2.bits();
- unsigned int *data3 = (unsigned int *)blendImage.bits();
- unsigned char *data3b = (unsigned char *)blendImage.bits();
- unsigned int color3;
-
- x1 = image1.width(); y1 = image1.height();
- x2 = image2.width(); y2 = image2.height();
- x3 = blendImage.width(); y3 = blendImage.height();
-
- for (y = 0; y < (int)y1; y++) {
- ind1 = x1*y;
- ind2 = x2*(y%y2);
- ind3 = x3*(y%y3);
-
- x=0;
- while(x < (int)x1) {
- color3 = (colorTable3) ? colorTable3[data3b[ind3]] : data3[ind3];
-
- a = (channel == Red) ? qRed(color3) :
- (channel == Green) ? qGreen(color3) :
- (channel == Blue) ? qBlue(color3) : qGray(color3);
-
- r = (a*qRed(data1[ind1]) + (256-a)*qRed(data2[ind2]))/256;
- g = (a*qGreen(data1[ind1]) + (256-a)*qGreen(data2[ind2]))/256;
- b = (a*qBlue(data1[ind1]) + (256-a)*qBlue(data2[ind2]))/256;
-
- a = qAlpha(data1[ind1]);
- data1[ind1] = qRgba(r, g, b, a);
-
- ind1++; ind2++; ind3++; x++;
- if ( (x%x2) ==0) ind2 -= x2;
- if ( (x%x3) ==0) ind3 -= x3;
- }
- }
- return image1;
-}
-
-
-//======================================================================
-//
-// Hash effects
-//
-//======================================================================
-
-unsigned int KImageEffect::lHash(unsigned int c)
-{
- unsigned char r = qRed(c), g = qGreen(c), b = qBlue(c), a = qAlpha(c);
- unsigned char nr, ng, nb;
- nr =(r >> 1) + (r >> 2); nr = nr > r ? 0 : nr;
- ng =(g >> 1) + (g >> 2); ng = ng > g ? 0 : ng;
- nb =(b >> 1) + (b >> 2); nb = nb > b ? 0 : nb;
-
- return qRgba(nr, ng, nb, a);
-}
-
-
-// -----------------------------------------------------------------------------
-
-unsigned int KImageEffect::uHash(unsigned int c)
-{
- unsigned char r = qRed(c), g = qGreen(c), b = qBlue(c), a = qAlpha(c);
- unsigned char nr, ng, nb;
- nr = r + (r >> 3); nr = nr < r ? ~0 : nr;
- ng = g + (g >> 3); ng = ng < g ? ~0 : ng;
- nb = b + (b >> 3); nb = nb < b ? ~0 : nb;
-
- return qRgba(nr, ng, nb, a);
-}
-
-
-// -----------------------------------------------------------------------------
-
-QImage& KImageEffect::hash(QImage &image, Lighting lite, unsigned int spacing)
-{
- if (image.width() == 0 || image.height() == 0) {
-#ifndef NDEBUG
- cerr << "KImageEffect::hash effect invalid image" << endl;
-#endif
- return image;
- }
-
- register int x, y;
- unsigned int *data = (unsigned int *)image.bits();
- unsigned int ind;
-
- //CT no need to do it if not enough space
- if ((lite == NorthLite ||
- lite == SouthLite)&&
- (unsigned)image.height() < 2+spacing) return image;
- if ((lite == EastLite ||
- lite == WestLite)&&
- (unsigned)image.height() < 2+spacing) return image;
-
- if (lite == NorthLite || lite == SouthLite) {
- for (y = 0 ; y < image.height(); y = y + 2 + spacing) {
- for (x = 0; x < image.width(); x++) {
- ind = x + image.width() * y;
- data[ind] = lite==NorthLite?uHash(data[ind]):lHash(data[ind]);
-
- ind = ind + image.width();
- data[ind] = lite==NorthLite?lHash(data[ind]):uHash(data[ind]);
- }
- }
- }
-
- else if (lite == EastLite || lite == WestLite) {
- for (y = 0 ; y < image.height(); y++) {
- for (x = 0; x < image.width(); x = x + 2 + spacing) {
- ind = x + image.width() * y;
- data[ind] = lite==EastLite?uHash(data[ind]):lHash(data[ind]);
-
- ind++;
- data[ind] = lite==EastLite?lHash(data[ind]):uHash(data[ind]);
- }
- }
- }
-
- else if (lite == NWLite || lite == SELite) {
- for (y = 0 ; y < image.height(); y++) {
- for (x = 0;
- x < (int)(image.width() - ((y & 1)? 1 : 0) * spacing);
- x = x + 2 + spacing) {
- ind = x + image.width() * y + ((y & 1)? 1 : 0);
- data[ind] = lite==NWLite?uHash(data[ind]):lHash(data[ind]);
-
- ind++;
- data[ind] = lite==NWLite?lHash(data[ind]):uHash(data[ind]);
- }
- }
- }
-
- else if (lite == SWLite || lite == NELite) {
- for (y = 0 ; y < image.height(); y++) {
- for (x = 0 + ((y & 1)? 1 : 0); x < image.width(); x = x + 2 + spacing) {
- ind = x + image.width() * y - ((y & 1)? 1 : 0);
- data[ind] = lite==SWLite?uHash(data[ind]):lHash(data[ind]);
-
- ind++;
- data[ind] = lite==SWLite?lHash(data[ind]):uHash(data[ind]);
- }
- }
- }
-
- return image;
-}
-
-
-//======================================================================
-//
-// Flatten effects
-//
-//======================================================================
-
-QImage& KImageEffect::flatten(QImage &img, const QColor &ca,
- const QColor &cb, int ncols)
-{
- if (img.width() == 0 || img.height() == 0)
- return img;
-
- // a bitmap is easy...
- if (img.depth() == 1) {
- img.setColor(0, ca.rgb());
- img.setColor(1, cb.rgb());
- return img;
- }
-
- int r1 = ca.red(); int r2 = cb.red();
- int g1 = ca.green(); int g2 = cb.green();
- int b1 = ca.blue(); int b2 = cb.blue();
- int min = 0, max = 255;
-
- QRgb col;
-
- // Get minimum and maximum greylevel.
- if (img.numColors()) {
- // pseudocolor
- for (int i = 0; i < img.numColors(); i++) {
- col = img.color(i);
- int mean = (qRed(col) + qGreen(col) + qBlue(col)) / 3;
- min = QMIN(min, mean);
- max = QMAX(max, mean);
- }
- } else {
- // truecolor
- for (int y=0; y < img.height(); y++)
- for (int x=0; x < img.width(); x++) {
- col = img.pixel(x, y);
- int mean = (qRed(col) + qGreen(col) + qBlue(col)) / 3;
- min = QMIN(min, mean);
- max = QMAX(max, mean);
- }
- }
-
- // Conversion factors
- float sr = ((float) r2 - r1) / (max - min);
- float sg = ((float) g2 - g1) / (max - min);
- float sb = ((float) b2 - b1) / (max - min);
-
-
- // Repaint the image
- if (img.numColors()) {
- for (int i=0; i < img.numColors(); i++) {
- col = img.color(i);
- int mean = (qRed(col) + qGreen(col) + qBlue(col)) / 3;
- int r = (int) (sr * (mean - min) + r1 + 0.5);
- int g = (int) (sg * (mean - min) + g1 + 0.5);
- int b = (int) (sb * (mean - min) + b1 + 0.5);
- img.setColor(i, qRgba(r, g, b, qAlpha(col)));
- }
- } else {
- for (int y=0; y < img.height(); y++)
- for (int x=0; x < img.width(); x++) {
- col = img.pixel(x, y);
- int mean = (qRed(col) + qGreen(col) + qBlue(col)) / 3;
- int r = (int) (sr * (mean - min) + r1 + 0.5);
- int g = (int) (sg * (mean - min) + g1 + 0.5);
- int b = (int) (sb * (mean - min) + b1 + 0.5);
- img.setPixel(x, y, qRgba(r, g, b, qAlpha(col)));
- }
- }
-
-
- // Dither if necessary
- if ( (ncols <= 0) || ((img.numColors() != 0) && (img.numColors() <= ncols)))
- return img;
-
- if (ncols == 1) ncols++;
- if (ncols > 256) ncols = 256;
-
- QColor *pal = new QColor[ncols];
- sr = ((float) r2 - r1) / (ncols - 1);
- sg = ((float) g2 - g1) / (ncols - 1);
- sb = ((float) b2 - b1) / (ncols - 1);
-
- for (int i=0; i<ncols; i++)
- pal[i] = QColor(r1 + int(sr*i), g1 + int(sg*i), b1 + int(sb*i));
-
- dither(img, pal, ncols);
-
- delete[] pal;
- return img;
-}
-
-
-//======================================================================
-//
-// Fade effects
-//
-//======================================================================
-
-QImage& KImageEffect::fade(QImage &img, float val, const QColor &color)
-{
- if (img.width() == 0 || img.height() == 0)
- return img;
-
- // We don't handle bitmaps
- if (img.depth() == 1)
- return img;
-
- unsigned char tbl[256];
- for (int i=0; i<256; i++)
- tbl[i] = (int) (val * i + 0.5);
-
- int red = color.red();
- int green = color.green();
- int blue = color.blue();
-
- QRgb col;
- int r, g, b, cr, cg, cb;
-
- if (img.depth() <= 8) {
- // pseudo color
- for (int i=0; i<img.numColors(); i++) {
- col = img.color(i);
- cr = qRed(col); cg = qGreen(col); cb = qBlue(col);
- if (cr > red)
- r = cr - tbl[cr - red];
- else
- r = cr + tbl[red - cr];
- if (cg > green)
- g = cg - tbl[cg - green];
- else
- g = cg + tbl[green - cg];
- if (cb > blue)
- b = cb - tbl[cb - blue];
- else
- b = cb + tbl[blue - cb];
- img.setColor(i, qRgba(r, g, b, qAlpha(col)));
- }
-
- } else {
- // truecolor
- for (int y=0; y<img.height(); y++) {
- QRgb *data = (QRgb *) img.scanLine(y);
- for (int x=0; x<img.width(); x++) {
- col = *data;
- cr = qRed(col); cg = qGreen(col); cb = qBlue(col);
- if (cr > red)
- r = cr - tbl[cr - red];
- else
- r = cr + tbl[red - cr];
- if (cg > green)
- g = cg - tbl[cg - green];
- else
- g = cg + tbl[green - cg];
- if (cb > blue)
- b = cb - tbl[cb - blue];
- else
- b = cb + tbl[blue - cb];
- *data++ = qRgba(r, g, b, qAlpha(col));
- }
- }
- }
-
- return img;
-}
-
-//======================================================================
-//
-// Color effects
-//
-//======================================================================
-
-// This code is adapted from code (C) Rik Hemsley <rik@kde.org>
-//
-// The formula used (r + b + g) /3 is different from the qGray formula
-// used by Qt. This is because our formula is much much faster. If,
-// however, it turns out that this is producing sub-optimal images,
-// then it will have to change (kurt)
-//
-// It does produce lower quality grayscale ;-) Use fast == true for the fast
-// algorithm, false for the higher quality one (mosfet).
-QImage& KImageEffect::toGray(QImage &img, bool fast)
-{
- if (img.width() == 0 || img.height() == 0)
- return img;
-
- if(fast){
- if (img.depth() == 32) {
- register uchar * r(img.bits());
- register uchar * g(img.bits() + 1);
- register uchar * b(img.bits() + 2);
-
- uchar * end(img.bits() + img.numBytes());
-
- while (r != end) {
-
- *r = *g = *b = (((*r + *g) >> 1) + *b) >> 1; // (r + b + g) / 3
-
- r += 4;
- g += 4;
- b += 4;
- }
- }
- else
- {
- for (int i = 0; i < img.numColors(); i++)
- {
- register uint r = qRed(img.color(i));
- register uint g = qGreen(img.color(i));
- register uint b = qBlue(img.color(i));
-
- register uint gray = (((r + g) >> 1) + b) >> 1;
- img.setColor(i, qRgba(gray, gray, gray, qAlpha(img.color(i))));
- }
- }
- }
- else{
- int pixels = img.depth() > 8 ? img.width()*img.height() :
- img.numColors();
- unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() :
- (unsigned int *)img.colorTable();
- int val, i;
- for(i=0; i < pixels; ++i){
- val = qGray(data[i]);
- data[i] = qRgba(val, val, val, qAlpha(data[i]));
- }
- }
- return img;
-}
-
-// CT 29Jan2000 - desaturation algorithms
-QImage& KImageEffect::desaturate(QImage &img, float desat)
-{
- if (img.width() == 0 || img.height() == 0)
- return img;
-
- if (desat < 0) desat = 0.;
- if (desat > 1) desat = 1.;
- int pixels = img.depth() > 8 ? img.width()*img.height() :
- img.numColors();
- unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() :
- (unsigned int *)img.colorTable();
- int h, s, v, i;
- QColor clr; // keep constructor out of loop (mosfet)
- for(i=0; i < pixels; ++i){
- clr.setRgb(data[i]);
- clr.hsv(&h, &s, &v);
- clr.setHsv(h, (int)(s * (1. - desat)), v);
- data[i] = clr.rgb();
- }
- return img;
-}
-
-// Contrast stuff (mosfet)
-QImage& KImageEffect::contrast(QImage &img, int c)
-{
- if (img.width() == 0 || img.height() == 0)
- return img;
-
- if(c > 255)
- c = 255;
- if(c < -255)
- c = -255;
- int pixels = img.depth() > 8 ? img.width()*img.height() :
- img.numColors();
- unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() :
- (unsigned int *)img.colorTable();
- int i, r, g, b;
- for(i=0; i < pixels; ++i){
- r = qRed(data[i]);
- g = qGreen(data[i]);
- b = qBlue(data[i]);
- if(qGray(data[i]) <= 127){
- if(r - c <= 255)
- r -= c;
- if(g - c <= 255)
- g -= c;
- if(b - c <= 255)
- b -= c;
- }
- else{
- if(r + c <= 255)
- r += c;
- if(g + c <= 255)
- g += c;
- if(b + c <= 255)
- b += c;
- }
- data[i] = qRgba(r, g, b, qAlpha(data[i]));
- }
- return(img);
-}
-
-//======================================================================
-//
-// Dithering effects
-//
-//======================================================================
-
-// adapted from kFSDither (C) 1997 Martin Jones (mjones@kde.org)
-//
-// Floyd-Steinberg dithering
-// Ref: Bitmapped Graphics Programming in C++
-// Marv Luse, Addison-Wesley Publishing, 1993.
-QImage& KImageEffect::dither(QImage &img, const QColor *palette, int size)
-{
- if (img.width() == 0 || img.height() == 0 ||
- palette == 0 || img.depth() <= 8)
- return img;
-
- QImage dImage( img.width(), img.height(), 8, size );
- int i;
-
- dImage.setNumColors( size );
- for ( i = 0; i < size; i++ )
- dImage.setColor( i, palette[ i ].rgb() );
-
- int *rerr1 = new int [ img.width() * 2 ];
- int *gerr1 = new int [ img.width() * 2 ];
- int *berr1 = new int [ img.width() * 2 ];
-
- memset( rerr1, 0, sizeof( int ) * img.width() * 2 );
- memset( gerr1, 0, sizeof( int ) * img.width() * 2 );
- memset( berr1, 0, sizeof( int ) * img.width() * 2 );
-
- int *rerr2 = rerr1 + img.width();
- int *gerr2 = gerr1 + img.width();
- int *berr2 = berr1 + img.width();
-
- for ( int j = 0; j < img.height(); j++ )
- {
- uint *ip = (uint * )img.scanLine( j );
- uchar *dp = dImage.scanLine( j );
-
- for ( i = 0; i < img.width(); i++ )
- {
- rerr1[i] = rerr2[i] + qRed( *ip );
- rerr2[i] = 0;
- gerr1[i] = gerr2[i] + qGreen( *ip );
- gerr2[i] = 0;
- berr1[i] = berr2[i] + qBlue( *ip );
- berr2[i] = 0;
- ip++;
- }
-
- *dp++ = nearestColor( rerr1[0], gerr1[0], berr1[0], palette, size );
-
- for ( i = 1; i < img.width()-1; i++ )
- {
- int indx = nearestColor( rerr1[i], gerr1[i], berr1[i], palette, size );
- *dp = indx;
-
- int rerr = rerr1[i];
- rerr -= palette[indx].red();
- int gerr = gerr1[i];
- gerr -= palette[indx].green();
- int berr = berr1[i];
- berr -= palette[indx].blue();
-
- // diffuse red error
- rerr1[ i+1 ] += ( rerr * 7 ) >> 4;
- rerr2[ i-1 ] += ( rerr * 3 ) >> 4;
- rerr2[ i ] += ( rerr * 5 ) >> 4;
- rerr2[ i+1 ] += ( rerr ) >> 4;
-
- // diffuse green error
- gerr1[ i+1 ] += ( gerr * 7 ) >> 4;
- gerr2[ i-1 ] += ( gerr * 3 ) >> 4;
- gerr2[ i ] += ( gerr * 5 ) >> 4;
- gerr2[ i+1 ] += ( gerr ) >> 4;
-
- // diffuse red error
- berr1[ i+1 ] += ( berr * 7 ) >> 4;
- berr2[ i-1 ] += ( berr * 3 ) >> 4;
- berr2[ i ] += ( berr * 5 ) >> 4;
- berr2[ i+1 ] += ( berr ) >> 4;
-
- dp++;
- }
-
- *dp = nearestColor( rerr1[i], gerr1[i], berr1[i], palette, size );
- }
-
- delete [] rerr1;
- delete [] gerr1;
- delete [] berr1;
-
- img = dImage;
- return img;
-}
-
-int KImageEffect::nearestColor( int r, int g, int b, const QColor *palette, int size )
-{
- if (palette == 0)
- return 0;
-
- int dr = palette[0].red() - r;
- int dg = palette[0].green() - g;
- int db = palette[0].blue() - b;
-
- int minDist = dr*dr + dg*dg + db*db;
- int nearest = 0;
-
- for (int i = 1; i < size; i++ )
- {
- dr = palette[i].red() - r;
- dg = palette[i].green() - g;
- db = palette[i].blue() - b;
-
- int dist = dr*dr + dg*dg + db*db;
-
- if ( dist < minDist )
- {
- minDist = dist;
- nearest = i;
- }
- }
-
- return nearest;
-}
-
-bool KImageEffect::blend(
- const QImage & upper,
- const QImage & lower,
- QImage & output
-)
-{
- if (
- upper.width() > lower.width() ||
- upper.height() > lower.height() ||
- upper.depth() != 32 ||
- lower.depth() != 32
- )
- {
-#ifndef NDEBUG
- cerr << "KImageEffect::blend : Sizes not correct\n" ;
-#endif
- return false;
- }
-
- output = lower.copy();
-
- register uchar *i, *o;
- register int a;
- register int col;
- register int w = upper.width();
- int row(upper.height() - 1);
-
- do {
-
- i = upper.scanLine(row);
- o = output.scanLine(row);
-
- col = w << 2;
- --col;
-
- do {
-
- while (!(a = i[col]) && (col != 3)) {
- --col; --col; --col; --col;
- }
-
- --col;
- o[col] += ((i[col] - o[col]) * a) >> 8;
-
- --col;
- o[col] += ((i[col] - o[col]) * a) >> 8;
-
- --col;
- o[col] += ((i[col] - o[col]) * a) >> 8;
-
- } while (col--);
-
- } while (row--);
-
- return true;
-}
-
-#if 0
-// Not yet...
-bool KImageEffect::blend(
- const QImage & upper,
- const QImage & lower,
- QImage & output,
- const QRect & destRect
-)
-{
- output = lower.copy();
- return output;
-}
-
-#endif
-
-bool KImageEffect::blend(
- int &x, int &y,
- const QImage & upper,
- const QImage & lower,
- QImage & output
-)
-{
- int cx=0, cy=0, cw=upper.width(), ch=upper.height();
-
- if ( upper.width() + x > lower.width() ||
- upper.height() + y > lower.height() ||
- x < 0 || y < 0 ||
- upper.depth() != 32 || lower.depth() != 32 )
- {
- if ( x > lower.width() || y > lower.height() ) return false;
- if ( upper.width()<=0 || upper.height() <= 0 ) return false;
- if ( lower.width()<=0 || lower.height() <= 0 ) return false;
-
- if (x<0) {cx=-x; cw+=x; x=0; };
- if (cw + x > lower.width()) { cw=lower.width()-x; };
- if (y<0) {cy=-y; ch+=y; y=0; };
- if (ch + y > lower.height()) { ch=lower.height()-y; };
-
- if ( cx >= upper.width() || cy >= upper.height() ) return true;
- if ( cw <= 0 || ch <= 0 ) return true;
- }
-
- output.create(cw,ch,32);
-// output.setAlphaBuffer(true); // I should do some benchmarks to see if
- // this is worth the effort
-
- register QRgb *i, *o, *b;
-
- register int a;
- register int j,k;
- for (j=0; j<ch; j++)
- {
- b=reinterpret_cast<QRgb *>(&lower.scanLine(y+j) [ (x+cw) << 2 ]);
- i=reinterpret_cast<QRgb *>(&upper.scanLine(cy+j)[ (cx+cw) << 2 ]);
- o=reinterpret_cast<QRgb *>(&output.scanLine(j) [ cw << 2 ]);
-
- k=cw-1;
- --b; --i; --o;
- do
- {
- while ( !(a=qAlpha(*i)) && k>0 )
- {
- i--;
-// *o=0;
- *o=*b;
- --o; --b;
- k--;
- };
-// *o=0xFF;
- *o = qRgb(qRed(*b) + (((qRed(*i) - qRed(*b)) * a) >> 8),
- qGreen(*b) + (((qGreen(*i) - qGreen(*b)) * a) >> 8),
- qBlue(*b) + (((qBlue(*i) - qBlue(*b)) * a) >> 8));
- --i; --o; --b;
- } while (k--);
- }
-
- return true;
-}
-
-bool KImageEffect::blendOnLower(
- int x, int y,
- const QImage & upper,
- const QImage & lower
-)
-{
- int cx=0, cy=0, cw=upper.width(), ch=upper.height();
-
- if ( upper.depth() != 32 || lower.depth() != 32 ) return false;
- if ( x + cw > lower.width() ||
- y + ch > lower.height() ||
- x < 0 || y < 0 )
- {
- if ( x > lower.width() || y > lower.height() ) return true;
- if ( upper.width()<=0 || upper.height() <= 0 ) return true;
- if ( lower.width()<=0 || lower.height() <= 0 ) return true;
-
- if (x<0) {cx=-x; cw+=x; x=0; };
- if (cw + x > lower.width()) { cw=lower.width()-x; };
- if (y<0) {cy=-y; ch+=y; y=0; };
- if (ch + y > lower.height()) { ch=lower.height()-y; };
-
- if ( cx >= upper.width() || cy >= upper.height() ) return true;
- if ( cw <= 0 || ch <= 0 ) return true;
- }
-
- register uchar *i, *b;
- register int a;
- register int k;
-
- for (int j=0; j<ch; j++)
- {
- b=&lower.scanLine(y+j) [ (x+cw) << 2 ];
- i=&upper.scanLine(cy+j)[ (cx+cw) << 2 ];
-
- k=cw-1;
- --b; --i;
- do
- {
- while ( !(a=*i) && k>0 )
- {
- i-=4; b-=4; k--;
- };
-
- --i; --b;
- *b += ( ((*i - *b) * a) >> 8 );
- --i; --b;
- *b += ( ((*i - *b) * a) >> 8 );
- --i; --b;
- *b += ( ((*i - *b) * a) >> 8 );
- --i; --b;
- } while (k--);
- }
-
- return true;
-}
-
-// For selected icons
-// Code added by David Faure - I couldn't find a similar effect
-// among the existing ones, but I may have overlooked...
-QImage& KImageEffect::selectedImage( QImage &img, const QColor &col )
-{
- if ( img.depth() != 32 ) {
-#ifndef NDEBUG
- qDebug("KImageEffect::selectedImage converting to 32 bit");
-#endif
- img = img.convertDepth(32); // is this ok?
- }
- int w = img.width();
- int h = img.height();
- //QImage outImg(w, h, 32);
-
- if (img.isNull())
- return img;
-
-#define PIX(x,y) (*((QRgb*)img.scanLine(y)+x) & 0x00ffffff)
-
- // Determine background color from the 4 borders,
- // code taken from QPixmap::createHeuristicMask
- QRgb background = PIX(0,0);
- if ( background != PIX(w-1,0) &&
- background != PIX(0,h-1) &&
- background != PIX(w-1,h-1) ) {
- background = PIX(w-1,0);
- if ( background != PIX(w-1,h-1) &&
- background != PIX(0,h-1) &&
- PIX(0,h-1) == PIX(w-1,h-1) ) {
- background = PIX(w-1,h-1);
- }
- }
-#undef PIX
- //qDebug("background: %s",QString::number(background,16).ascii());
-
- img.setAlphaBuffer( true ); // just in case
-
- // Apply an overlay made of the 'selection color' with 50% transparency
- // (that overlay is a mask of the icon, transparent where the icon is transparent)
- int red = col.red();
- int green = col.green();
- int blue = col.blue();
- int alpha = 0x7f;
-
- for ( int y = 0; y < h; y++ ) {
- //QRgb *outp = (QRgb*)outImg.scanLine(y);
- QRgb *p = (QRgb *)img.scanLine(y);
- QRgb *end = p + w;
- for ( ; p < end; p++ /*, outp++*/ ) {
- QRgb pix = *p;
- if ( (pix & 0x00ffffff) != background )
- {
- int r = ((0xff-alpha) * qRed(pix) + alpha * red) >> 8;
- int g = ((0xff-alpha) * qGreen(pix) + alpha * green) >> 8;
- int b = ((0xff-alpha) * qBlue(pix) + alpha * blue) >> 8;
-
- *p = qRgba(r, g, b, qAlpha(pix));
- }
- //else // transparent pixel, copy as is
- // *outp = pix;
- }
- }
- return img;
-}
-
-//
-// ===================================================================
-// Effects originally ported from ImageMagick for PixiePlus, plus a few
-// new ones. (mosfet 12/29/01)
-// ===================================================================
-//
-
-void KImageEffect::normalize(QImage &img)
-{
- int *histogram, threshold_intensity, intense;
- int x, y, i;
-
- unsigned int gray_value;
- unsigned int *normalize_map;
- unsigned int high, low;
-
- // allocate histogram and normalize map
- histogram = (int *)calloc(MaxRGB+1, sizeof(int));
- normalize_map = (unsigned int *)malloc((MaxRGB+1)*sizeof(unsigned int));
- if(!normalize_map || !histogram){
- qWarning("Unable to allocate normalize histogram and map");
- free(normalize_map);
- free(histogram);
- return;
- }
-
- // form histogram
- if(img.depth() > 8){ // DirectClass
- unsigned int *data;
- for(y=0; y < img.height(); ++y){
- data = (unsigned int *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- gray_value = intensityValue(data[x]);
- histogram[gray_value]++;
- }
- }
- }
- else{ // PsudeoClass
- unsigned char *data;
- unsigned int *cTable = img.colorTable();
- for(y=0; y < img.height(); ++y){
- data = (unsigned char *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- gray_value = intensityValue(*(cTable+data[x]));
- histogram[gray_value]++;
- }
- }
- }
-
- // find histogram boundaries by locating the 1 percent levels
- threshold_intensity = (img.width()*img.height())/100;
- intense = 0;
- for(low=0; low < MaxRGB; ++low){
- intense+=histogram[low];
- if(intense > threshold_intensity)
- break;
- }
- intense=0;
- for(high=MaxRGB; high != 0; --high){
- intense+=histogram[high];
- if(intense > threshold_intensity)
- break;
- }
-
- if (low == high){
- // Unreasonable contrast; use zero threshold to determine boundaries.
- threshold_intensity=0;
- intense=0;
- for(low=0; low < MaxRGB; ++low){
- intense+=histogram[low];
- if(intense > threshold_intensity)
- break;
- }
- intense=0;
- for(high=MaxRGB; high != 0; --high)
- {
- intense+=histogram[high];
- if(intense > threshold_intensity)
- break;
- }
- if(low == high)
- return; // zero span bound
- }
-
- // Stretch the histogram to create the normalized image mapping.
- for(i=0; i <= MaxRGB; i++){
- if (i < (int) low)
- normalize_map[i]=0;
- else{
- if(i > (int) high)
- normalize_map[i]=MaxRGB;
- else
- normalize_map[i]=(MaxRGB-1)*(i-low)/(high-low);
- }
- }
- // Normalize
- if(img.depth() > 8){ // DirectClass
- unsigned int *data;
- for(y=0; y < img.height(); ++y){
- data = (unsigned int *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- data[x] = qRgba(normalize_map[qRed(data[x])],
- normalize_map[qGreen(data[x])],
- normalize_map[qBlue(data[x])],
- qAlpha(data[x]));
- }
- }
- }
- else{ // PsudeoClass
- int colors = img.numColors();
- unsigned int *cTable = img.colorTable();
- for(i=0; i < colors; ++i){
- cTable[i] = qRgba(normalize_map[qRed(cTable[i])],
- normalize_map[qGreen(cTable[i])],
- normalize_map[qBlue(cTable[i])],
- qAlpha(cTable[i]));
- }
- }
- free(histogram);
- free(normalize_map);
-}
-
-
-void KImageEffect::equalize(QImage &img)
-{
- int *histogram, *map, *equalize_map;
- int x, y, i, j;
-
- unsigned int high, low;
-
- // allocate histogram and maps
- histogram = (int *)calloc(MaxRGB+1, sizeof(int));
- map = (int *)malloc((MaxRGB+1)*sizeof(unsigned int));
- equalize_map = (int *)malloc((MaxRGB+1)*sizeof(unsigned int));
-
- if(!histogram || !map || !equalize_map){
- qWarning("Unable to allocate equalize histogram and maps");
- free(histogram);
- free(map);
- free(equalize_map);
- return;
- }
- // form histogram
- if(img.depth() > 8){ // DirectClass
- unsigned int *data;
- for(y=0; y < img.height(); ++y){
- data = (unsigned int *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- histogram[intensityValue(data[x])]++;
- }
- }
- }
- else{ // PsudeoClass
- unsigned char *data;
- unsigned int *cTable = img.colorTable();
- for(y=0; y < img.height(); ++y){
- data = (unsigned char *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- histogram[intensityValue(*(cTable+data[x]))]++;
- }
- }
- }
-
- // integrate the histogram to get the equalization map.
- j=0;
- for(i=0; i <= MaxRGB; i++){
- j+=histogram[i];
- map[i]=j;
- }
- free(histogram);
- if(map[MaxRGB] == 0){
- free(equalize_map);
- free(map);
- return;
- }
- // equalize
- low=map[0];
- high=map[MaxRGB];
- for(i=0; i <= MaxRGB; i++)
- equalize_map[i]=(unsigned int)
- ((((double) (map[i]-low))*MaxRGB)/QMAX(high-low,1));
- free(map);
- // stretch the histogram
- if(img.depth() > 8){ // DirectClass
- unsigned int *data;
- for(y=0; y < img.height(); ++y){
- data = (unsigned int *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- data[x] = qRgba(equalize_map[qRed(data[x])],
- equalize_map[qGreen(data[x])],
- equalize_map[qBlue(data[x])],
- qAlpha(data[x]));
- }
- }
- }
- else{ // PsudeoClass
- int colors = img.numColors();
- unsigned int *cTable = img.colorTable();
- for(i=0; i < colors; ++i){
- cTable[i] = qRgba(equalize_map[qRed(cTable[i])],
- equalize_map[qGreen(cTable[i])],
- equalize_map[qBlue(cTable[i])],
- qAlpha(cTable[i]));
- }
- }
- free(equalize_map);
-}
-
-QImage KImageEffect::sample(QImage &src, int w, int h)
-{
- if(w == src.width() && h == src.height())
- return(src);
-
- double *x_offset, *y_offset;
- int j, k, y;
- register int x;
- QImage dest(w, h, src.depth());
-
- x_offset = (double *)malloc(w*sizeof(double));
- y_offset = (double *)malloc(h*sizeof(double));
- if(!x_offset || !y_offset){
- qWarning("Unable to allocate pixels buffer");
- free(x_offset);
- free(y_offset);
- return(src);
- }
-
- // init pixel offsets
- for(x=0; x < w; ++x)
- x_offset[x] = x*src.width()/((double)w);
- for(y=0; y < h; ++y)
- y_offset[y] = y*src.height()/((double)h);
-
- // sample each row
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *srcData, *destData;
- unsigned int *pixels;
- pixels = (unsigned int *)malloc(src.width()*sizeof(unsigned int));
- if(!pixels){
- qWarning("Unable to allocate pixels buffer");
- free(pixels);
- free(x_offset);
- free(y_offset);
- return(src);
- }
- j = (-1);
- for(y=0; y < h; ++y){
- destData = (unsigned int *)dest.scanLine(y);
- if(j != y_offset[y]){
- // read a scan line
- j = (int)(y_offset[y]);
- srcData = (unsigned int *)src.scanLine(j);
- (void)memcpy(pixels, srcData, src.width()*sizeof(unsigned int));
- }
- // sample each column
- for(x=0; x < w; ++x){
- k = (int)(x_offset[x]);
- destData[x] = pixels[k];
- }
- }
- free(pixels);
- }
- else{ // PsudeoClass source image
- unsigned char *srcData, *destData;
- unsigned char *pixels;
- pixels = (unsigned char *)malloc(src.width()*sizeof(unsigned char));
- if(!pixels){
- qWarning("Unable to allocate pixels buffer");
- free(pixels);
- free(x_offset);
- free(y_offset);
- return(src);
- }
- // copy colortable
- dest.setNumColors(src.numColors());
- (void)memcpy(dest.colorTable(), src.colorTable(),
- src.numColors()*sizeof(unsigned int));
-
- // sample image
- j = (-1);
- for(y=0; y < h; ++y){
- destData = (unsigned char *)dest.scanLine(y);
- if(j != y_offset[y]){
- // read a scan line
- j = (int)(y_offset[y]);
- srcData = (unsigned char *)src.scanLine(j);
- (void)memcpy(pixels, srcData, src.width()*sizeof(unsigned char));
- }
- // sample each column
- for(x=0; x < w; ++x){
- k = (int)(x_offset[x]);
- destData[x] = pixels[k];
- }
- }
- free(pixels);
- }
- free(x_offset);
- free(y_offset);
- return(dest);
-}
-
-void KImageEffect::threshold(QImage &img, unsigned int threshold)
-{
- int i, count;
- unsigned int *data;
- if(img.depth() > 8){ // DirectClass
- count = img.width()*img.height();
- data = (unsigned int *)img.bits();
- }
- else{ // PsudeoClass
- count = img.numColors();
- data = (unsigned int *)img.colorTable();
- }
- for(i=0; i < count; ++i)
- data[i] = intensityValue(data[i]) < threshold ? Qt::black.rgb() : Qt::white.rgb();
-}
-
-QImage KImageEffect::charcoal(QImage &src, double factor)
-{
- QImage dest(src);
- dest.detach();
- toGray(dest);
- dest = edge(dest, factor);
- dest = blur(dest, factor);
- normalize(dest);
- dest.invertPixels(false);
- return(dest);
-}
-
-void KImageEffect::hull(const int x_offset, const int y_offset,
- const int polarity, const int columns,
- const int rows,
- unsigned int *f, unsigned int *g)
-{
- int x, y;
-
- unsigned int *p, *q, *r, *s;
- unsigned int v;
- if(f == NULL || g == NULL)
- return;
- p=f+(columns+2);
- q=g+(columns+2);
- r=p+(y_offset*(columns+2)+x_offset);
- for (y=0; y < rows; y++){
- p++;
- q++;
- r++;
- if(polarity > 0)
- for (x=0; x < columns; x++){
- v=(*p);
- if (*r > v)
- v++;
- *q=v;
- p++;
- q++;
- r++;
- }
- else
- for(x=0; x < columns; x++){
- v=(*p);
- if (v > (unsigned int) (*r+1))
- v--;
- *q=v;
- p++;
- q++;
- r++;
- }
- p++;
- q++;
- r++;
- }
- p=f+(columns+2);
- q=g+(columns+2);
- r=q+(y_offset*(columns+2)+x_offset);
- s=q-(y_offset*(columns+2)+x_offset);
- for(y=0; y < rows; y++){
- p++;
- q++;
- r++;
- s++;
- if(polarity > 0)
- for(x=0; x < (int) columns; x++){
- v=(*q);
- if (((unsigned int) (*s+1) > v) && (*r > v))
- v++;
- *p=v;
- p++;
- q++;
- r++;
- s++;
- }
- else
- for (x=0; x < columns; x++){
- v=(*q);
- if (((unsigned int) (*s+1) < v) && (*r < v))
- v--;
- *p=v;
- p++;
- q++;
- r++;
- s++;
- }
- p++;
- q++;
- r++;
- s++;
- }
-}
-
-QImage KImageEffect::despeckle(QImage &src)
-{
- int i, j, x, y;
- unsigned int *blue_channel, *red_channel, *green_channel, *buffer,
- *alpha_channel;
- int packets;
- static const int
- X[4]= {0, 1, 1,-1},
- Y[4]= {1, 0, 1, 1};
-
- unsigned int *destData;
- QImage dest(src.width(), src.height(), 32);
-
- packets = (src.width()+2)*(src.height()+2);
- red_channel = (unsigned int *)calloc(packets, sizeof(unsigned int));
- green_channel = (unsigned int *)calloc(packets, sizeof(unsigned int));
- blue_channel = (unsigned int *)calloc(packets, sizeof(unsigned int));
- alpha_channel = (unsigned int *)calloc(packets, sizeof(unsigned int));
- buffer = (unsigned int *)calloc(packets, sizeof(unsigned int));
- if(!red_channel || ! green_channel || ! blue_channel || ! alpha_channel ||
- !buffer){
- free(red_channel);
- free(green_channel);
- free(blue_channel);
- free(alpha_channel);
- free(buffer);
- return(src);
- }
-
- // copy image pixels to color component buffers
- j = src.width()+2;
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *srcData;
- for(y=0; y < src.height(); ++y){
- srcData = (unsigned int *)src.scanLine(y);
- ++j;
- for(x=0; x < src.width(); ++x){
- red_channel[j] = qRed(srcData[x]);
- green_channel[j] = qGreen(srcData[x]);
- blue_channel[j] = qBlue(srcData[x]);
- alpha_channel[j] = qAlpha(srcData[x]);
- ++j;
- }
- ++j;
- }
- }
- else{ // PsudeoClass source image
- unsigned char *srcData;
- unsigned int *cTable = src.colorTable();
- unsigned int pixel;
- for(y=0; y < src.height(); ++y){
- srcData = (unsigned char *)src.scanLine(y);
- ++j;
- for(x=0; x < src.width(); ++x){
- pixel = *(cTable+srcData[x]);
- red_channel[j] = qRed(pixel);
- green_channel[j] = qGreen(pixel);
- blue_channel[j] = qBlue(pixel);
- alpha_channel[j] = qAlpha(pixel);
- ++j;
- }
- ++j;
- }
- }
- // reduce speckle in red channel
- for(i=0; i < 4; i++){
- hull(X[i],Y[i],1,src.width(),src.height(),red_channel,buffer);
- hull(-X[i],-Y[i],1,src.width(),src.height(),red_channel,buffer);
- hull(-X[i],-Y[i],-1,src.width(),src.height(),red_channel,buffer);
- hull(X[i],Y[i],-1,src.width(),src.height(),red_channel,buffer);
- }
- // reduce speckle in green channel
- for (i=0; i < packets; i++)
- buffer[i]=0;
- for (i=0; i < 4; i++){
- hull(X[i],Y[i],1,src.width(),src.height(),green_channel,buffer);
- hull(-X[i],-Y[i],1,src.width(),src.height(),green_channel,buffer);
- hull(-X[i],-Y[i],-1,src.width(),src.height(),green_channel,buffer);
- hull(X[i],Y[i],-1,src.width(),src.height(),green_channel,buffer);
- }
- // reduce speckle in blue channel
- for (i=0; i < packets; i++)
- buffer[i]=0;
- for (i=0; i < 4; i++){
- hull(X[i],Y[i],1,src.width(),src.height(),blue_channel,buffer);
- hull(-X[i],-Y[i],1,src.width(),src.height(),blue_channel,buffer);
- hull(-X[i],-Y[i],-1,src.width(),src.height(),blue_channel,buffer);
- hull(X[i],Y[i],-1,src.width(),src.height(),blue_channel,buffer);
- }
- // copy color component buffers to despeckled image
- j = dest.width()+2;
- for(y=0; y < dest.height(); ++y)
- {
- destData = (unsigned int *)dest.scanLine(y);
- ++j;
- for (x=0; x < dest.width(); ++x)
- {
- destData[x] = qRgba(red_channel[j], green_channel[j],
- blue_channel[j], alpha_channel[j]);
- ++j;
- }
- ++j;
- }
- free(buffer);
- free(red_channel);
- free(green_channel);
- free(blue_channel);
- free(alpha_channel);
- return(dest);
-}
-
-unsigned int KImageEffect::generateNoise(unsigned int pixel,
- NoiseType noise_type)
-{
-#define NoiseEpsilon 1.0e-5
-#define NoiseMask 0x7fff
-#define SigmaUniform 4.0
-#define SigmaGaussian 4.0
-#define SigmaImpulse 0.10
-#define SigmaLaplacian 10.0
-#define SigmaMultiplicativeGaussian 0.5
-#define SigmaPoisson 0.05
-#define TauGaussian 20.0
-
- double alpha, beta, sigma, value;
- alpha=(double) (rand() & NoiseMask)/NoiseMask;
- if (alpha == 0.0)
- alpha=1.0;
- switch(noise_type){
- case UniformNoise:
- default:
- {
- value=(double) pixel+SigmaUniform*(alpha-0.5);
- break;
- }
- case GaussianNoise:
- {
- double tau;
-
- beta=(double) (rand() & NoiseMask)/NoiseMask;
- sigma=sqrt(-2.0*log(alpha))*cos(2.0*M_PI*beta);
- tau=sqrt(-2.0*log(alpha))*sin(2.0*M_PI*beta);
- value=(double) pixel+
- (sqrt((double) pixel)*SigmaGaussian*sigma)+(TauGaussian*tau);
- break;
- }
- case MultiplicativeGaussianNoise:
- {
- if (alpha <= NoiseEpsilon)
- sigma=MaxRGB;
- else
- sigma=sqrt(-2.0*log(alpha));
- beta=(rand() & NoiseMask)/NoiseMask;
- value=(double) pixel+
- pixel*SigmaMultiplicativeGaussian*sigma*cos(2.0*M_PI*beta);
- break;
- }
- case ImpulseNoise:
- {
- if (alpha < (SigmaImpulse/2.0))
- value=0;
- else
- if (alpha >= (1.0-(SigmaImpulse/2.0)))
- value=MaxRGB;
- else
- value=pixel;
- break;
- }
- case LaplacianNoise:
- {
- if (alpha <= 0.5)
- {
- if (alpha <= NoiseEpsilon)
- value=(double) pixel-MaxRGB;
- else
- value=(double) pixel+SigmaLaplacian*log(2.0*alpha);
- break;
- }
- beta=1.0-alpha;
- if (beta <= (0.5*NoiseEpsilon))
- value=(double) pixel+MaxRGB;
- else
- value=(double) pixel-SigmaLaplacian*log(2.0*beta);
- break;
- }
- case PoissonNoise:
- {
- register int
- i;
-
- for (i=0; alpha > exp(-SigmaPoisson*pixel); i++)
- {
- beta=(double) (rand() & NoiseMask)/NoiseMask;
- alpha=alpha*beta;
- }
- value=i/SigmaPoisson;
- break;
- }
- }
- if(value < 0.0)
- return(0);
- if(value > MaxRGB)
- return(MaxRGB);
- return((unsigned int) (value+0.5));
-}
-
-QImage KImageEffect::addNoise(QImage &src, NoiseType noise_type)
-{
- int x, y;
- QImage dest(src.width(), src.height(), 32);
- unsigned int *destData;
-
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *srcData;
- for(y=0; y < src.height(); ++y){
- srcData = (unsigned int *)src.scanLine(y);
- destData = (unsigned int *)dest.scanLine(y);
- for(x=0; x < src.width(); ++x){
- destData[x] = qRgba(generateNoise(qRed(srcData[x]), noise_type),
- generateNoise(qGreen(srcData[x]), noise_type),
- generateNoise(qBlue(srcData[x]), noise_type),
- qAlpha(srcData[x]));
- }
- }
- }
- else{ // PsudeoClass source image
- unsigned char *srcData;
- unsigned int *cTable = src.colorTable();
- unsigned int pixel;
- for(y=0; y < src.height(); ++y){
- srcData = (unsigned char *)src.scanLine(y);
- destData = (unsigned int *)dest.scanLine(y);
- for(x=0; x < src.width(); ++x){
- pixel = *(cTable+srcData[x]);
- destData[x] = qRgba(generateNoise(qRed(pixel), noise_type),
- generateNoise(qGreen(pixel), noise_type),
- generateNoise(qBlue(pixel), noise_type),
- qAlpha(pixel));
- }
- }
-
- }
- return(dest);
-}
-
-unsigned int KImageEffect::interpolateColor(QImage *image, double x_offset,
- double y_offset,
- unsigned int background)
-{
- double alpha, beta;
- unsigned int p, q, r, s;
- int x, y;
-
- x = (int)x_offset;
- y = (int)y_offset;
- if((x < -1) || (x >= image->width()) || (y < -1) || (y >= image->height()))
- return(background);
- if(image->depth() > 8){
- if((x >= 0) && (y >= 0) && (x < (image->width()-1)) && (y < (image->height()-1))) {
- unsigned int *t = (unsigned int *)image->scanLine(y);
- p = t[x];
- q = t[x+1];
- r = t[x+image->width()];
- s = t[x+image->width()+1];
- }
- else{
- unsigned int *t = (unsigned int *)image->scanLine(y);
- p = background;
- if((x >= 0) && (y >= 0)){
- p = t[x];
- }
- q = background;
- if(((x+1) < image->width()) && (y >= 0)){
- q = t[x+1];
- }
- r = background;
- if((x >= 0) && ((y+1) < image->height())){
- t = (unsigned int *)image->scanLine(y+1);
- r = t[x+image->width()];
- }
- s = background;
- if(((x+1) < image->width()) && ((y+1) < image->height())){
- t = (unsigned int *)image->scanLine(y+1);
- s = t[x+image->width()+1];
- }
-
- }
- }
- else{
- unsigned int *colorTable = (unsigned int *)image->colorTable();
- if((x >= 0) && (y >= 0) && (x < (image->width()-1)) && (y < (image->height()-1))) {
- unsigned char *t;
- t = (unsigned char *)image->scanLine(y);
- p = *(colorTable+t[x]);
- q = *(colorTable+t[x+1]);
- t = (unsigned char *)image->scanLine(y+1);
- r = *(colorTable+t[x]);
- s = *(colorTable+t[x+1]);
- }
- else{
- unsigned char *t;
- p = background;
- if((x >= 0) && (y >= 0)){
- t = (unsigned char *)image->scanLine(y);
- p = *(colorTable+t[x]);
- }
- q = background;
- if(((x+1) < image->width()) && (y >= 0)){
- t = (unsigned char *)image->scanLine(y);
- q = *(colorTable+t[x+1]);
- }
- r = background;
- if((x >= 0) && ((y+1) < image->height())){
- t = (unsigned char *)image->scanLine(y+1);
- r = *(colorTable+t[x]);
- }
- s = background;
- if(((x+1) < image->width()) && ((y+1) < image->height())){
- t = (unsigned char *)image->scanLine(y+1);
- s = *(colorTable+t[x+1]);
- }
-
- }
-
- }
- x_offset -= floor(x_offset);
- y_offset -= floor(y_offset);
- alpha = 1.0-x_offset;
- beta = 1.0-y_offset;
-
- return(qRgba((unsigned char)(beta*(alpha*qRed(p)+x_offset*qRed(q))+y_offset*(alpha*qRed(r)+x_offset*qRed(s))),
- (unsigned char)(beta*(alpha*qGreen(p)+x_offset*qGreen(q))+y_offset*(alpha*qGreen(r)+x_offset*qGreen(s))),
- (unsigned char)(beta*(alpha*qBlue(p)+x_offset*qBlue(q))+y_offset*(alpha*qBlue(r)+x_offset*qBlue(s))),
- (unsigned char)(beta*(alpha*qAlpha(p)+x_offset*qAlpha(q))+y_offset*(alpha*qAlpha(r)+x_offset*qAlpha(s)))));
-}
-
-QImage KImageEffect::implode(QImage &src, double factor,
- unsigned int background)
-{
- double amount, distance, radius;
- double x_center, x_distance, x_scale;
- double y_center, y_distance, y_scale;
- unsigned int *destData;
- int x, y;
-
- QImage dest(src.width(), src.height(), 32);
-
- // compute scaling factor
- x_scale = 1.0;
- y_scale = 1.0;
- x_center = (double)0.5*src.width();
- y_center = (double)0.5*src.height();
- radius=x_center;
- if(src.width() > src.height())
- y_scale = (double)src.width()/src.height();
- else if(src.width() < src.height()){
- x_scale = (double) src.height()/src.width();
- radius = y_center;
- }
- amount=factor/10.0;
- if(amount >= 0)
- amount/=10.0;
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *srcData;
- for(y=0; y < src.height(); ++y){
- srcData = (unsigned int *)src.scanLine(y);
- destData = (unsigned int *)dest.scanLine(y);
- y_distance=y_scale*(y-y_center);
- for(x=0; x < src.width(); ++x){
- destData[x] = srcData[x];
- x_distance = x_scale*(x-x_center);
- distance= x_distance*x_distance+y_distance*y_distance;
- if(distance < (radius*radius)){
- double factor;
- // Implode the pixel.
- factor=1.0;
- if(distance > 0.0)
- factor=
- pow(sin(0.5000000000000001*M_PI*sqrt(distance)/radius),-amount);
- destData[x] = interpolateColor(&src, factor*x_distance/x_scale+x_center,
- factor*y_distance/y_scale+y_center,
- background);
- }
- }
- }
- }
- else{ // PsudeoClass source image
- unsigned char *srcData;
- unsigned char idx;
- unsigned int *cTable = src.colorTable();
- for(y=0; y < src.height(); ++y){
- srcData = (unsigned char *)src.scanLine(y);
- destData = (unsigned int *)dest.scanLine(y);
- y_distance=y_scale*(y-y_center);
- for(x=0; x < src.width(); ++x){
- idx = srcData[x];
- destData[x] = cTable[idx];
- x_distance = x_scale*(x-x_center);
- distance= x_distance*x_distance+y_distance*y_distance;
- if(distance < (radius*radius)){
- double factor;
- // Implode the pixel.
- factor=1.0;
- if(distance > 0.0)
- factor=
- pow(sin(0.5000000000000001*M_PI*sqrt(distance)/radius),-amount);
- destData[x] = interpolateColor(&src, factor*x_distance/x_scale+x_center,
- factor*y_distance/y_scale+y_center,
- background);
- }
- }
- }
-
- }
- return(dest);
-}
-
-QImage KImageEffect::rotate(QImage &img, RotateDirection r)
-{
- QImage dest;
- int x, y;
- if(img.depth() > 8){
- unsigned int *srcData, *destData;
- switch(r){
- case Rotate90:
- dest.create(img.height(), img.width(), img.depth());
- for(y=0; y < img.height(); ++y){
- srcData = (unsigned int *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- destData = (unsigned int *)dest.scanLine(x);
- destData[img.height()-y-1] = srcData[x];
- }
- }
- break;
- case Rotate180:
- dest.create(img.width(), img.height(), img.depth());
- for(y=0; y < img.height(); ++y){
- srcData = (unsigned int *)img.scanLine(y);
- destData = (unsigned int *)dest.scanLine(img.height()-y-1);
- for(x=0; x < img.width(); ++x)
- destData[img.width()-x-1] = srcData[x];
- }
- break;
- case Rotate270:
- dest.create(img.height(), img.width(), img.depth());
- for(y=0; y < img.height(); ++y){
- srcData = (unsigned int *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- destData = (unsigned int *)dest.scanLine(img.width()-x-1);
- destData[y] = srcData[x];
- }
- }
- break;
- default:
- dest = img;
- break;
- }
- }
- else{
- unsigned char *srcData, *destData;
- unsigned int *srcTable, *destTable;
- switch(r){
- case Rotate90:
- dest.create(img.height(), img.width(), img.depth());
- dest.setNumColors(img.numColors());
- srcTable = (unsigned int *)img.colorTable();
- destTable = (unsigned int *)dest.colorTable();
- for(x=0; x < img.numColors(); ++x)
- destTable[x] = srcTable[x];
- for(y=0; y < img.height(); ++y){
- srcData = (unsigned char *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- destData = (unsigned char *)dest.scanLine(x);
- destData[img.height()-y-1] = srcData[x];
- }
- }
- break;
- case Rotate180:
- dest.create(img.width(), img.height(), img.depth());
- dest.setNumColors(img.numColors());
- srcTable = (unsigned int *)img.colorTable();
- destTable = (unsigned int *)dest.colorTable();
- for(x=0; x < img.numColors(); ++x)
- destTable[x] = srcTable[x];
- for(y=0; y < img.height(); ++y){
- srcData = (unsigned char *)img.scanLine(y);
- destData = (unsigned char *)dest.scanLine(img.height()-y-1);
- for(x=0; x < img.width(); ++x)
- destData[img.width()-x-1] = srcData[x];
- }
- break;
- case Rotate270:
- dest.create(img.height(), img.width(), img.depth());
- dest.setNumColors(img.numColors());
- srcTable = (unsigned int *)img.colorTable();
- destTable = (unsigned int *)dest.colorTable();
- for(x=0; x < img.numColors(); ++x)
- destTable[x] = srcTable[x];
- for(y=0; y < img.height(); ++y){
- srcData = (unsigned char *)img.scanLine(y);
- for(x=0; x < img.width(); ++x){
- destData = (unsigned char *)dest.scanLine(img.width()-x-1);
- destData[y] = srcData[x];
- }
- }
- break;
- default:
- dest = img;
- break;
- }
-
- }
- return(dest);
-}
-
-void KImageEffect::solarize(QImage &img, double factor)
-{
- int i, count;
- int threshold;
- unsigned int *data;
-
- threshold = (int)(factor*(MaxRGB+1)/100.0);
- if(img.depth() < 32){
- data = (unsigned int *)img.colorTable();
- count = img.numColors();
- }
- else{
- data = (unsigned int *)img.bits();
- count = img.width()*img.height();
- }
- for(i=0; i < count; ++i){
- data[i] = qRgba(qRed(data[i]) > threshold ? MaxRGB-qRed(data[i]) : qRed(data[i]),
- qGreen(data[i]) > threshold ? MaxRGB-qGreen(data[i]) : qGreen(data[i]),
- qBlue(data[i]) > threshold ? MaxRGB-qBlue(data[i]) : qBlue(data[i]),
- qAlpha(data[i]));
- }
-}
-
-QImage KImageEffect::spread(QImage &src, unsigned int amount)
-{
- int quantum, x, y;
- int x_distance, y_distance;
- if(src.width() < 3 || src.height() < 3)
- return(src);
- QImage dest(src);
- dest.detach();
- quantum=(amount+1) >> 1;
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p, *q;
- for(y=0; y < src.height(); y++){
- q = (unsigned int *)dest.scanLine(y);
- for(x=0; x < src.width(); x++){
- x_distance = x + ((rand() & (amount+1))-quantum);
- y_distance = y + ((rand() & (amount+1))-quantum);
- x_distance = QMIN(x_distance, src.width()-1);
- y_distance = QMIN(y_distance, src.height()-1);
- if(x_distance < 0)
- x_distance = 0;
- if(y_distance < 0)
- y_distance = 0;
- p = (unsigned int *)src.scanLine(y_distance);
- p += x_distance;
- *q++=(*p);
- }
- }
- }
- else{ // PsudeoClass source image
- // just do colortable values
- unsigned char *p, *q;
- for(y=0; y < src.height(); y++){
- q = (unsigned char *)dest.scanLine(y);
- for(x=0; x < src.width(); x++){
- x_distance = x + ((rand() & (amount+1))-quantum);
- y_distance = y + ((rand() & (amount+1))-quantum);
- x_distance = QMIN(x_distance, src.width()-1);
- y_distance = QMIN(y_distance, src.height()-1);
- if(x_distance < 0)
- x_distance = 0;
- if(y_distance < 0)
- y_distance = 0;
- p = (unsigned char *)src.scanLine(y_distance);
- p += x_distance;
- *q++=(*p);
- }
- }
- }
- return(dest);
-}
-
-QImage KImageEffect::swirl(QImage &src, double degrees,
- unsigned int background)
-{
- double cosine, distance, factor, radius, sine, x_center, x_distance,
- x_scale, y_center, y_distance, y_scale;
- int x, y;
- unsigned int *q;
- QImage dest(src.width(), src.height(), 32);
-
- // compute scaling factor
- x_center = src.width()/2.0;
- y_center = src.height()/2.0;
- radius = QMAX(x_center,y_center);
- x_scale=1.0;
- y_scale=1.0;
- if(src.width() > src.height())
- y_scale=(double)src.width()/src.height();
- else if(src.width() < src.height())
- x_scale=(double)src.height()/src.width();
- degrees=DegreesToRadians(degrees);
- // swirl each row
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p;
- for(y=0; y < src.height(); y++){
- p = (unsigned int *)src.scanLine(y);
- q = (unsigned int *)dest.scanLine(y);
- y_distance = y_scale*(y-y_center);
- for(x=0; x < src.width(); x++){
- // determine if the pixel is within an ellipse
- *q=(*p);
- x_distance = x_scale*(x-x_center);
- distance = x_distance*x_distance+y_distance*y_distance;
- if (distance < (radius*radius)){
- // swirl
- factor = 1.0-sqrt(distance)/radius;
- sine = sin(degrees*factor*factor);
- cosine = cos(degrees*factor*factor);
- *q = interpolateColor(&src,
- (cosine*x_distance-sine*y_distance)/x_scale+x_center,
- (sine*x_distance+cosine*y_distance)/y_scale+y_center,
- background);
- }
- p++;
- q++;
- }
- }
- }
- else{ // PsudeoClass source image
- unsigned char *p;
- unsigned int *cTable = (unsigned int *)src.colorTable();
- for(y=0; y < src.height(); y++){
- p = (unsigned char *)src.scanLine(y);
- q = (unsigned int *)dest.scanLine(y);
- y_distance = y_scale*(y-y_center);
- for(x=0; x < src.width(); x++){
- // determine if the pixel is within an ellipse
- *q = *(cTable+(*p));
- x_distance = x_scale*(x-x_center);
- distance = x_distance*x_distance+y_distance*y_distance;
- if (distance < (radius*radius)){
- // swirl
- factor = 1.0-sqrt(distance)/radius;
- sine = sin(degrees*factor*factor);
- cosine = cos(degrees*factor*factor);
- *q = interpolateColor(&src,
- (cosine*x_distance-sine*y_distance)/x_scale+x_center,
- (sine*x_distance+cosine*y_distance)/y_scale+y_center,
- background);
- }
- p++;
- q++;
- }
- }
-
- }
- return(dest);
-}
-
-QImage KImageEffect::wave(QImage &src, double amplitude, double wavelength,
- unsigned int background)
-{
- double *sine_map;
- int x, y;
- unsigned int *q;
-
- QImage dest(src.width(), src.height() + (int)(2*fabs(amplitude)), 32);
- // allocate sine map
- sine_map = (double *)malloc(dest.width()*sizeof(double));
- if(!sine_map)
- return(src);
- for(x=0; x < dest.width(); ++x)
- sine_map[x]=fabs(amplitude)+amplitude*sin((2*M_PI*x)/wavelength);
- // wave image
- for(y=0; y < dest.height(); ++y){
- q = (unsigned int *)dest.scanLine(y);
- for (x=0; x < dest.width(); x++){
- *q=interpolateColor(&src, x, (int)(y-sine_map[x]), background);
- ++q;
- }
- }
- free(sine_map);
- return(dest);
-}
-
-QImage KImageEffect::oilPaint(QImage &src, int radius)
-{
- // TODO 8bpp src!
- if(src.depth() < 32){
- qWarning("Oil Paint source image < 32bpp. Convert before using!");
- return(src);
- }
- int j, k, i, x, y;
- unsigned int *histogram;
- unsigned int *s;
- unsigned int count;
-
- unsigned int *srcData, *destData;
-
- QImage dest(src);
- dest.detach();
- histogram = (unsigned int *) malloc((MaxRGB+1)*sizeof(unsigned int));
- if(!histogram)
- return(src);
- // paint each row
- k=0;
- for(y = radius; y < src.height(); ++y){
- srcData = (unsigned int *)src.scanLine(y-radius);
- destData = (unsigned int *)dest.scanLine(y);
- srcData += radius*src.width()+radius;
- destData += radius;
- for(x=radius; x < src.width()-radius; ++x){
- // determine most frequent color
- count = 0;
- for(i=0; i < MaxRGB+1; ++i)
- histogram[i] = 0;
- for(i=0; i < radius; ++i){
- s = srcData-(radius-1)*src.width()-i-1;
- for(j =0; j < (2*i+1); ++j){
- k = intensityValue(*s);
- histogram[k]++;
- if(histogram[k] > count){
- *destData = *s;
- count = histogram[k];
- }
- ++s;
- }
- s = srcData+(radius-i)*src.width()-i-1;
- for(j =0; j < (2*i+1); ++j){
- k = intensityValue(*s);
- histogram[k]++;
- if(histogram[k] > count){
- *destData = *s;
- count = histogram[k];
- }
- ++s;
- }
- }
- s = srcData-radius;
- for(j =0; j < (2*i+1); ++j){
- k = intensityValue(*s);
- histogram[k]++;
- if(histogram[k] > count){
- *destData = *s;
- count = histogram[k];
- }
- ++s;
- }
- ++srcData;
- ++destData;
- }
- }
- free(histogram);
- return(dest);
-}
-
-//
-// The following methods work by computing a value from neighboring pixels
-// (mosfet 12/28/01)
-//
-
-QImage KImageEffect::edge(QImage &src, double factor)
-{
-#define Edge(weight) \
- total_red+=(weight)*qRed(*s); \
- total_green+=(weight)*qGreen(*s); \
- total_blue+=(weight)*qBlue(*s); \
- total_opacity+=(weight)*qAlpha(*s); \
- s++;
-
-#define Edge256(weight) \
- total_red+=(weight)*qRed(*(cTable+(*s))); \
- total_green+=(weight)*qGreen(*(cTable+(*s))); \
- total_blue+=(weight)*qBlue(*(cTable+(*s))); \
- total_opacity+=(weight)*qAlpha(*(cTable+(*s))); \
- s++;
-
- if(src.width() < 3 || src.height() < 3)
- return(src);
-
- double total_blue, total_green, total_opacity, total_red, weight;
-
- int x, y;
-
- unsigned int *q;
-
- QImage dest(src.width(), src.height(), 32);
- weight=factor/8.0;
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p, *s;
- for(y=0; y < src.height(); ++y){
- p = (unsigned int *)src.scanLine(QMIN(QMAX(y-1,0),src.height()-3));
- q = (unsigned int *)dest.scanLine(y);
- // edge detect this row of pixels.
- *q++=(*(p+src.width()));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- total_opacity=0.0;
- s=p;
- Edge(-weight/8); Edge(-weight/8) Edge(-weight/8);
- s=p+src.width();
- Edge(-weight/8); Edge(weight); Edge(-weight/8);
- s=p+2*src.width();
- Edge(-weight/8); Edge(-weight/8); Edge(-weight/8);
- *q = qRgba((unsigned char)((total_red < 0) ? 0 : (total_red > MaxRGB) ? MaxRGB : total_red),
- (unsigned char)((total_green < 0) ? 0 : (total_green > MaxRGB) ? MaxRGB : total_green),
- (unsigned char)((total_blue < 0) ? 0 : (total_blue > MaxRGB) ? MaxRGB : total_blue),
- (unsigned char)((total_opacity < 0) ? 0 : (total_opacity > MaxRGB) ? MaxRGB : total_opacity));
- p++;
- q++;
- }
- p++;
- *q++=(*p);
- }
- }
- else{ // PsudeoClass source image
- unsigned char *p, *p2, *p3, *s;
- unsigned int *cTable = src.colorTable();
- int scanLineIdx;
- for(y=0; y < src.height(); ++y){
- scanLineIdx = QMIN(QMAX(y-1,0),src.height()-3);
- p = (unsigned char *)src.scanLine(scanLineIdx);
- p2 = (unsigned char *)src.scanLine(scanLineIdx+1);
- p3 = (unsigned char *)src.scanLine(scanLineIdx+2);
- q = (unsigned int *)dest.scanLine(y);
- // edge detect this row of pixels.
- *q++=(*(cTable+(*p2)));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- total_opacity=0.0;
- s=p;
- Edge256(-weight/8); Edge256(-weight/8) Edge256(-weight/8);
- s=p2;
- Edge256(-weight/8); Edge256(weight); Edge256(-weight/8);
- s=p3;
- Edge256(-weight/8); Edge256(-weight/8); Edge256(-weight/8);
- *q = qRgba((unsigned char)((total_red < 0) ? 0 : (total_red > MaxRGB) ? MaxRGB : total_red),
- (unsigned char)((total_green < 0) ? 0 : (total_green > MaxRGB) ? MaxRGB : total_green),
- (unsigned char)((total_blue < 0) ? 0 : (total_blue > MaxRGB) ? MaxRGB : total_blue),
- (unsigned char)((total_opacity < 0) ? 0 : (total_opacity > MaxRGB) ? MaxRGB : total_opacity));
- p++;
- p2++;
- p3++;
- q++;
- }
- p++;
- *q++=(*(cTable+(*p)));
- }
- }
- return(dest);
-}
-
-QImage KImageEffect::sharpen(QImage &src, double factor)
-{
-#define Sharpen(weight) \
- total_red+=(weight)*qRed(*s); \
- total_green+=(weight)*qGreen(*s); \
- total_blue+=(weight)*qBlue(*s); \
- total_opacity+=(weight)*qAlpha(*s); \
- s++;
-
-#define Sharpen256(weight) \
- total_red+=(weight)*qRed(*(cTable+(*s))); \
- total_green+=(weight)*qGreen(*(cTable+(*s))); \
- total_blue+=(weight)*qBlue(*(cTable+(*s))); \
- total_opacity+=(weight)*qAlpha(*(cTable+(*s))); \
- s++;
-
- if(src.width() < 3 || src.height() < 3)
- return(src);
-
- double total_blue, total_green, total_opacity, total_red;
- double quantum, weight;
- unsigned char r, g, b, a;
-
- int x, y;
- unsigned int *q;
-
- QImage dest(src.width(), src.height(), 32);
- weight = ((100.0-factor)/2.0+13.0);
- quantum = QMAX(weight-12.0, 1.0);
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p, *s;
- for(y=0; y < src.height(); ++y){
- p = (unsigned int *)src.scanLine(QMIN(QMAX(y-1,0),src.height()-3));
- q = (unsigned int *)dest.scanLine(y);
- // sharpen this row of pixels.
- *q++=(*(p+src.width()));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- total_opacity=0.0;
- s=p;
- Sharpen(-1); Sharpen(-2); Sharpen(-1);
- s=p+src.width();
- Sharpen(-2); Sharpen(weight); Sharpen(-2);
- s=p+2*src.width();
- Sharpen(-1); Sharpen(-2); Sharpen(-1);
- if(total_red < 0)
- r=0;
- else if(total_red > (int)(MaxRGB*quantum))
- r = (unsigned char)MaxRGB;
- else
- r = (unsigned char)((total_red+(quantum/2.0))/quantum);
-
- if(total_green < 0)
- g = 0;
- else if(total_green > (int)(MaxRGB*quantum))
- g = (unsigned char)MaxRGB;
- else
- g = (unsigned char)((total_green+(quantum/2.0))/quantum);
-
- if(total_blue < 0)
- b = 0;
- else if(total_blue > (int)(MaxRGB*quantum))
- b = (unsigned char)MaxRGB;
- else
- b = (unsigned char)((total_blue+(quantum/2.0))/quantum);
-
- if(total_opacity < 0)
- a = 0;
- else if(total_opacity > (int)(MaxRGB*quantum))
- a = (unsigned char)MaxRGB;
- else
- a= (unsigned char)((total_opacity+(quantum/2.0))/quantum);
-
- *q = qRgba(r, g, b, a);
-
- p++;
- q++;
- }
- p++;
- *q++=(*p);
- }
- }
- else{ // PsudeoClass source image
- unsigned char *p, *p2, *p3, *s;
- unsigned int *cTable = src.colorTable();
- int scanLineIdx;
- for(y=0; y < src.height(); ++y){
- scanLineIdx = QMIN(QMAX(y-1,0),src.height()-3);
- p = (unsigned char *)src.scanLine(scanLineIdx);
- p2 = (unsigned char *)src.scanLine(scanLineIdx+1);
- p3 = (unsigned char *)src.scanLine(scanLineIdx+2);
- q = (unsigned int *)dest.scanLine(y);
- // sharpen this row of pixels.
- *q++=(*(cTable+(*p2)));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- total_opacity=0.0;
- s=p;
- Sharpen256(-1); Sharpen256(-2); Sharpen256(-1);
- s=p2;
- Sharpen256(-2); Sharpen256(weight); Sharpen256(-2);
- s=p3;
- Sharpen256(-1); Sharpen256(-2); Sharpen256(-1);
- if(total_red < 0)
- r=0;
- else if(total_red > (int)(MaxRGB*quantum))
- r = (unsigned char)MaxRGB;
- else
- r = (unsigned char)((total_red+(quantum/2.0))/quantum);
-
- if(total_green < 0)
- g = 0;
- else if(total_green > (int)(MaxRGB*quantum))
- g = (unsigned char)MaxRGB;
- else
- g = (unsigned char)((total_green+(quantum/2.0))/quantum);
-
- if(total_blue < 0)
- b = 0;
- else if(total_blue > (int)(MaxRGB*quantum))
- b = (unsigned char)MaxRGB;
- else
- b = (unsigned char)((total_blue+(quantum/2.0))/quantum);
-
- if(total_opacity < 0)
- a = 0;
- else if(total_opacity > (int)(MaxRGB*quantum))
- a = (unsigned char)MaxRGB;
- else
- a = (unsigned char)((total_opacity+(quantum/2.0))/quantum);
-
- *q = qRgba(r, g, b, a);
-
- p++;
- p2++;
- p3++;
- q++;
- }
- p++;
- *q++=(*(cTable+(*p)));
- }
- }
- return(dest);
-}
-
-QImage KImageEffect::emboss(QImage &src)
-{
-#define Emboss(weight) \
- total_red+=(weight)*qRed(*s); \
- total_green+=(weight)*qGreen(*s); \
- total_blue+=(weight)*qBlue(*s); \
- s++;
-
-#define Emboss256(weight) \
- total_red+=(weight)*qRed(*(cTable+(*s))); \
- total_green+=(weight)*qGreen(*(cTable+(*s))); \
- total_blue+=(weight)*qBlue(*(cTable+(*s))); \
- s++;
-
- if(src.width() < 3 || src.height() < 3)
- return(src);
-
- double total_blue, total_green, total_red;
- int x, y;
- unsigned int *q;
-
- QImage dest(src.width(), src.height(), 32);
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p, *s;
- for(y=0; y < src.height(); ++y){
- p = (unsigned int *)src.scanLine(QMIN(QMAX(y-1,0),src.height()-3));
- q = (unsigned int *)dest.scanLine(y);
- // emboss this row of pixels.
- *q++=(*(p+src.width()));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- s=p;
- Emboss(-1); Emboss(-2); Emboss( 0);
- s=p+src.width();
- Emboss(-2); Emboss( 0); Emboss( 2);
- s=p+2*src.width();
- Emboss( 0); Emboss( 2); Emboss( 1);
- total_red += (MaxRGB+1)/2;
- total_green += (MaxRGB+1)/2;
- total_blue += (MaxRGB+1)/2;
- *q = qRgba((unsigned char)((total_red < 0) ? 0 : (total_red > MaxRGB) ? MaxRGB : total_red),
- (unsigned char)((total_green < 0) ? 0 : (total_green > MaxRGB) ? MaxRGB : total_green),
- (unsigned char)((total_blue < 0) ? 0 : (total_blue > MaxRGB) ? MaxRGB : total_blue),
- 255);
- p++;
- q++;
- }
- p++;
- *q++=(*p);
- }
- }
- else{ // PsudeoClass source image
- unsigned char *p, *p2, *p3, *s;
- unsigned int *cTable = src.colorTable();
- int scanLineIdx;
- for(y=0; y < src.height(); ++y){
- scanLineIdx = QMIN(QMAX(y-1,0),src.height()-3);
- p = (unsigned char *)src.scanLine(scanLineIdx);
- p2 = (unsigned char *)src.scanLine(scanLineIdx+1);
- p3 = (unsigned char *)src.scanLine(scanLineIdx+2);
- q = (unsigned int *)dest.scanLine(y);
- // emboss this row of pixels.
- *q++=(*(cTable+(*p2)));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- s=p;
- Emboss256(-1); Emboss256(-2); Emboss256(0);
- s=p2;
- Emboss256(-2); Emboss256(0); Emboss256(2);
- s=p3;
- Emboss256(0); Emboss256(2); Emboss256(1);
- total_red += (MaxRGB+1)/2;
- total_green += (MaxRGB+1)/2;
- total_blue += (MaxRGB+1)/2;
- *q = qRgba((unsigned char)((total_red < 0) ? 0 : (total_red > MaxRGB) ? MaxRGB : total_red),
- (unsigned char)((total_green < 0) ? 0 : (total_green > MaxRGB) ? MaxRGB : total_green),
- (unsigned char)((total_blue < 0) ? 0 : (total_blue > MaxRGB) ? MaxRGB : total_blue),
- 255);
- p++;
- p2++;
- p3++;
- q++;
- }
- p++;
- *q++=(*(cTable+(*p)));
- }
- }
- toGray(dest);
- normalize(dest);
- return(dest);
-}
-
-QImage KImageEffect::shade(QImage &src, bool color_shading, double azimuth,
- double elevation)
-{
- struct PointInfo{
- double x, y, z;
- };
-
- double distance, normal_distance, shade;
- int x, y;
-
- struct PointInfo light, normal;
-
- unsigned int *q;
-
- QImage dest(src.width(), src.height(), 32);
-
- azimuth = DegreesToRadians(azimuth);
- elevation = DegreesToRadians(elevation);
- light.x = MaxRGB*cos(azimuth)*cos(elevation);
- light.y = MaxRGB*sin(azimuth)*cos(elevation);
- light.z = MaxRGB*sin(elevation);
- normal.z= 2*MaxRGB; // constant Z of surface normal
-
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p, *s0, *s1, *s2;
- for(y=0; y < src.height(); ++y){
- p = (unsigned int *)src.scanLine(QMIN(QMAX(y-1,0),src.height()-3));
- q = (unsigned int *)dest.scanLine(y);
- // shade this row of pixels.
- *q++=(*(p+src.width()));
- p++;
- s0 = p;
- s1 = p + src.width();
- s2 = p + 2*src.width();
- for(x=1; x < src.width()-1; ++x){
- // determine the surface normal and compute shading.
- normal.x=intensityValue(*(s0-1))+intensityValue(*(s1-1))+intensityValue(*(s2-1))-
- (double) intensityValue(*(s0+1))-(double) intensityValue(*(s1+1))-
- (double) intensityValue(*(s2+1));
- normal.y=intensityValue(*(s2-1))+intensityValue(*s2)+intensityValue(*(s2+1))-
- (double) intensityValue(*(s0-1))-(double) intensityValue(*s0)-
- (double) intensityValue(*(s0+1));
- if((normal.x == 0) && (normal.y == 0))
- shade=light.z;
- else{
- shade=0.0;
- distance=normal.x*light.x+normal.y*light.y+normal.z*light.z;
- if (distance > 0.0){
- normal_distance=
- normal.x*normal.x+normal.y*normal.y+normal.z*normal.z;
- if(fabs(normal_distance) > 0.0000001)
- shade=distance/sqrt(normal_distance);
- }
- }
- if(!color_shading){
- *q = qRgba((unsigned char)(shade),
- (unsigned char)(shade),
- (unsigned char)(shade),
- qAlpha(*s1));
- }
- else{
- *q = qRgba((unsigned char)((shade*qRed(*s1))/(MaxRGB+1)),
- (unsigned char)((shade*qGreen(*s1))/(MaxRGB+1)),
- (unsigned char)((shade*qBlue(*s1))/(MaxRGB+1)),
- qAlpha(*s1));
- }
- ++s0;
- ++s1;
- ++s2;
- q++;
- }
- *q++=(*s1);
- }
- }
- else{ // PsudeoClass source image
- unsigned char *p, *s0, *s1, *s2;
- int scanLineIdx;
- unsigned int *cTable = (unsigned int *)src.colorTable();
- for(y=0; y < src.height(); ++y){
- scanLineIdx = QMIN(QMAX(y-1,0),src.height()-3);
- p = (unsigned char *)src.scanLine(scanLineIdx);
- q = (unsigned int *)dest.scanLine(y);
- // shade this row of pixels.
- s0 = p;
- s1 = (unsigned char *) src.scanLine(scanLineIdx+1);
- s2 = (unsigned char *) src.scanLine(scanLineIdx+2);
- *q++=(*(cTable+(*s1)));
- ++p;
- ++s0;
- ++s1;
- ++s2;
- for(x=1; x < src.width()-1; ++x){
- // determine the surface normal and compute shading.
- normal.x=intensityValue(*(cTable+(*(s0-1))))+intensityValue(*(cTable+(*(s1-1))))+intensityValue(*(cTable+(*(s2-1))))-
- (double) intensityValue(*(cTable+(*(s0+1))))-(double) intensityValue(*(cTable+(*(s1+1))))-
- (double) intensityValue(*(cTable+(*(s2+1))));
- normal.y=intensityValue(*(cTable+(*(s2-1))))+intensityValue(*(cTable+(*s2)))+intensityValue(*(cTable+(*(s2+1))))-
- (double) intensityValue(*(cTable+(*(s0-1))))-(double) intensityValue(*(cTable+(*s0)))-
- (double) intensityValue(*(cTable+(*(s0+1))));
- if((normal.x == 0) && (normal.y == 0))
- shade=light.z;
- else{
- shade=0.0;
- distance=normal.x*light.x+normal.y*light.y+normal.z*light.z;
- if (distance > 0.0){
- normal_distance=
- normal.x*normal.x+normal.y*normal.y+normal.z*normal.z;
- if(fabs(normal_distance) > 0.0000001)
- shade=distance/sqrt(normal_distance);
- }
- }
- if(!color_shading){
- *q = qRgba((unsigned char)(shade),
- (unsigned char)(shade),
- (unsigned char)(shade),
- qAlpha(*(cTable+(*s1))));
- }
- else{
- *q = qRgba((unsigned char)((shade*qRed(*(cTable+(*s1))))/(MaxRGB+1)),
- (unsigned char)((shade*qGreen(*(cTable+(*s1))))/(MaxRGB+1)),
- (unsigned char)((shade*qBlue(*(cTable+(*s1))))/(MaxRGB+1)),
- qAlpha(*s1));
- }
- ++s0;
- ++s1;
- ++s2;
- q++;
- }
- *q++=(*(cTable+(*s1)));
- }
- }
- return(dest);
-}
-
-QImage KImageEffect::blur(QImage &src, double factor)
-{
-
-#define Blur(weight) \
- total_red+=(weight)*qRed(*s); \
- total_green+=(weight)*qGreen(*s); \
- total_blue+=(weight)*qBlue(*s); \
- total_opacity+=(weight)*qAlpha(*s); \
- s++;
-
-#define Blur256(weight) \
- total_red+=(weight)*qRed(*(cTable+(*s))); \
- total_green+=(weight)*qGreen(*(cTable+(*s))); \
- total_blue+=(weight)*qBlue(*(cTable+(*s))); \
- total_opacity+=(weight)*qAlpha(*(cTable+(*s))); \
- s++;
-
- if(src.width() < 3 || src.height() < 3)
- return(src);
-
- double quantum, total_blue, total_green, total_opacity, total_red, weight;
-
- int x, y;
- unsigned int *q;
-
- QImage dest(src.width(), src.height(), 32);
- weight=((100.0-factor)/2)+1;
- quantum = QMAX(weight+12.0, 1.0);
- if(src.depth() > 8){ // DirectClass source image
- unsigned int *p, *s;
- for(y=0; y < src.height(); ++y){
- p = (unsigned int *)src.scanLine(QMIN(QMAX(y-1,0),src.height()-3));
- q = (unsigned int *)dest.scanLine(y);
- // blur this row of pixels.
- *q++=(*(p+src.width()));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- total_opacity=0.0;
- s=p;
- Blur(1); Blur(2); Blur(1);
- s=p+src.width();
- Blur(2); Blur(weight); Blur(2);
- s=p+2*src.width();
- Blur(1); Blur(2); Blur(1);
- *q = qRgba((unsigned char)((total_red+(quantum/2))/quantum),
- (unsigned char)((total_green+(quantum/2))/quantum),
- (unsigned char)((total_blue+(quantum/2))/quantum),
- (unsigned char)((total_opacity+(quantum/2))/quantum));
- p++;
- q++;
- }
- p++;
- *q++=(*p);
- }
- }
- else{ // PsudeoClass source image
- unsigned char *p, *p2, *p3, *s;
- unsigned int *cTable = src.colorTable();
- int scanLineIdx;
- for(y=0; y < src.height(); ++y){
- scanLineIdx = QMIN(QMAX(y-1,0),src.height()-3);
- p = (unsigned char *)src.scanLine(scanLineIdx);
- p2 = (unsigned char *)src.scanLine(scanLineIdx+1);
- p3 = (unsigned char *)src.scanLine(scanLineIdx+2);
- q = (unsigned int *)dest.scanLine(y);
- // blur this row of pixels.
- *q++=(*(cTable+(*p2)));
- for(x=1; x < src.width()-1; ++x){
- // compute weighted average of target pixel color components.
- total_red=0.0;
- total_green=0.0;
- total_blue=0.0;
- total_opacity=0.0;
- s=p;
- Blur256(1); Blur256(2); Blur256(1);
- s=p2;
- Blur256(2); Blur256(weight); Blur256(2);
- s=p3;
- Blur256(1); Blur256(2); Blur256(1);
- *q = qRgba((unsigned char)((total_red+(quantum/2))/quantum),
- (unsigned char)((total_green+(quantum/2))/quantum),
- (unsigned char)((total_blue+(quantum/2))/quantum),
- (unsigned char)((total_opacity+(quantum/2))/quantum));
- p++;
- p2++;
- p3++;
- q++;
- }
- p++;
- *q++=(*(cTable+(*p)));
- }
- }
- return(dest);
-}
-
-// High quality, expensive HSV contrast. You can do a faster one by just
-// taking a grayscale threshold (ie: 128) and incrementing RGB color
-// channels above it and decrementing those below it, but this gives much
-// better results. (mosfet 12/28/01)
-void KImageEffect::contrastHSV(QImage &img, bool sharpen)
-{
- int i, sign;
- unsigned int *data;
- int count;
- double brightness, scale, theta;
- QColor c;
- int h, s, v;
-
- sign = sharpen ? 1 : -1;
- scale=0.5000000000000001;
- if(img.depth() > 8){
- count = img.width()*img.height();
- data = (unsigned int *)img.bits();
- }
- else{
- count = img.numColors();
- data = (unsigned int *)img.colorTable();
- }
- for(i=0; i < count; ++i){
- c.setRgb(data[i]);
- c.hsv(&h, &s, &v);
- brightness = v/255.0;
- theta=(brightness-0.5)*M_PI;
- brightness+=scale*(((scale*((sin(theta)+1.0)))-brightness)*sign);
- if (brightness > 1.0)
- brightness=1.0;
- else
- if (brightness < 0)
- brightness=0.0;
- v = (int)(brightness*255);
- c.setHsv(h, s, v);
- data[i] = qRgba(c.red(), c.green(), c.blue(), qAlpha(data[i]));
- }
-}
-
-
-
-
/trunk/Scribus/scribus/kimageeffect.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-13ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-13ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-13ps.enc (nonexistent)
@@ -1,96 +0,0 @@
-16#A0 /space
-16#A1 /quotedblright
-16#A2 /cent
-16#A3 /sterling
-16#A4 /currency
-16#A5 /quotedblbase
-16#A6 /brokenbar
-16#A7 /section
-16#A8 /Oslash
-16#A9 /copyright
-16#AA /Rcedilla
-16#AB /guillemotleft
-16#AC /logicalnot
-16#AD /hyphen
-16#AE /registered
-16#AF /AE
-16#B0 /degree
-16#B1 /plusminus
-16#B2 /twosuperior
-16#B3 /threesuperior
-16#B4 /quotedblleft
-16#B5 /mu
-16#B6 /paragraph
-16#B7 /bullet
-16#B8 /oslash
-16#B9 /onesuperior
-16#BA /rcedilla
-16#BB /guillemotright
-16#BC /onequarter
-16#BD /onehalf
-16#BE /threequarters
-16#BF /ae
-16#C0 /Aogonek
-16#C1 /Iogonek
-16#C2 /Amacron
-16#C3 /Cacute
-16#C4 /Adieresis
-16#C5 /Aring
-16#C6 /Eogonek
-16#C7 /Emacron
-16#C8 /Ccaron
-16#C9 /Eacute
-16#CA /Zacute
-16#CB /Edotaccent
-16#CC /Gcedilla
-16#CD /Kcedilla
-16#CE /Imacron
-16#CF /Lcedilla
-16#D0 /Scaron
-16#D1 /Nacute
-16#D2 /Ncedilla
-16#D3 /Oacute
-16#D4 /Omacron
-16#D5 /Otilde
-16#D6 /Odieresis
-16#D7 /multiply
-16#D8 /Uogonek
-16#D9 /Lslash
-16#DA /Sacute
-16#DB /Umacron
-16#DC /Udieresis
-16#DD /Zdotaccent
-16#DE /Zcaron
-16#DF /germandbls
-16#E0 /aogonek
-16#E1 /iogonek
-16#E2 /amacron
-16#E3 /cacute
-16#E4 /adieresis
-16#E5 /aring
-16#E6 /eogonek
-16#E7 /emacron
-16#E8 /ccaron
-16#E9 /eacute
-16#EA /zacute
-16#EB /edotaccent
-16#EC /gcedilla
-16#ED /kcedilla
-16#EE /imacron
-16#EF /lcedilla
-16#F0 /scaron
-16#F1 /nacute
-16#F2 /ncedilla
-16#F3 /oacute
-16#F4 /omacron
-16#F5 /otilde
-16#F6 /odieresis
-16#F7 /divide
-16#F8 /uogonek
-16#F9 /lslash
-16#FA /sacute
-16#FB /umacron
-16#FC /udieresis
-16#FD /zdotaccent
-16#FE /zcaron
-16#FF /quoteright
/trunk/Scribus/scribus/iso8859-13ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-10ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-10ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-10ps.enc (nonexistent)
@@ -1,96 +0,0 @@
-16#A0 /space
-16#A1 /Aogonek
-16#A2 /Emacron
-16#A3 /Gcedilla
-16#A4 /Imacron
-16#A5 /Itilde
-16#A6 /Kcedilla
-16#A7 /Lcedilla
-16#A8 /acute
-16#A9 /Rcedilla
-16#AA /Scaron
-16#AB /Tbar
-16#AC /Zcaron
-16#AD /hyphen
-16#AE /kra
-16#AF /Eng
-16#B0 /Dbar
-16#B1 /aogonek
-16#B2 /emacron
-16#B3 /gcedilla
-16#B4 /imacron
-16#B5 /itilde
-16#B6 /kcedilla
-16#B7 /lcedilla
-16#B8 /nacute
-16#B9 /rcedilla
-16#BA /scaron
-16#BB /tbar
-16#BC /zcaron
-16#BD /section
-16#BE /germandbls
-16#BF /eng
-16#C0 /Amacron
-16#C1 /Aacute
-16#C2 /Acircumflex
-16#C3 /Atilde
-16#C4 /Adieresis
-16#C5 /Aring
-16#C6 /AE
-16#C7 /Iogonek
-16#C8 /Ccaron
-16#C9 /Eacute
-16#CA /Eogonek
-16#CB /Edieresis
-16#CC /Edotaccent
-16#CD /Iacute
-16#CE /Icircumflex
-16#CF /Idieresis
-16#D0 /Dbar
-16#D1 /Ncedilla
-16#D2 /Omacron
-16#D3 /Oacute
-16#D4 /Ocircumflex
-16#D5 /Otilde
-16#D6 /Odieresis
-16#D7 /Utilde
-16#D8 /Oslash
-16#D9 /Uogonek
-16#DA /Uacute
-16#DB /Ucircumflex
-16#DC /Udieresis
-16#DD /Yacute
-16#DE /Thorn
-16#DF /Umacron
-16#E0 /amacron
-16#E1 /aacute
-16#E2 /acircumflex
-16#E3 /atilde
-16#E4 /adieresis
-16#E5 /aring
-16#E6 /ae
-16#E7 /iogonek
-16#E8 /ccaron
-16#E9 /eacute
-16#EA /eogonek
-16#EB /edieresis
-16#EC /edotaccent
-16#ED /iacute
-16#EE /icircumflex
-16#EF /idieresis
-16#F0 /eth
-16#F1 /ncedilla
-16#F2 /omacron
-16#F3 /oacute
-16#F4 /ocircumflex
-16#F5 /otilde
-16#F6 /odieresis
-16#F7 /utilde
-16#F8 /oslash
-16#F9 /uogonek
-16#FA /uacute
-16#FB /ucircumflex
-16#FC /udieresis
-16#FD /yacute
-16#FE /thorn
-16#FF /umacron
/trunk/Scribus/scribus/iso8859-10ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-15.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-15.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-15.enc (nonexistent)
@@ -1,32 +0,0 @@
-0 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl
-/numbersign /dollar /percent /ampersand /quotesingle /parenleft
-/parenright /asterisk /plus /comma /hyphen /period /slash /zero
-/one /two /three /four /five /six /seven /eight /nine /colon /semicolon
-/less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J
-/K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft
-/backslash /bracketright /asciicircum /underscore /grave /a /b /c
-/d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y
-/z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /space /exclamdown /cent /sterling /Euro /yen
-/Scaron /section /scaron /copyright /ordfeminine /guillemotleft
-/logicalnot /hyphen /registered /macron /degree /plusminus
-/twosuperior /threesuperior /Zcaron /mu /paragraph /bullet /zcaron
-/onesuperior /ordmasculine /guillemotright /OE /oe /Ydieresis
-/questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis
-/Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis
-/Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve
-/Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave
-/Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave
-/aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
-/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
-/idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde
-/odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis
-/yacute /thorn /ydieresis
/trunk/Scribus/scribus/iso8859-15.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-13.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-13.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-13.enc (nonexistent)
@@ -1,37 +0,0 @@
-0 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /space /exclam /quotedbl /numbersign
-/dollar /percent /ampersand /quotesingle /parenleft
-/parenright /asterisk /plus /comma /hyphen /period
-/slash /zero /one /two /three /four /five /six /seven
-/eight /nine /colon /semicolon /less /equal /greater
-/question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N
-/O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash
-/bracketright /asciicircum /underscore /grave /a /b /c /d
-/e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w
-/x /y /z /braceleft /bar /braceright /asciitilde /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /space /guillemotright /cent /pounds
-/currency /yen /brokenbar /paragraph /Oslash /copyright
-/ordfeminine /Rcedilla /guillemotleft /logicalnot /less /registered
-/AE /degree /plusminus /twosuperior /threesuperior /quoteleft
-/colon /oslash /onesuperior /rcedilla /guillemotright /onequarter
-/onehalf /threequarters /questiondown /ae /Aogonek /Iogonek
-/Amacron /Cacute /Adieresis /Aring /Eogonek /Emacron
-/Ccaron /Eacute /Zacute /Edotaccent /Gcedilla /Kcedilla
-/Imacron /Lcedilla /Scaron /Nacute /Ncedilla /Oacute
-/Omacron /Otilde /Odieresis /multiply /Uogonek /Lslash
-/Sacute /Umacron /Udieresis /Zdotaccent /Zcaron /germandbls
-/aogonek /iogonek /amacron /cacute /adieresis /aring
-/eogonek /emacron /ccaron /eacute /zacute /edotaccent
-/gcedilla /kcedilla /imacron /lcedilla /scaron /nacute
-/ncedilla /oacute /omacron /otilde /odieresis /divide
-/uogonek /lslash /sacute /umacron /udieresis /zdotaccent
-/zcaron /quoteright
/trunk/Scribus/scribus/iso8859-13.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/iso8859-5ps.enc
===================================================================
--- trunk/Scribus/scribus/iso8859-5ps.enc (revision 67)
+++ trunk/Scribus/scribus/iso8859-5ps.enc (nonexistent)
@@ -1,96 +0,0 @@
-16#A0 /space
-16#A1 /afii10023
-16#A2 /afii10051
-16#A3 /afii10052
-16#A4 /afii10053
-16#A5 /afii10054
-16#A6 /afii10055
-16#A7 /afii10056
-16#A8 /afii10057
-16#A9 /afii10058
-16#AA /afii10059
-16#AB /afii10060
-16#AC /afii10061
-16#AD /hyphen
-16#AE /afii10062
-16#AF /afii10145
-16#B0 /afii10017
-16#B1 /afii10018
-16#B2 /afii10019
-16#B3 /afii10020
-16#B4 /afii10021
-16#B5 /afii10022
-16#B6 /afii10024
-16#B7 /afii10025
-16#B8 /afii10026
-16#B9 /afii10027
-16#BA /afii10028
-16#BB /afii10029
-16#BC /afii10030
-16#BD /afii10031
-16#BE /afii10032
-16#BF /afii10033
-16#C0 /afii10034
-16#C1 /afii10035
-16#C2 /afii10036
-16#C3 /afii10037
-16#C4 /afii10038
-16#C5 /afii10039
-16#C6 /afii10040
-16#C7 /afii10041
-16#C8 /afii10042
-16#C9 /afii10043
-16#CA /afii10044
-16#CB /afii10045
-16#CC /afii10046
-16#CD /afii10047
-16#CE /afii10048
-16#CF /afii10049
-16#D0 /afii10065
-16#D1 /afii10066
-16#D2 /afii10067
-16#D3 /afii10068
-16#D4 /afii10069
-16#D5 /afii10070
-16#D6 /afii10072
-16#D7 /afii10073
-16#D8 /afii10074
-16#D9 /afii10075
-16#DA /afii10076
-16#DB /afii10077
-16#DC /afii10078
-16#DD /afii10079
-16#DE /afii10080
-16#DF /afii10081
-16#E0 /afii10082
-16#E1 /afii10083
-16#E2 /afii10084
-16#E3 /afii10085
-16#E4 /afii10086
-16#E5 /afii10087
-16#E6 /afii10088
-16#E7 /afii10089
-16#E8 /afii10090
-16#E9 /afii10091
-16#EA /afii10092
-16#EB /afii10093
-16#EC /afii10094
-16#ED /afii10095
-16#EE /afii10096
-16#EF /afii10097
-16#F0 /afii61352
-16#F1 /afii10071
-16#F2 /afii10099
-16#F3 /afii10100
-16#F4 /afii10101
-16#F5 /afii10102
-16#F6 /afii10103
-16#F7 /afii10104
-16#F8 /afii10105
-16#F9 /afii10106
-16#FA /afii10107
-16#FB /afii10108
-16#FC /afii10109
-16#FD /yacute
-16#FE /afii10110
-16#FF /afii10193
/trunk/Scribus/scribus/iso8859-5ps.enc
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/scfonts_encoding.cpp
===================================================================
--- trunk/Scribus/scribus/scfonts_encoding.cpp (revision 67)
+++ trunk/Scribus/scribus/scfonts_encoding.cpp (nonexistent)
@@ -1,45 +0,0 @@
-#include "config.h"
-#include <qapplication.h>
-#include <qfile.h>
-#include <qtextstream.h>
-
-#include <iostream>
-
-#include "scfonts_encoding.h"
-
-#ifndef PREL
-#define PREL "/usr/local"
-#endif
-
-
-bool SCFonts_Encoding::read(QString name)
-{
- QString ISO;
- QString pfad = PREL;
- pfad += "/lib/scribus/" + name;
- QFile tf(pfad);
- if (tf.open(IO_ReadOnly))
- {
- QTextStream t(&tf);
- ISO=t.read();
- tf.close();
- }
- else
- return(false);
- QTextStream isoTs(&ISO, IO_ReadOnly);
- isoTs << oct;
- while (!isoTs.atEnd())
- {
- QString iNam;
- int iNr;
- isoTs >> iNam >> iNr;
- Codes[iNam] = iNr;
- Names[iNr]=iNam;
- }
-}
-
-
-SCFonts_Encoding::SCFonts_Encoding(QString name)
-{
- read(name);
-}
/trunk/Scribus/scribus/scfonts_encoding.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/TTFenc.txt
===================================================================
--- trunk/Scribus/scribus/TTFenc.txt (revision 67)
+++ trunk/Scribus/scribus/TTFenc.txt (nonexistent)
@@ -1,258 +0,0 @@
-.notdef 00
-.null 01
-CR 02
-space 03
-exclam 04
-quotedbl 05
-numbersign 06
-dollar 07
-percent 010
-ampersand 011
-quotesingle 012
-parenleft 013
-parenright 014
-asterisk 015
-plus 016
-comma 017
-hyphen 020
-period 021
-slash 022
-zero 023
-one 024
-two 025
-three 026
-four 027
-five 030
-six 031
-seven 032
-eight 033
-nine 034
-colon 035
-semicolon 036
-less 037
-equal 040
-greater 041
-question 042
-at 043
-A 044
-B 045
-C 046
-D 047
-E 050
-F 051
-G 052
-H 053
-I 054
-J 055
-K 056
-L 057
-M 060
-N 061
-O 062
-P 063
-Q 064
-R 065
-S 066
-T 067
-U 070
-V 071
-W 072
-X 073
-Y 074
-Z 075
-bracketleft 076
-backslash 077
-bracketright 0100
-asciicircum 0101
-underscore 0102
-grave 0103
-a 0104
-b 0105
-c 0106
-d 0107
-e 0110
-f 0111
-g 0112
-h 0113
-i 0114
-j 0115
-k 0116
-l 0117
-m 0120
-n 0121
-o 0122
-p 0123
-q 0124
-r 0125
-s 0126
-t 0127
-u 0130
-v 0131
-w 0132
-x 0133
-y 0134
-z 0135
-braceleft 0136
-bar 0137
-braceright 0140
-asciitilde 0141
-Adieresis 0142
-Aring 0143
-Ccedilla 0144
-Eacute 0145
-Ntilde 0146
-Odieresis 0147
-Udieresis 0150
-aacute 0151
-agrave 0152
-acircumflex 0153
-adieresis 0154
-atilde 0155
-aring 0156
-ccedilla 0157
-eacute 0160
-egrave 0161
-ecircumflex 0162
-edieresis 0163
-iacute 0164
-igrave 0165
-icircumflex 0166
-idieresis 0167
-ntilde 0170
-oacute 0171
-ograve 0172
-ocircumflex 0173
-odieresis 0174
-otilde 0175
-uacute 0176
-ugrave 0177
-ucircumflex 0200
-udieresis 0201
-dagger 0202
-degree 0203
-cent 0204
-sterling 0205
-section 0206
-bullet 0207
-paragraph 0210
-germandbls 0211
-registered 0212
-copyright 0213
-trademark 0214
-acute 0215
-dieresis 0216
-notequal 0217
-AE 0220
-Oslash 0221
-infinity 0222
-plusminus 0223
-lessequal 0224
-greaterequal 0225
-yen 0226
-mu1 0227
-partialdiff 0230
-summation 0231
-product 0232
-pi 0233
-integral 0234
-ordfeminine 0235
-ordmasculine 0236
-Ohm 0237
-ae 0240
-oslash 0241
-questiondown 0242
-exclamdown 0243
-logicalnot 0244
-radical 0245
-florin 0246
-approxequal 0247
-increment 0250
-guillemotleft 0251
-guillemotright 0252
-ellipsis 0253
-nbspace 0254
-Agrave 0255
-Atilde 0256
-Otilde 0257
-OE 0260
-oe 0261
-endash 0262
-emdash 0263
-quotedblleft 0264
-quotedblright 0265
-quoteleft 0266
-quoteright 0267
-divide 0270
-lozenge 0271
-ydieresis 0272
-Ydieresis 0273
-fraction 0274
-currency 0275
-guilsingleft 0276
-guilsingright 0277
-fi 0300
-fl 0301
-daggerdbl 0302
-periodcentered 0303
-quotesinglbase 0304
-quotedblbase 0305
-perthousand 0306
-Acircumflex 0307
-Ecircumflex 0310
-Aacute 0311
-Edieresis 0312
-Egrave 0313
-Iacute 0314
-Icircumflex 0315
-Idieresis 0316
-Igrave 0317
-Oacute 0320
-Ocircumflex 0321
-applelogo 0322
-Ograve 0323
-Uacute 0324
-Ucircumflex 0325
-Ugrave 0326
-dotlessi 0327
-circumflex 0330
-tilde 0331
-overscore 0332
-breve 0333
-dotaccent 0334
-ring 0335
-cedilla 0336
-hungarumlaut 0337
-ogonek 0340
-caron 0341
-Lslash 0342
-lslash 0343
-Scaron 0344
-scaron 0345
-Zcaron 0346
-zcaron 0347
-brokenbar 0350
-Eth 0351
-eth 0352
-Yacute 0353
-yacute 0354
-Thorn 0355
-thorn 0356
-minus 0357
-multiply 0360
-onesuperior 0361
-twosuperior 0362
-threesuperior 0363
-onehalf 0364
-onequarter 0365
-threequarters 0366
-franc 0367
-Gbreve 0370
-gbreve 0371
-Idot 0372
-Scedilla 0373
-scedilla 0374
-Cacute 0375
-cacute 0376
-Ccaron 0377
-ccaron 0400
-dmacron 0401
/trunk/Scribus/scribus/TTFenc.txt
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/art_render_misc.c
===================================================================
--- trunk/Scribus/scribus/art_render_misc.c (nonexistent)
+++ trunk/Scribus/scribus/art_render_misc.c (revision 68)
@@ -0,0 +1,403 @@
+/* This file is part of the KDE project.
+ * art_render_misc.c: Here I store some routines I feel should be in libart :)
+ *
+ * Copyright (C) 2002, The Karbon Developers
+ *
+ * This code is adapted from :
+ *
+ * art_render_gradient.c: Gradient image source for modular rendering.
+ *
+ * Libart_LGPL - library of basic graphic primitives
+ * Copyright (C) 2000 Raph Levien
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Raph Levien <raph@acm.org>
+ * Alexander Larsson <alla@lysator.liu.se>
+ */
+
+#include "config.h"
+#include "art_render_misc.h"
+
+#include <math.h>
+
+typedef struct _ArtImageSourceGradLin ArtImageSourceGradLin;
+typedef struct _ArtImageSourceGradRad ArtImageSourceGradRad;
+typedef struct _ArtImageSourceGradCon ArtImageSourceGradCon;
+
+struct _ArtImageSourceGradLin {
+ ArtImageSource super;
+ const ArtGradientLinear *gradient;
+};
+
+struct _ArtImageSourceGradRad {
+ ArtImageSource super;
+ const ArtGradientRadial *gradient;
+ double a;
+};
+
+struct _ArtImageSourceGradCon {
+ ArtImageSource super;
+ const ArtGradientConical *gradient;
+};
+
+
+#define EPSILON 1e-6
+
+/**
+ * art_karbon_render_gradient_setpix: Set a gradient pixel.
+ * @render: The render object.
+ * @dst: Pointer to destination (where to store pixel).
+ * @n_stops: Number of stops in @stops.
+ * @stops: The stops for the gradient.
+ * @offset: The offset.
+ *
+ * @n_stops must be > 0.
+ *
+ * Sets a gradient pixel, storing it at @dst.
+ **/
+static void
+art_karbon_render_gradient_setpix (ArtRender *render,
+ art_u8 *dst,
+ int n_stops, ArtGradientStop *stops,
+ double offset)
+{
+ int ix;
+ int j;
+ double off0, off1;
+ int n_ch = render->n_chan + 1;
+
+ for (ix = 0; ix < n_stops; ix++)
+ if (stops[ix].offset > offset)
+ break;
+ /* stops[ix - 1].offset < offset < stops[ix].offset */
+ if (ix > 0 && ix < n_stops)
+ {
+ off0 = stops[ix - 1].offset;
+ off1 = stops[ix].offset;
+ if (fabs (off1 - off0) > EPSILON)
+ {
+ double interp;
+
+ interp = (offset - off0) / (off1 - off0);
+ for (j = 0; j < n_ch; j++)
+ {
+ int z0, z1;
+ int z;
+ z0 = stops[ix - 1].color[j];
+ z1 = stops[ix].color[j];
+ z = floor (z0 + (z1 - z0) * interp + 0.5);
+ if (render->buf_depth == 8)
+ dst[j] = ART_PIX_8_FROM_MAX (z);
+ else /* (render->buf_depth == 16) */
+ ((art_u16 *)dst)[j] = z;
+ }
+ return;
+ }
+ }
+ else if (ix == n_stops)
+ ix--;
+
+ for (j = 0; j < n_ch; j++)
+ {
+ int z;
+ z = stops[ix].color[j];
+ if (render->buf_depth == 8)
+ dst[j] = ART_PIX_8_FROM_MAX (z);
+ else /* (render->buf_depth == 16) */
+ ((art_u16 *)dst)[j] = z;
+ }
+}
+
+static void
+art_karbon_render_gradient_linear_done (ArtRenderCallback *self, ArtRender *render)
+{
+ art_free (self);
+}
+
+static void
+art_karbon_render_gradient_linear_render (ArtRenderCallback *self, ArtRender *render,
+ art_u8 *dest, int y)
+{
+ ArtImageSourceGradLin *z = (ArtImageSourceGradLin *)self;
+ const ArtGradientLinear *gradient = z->gradient;
+ int pixstride = (render->n_chan + 1) * (render->depth >> 3);
+ int x;
+ int width = render->x1 - render->x0;
+ double offset, d_offset;
+ double actual_offset;
+ int n_stops = gradient->n_stops;
+ ArtGradientStop *stops = gradient->stops;
+ art_u8 *bufp = render->image_buf;
+ ArtGradientSpread spread = gradient->spread;
+
+ offset = render->x0 * gradient->a + y * gradient->b + gradient->c;
+ d_offset = gradient->a;
+
+ for (x = 0; x < width; x++)
+ {
+ if (spread == ART_GRADIENT_PAD)
+ actual_offset = offset;
+ else if (spread == ART_GRADIENT_REPEAT)
+ actual_offset = offset - floor (offset);
+ else /* (spread == ART_GRADIENT_REFLECT) */
+ {
+ double tmp;
+
+ tmp = offset - 2 * floor (0.5 * offset);
+ actual_offset = tmp > 1 ? 2 - tmp : tmp;
+ }
+ art_karbon_render_gradient_setpix (render, bufp, n_stops, stops, actual_offset);
+ offset += d_offset;
+ bufp += pixstride;
+ }
+}
+
+static void
+art_karbon_render_gradient_linear_negotiate (ArtImageSource *self, ArtRender *render,
+ ArtImageSourceFlags *p_flags,
+ int *p_buf_depth, ArtAlphaType *p_alpha)
+{
+ self->super.render = art_karbon_render_gradient_linear_render;
+ *p_flags = 0;
+ *p_buf_depth = render->depth;
+ *p_alpha = ART_ALPHA_PREMUL;
+}
+
+/**
+ * art_karbon_render_gradient_linear: Add a linear gradient image source.
+ * @render: The render object.
+ * @gradient: The linear gradient.
+ *
+ * Adds the linear gradient @gradient as the image source for rendering
+ * in the render object @render.
+ **/
+void
+art_karbon_render_gradient_linear (ArtRender *render,
+ const ArtGradientLinear *gradient,
+ ArtFilterLevel level)
+{
+ ArtImageSourceGradLin *image_source = art_new (ArtImageSourceGradLin, 1);
+
+ image_source->super.super.render = NULL;
+ image_source->super.super.done = art_karbon_render_gradient_linear_done;
+ image_source->super.negotiate = art_karbon_render_gradient_linear_negotiate;
+
+ image_source->gradient = gradient;
+
+ art_render_add_image_source (render, &image_source->super);
+}
+
+static void
+art_karbon_render_gradient_radial_done (ArtRenderCallback *self, ArtRender *render)
+{
+ art_free (self);
+}
+
+static void
+art_karbon_render_gradient_radial_render (ArtRenderCallback *self, ArtRender *render,
+ art_u8 *dest, int y)
+{
+ ArtImageSourceGradRad *z = (ArtImageSourceGradRad *)self;
+ const ArtGradientRadial *gradient = z->gradient;
+ int pixstride = (render->n_chan + 1) * (render->depth >> 3);
+ int x;
+ int x0 = render->x0;
+ int width = render->x1 - x0;
+ int n_stops = gradient->n_stops;
+ ArtGradientStop *stops = gradient->stops;
+ art_u8 *bufp = render->image_buf;
+ double fx = gradient->fx;
+ double fy = gradient->fy;
+ double dx, dy;
+ double *affine = gradient->affine;
+ double aff0 = affine[0];
+ double aff1 = affine[1];
+ const double a = z->a;
+ const double arecip = 1.0 / a;
+ double b, db;
+ double c, dc, ddc;
+ double b_a, db_a;
+ double rad, drad, ddrad;
+ ArtGradientSpread spread = gradient->spread;
+
+ dx = x0 * aff0 + y * affine[2] + affine[4] - fx;
+ dy = x0 * aff1 + y * affine[3] + affine[5] - fy;
+ b = dx * fx + dy * fy;
+ db = aff0 * fx + aff1 * fy;
+ c = dx * dx + dy * dy;
+ dc = 2 * aff0 * dx + aff0 * aff0 + 2 * aff1 * dy + aff1 * aff1;
+ ddc = 2 * aff0 * aff0 + 2 * aff1 * aff1;
+
+ b_a = b * arecip;
+ db_a = db * arecip;
+
+ rad = b_a * b_a + c * arecip;
+ drad = 2 * b_a * db_a + db_a * db_a + dc * arecip;
+ ddrad = 2 * db_a * db_a + ddc * arecip;
+
+ for (x = 0; x < width; x++)
+ {
+ double z;
+
+ if (rad > 0)
+ z = b_a + sqrt (rad);
+ else
+ z = b_a;
+
+ if (spread == ART_GRADIENT_REPEAT)
+ z = z - floor (z);
+ else if (spread == ART_GRADIENT_REFLECT)
+ {
+ double tmp;
+
+ tmp = z - 2 * floor (0.5 * z);
+ z = tmp > 1 ? 2 - tmp : tmp;
+ }
+
+ art_karbon_render_gradient_setpix (render, bufp, n_stops, stops, z);
+ bufp += pixstride;
+ b_a += db_a;
+ rad += drad;
+ drad += ddrad;
+ }
+}
+
+static void
+art_karbon_render_gradient_radial_negotiate (ArtImageSource *self, ArtRender *render,
+ ArtImageSourceFlags *p_flags,
+ int *p_buf_depth, ArtAlphaType *p_alpha)
+{
+ self->super.render = art_karbon_render_gradient_radial_render;
+ *p_flags = 0;
+ *p_buf_depth = render->depth;
+ *p_alpha = ART_ALPHA_PREMUL;
+}
+
+/**
+ * art_karbon_render_gradient_radial: Add a radial gradient image source.
+ * @render: The render object.
+ * @gradient: The radial gradient.
+ *
+ * Adds the radial gradient @gradient as the image source for rendering
+ * in the render object @render.
+ **/
+void
+art_karbon_render_gradient_radial (ArtRender *render,
+ const ArtGradientRadial *gradient,
+ ArtFilterLevel level)
+{
+ ArtImageSourceGradRad *image_source = art_new (ArtImageSourceGradRad, 1);
+ double fx = gradient->fx;
+ double fy = gradient->fy;
+
+ image_source->super.super.render = NULL;
+ image_source->super.super.done = art_karbon_render_gradient_radial_done;
+ image_source->super.negotiate = art_karbon_render_gradient_radial_negotiate;
+
+ image_source->gradient = gradient;
+ /* todo: sanitycheck fx, fy? */
+ image_source->a = 1 - fx * fx - fy * fy;
+
+ art_render_add_image_source (render, &image_source->super);
+}
+
+/* Conical */
+
+static void
+art_render_gradient_conical_done (ArtRenderCallback *self, ArtRender *render)
+{
+ art_free (self);
+}
+
+static void
+art_render_gradient_conical_render (ArtRenderCallback *self, ArtRender *render,
+ art_u8 *dest, int y)
+{
+ ArtImageSourceGradCon *z = (ArtImageSourceGradCon *)self;
+ const ArtGradientConical *gradient = z->gradient;
+ int pixstride = (render->n_chan + 1) * (render->depth >> 3);
+ int x;
+ int x0 = render->x0;
+ int width = render->x1 - x0;
+ int n_stops = gradient->n_stops;
+ ArtGradientStop *stops = gradient->stops;
+ art_u8 *bufp = render->image_buf;
+ double cx = gradient->cx;
+ double cy = gradient->cy;
+ double r = gradient->r;
+ double dx, dy;
+ ArtGradientSpread spread = gradient->spread;
+
+ dy = fabs(y) - fabs(cy);
+
+ for (x = 0; x < width; x++)
+ {
+ double z;
+ dx = fabs(x0 + x) - fabs(cx);
+
+ z = (fabs(dx) + fabs(dy)) / (r);
+
+ if (spread == ART_GRADIENT_REPEAT)
+ z = z - floor (z);
+ else if (spread == ART_GRADIENT_REFLECT)
+ {
+ double tmp;
+
+ tmp = z - 2 * floor (0.5 * z);
+ z = tmp > 1 ? 2 - tmp : tmp;
+ }
+
+ art_karbon_render_gradient_setpix (render, bufp, n_stops, stops, z);
+ bufp += pixstride;
+ }
+}
+
+static void
+art_render_gradient_conical_negotiate (ArtImageSource *self, ArtRender *render,
+ ArtImageSourceFlags *p_flags,
+ int *p_buf_depth, ArtAlphaType *p_alpha)
+{
+ self->super.render = art_render_gradient_conical_render;
+ *p_flags = 0;
+ *p_buf_depth = render->depth;
+ *p_alpha = ART_ALPHA_PREMUL;
+}
+
+/**
+ * art_render_gradient_radial: Add a radial gradient image source.
+ * @render: The render object.
+ * @gradient: The radial gradient.
+ *
+ * Adds the radial gradient @gradient as the image source for rendering
+ * in the render object @render.
+ **/
+void
+art_karbon_render_gradient_conical (ArtRender *render,
+ const ArtGradientConical *gradient,
+ ArtFilterLevel level)
+{
+ ArtImageSourceGradCon *image_source = art_new (ArtImageSourceGradCon, 1);
+
+ image_source->super.super.render = NULL;
+ image_source->super.super.done = art_render_gradient_conical_done;
+ image_source->super.negotiate = art_render_gradient_conical_negotiate;
+
+ image_source->gradient = gradient;
+
+ art_render_add_image_source (render, &image_source->super);
+}
+
/trunk/Scribus/scribus/art_render_misc.c
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/fpointarray.h
===================================================================
--- trunk/Scribus/scribus/fpointarray.h (revision 67)
+++ trunk/Scribus/scribus/fpointarray.h (revision 68)
@@ -47,6 +47,9 @@
{ return (FPointArray&)assign( a ); }
FPointArray copy() const
{ FPointArray tmp; return *((FPointArray*)&tmp.duplicate(*this)); }
+ void setMarker();
+ void addPoint(float x, float y);
+ void addPoint(FPoint p);
~FPointArray() {};
};
/trunk/Scribus/scribus/art_render_misc.h
0,0 → 1,109
/* This file is part of the KDE project.
* art_render_misc.c: Here I store some routines I feel should be in libart :)
*
* Copyright (C) 2002, The Karbon Developers
*
* This code is adapted from :
*
* art_render_gradient.h: Gradient image source for modular rendering.
*
* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors: Raph Levien <raph@acm.org>
* Alexander Larsson <alla@lysator.liu.se>
*/
 
#ifndef __ART_RENDER_MISC_H__
#define __ART_RENDER_MISC_H__
 
#ifdef LIBART_COMPILATION
#include "art_filterlevel.h"
#include "art_render.h"
#else
#include <libart_lgpl/art_filterlevel.h>
#include <libart_lgpl/art_render.h>
#endif
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
typedef struct _ArtGradientLinear ArtGradientLinear;
typedef struct _ArtGradientRadial ArtGradientRadial;
typedef struct _ArtGradientConical ArtGradientConical;
typedef struct _ArtGradientStop ArtGradientStop;
 
typedef enum {
ART_GRADIENT_PAD,
ART_GRADIENT_REFLECT,
ART_GRADIENT_REPEAT
} ArtGradientSpread;
 
struct _ArtGradientLinear {
double a;
double b;
double c;
ArtGradientSpread spread;
int n_stops;
ArtGradientStop *stops;
};
 
struct _ArtGradientRadial {
double affine[6]; /* transforms user coordinates to unit circle */
double fx, fy; /* focal point in unit circle coords */
int n_stops;
ArtGradientSpread spread;
ArtGradientStop *stops;
};
 
struct _ArtGradientConical {
double cx, cy; /* focal point in unit circle coords */
double r; /* focal point in unit circle coords */
ArtGradientSpread spread;
art_u8 *buf;
int n_stops;
ArtGradientStop *stops;
};
 
 
struct _ArtGradientStop {
double offset;
ArtPixMaxDepth color[ART_MAX_CHAN + 1];
};
 
void
art_karbon_render_gradient_linear (ArtRender *render,
const ArtGradientLinear *gradient,
ArtFilterLevel level);
 
void
art_karbon_render_gradient_radial (ArtRender *render,
const ArtGradientRadial *gradient,
ArtFilterLevel level);
 
void
art_karbon_render_gradient_conical (ArtRender *render,
const ArtGradientConical *gradient,
ArtFilterLevel level);
 
#ifdef __cplusplus
}
#endif /* __cplusplus */
 
#endif /* __ART_RENDER_MISC_H__ */
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/mpalette.h
===================================================================
--- trunk/Scribus/scribus/mpalette.h (revision 67)
+++ trunk/Scribus/scribus/mpalette.h (revision 68)
@@ -19,6 +19,7 @@
#include <qimage.h>
#include <qpixmap.h>
#include <qlistbox.h>
+#include <qlineedit.h>
#include "mspinbox.h"
#include "pageitem.h"
#include "page.h"
@@ -28,7 +29,23 @@
#include "cpalette.h"
#include "spalette.h"
#include "fontcombo.h"
+extern bool CMSavail;
+class NameWidget : public QLineEdit
+{
+ Q_OBJECT
+
+public:
+ NameWidget(QWidget* parent);
+ ~NameWidget() {};
+
+signals:
+ void Leaved();
+
+protected:
+ virtual void focusOutEvent(QFocusEvent *);
+};
+
class Mpalette : public QDialog {
Q_OBJECT
public:
@@ -35,6 +52,11 @@
Mpalette(QWidget* parent, preV *Prefs);
~Mpalette() {};
void closeEvent(QCloseEvent *ce);
+ void ToggleFlow();
+ void updateCList();
+ void updateCmsList();
+ void ShowCMS();
+ void fillLangCombo(QMap<QString,QString> Sprachen);
QButtonGroup* buttonGroup5;
QToolButton* SShape;
@@ -44,12 +66,17 @@
QToolButton* SGeom;
QToolButton* SColor;
QWidgetStack* TabStack;
+ QWidgetStack* TabStack2;
QWidget* page;
QWidget* page_2;
+ QWidget* page_2a;
+ QWidget* page_2b;
QWidget* page_3;
QWidget* page_4;
QWidget* page_5;
Cpalette *Cpal;
+ QGroupBox* NameGroup;
+ NameWidget* NameEdit;
QGroupBox* GeoGroup;
QLabel* Text1;
QLabel* Text2;
@@ -78,6 +105,8 @@
MSpinBox* Rot;
QToolButton* FlipH;
QToolButton* FlipV;
+ QToolButton* Locked;
+ QToolButton* NoPrint;
QButtonGroup* ShapeGroup;
QToolButton* SRect;
QToolButton* SOval;
@@ -85,8 +114,14 @@
QLabel* Text4;
QSpinBox* RoundRect;
QCheckBox* Textflow;
+ QCheckBox* Textflow2;
QToolButton* EditShape;
QGroupBox* Distance;
+ QGroupBox* Distance2;
+ QLabel* TextLabel3;
+ QLabel* TextLabel2;
+ MSpinBox* Dist;
+ MSpinBox* LineW;
QLabel* Text14;
QLabel* Text15;
QLabel* Text16;
@@ -95,6 +130,7 @@
MSpinBox* DLeft;
QLabel* Text17;
MSpinBox* DRight;
+ QCheckBox* NormText2;
FontCombo* Fonts;
QSpinBox* Size;
QToolButton* Revert;
@@ -104,6 +140,7 @@
QToolButton* Supers;
QToolButton* Kapital;
QToolButton* Strike;
+ QToolButton* Outlined;
QButtonGroup* GroupAlign;
QToolButton* TextL;
QToolButton* TextR;
@@ -131,6 +168,10 @@
QRadioButton* FrameScale;
QFrame* Frame4;
QCheckBox* Aspect;
+ QLabel* TextCms1;
+ QLabel* TextCms2;
+ QComboBox* InputP;
+ QComboBox* MonitorI;
QComboBox* LineMode;
QLabel* Text9;
MSpinBox* LSize;
@@ -141,6 +182,18 @@
QLabel* Text8;
LineCombo* LStyle;
QListBox* StyledLine;
+ QLabel* ScaleTxt;
+ QSpinBox* ChScale;
+ QLabel* StrokeIcon;
+ QComboBox* TxStroke;
+ QToolButton *PM1;
+ QPopupMenu *TxStrokeSh;
+ QLabel* FillIcon;
+ QComboBox* TxFill;
+ QToolButton *PM2;
+ QPopupMenu *TxFillSh;
+ QLabel* SprachT;
+ QComboBox* LangCombo;
PageItem *CurItem;
bool HaveDoc;
bool HaveItem;
@@ -168,9 +221,15 @@
void setLIvalue(PenStyle p, PenCapStyle pc, PenJoinStyle pj);
void setStil(int s);
void setAli(int e);
+ void setTScale(int e);
+ void NewTScale();
void SetLineFormats(ScribusDoc *dd);
void SetSTline(QListBoxItem *c);
void NewTFont(int);
+ void newTxtFill();
+ void newTxtStroke();
+ void setActShade(int id);
+ void setActFarben(QString p, QString b, int shp, int shb);
private slots:
void SelTab(int t);
@@ -203,6 +262,7 @@
void DoBack();
void NewRotMode(int m);
void DoFlow();
+ void DoFlow2();
void MakeRect();
void MakeOval();
void MakeIrre();
@@ -209,6 +269,15 @@
void EditSh();
void NewTDist();
void DoRevert();
+ void handleLock();
+ void handlePrint();
+ void handlePathLine();
+ void handlePathDist();
+ void handlePathOffs();
+ void ChProf(const QString& prn);
+ void ChIntent();
+ void NewName();
+ void NewLanguage();
signals:
void Schliessen();
@@ -225,6 +294,8 @@
QGridLayout* buttonGroup5Layout;
QVBoxLayout* pageLayout;
QVBoxLayout* pageLayout_2;
+ QVBoxLayout* pageLayout_2a;
+ QVBoxLayout* pageLayout_2b;
QVBoxLayout* pageLayout_3;
QVBoxLayout* pageLayout_4;
QVBoxLayout* pageLayout_5;
@@ -231,6 +302,7 @@
QHBoxLayout* layout60;
QHBoxLayout* layout60a;
QVBoxLayout* Layout44;
+ QVBoxLayout* Layout44a;
QGridLayout* Layout12;
QVBoxLayout* Layout15_2;
QHBoxLayout* Layout13;
@@ -243,15 +315,21 @@
QHBoxLayout* Layout18;
QHBoxLayout* Layout13_2;
QGridLayout* Layout12_2;
+ QHBoxLayout* NameGroupLayout;
QGridLayout* GeoGroupLayout;
QGridLayout* LayerGroupLayout;
QHBoxLayout* RotationGroupLayout;
QHBoxLayout* ShapeGroupLayout;
QGridLayout* DistanceLayout;
+ QGridLayout* DistanceLayout2;
QHBoxLayout* ButtonGroup1Layout;
QGridLayout* GroupAlignLayout;
QGridLayout* GroupBox3Layout;
QVBoxLayout* GroupBox3aLayout;
+ QHBoxLayout* layout22;
+ QHBoxLayout* layout23;
+ QHBoxLayout* layout24;
+ QHBoxLayout* layoutLang;
};
#endif
/trunk/Scribus/scribus/customfdialog.cpp
282,7 → 282,12
if (SaveZip->isChecked())
{
if (tmp.right(3) != ".gz")
tmp = tmp+".gz";
{
if (tmp.right(3) == "svg")
tmp = tmp+"z";
else
tmp = tmp+".gz";
}
setSelection(tmp);
}
else
290,6 → 295,12
int en = tmp.findRev(".gz");
if (en > 0)
tmp.remove(en,3);
else
{
en = tmp.findRev("z");
if (en > 0)
tmp.remove(en,1);
}
}
setSelection(tmp);
}
/trunk/Scribus/scribus/helpbrowser.h
10,11 → 10,12
#define HELPBROWSER_H
 
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QTextBrowser;
class QToolButton;
#include <qpushbutton.h>
#include <qtextbrowser.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qpopupmenu.h>
#include <qmap.h>
 
class HelpBrowser : public QWidget
{
28,7 → 29,13
QToolButton* BackB;
QToolButton* ForwB;
QTextBrowser* Anzeige;
QPopupMenu* hist;
QMap<int, QString> mHistory;
 
public slots:
void sourceChanged(const QString& url);
void histChosen(int i);
 
protected:
QVBoxLayout* HelpBrowserLayout;
QHBoxLayout* Layout13;
/trunk/Scribus/scribus/scfonts_ttf.h
12,8 → 12,8
class Foi_ttf : public Foi
{
public:
Foi_ttf(QString scname, QString path, bool embedps, SCFonts_Encoding &encoding) :
Foi(scname,path,embedps,encoding), metricsread(false)
Foi_ttf(QString scname, QString path, bool embedps) :
Foi(scname,path,embedps), metricsread(false)
{
HasMetrics=true;
}
21,7 → 21,6
bool ReadMetrics();
virtual bool EmbedFont(QString &str);
private:
QString cached_RealName;
bool metricsread;
};
 
/trunk/Scribus/scribus/gdk-pixbuf-xlib-render.c
0,0 → 1,380
/* GdkPixbuf library - Rendering functions
*
* Copyright (C) 1999 The Free Software Foundation
*
* Author: Federico Mena-Quintero <federico@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
 
/* Trivially ported to Xlib(RGB) by John Harper. */
 
#include <config.h>
/* #include "gdk-pixbuf-private.h" */
#include "gdk-pixbuf-xlib-private.h"
 
/*
**
* gdk_pixbuf_xlib_render_threshold_alpha:
* @pixbuf: A pixbuf.
* @bitmap: Bitmap where the bilevel mask will be painted to.
* @src_x: Source X coordinate.
* @src_y: source Y coordinate.
* @dest_x: Destination X coordinate.
* @dest_y: Destination Y coordinate.
* @width: Width of region to threshold.
* @height: Height of region to threshold.
* @alpha_threshold: Opacity values below this will be painted as zero; all
* other values will be painted as one.
*
* Takes the opacity values in a rectangular portion of a pixbuf and thresholds
* them to produce a bi-level alpha mask that can be used as a clipping mask for
* a drawable.
*
void
gdk_pixbuf_xlib_render_threshold_alpha (GdkPixbuf *pixbuf, Pixmap bitmap,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
int alpha_threshold)
{
GC gc;
XColor color;
int x, y;
guchar *p;
int start, start_status;
int status;
XGCValues gcv;
 
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
g_return_if_fail (pixbuf->bits_per_sample == 8);
 
g_return_if_fail (bitmap != 0);
g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
 
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
 
if (width == 0 || height == 0)
return;
 
gc = XCreateGC (gdk_pixbuf_dpy, bitmap, 0, &gcv);
 
if (!pixbuf->has_alpha) {
color.pixel = (alpha_threshold == 255) ? 0 : 1;
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
XFillRectangle (gdk_pixbuf_dpy, bitmap, gc,
dest_x, dest_y, width, height);
XFreeGC (gdk_pixbuf_dpy, gc);
return;
}
 
color.pixel = 0;
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
XFillRectangle (gdk_pixbuf_dpy, bitmap, gc,
dest_x, dest_y, width, height);
 
color.pixel = 1;
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
 
for (y = 0; y < height; y++) {
p = (pixbuf->pixels + (y + src_y) * pixbuf->rowstride + src_x * pixbuf->n_channels
+ pixbuf->n_channels - 1);
 
start = 0;
start_status = *p < alpha_threshold;
 
for (x = 0; x < width; x++) {
status = *p < alpha_threshold;
 
if (status != start_status) {
if (!start_status)
XDrawLine (gdk_pixbuf_dpy, bitmap, gc,
start + dest_x, y + dest_y,
x - 1 + dest_x, y + dest_y);
 
start = x;
start_status = status;
}
 
p += pixbuf->n_channels;
}
 
if (!start_status)
XDrawLine (gdk_pixbuf_dpy, bitmap, gc,
start + dest_x, y + dest_y,
x - 1 + dest_x, y + dest_y);
}
 
XFreeGC (gdk_pixbuf_dpy, gc);
}
 
static guchar *
remove_alpha (GdkPixbuf *pixbuf, int x, int y, int width, int height, int *rowstride)
{
guchar *buf;
int xx, yy;
guchar *src, *dest;
 
g_assert (pixbuf->n_channels == 4);
g_assert (pixbuf->has_alpha);
g_assert (width > 0 && height > 0);
g_assert (x >= 0 && x + width <= pixbuf->width);
g_assert (y >= 0 && y + height <= pixbuf->height);
 
*rowstride = 4 * ((width * 3 + 3) / 4);
 
buf = g_new (guchar, *rowstride * height);
 
for (yy = 0; yy < height; yy++) {
src = pixbuf->pixels + pixbuf->rowstride * (yy + y) + x * pixbuf->n_channels;
dest = buf + *rowstride * yy;
 
for (xx = 0; xx < width; xx++) {
*dest++ = *src++;
*dest++ = *src++;
*dest++ = *src++;
src++;
}
}
 
return buf;
}
 
* gdk_pixbuf_xlib_render_to_drawable:
* @pixbuf: A pixbuf.
* @drawable: Destination drawable.
* @gc: GC used for rendering.
* @src_x: Source X coordinate within pixbuf.
* @src_y: Source Y coordinate within pixbuf.
* @dest_x: Destination X coordinate within drawable.
* @dest_y: Destination Y coordinate within drawable.
* @width: Width of region to render, in pixels.
* @height: Height of region to render, in pixels.
* @dither: Dithering mode for XlibRGB.
* @x_dither: X offset for dither.
* @y_dither: Y offset for dither.
*
* Renders a rectangular portion of a pixbuf to a drawable while using the
* specified GC. This is done using XlibRGB, so the specified drawable must
* have the XlibRGB visual and colormap. Note that this function will ignore
* the opacity information for images with an alpha channel; the GC must already
* have the clipping mask set if you want transparent regions to show through.
*
* For an explanation of dither offsets, see the XlibRGB documentation. In
* brief, the dither offset is important when re-rendering partial regions of an
* image to a rendered version of the full image, or for when the offsets to a
* base position change, as in scrolling. The dither matrix has to be shifted
* for consistent visual results. If you do not have any of these cases, the
* dither offsets can be both zero.
void
gdk_pixbuf_xlib_render_to_drawable (GdkPixbuf *pixbuf,
Drawable drawable, GC gc,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
XlibRgbDither dither,
int x_dither, int y_dither)
{
guchar *buf;
int rowstride;
 
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
g_return_if_fail (pixbuf->bits_per_sample == 8);
 
g_return_if_fail (drawable != 0);
g_return_if_fail (gc != 0);
 
g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
 
if (width == 0 || height == 0)
return;
 
if (pixbuf->has_alpha)
buf = remove_alpha (pixbuf, src_x, src_y, width, height, &rowstride);
else {
buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3;
rowstride = pixbuf->rowstride;
}
 
xlib_draw_rgb_image_dithalign (drawable, gc,
dest_x, dest_y,
width, height,
dither,
buf, rowstride,
x_dither, y_dither);
 
if (pixbuf->has_alpha)
g_free (buf);
}
 
 
* gdk_pixbuf_xlib_render_to_drawable_alpha:
* @pixbuf: A pixbuf.
* @drawable: Destination drawable.
* @src_x: Source X coordinate within pixbuf.
* @src_y: Source Y coordinates within pixbuf.
* @dest_x: Destination X coordinate within drawable.
* @dest_y: Destination Y coordinate within drawable.
* @width: Width of region to render, in pixels.
* @height: Height of region to render, in pixels.
* @alpha_mode: If the image does not have opacity information, this is ignored.
* Otherwise, specifies how to handle transparency when rendering.
* @alpha_threshold: If the image does have opacity information and @alpha_mode
* is GDK_PIXBUF_ALPHA_BILEVEL, specifies the threshold value for opacity
* values.
* @dither: Dithering mode for XlibRGB.
* @x_dither: X offset for dither.
* @y_dither: Y offset for dither.
*
* Renders a rectangular portion of a pixbuf to a drawable. This is done using
* XlibRGB, so the specified drawable must have the XlibRGB visual and colormap.
*
* When used with #GDK_PIXBUF_ALPHA_BILEVEL, this function has to create a bitmap
* out of the thresholded alpha channel of the image and, it has to set this
* bitmap as the clipping mask for the GC used for drawing. This can be a
* significant performance penalty depending on the size and the complexity of
* the alpha channel of the image. If performance is crucial, consider handling
* the alpha channel yourself (possibly by caching it in your application) and
* using gdk_pixbuf_xlib_render_to_drawable() or GdkRGB directly instead.
void
gdk_pixbuf_xlib_render_to_drawable_alpha (GdkPixbuf *pixbuf, Drawable drawable,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
GdkPixbufAlphaMode alpha_mode,
int alpha_threshold,
XlibRgbDither dither,
int x_dither, int y_dither)
{
Pixmap bitmap = 0;
GC gc;
XGCValues gcv;
 
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
g_return_if_fail (pixbuf->bits_per_sample == 8);
 
g_return_if_fail (drawable != 0);
g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
 
if (width == 0 || height == 0)
return;
 
gc = XCreateGC (gdk_pixbuf_dpy, drawable, 0, &gcv);
 
if (pixbuf->has_alpha) {
 
bitmap = XCreatePixmap (gdk_pixbuf_dpy,
RootWindow (gdk_pixbuf_dpy,
gdk_pixbuf_screen),
width, height, 1);
gdk_pixbuf_xlib_render_threshold_alpha (pixbuf, bitmap,
src_x, src_y,
0, 0,
width, height,
alpha_threshold);
 
XSetClipMask (gdk_pixbuf_dpy, gc, bitmap);
XSetClipOrigin (gdk_pixbuf_dpy, gc, dest_x, dest_y);
}
 
gdk_pixbuf_xlib_render_to_drawable (pixbuf, drawable, gc,
src_x, src_y,
dest_x, dest_y,
width, height,
dither,
x_dither, y_dither);
 
if (bitmap)
XFreePixmap (gdk_pixbuf_dpy, bitmap);
 
XFreeGC (gdk_pixbuf_dpy, gc);
}
 
* @pixbuf: A pixbuf.
* @pixmap_return: Return value for the created pixmap.
* @mask_return: Return value for the created mask.
* @alpha_threshold: Threshold value for opacity values.
*
* Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
* and @mask_return arguments, respectively, and renders a pixbuf and its
* corresponding tresholded alpha mask to them. This is merely a convenience
* function; applications that need to render pixbufs with dither offsets or to
* given drawables should use gdk_pixbuf_xlib_render_to_drawable_alpha() or
* gdk_pixbuf_xlib_render_to_drawable(), and
* gdk_pixbuf_xlib_render_threshold_alpha().
*
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
* to None.
void
gdk_pixbuf_xlib_render_pixmap_and_mask (GdkPixbuf *pixbuf,
Pixmap *pixmap_return,
Pixmap *mask_return,
int alpha_threshold)
{
g_return_if_fail (pixbuf != NULL);
 
if (pixmap_return) {
GC gc;
XGCValues gcv;
 
*pixmap_return = XCreatePixmap (gdk_pixbuf_dpy,
RootWindow (gdk_pixbuf_dpy,
gdk_pixbuf_screen),
pixbuf->width,
pixbuf->height,
xlib_rgb_get_depth ());
gc = XCreateGC (gdk_pixbuf_dpy, *pixmap_return, 0, &gcv);
gdk_pixbuf_xlib_render_to_drawable (pixbuf, *pixmap_return, gc,
0, 0, 0, 0,
pixbuf->width,
pixbuf->height,
XLIB_RGB_DITHER_NORMAL,
0, 0);
XFreeGC (gdk_pixbuf_dpy, gc);
}
 
if (mask_return) {
if (pixbuf->has_alpha) {
*mask_return = XCreatePixmap (gdk_pixbuf_dpy,
RootWindow (gdk_pixbuf_dpy,
gdk_pixbuf_screen),
pixbuf->width,
pixbuf->height, 1);
gdk_pixbuf_xlib_render_threshold_alpha (pixbuf,
*mask_return,
0, 0, 0, 0,
pixbuf->width,
pixbuf->height,
alpha_threshold);
} else
*mask_return = 0;
}
}*/
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/mpalette.cpp
===================================================================
--- trunk/Scribus/scribus/mpalette.cpp (revision 67)
+++ trunk/Scribus/scribus/mpalette.cpp (revision 68)
@@ -3,14 +3,27 @@
#include <cmath>
#include <qpoint.h>
#include <qwmatrix.h>
+#include <qmessagebox.h>
+#include "query.h"
+#include "scribusview.h"
extern QPixmap loadIcon(QString nam);
extern float UmReFaktor;
+extern ProfilesL InputProfiles;
+NameWidget::NameWidget(QWidget* parent) : QLineEdit(parent)
+{
+}
+
+void NameWidget::focusOutEvent(QFocusEvent *)
+{
+ emit Leaved();
+}
+
Mpalette::Mpalette( QWidget* parent, preV *Prefs)
: QDialog( parent, "Mfloat", false, 0)
// : QDialog( parent, "Mfloat", false, Qt::WStyle_Customize | Qt::WStyle_Title | Qt::WStyle_Tool)
{
- setCaption( tr( "Measurements" ) );
+ setCaption( tr( "Properties" ) );
HaveDoc = false;
HaveItem = false;
Umrech = UmReFaktor;
@@ -70,6 +83,17 @@
page = new QWidget( TabStack, "page" );
pageLayout = new QVBoxLayout( page, 0, 5, "pageLayout");
+ NameGroup = new QGroupBox( page, "NameGroup" );
+ NameGroup->setTitle( tr( "Name" ) );
+ NameGroup->setColumnLayout(0, Qt::Vertical );
+ NameGroup->layout()->setSpacing( 4 );
+ NameGroup->layout()->setMargin( 5 );
+ NameGroupLayout = new QHBoxLayout( NameGroup->layout() );
+ NameGroupLayout->setAlignment( Qt::AlignTop );
+ NameEdit = new NameWidget(NameGroup);
+ NameGroupLayout->addWidget( NameEdit );
+ pageLayout->addWidget( NameGroup );
+
GeoGroup = new QGroupBox( page, "GeoGroup" );
GeoGroup->setTitle( tr( "Geometry" ) );
GeoGroup->setColumnLayout(0, Qt::Vertical );
@@ -153,6 +177,29 @@
QSpacerItem* spacer4 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout44->addItem( spacer4 );
layout60->addLayout( Layout44 );
+
+ Layout44a = new QVBoxLayout( 0, 0, 4, "Layout44");
+ QSpacerItem* spacer3a = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout44a->addItem( spacer3a );
+ Locked = new QToolButton( page, "Lock" );
+ Locked->setToggleButton( true );
+ QIconSet a = QIconSet();
+ a.setPixmap(loadIcon("locked.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
+ a.setPixmap(loadIcon("unlock.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
+ Locked->setIconSet(a);
+ Layout44a->addWidget( Locked );
+ NoPrint = new QToolButton( page, "NoPrint" );
+ NoPrint->setToggleButton( true );
+ QIconSet a2 = QIconSet();
+ a2.setPixmap(loadIcon("NoPrint.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
+ a2.setPixmap(loadIcon("DateiPrint16.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
+ NoPrint->setIconSet(a2);
+ Layout44a->addWidget( NoPrint );
+ QSpacerItem* spacer4a = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout44a->addItem( spacer4a );
+ layout60->addLayout( Layout44a );
+
+
QSpacerItem* spacer5 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout60->addItem( spacer5 );
pageLayout->addLayout( layout60 );
@@ -277,7 +324,50 @@
Textflow->setText( tr( "Text flows around Box" ) );
pageLayout_2->addWidget( Textflow );
- Distance = new QGroupBox( page_2, "Distance" );
+ Textflow2 = new QCheckBox( page_2, "Textflow2" );
+ Textflow2->setText( tr( "Use Bounding Box" ) );
+ pageLayout_2->addWidget( Textflow2 );
+
+
+ TabStack2 = new QWidgetStack( page_2, "TabStack2" );
+ TabStack2->setFrameShape( QWidgetStack::NoFrame );
+
+ page_2b = new QWidget( TabStack2, "page" );
+ pageLayout_2b = new QVBoxLayout( page_2b, 0, 5, "pageLayout_2");
+ Distance2 = new QGroupBox( page_2b, "Distance" );
+ Distance2->setTitle( tr( "Pathtext Properites" ) );
+ Distance2->setColumnLayout(0, Qt::Vertical );
+ Distance2->layout()->setSpacing( 2 );
+ Distance2->layout()->setMargin( 5 );
+ DistanceLayout2 = new QGridLayout( Distance2->layout() );
+ DistanceLayout2->setAlignment( Qt::AlignTop );
+ NormText2 = new QCheckBox( Distance2, "NormText" );
+ NormText2->setText( tr( "Show Curve" ) );
+ DistanceLayout2->addMultiCellWidget( NormText2, 0, 0, 0, 1 );
+ TextLabel3 = new QLabel( Distance2, "TextLabel3" );
+ TextLabel3->setText( tr( "Startoffset:" ) );
+ DistanceLayout2->addWidget( TextLabel3, 1, 0);
+ Dist = new MSpinBox( Distance2, 1 );
+ Dist->setSuffix( tr( " pts" ) );
+ Dist->setMaxValue( 3000 );
+ Dist->setMinValue( 0 );
+ Dist->setLineStep(10);
+ DistanceLayout2->addWidget( Dist, 1, 1);
+ TextLabel2 = new QLabel( Distance2, "TextLabel2" );
+ TextLabel2->setText( tr( "Distance from Curve:" ) );
+ DistanceLayout2->addWidget( TextLabel2, 2, 0);
+ LineW = new MSpinBox( Distance2, 1 );
+ LineW->setSuffix( tr( " pts" ) );
+ LineW->setMaxValue( 3000 );
+ LineW->setMinValue( -3000 );
+ LineW->setLineStep(10);
+ DistanceLayout2->addWidget( LineW, 2, 1);
+ pageLayout_2b->addWidget(Distance2);
+ TabStack2->addWidget( page_2b, 1 );
+
+ page_2a = new QWidget( TabStack2, "page" );
+ pageLayout_2a = new QVBoxLayout( page_2a, 0, 5, "pageLayout_2");
+ Distance = new QGroupBox( page_2a, "Distance" );
Distance->setTitle( tr( "Distance of Text" ) );
Distance->setColumnLayout(0, Qt::Vertical );
Distance->layout()->setSpacing( 2 );
@@ -316,7 +406,10 @@
DRight->setMaxValue( 3000 );
DRight->setMinValue( 0 );
DistanceLayout->addWidget( DRight, 3, 1 );
- pageLayout_2->addWidget( Distance );
+ pageLayout_2a->addWidget(Distance);
+ TabStack2->addWidget( page_2a, 0 );
+
+ pageLayout_2->addWidget( TabStack2 );
QSpacerItem* spacer6 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
pageLayout_2->addItem( spacer6 );
TabStack->addWidget( page_2, 1 );
@@ -334,7 +427,7 @@
layout41->addMultiCellWidget( Fonts, 0, 0, 0, 1 );
Text20 = new QLabel( page_3, "Text20" );
- Text20->setText(tr("Fontsize:"));
+ Text20->setText(tr("Size:"));
layout41->addWidget( Text20, 1, 0 );
Size = new QSpinBox( page_3, "Fontsize:" );
Size->setPrefix( tr( "" ) );
@@ -344,6 +437,83 @@
layout41->addWidget( Size, 1, 1 );
layout46->addLayout( layout41 );
+ layout22 = new QHBoxLayout( 0, 0, 5, "layout22");
+ ScaleTxt = new QLabel( page_3, "ScaleTxt" );
+ ScaleTxt->setText(tr("Width:"));
+ layout22->addWidget( ScaleTxt );
+ ChScale = new QSpinBox( page_3, "ChScale" );
+ ChScale->setMaxValue( 400 );
+ ChScale->setMinValue( 25 );
+ ChScale->setValue( 100 );
+ ChScale->setSuffix( tr( " %" ) );
+ layout22->addWidget( ChScale );
+ layout46->addLayout( layout22 );
+
+ layout23 = new QHBoxLayout( 0, 0, 5, "layout23");
+ StrokeIcon = new QLabel( page_3, "StrokeIcon" );
+ StrokeIcon->setText( tr( "" ) );
+ StrokeIcon->setPixmap(loadIcon("Stiftalt.xpm"));
+ StrokeIcon->setScaledContents( FALSE );
+ layout23->addWidget( StrokeIcon );
+ TxStroke = new QComboBox( true, page_3, "TxStroke" );
+ TxStroke->setEditable(false);
+ layout23->addWidget( TxStroke );
+ TxStrokeSh = new QPopupMenu();
+ TxStrokeSh->insertItem(tr("Other..."));
+ TxStrokeSh->insertItem("0 %");
+ TxStrokeSh->insertItem("10 %");
+ TxStrokeSh->insertItem("20 %");
+ TxStrokeSh->insertItem("30 %");
+ TxStrokeSh->insertItem("40 %");
+ TxStrokeSh->insertItem("50 %");
+ TxStrokeSh->insertItem("60 %");
+ TxStrokeSh->insertItem("70 %");
+ TxStrokeSh->insertItem("80 %");
+ TxStrokeSh->insertItem("90 %");
+ TxStrokeSh->insertItem("100 %");
+ QSpacerItem* spacer2S = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ layout23->addItem( spacer2S );
+ PM1 = new QToolButton(page_3, "Colors");
+ PM1->setBackgroundMode(PaletteBackground);
+ PM1->setPopup(TxStrokeSh);
+ PM1->setPopupDelay(1);
+ PM1->setText("100 %");
+ PM1->setAutoRaise(true);
+ layout23->addWidget( PM1 );
+ layout46->addLayout( layout23 );
+ layout24 = new QHBoxLayout( 0, 0, 5, "layout24");
+ FillIcon = new QLabel( page_3, "FillIcon" );
+ FillIcon->setText(tr(""));
+ FillIcon->setPixmap(loadIcon("fill.png"));
+ FillIcon->setScaledContents( FALSE );
+ layout24->addWidget( FillIcon );
+ TxFill = new QComboBox( true, page_3, "TxFill" );
+ TxFill->setEditable(false);
+ layout24->addWidget( TxFill );
+ TxFillSh = new QPopupMenu();
+ TxFillSh->insertItem(tr("Other..."));
+ TxFillSh->insertItem("0 %");
+ TxFillSh->insertItem("10 %");
+ TxFillSh->insertItem("20 %");
+ TxFillSh->insertItem("30 %");
+ TxFillSh->insertItem("40 %");
+ TxFillSh->insertItem("50 %");
+ TxFillSh->insertItem("60 %");
+ TxFillSh->insertItem("70 %");
+ TxFillSh->insertItem("80 %");
+ TxFillSh->insertItem("90 %");
+ TxFillSh->insertItem("100 %");
+ QSpacerItem* spacer2Sf = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ layout24->addItem( spacer2Sf );
+ PM2 = new QToolButton(page_3, "Colors");
+ PM2->setBackgroundMode(PaletteBackground);
+ PM2->setPopup(TxFillSh);
+ PM2->setPopupDelay(1);
+ PM2->setText("100 %");
+ PM2->setAutoRaise(true);
+ layout24->addWidget( PM2 );
+ layout46->addLayout( layout24 );
+
Layout1 = new QHBoxLayout( 0, 0, 0, "Layout1");
Underline = new QToolButton( page_3, "Underline" );
@@ -392,6 +562,14 @@
Strike->setPixmap(loadIcon("Strike.xpm"));
Strike->setToggleButton( true );
Layout1->addWidget( Strike );
+
+ Outlined = new QToolButton( page_3, "Outlined" );
+ Outlined->setMaximumSize( QSize( 22, 22 ) );
+ Outlined->setText( tr( "" ) );
+ Outlined->setPixmap(loadIcon("outlined.png"));
+ Outlined->setToggleButton( true );
+ Layout1->addWidget( Outlined );
+
Revert = new QToolButton( page_3, "Bold" );
Revert->setMaximumSize( QSize( 22, 22 ) );
Revert->setText( tr( "" ) );
@@ -483,6 +661,17 @@
GroupBox3aLayout->addWidget( Spal );
pageLayout_3->addWidget( GroupBox3a );
+ layoutLang = new QHBoxLayout( 0, 0, 5, "layout24");
+ SprachT = new QLabel( page_3, "Sprache" );
+ SprachT->setText(tr("Sprache:"));
+ layoutLang->addWidget( SprachT );
+ LangCombo = new QComboBox( true, page_3, "Lang" );
+ LangCombo->setEditable(false);
+ layoutLang->addWidget( LangCombo );
+// QSpacerItem* spacer2L = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ // layoutLang->addItem( spacer2L );
+ pageLayout_3->addLayout(layoutLang);
+
QSpacerItem* spacer8 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
pageLayout_3->addItem( spacer8 );
TabStack->addWidget( page_3, 2 );
@@ -552,6 +741,23 @@
Layout18->addWidget( Aspect );
Layout24->addLayout( Layout18 );
pageLayout_4->addLayout( Layout24 );
+ TextCms1 = new QLabel( page_4, "Text1" );
+ TextCms1->setText( tr( "Input Profile:" ) );
+ pageLayout_4->addWidget( TextCms1 );
+ InputP = new QComboBox( true, page_4, "InputP" );
+ InputP->setEditable(false);
+ pageLayout_4->addWidget(InputP);
+ TextCms2 = new QLabel( page_4, "Text2" );
+ TextCms2->setText( tr( "Rendering Intent:" ) );
+ pageLayout_4->addWidget(TextCms2);
+ MonitorI = new QComboBox( true, page_4, "MonitorI" );
+ MonitorI->insertItem( tr( "Perceptual" ) );
+ MonitorI->insertItem( tr( "Relative Colorimetric" ) );
+ MonitorI->insertItem( tr( "Saturation" ) );
+ MonitorI->insertItem( tr( "Absolute Colorimetric" ) );
+ MonitorI->setEditable(false);
+ pageLayout_4->addWidget(MonitorI);
+
QSpacerItem* spacer9 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
pageLayout_4->addItem( spacer9 );
TabStack->addWidget( page_4, 3 );
@@ -658,9 +864,10 @@
connect(Kapital, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
connect(Revert, SIGNAL(clicked()), this, SLOT(DoRevert()));
connect(Underline, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
+ connect(Subs, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
connect(Strike, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
connect(Supers, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
- connect(Subs, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
+ connect(Outlined, SIGNAL(clicked()), this, SLOT(setTypeStyle()));
connect(FreeScale, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
connect(FrameScale, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
connect(Aspect, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
@@ -670,6 +877,7 @@
connect(ZBottom, SIGNAL(clicked()), this, SLOT(DoBack()));
connect(RotationGroup, SIGNAL(clicked(int)), this, SLOT(NewRotMode(int)));
connect(Textflow, SIGNAL(clicked()), this, SLOT(DoFlow()));
+ connect(Textflow2, SIGNAL(clicked()), this, SLOT(DoFlow2()));
connect(SRect, SIGNAL(clicked()), this, SLOT(MakeRect()));
connect(SOval, SIGNAL(clicked()), this, SLOT(MakeOval()));
connect(SCustom, SIGNAL(clicked()), this, SLOT(MakeIrre()));
@@ -682,6 +890,20 @@
connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
connect(StyledLine, SIGNAL(selected(int)), this, SIGNAL(EditLSt()));
connect(Fonts, SIGNAL(activated(int)), this, SLOT(NewTFont(int)));
+ connect(TxFill, SIGNAL(activated(int)), this, SLOT(newTxtFill()));
+ connect(TxStroke, SIGNAL(activated(int)), this, SLOT(newTxtStroke()));
+ connect(TxFillSh, SIGNAL(activated(int)), this, SLOT(setActShade(int)));
+ connect(TxStrokeSh, SIGNAL(activated(int)), this, SLOT(setActShade(int)));
+ connect(ChScale, SIGNAL(valueChanged(int)), this, SLOT(NewTScale()));
+ connect(Locked, SIGNAL(clicked()), this, SLOT(handleLock()));
+ connect(NoPrint, SIGNAL(clicked()), this, SLOT(handlePrint()));
+ connect(NormText2, SIGNAL(clicked()), this, SLOT(handlePathLine()));
+ connect(Dist, SIGNAL(valueChanged(int)), this, SLOT(handlePathDist()));
+ connect(LineW, SIGNAL(valueChanged(int)), this, SLOT(handlePathOffs()));
+ connect(InputP, SIGNAL(activated(const QString&)), this, SLOT(ChProf(const QString&)));
+ connect(MonitorI, SIGNAL(activated(int)), this, SLOT(ChIntent()));
+ connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
+ connect(LangCombo, SIGNAL(activated(int)), this, SLOT(NewLanguage()));
HaveItem = false;
Xpos->setValue(0);
Ypos->setValue(0);
@@ -691,6 +913,7 @@
RoundRect->setValue(0);
TabStack->raiseWidget(0);
TabStack->widget(0)->setEnabled(false);
+ TabStack2->raiseWidget(0);
SGeom->setEnabled(false);
SShape->setEnabled(false);
SText->setEnabled(false);
@@ -697,6 +920,9 @@
SImage->setEnabled(false);
SLine->setEnabled(false);
SColor->setEnabled(false);
+ StrokeIcon->setEnabled(false);
+ TxStroke->setEnabled(false);
+ PM1->setEnabled(false);
}
@@ -742,7 +968,7 @@
ScaleX->setMinValue( 1 );
LXpos->setMaxValue( 300000 );
LXpos->setMinValue( -300000 );
- Size->setMaxValue( 512 );
+ Size->setMaxValue( 1024 );
Size->setMinValue( 1 );
LineSp->setMaxValue( 3000 );
LineSp->setMinValue( 1 );
@@ -765,6 +991,13 @@
DLeft->setDecimals(10);
DBottom->setDecimals(10);
DRight->setDecimals(10);
+ Dist->setMaxValue( 3000 );
+ Dist->setMinValue( 0 );
+ Dist->setLineStep(10);
+ LineW->setMaxValue( 3000 );
+ LineW->setMinValue( -3000 );
+ LineW->setLineStep(10);
+ updateCList();
}
void Mpalette::UnsetDoc()
@@ -775,10 +1008,10 @@
void Mpalette::SetCurItem(PageItem *i)
{
disconnect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
+ disconnect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
HaveItem = false;
CurItem = i;
- if (i->IFont != "");
- Fonts->setCurrentText(i->IFont);
+ NameEdit->setText(i->AnName);
RoundRect->setValue(qRound(i->RadRect));
DLeft->setValue(static_cast<int>(i->Extra*10));
DTop->setValue(static_cast<int>(i->TExtra*10));
@@ -785,6 +1018,10 @@
DBottom->setValue(static_cast<int>(i->BExtra*10));
DRight->setValue(static_cast<int>(i->RExtra*10));
Revert->setOn(i->Reverse);
+ Textflow->setChecked(i->Textflow);
+ Textflow2->setChecked(i->Textflow2);
+ ToggleFlow();
+ LangCombo->setCurrentText(i->Language);
if (i->NamedLStyle == "")
{
StyledLine->setCurrentItem(0);
@@ -802,6 +1039,11 @@
LEndStyle->setEnabled(false);
}
connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
+ connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
+ if (i->isPrintable)
+ NoPrint->setOn(false);
+ else
+ NoPrint->setOn(true);
if (i->Locked)
{
Xpos->setEnabled(false);
@@ -810,6 +1052,11 @@
Height->setEnabled(false);
Rot->setEnabled(false);
RoundRect->setEnabled(false);
+ EditShape->setEnabled(false);
+ ShapeGroup->setEnabled(false);
+ LayerGroup->setEnabled(false);
+ Locked->setOn(true);
+ HaveItem = true;
return;
}
else
@@ -820,7 +1067,20 @@
Height->setEnabled(true);
Rot->setEnabled(true);
RoundRect->setEnabled(true);
+ EditShape->setEnabled(true);
+ ShapeGroup->setEnabled(true);
+ LayerGroup->setEnabled(true);
+ Locked->setOn(false);
}
+ if (i->PType == 8)
+ {
+ TabStack2->raiseWidget(1);
+ NormText2->setChecked(i->PoShow);
+ LineW->setValue( qRound(i->BaseOffs * -10) );
+ Dist->setValue(static_cast<int>(i->Extra*10));
+ }
+ else
+ TabStack2->raiseWidget(0);
if (((i->PType == 4) || (i->PType == 2) || (i->PType == 3)) && (!i->ClipEdited))
RoundRect->setEnabled(true);
else
@@ -857,6 +1117,7 @@
{
if (i->PType == 2)
{
+ updateCmsList();
if (i->ScaleType)
{
FreeScale->setChecked(true);
@@ -900,9 +1161,11 @@
Rot->setEnabled(true);
SGeom->setEnabled(true);
TabStack->widget(0)->setEnabled(true);
+ NameEdit->setEnabled(false);
}
else
{
+ NameEdit->setEnabled(true);
FlipH->setEnabled(false);
FlipV->setEnabled(false);
ShapeGroup->setEnabled(false);
@@ -997,7 +1260,7 @@
SShape->setEnabled(true);
SText->setEnabled(true);
SImage->setEnabled(false);
- SLine->setEnabled(false);
+ SLine->setEnabled(true);
TabStack->widget(1)->setEnabled(true);
TabStack->widget(2)->setEnabled(true);
FlipH->setEnabled(true);
@@ -1054,7 +1317,7 @@
SShape->setEnabled(true);
SText->setEnabled(true);
SImage->setEnabled(false);
- SLine->setEnabled(false);
+ SLine->setEnabled(true);
TabStack->widget(1)->setEnabled(true);
TabStack->widget(2)->setEnabled(true);
TabStack->widget(4)->setEnabled(true);
@@ -1304,10 +1567,21 @@
Strike->setOn(false);
Underline->setOn(false);
Kapital->setOn(false);
+ Outlined->setOn(false);
+ StrokeIcon->setEnabled(false);
+ TxStroke->setEnabled(false);
+ PM1->setEnabled(false);
if (s & 1)
Supers->setOn(true);
if (s & 2)
Subs->setOn(true);
+ if (s & 4)
+ {
+ Outlined->setOn(true);
+ StrokeIcon->setEnabled(true);
+ TxStroke->setEnabled(true);
+ PM1->setEnabled(true);
+ }
if (s & 8)
Underline->setOn(true);
if (s & 16)
@@ -1348,6 +1622,24 @@
HaveItem = tmp;
}
+void Mpalette::setTScale(int e)
+{
+ bool tmp = HaveItem;
+ HaveItem = false;
+ ChScale->setValue(e);
+ HaveItem = tmp;
+}
+
+void Mpalette::NewTScale()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ doc->ActPage->ItemTextScale(ChScale->value());
+ doc->CurrTextScale = ChScale->value();
+ emit DocChanged();
+ }
+}
+
void Mpalette::NewX()
{
float x,y,w,h, gx, gy, gh, gw;
@@ -1538,7 +1830,7 @@
{
CurItem->Ptext.at(CurItem->CPos)->cextra = static_cast<float>(Extra->value())/10;
CurItem->Dirty = true;
- CurItem->paintObj();
+ doc->ActPage->RefreshItem(CurItem);
emit DocChanged();
}
}
@@ -1750,6 +2042,12 @@
emit BackHome();
return;
}
+ if (Outlined == sender())
+ {
+ emit Stellung(4);
+ emit BackHome();
+ return;
+ }
if (Underline == sender())
{
emit Stellung(8);
@@ -1820,9 +2118,20 @@
CurItem->Textflow = Textflow->isChecked();
doc->ActPage->update();
emit DocChanged();
+ ToggleFlow();
}
}
+void Mpalette::DoFlow2()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->Textflow2 = Textflow2->isChecked();
+ doc->ActPage->update();
+ emit DocChanged();
+ }
+}
+
void Mpalette::MakeRect()
{
if ((HaveDoc) && (HaveItem))
@@ -1898,9 +2207,7 @@
void Mpalette::NewTFont(int c)
{
if ((HaveDoc) && (HaveItem))
- {
emit NewTF(Fonts->text(c));
- }
}
void Mpalette::DoRevert()
@@ -1962,3 +2269,350 @@
doc->ActPage->RefreshItem(CurItem);
emit DocChanged();
}
+
+void Mpalette::updateCList()
+{
+ if (!HaveDoc)
+ return;
+ TxFill->clear();
+ TxStroke->clear();
+ CListe::Iterator it;
+ QPixmap pm = QPixmap(15, 15);
+ TxFill->insertItem(tr("None"));
+ TxStroke->insertItem(tr("None"));
+ for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it)
+ {
+ pm.fill(doc->PageColors[it.key()].getRGBColor());
+ TxFill->insertItem(pm, it.key());
+ TxStroke->insertItem(pm, it.key());
+ }
+}
+
+void Mpalette::updateCmsList()
+{
+ if (HaveDoc)
+ {
+ if ((CMSavail) && (doc->CMSSettings.CMSinUse))
+ {
+ TextCms1->show();
+ InputP->show();
+ TextCms2->show();
+ MonitorI->show();
+ }
+ else
+ {
+ TextCms1->hide();
+ TextCms2->hide();
+ InputP->hide();
+ MonitorI->hide();
+ return;
+ }
+ InputP->clear();
+ ProfilesL::Iterator itP;
+ for (itP = InputProfiles.begin(); itP != InputProfiles.end(); ++itP)
+ {
+ InputP->insertItem(itP.key());
+ if (itP.key() == CurItem->IProfile)
+ {
+ InputP->setCurrentItem(InputP->count()-1);
+ }
+ }
+ if (!InputProfiles.contains(CurItem->IProfile))
+ {
+ InputP->insertItem(CurItem->IProfile);
+ InputP->setCurrentItem(InputP->count()-1);
+ }
+ else
+ {
+ if (CurItem->EmProfile != "")
+ InputP->insertItem(CurItem->EmProfile);
+ }
+ MonitorI->setCurrentItem(CurItem->IRender);
+ }
+}
+
+void Mpalette::ChProf(const QString& prn)
+{
+ bool EmbedP;
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->IProfile = InputP->currentText();
+ if (prn.startsWith("Embedded"))
+ EmbedP = true;
+ else
+ EmbedP = false;
+ CurItem->UseEmbedded = EmbedP;
+ doc->ActPage->LoadPict(CurItem->Pfile, CurItem->ItemNr);
+ doc->ActPage->RefreshItem(CurItem);
+ }
+}
+
+void Mpalette::ChIntent()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->IRender = MonitorI->currentItem();
+ doc->ActPage->LoadPict(CurItem->Pfile, CurItem->ItemNr);
+ doc->ActPage->RefreshItem(CurItem);
+ }
+}
+
+void Mpalette::ShowCMS()
+{
+ if (HaveItem)
+ {
+ HaveItem = false;
+ updateCmsList();
+ HaveItem = true;
+ }
+ else
+ {
+ if ((CMSavail) && (doc->CMSSettings.CMSinUse))
+ {
+ TextCms1->show();
+ InputP->show();
+ TextCms2->show();
+ MonitorI->show();
+ }
+ else
+ {
+ TextCms1->hide();
+ TextCms2->hide();
+ InputP->hide();
+ MonitorI->hide();
+ }
+ }
+}
+
+void Mpalette::newTxtFill()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ doc->ActPage->ItemTextBrush(TxFill->currentText());
+ doc->CurrTextFill = TxFill->currentText();
+ emit DocChanged();
+ }
+}
+
+void Mpalette::newTxtStroke()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ doc->ActPage->ItemTextPen(TxStroke->currentText());
+ doc->CurrTextStroke = TxStroke->currentText();
+ emit DocChanged();
+ }
+}
+
+void Mpalette::setActShade(int id)
+{
+ bool ok = false;
+ uint a;
+ int c, b;
+ for (a = 0; a < TxFillSh->count(); ++a)
+ {
+ TxFillSh->setItemChecked(TxFillSh->idAt(a), false);
+ }
+ for (a = 0; a < TxFillSh->count(); ++a)
+ {
+ TxStrokeSh->setItemChecked(TxStrokeSh->idAt(a), false);
+ }
+ if (TxFillSh == sender())
+ {
+ c = TxFillSh->indexOf(id);
+ TxFillSh->setItemChecked(id, true);
+ }
+ else
+ {
+ c = TxStrokeSh->indexOf(id);
+ TxStrokeSh->setItemChecked(id, true);
+ }
+ if (c > 0)
+ b = (c-1) * 10;
+ if (c == 0)
+ {
+ Query* dia = new Query(this, "New", 1, 0, "Shade:", "Shade");
+ if (dia->exec())
+ {
+ c = dia->Answer->text().toInt(&ok);
+ if (ok)
+ {
+ b = c;
+ if (TxFillSh == sender())
+ PM2->setText(dia->Answer->text()+" %");
+ else
+ PM1->setText(dia->Answer->text()+" %");
+ }
+ delete dia;
+ }
+ else
+ {
+ delete dia;
+ return;
+ }
+ }
+ if (TxFillSh == sender())
+ {
+ PM2->setText(QString::number(b)+" %");
+ doc->ActPage->ItemTextBrushS(b);
+ doc->CurrTextFillSh = b;
+ }
+ else
+ {
+ PM1->setText(QString::number(b)+" %");
+ doc->ActPage->ItemTextPenS(b);
+ doc->CurrTextStrokeSh = b;
+ }
+ emit DocChanged();
+}
+
+void Mpalette::setActFarben(QString p, QString b, int shp, int shb)
+{
+ uint a;
+ CListe::Iterator it;
+ int c = 1;
+ for (a = 0; a < TxFillSh->count(); ++a)
+ {
+ TxFillSh->setItemChecked(TxFillSh->idAt(a), false);
+ }
+ for (a = 0; a < TxFillSh->count(); ++a)
+ {
+ TxStrokeSh->setItemChecked(TxStrokeSh->idAt(a), false);
+ }
+ if ((shb % 10) == 0)
+ TxFillSh->setItemChecked(TxFillSh->idAt(shb/10+1), true);
+ else
+ TxFillSh->setItemChecked(TxFillSh->idAt(0), true);
+ PM2->setText(QString::number(shb)+" %");
+ if ((shp % 10) == 0)
+ TxStrokeSh->setItemChecked(TxStrokeSh->idAt(shp/10+1), true);
+ else
+ TxStrokeSh->setItemChecked(TxStrokeSh->idAt(0), true);
+ PM1->setText(QString::number(shp)+" %");
+ if ((b != "None") && (b != ""))
+ {
+ for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it)
+ {
+ if (it.key() == b)
+ break;
+ c++;
+ }
+ }
+ TxFill->setCurrentItem(c);
+ c = 1;
+ if ((p != "None") && (p != ""))
+ {
+ for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it)
+ {
+ if (it.key() == p)
+ break;
+ c++;
+ }
+ }
+ TxStroke->setCurrentItem(c);
+}
+
+void Mpalette::handleLock()
+{
+ if ((HaveDoc) && (HaveItem))
+ doc->ActPage->ToggleLock();
+}
+
+void Mpalette::handlePrint()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->isPrintable = !NoPrint->isOn();
+ emit DocChanged();
+ }
+}
+
+void Mpalette::ToggleFlow()
+{
+ if (Textflow->isChecked())
+ Textflow2->setEnabled(true);
+ else
+ Textflow2->setEnabled(false);
+}
+
+void Mpalette::handlePathLine()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->PoShow = NormText2->isChecked();
+ doc->ActPage->RefreshItem(CurItem);
+ emit DocChanged();
+ }
+}
+
+void Mpalette::handlePathDist()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->Extra = static_cast<float>(Dist->value()) / 10;
+ doc->ActPage->UpdatePolyClip(CurItem);
+ doc->ActPage->AdjustItemSize(CurItem);
+ doc->ActPage->RefreshItem(CurItem);
+ emit DocChanged();
+ }
+}
+
+void Mpalette::handlePathOffs()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->BaseOffs = static_cast<float>(-LineW->value()) / 10;
+ doc->ActPage->UpdatePolyClip(CurItem);
+ doc->ActPage->AdjustItemSize(CurItem);
+ doc->ActPage->RefreshItem(CurItem);
+ emit DocChanged();
+ }
+}
+
+void Mpalette::NewName()
+{
+ QString NameOld = CurItem->AnName;
+ QString NameNew = NameEdit->text();
+ bool found = false;
+ ScribusView* view = (ScribusView*)doc->ActPage->Anz;
+ for (uint a = 0; a < view->Pages.count(); ++a)
+ {
+ for (uint b = 0; b < view->Pages.at(a)->Items.count(); ++b)
+ {
+ if ((NameNew == view->Pages.at(a)->Items.at(b)->AnName) && (view->Pages.at(a)->Items.at(b) != CurItem))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ if (found)
+ {
+ QMessageBox::warning(this, tr("Warning"), tr("Name \"%1\" isn't unique.\nPlease choose another.").arg(NameNew), tr("OK"));
+ NameEdit->setText(NameOld);
+ NameEdit->setFocus();
+ }
+ else
+ CurItem->AnName = NameEdit->text();
+}
+
+void Mpalette::fillLangCombo(QMap<QString,QString> Sprachen)
+{
+ LangCombo->clear();
+ QMap<QString,QString>::Iterator it;
+ for (it = Sprachen.begin(); it != Sprachen.end(); ++it)
+ {
+ LangCombo->insertItem(it.key());
+ }
+}
+
+void Mpalette::NewLanguage()
+{
+ if ((HaveDoc) && (HaveItem))
+ {
+ CurItem->Language = LangCombo->currentText();
+ emit DocChanged();
+ }
+}
/trunk/Scribus/scribus/util.cpp
34,13 → 34,10
#include "config.h"
#include "scribusdoc.h"
#include "libpdf/pdflib.h"
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_OUTLINE_H
#include FT_GLYPH_H
FPointArray traceCharacter(PageItem *b, QString chx, uint ind, float *x, float *y);
#endif
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_OUTLINE_H
#include FT_GLYPH_H
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
63,6 → 60,7
#endif
extern ProfilesL InputProfiles;
 
FPointArray traceChar(FT_Face face, uint chr, int chs, float *x, float *y);
QString Path2Relative(QString Path);
QPixmap LoadPDF(QString fn, int Seite, int Size, int *w, int *h);
bool GlyNames(QMap<uint, QString> *GList, QString Dat);
83,7 → 81,7
FPointArray RegularPolygonF(float w, float h, uint c, bool star, float factor, float rota);
QPixmap loadIcon(QString nam);
bool loadText(QString nam, QString *Buffer);
float Cwidth(ScribusDoc *doc, QPainter *p, QString name, QString ch, int Siz, QString ch2 = " ");
float Cwidth(ScribusDoc *doc, QString name, QString ch, int Siz, QString ch2 = " ");
float QStoFloat(QString in);
int QStoInt(QString in);
QString GetAttr(QDomElement *el, QString at, QString def="0");
685,9 → 683,8
return ret;
}
 
float Cwidth(ScribusDoc *doc, QPainter *p, QString name, QString ch, int Siz, QString ch2)
float Cwidth(ScribusDoc *doc, QString name, QString ch, int Siz, QString ch2)
{
#ifdef HAVE_FREETYPE
float w;
FT_Vector delta;
uint c1 = ch.at(0).unicode();
707,12 → 704,6
}
else
return static_cast<float>(Siz);
#else
if ((*doc->AllFonts)[name]->HasMetrics)
return (*doc->AllFonts)[name]->CharWidth[QMIN(ch.at(0).unicode(),255)]*Siz;
else
return p->fontMetrics().width(ch);
#endif
}
 
QPointArray RegularPolygon(float w, float h, uint c, bool star, float factor, float rota)
807,8 → 798,6
if (ina.point(poi).x() > 900000)
{
outa.resize(outa.size()+1);
// if (poi < 4)
// outa.setPoint(outa.size()-1, QPoint(0,0));
outa.setPoint(outa.size()-1, cli.point(cli.size()-1));
Segs.append(outa.size());
continue;
1096,7 → 1085,6
 
bool GlyNames(QMap<uint, QString> *GList, QString Dat)
{
#ifdef HAVE_FREETYPE
bool error;
char *buf[50];
FT_Library library;
1113,13 → 1101,11
charcode = FT_Get_Next_Char(face, charcode, &gindex );
}
FT_Done_FreeType( library );
#endif
return true;
}
 
bool GlyIndex(QMap<uint, PDFlib::GlNamInd> *GListInd, QString Dat)
{
#ifdef HAVE_FREETYPE
struct PDFlib::GlNamInd gln;
bool error;
char *buf[50];
1147,11 → 1133,9
}
}
FT_Done_FreeType( library );
#endif
return true;
}
 
#ifdef HAVE_FREETYPE
FPoint firstP;
bool FirstM;
 
1161,25 → 1145,14
double toy = ( to->y / 64.0 );
if (!FirstM)
{
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, firstP);
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, firstP);
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(999999, 999999));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(999999, 999999));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(999999, 999999));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(999999, 999999));
composite->addPoint(firstP);
composite->addPoint(firstP);
composite->setMarker();
}
else
FirstM = false;
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(tox, toy));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(tox, toy));
composite->addPoint(FPoint(tox, toy));
composite->addPoint(FPoint(tox, toy));
firstP = FPoint(tox, toy);
return 0;
}
1188,14 → 1161,10
{
double tox = ( to->x / 64.0 );
double toy = ( to->y / 64.0 );
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(tox, toy));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(tox, toy));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(tox, toy));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(tox, toy));
composite->addPoint(FPoint(tox, toy));
composite->addPoint(FPoint(tox, toy));
composite->addPoint(FPoint(tox, toy));
composite->addPoint(FPoint(tox, toy));
return 0;
}
 
1205,14 → 1174,10
double y1 = ( control->y / 64.0 );
double x2 = ( to->x / 64.0 );
double y2 = ( to->y / 64.0 );
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x2, y2));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x1, y1));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x2, y2));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x2, y2));
composite->addPoint(FPoint(x2, y2));
composite->addPoint(FPoint(x1, y1));
composite->addPoint(FPoint(x2, y2));
composite->addPoint(FPoint(x2, y2));
return 0;
};
 
1225,14 → 1190,10
double x3 = ( to->x / 64.0 );
double y3 = ( to->y / 64.0 );
composite->setPoint(composite->size()-1, FPoint(x1, y1));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x3, y3));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x2, y2));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x3, y3));
composite->resize(composite->size()+1);
composite->setPoint(composite->size()-1, FPoint(x3, y3));
composite->addPoint(FPoint(x3, y3));
composite->addPoint(FPoint(x2, y2));
composite->addPoint(FPoint(x3, y3));
composite->addPoint(FPoint(x3, y3));
return 0;
}
 
1246,26 → 1207,13
0
};
 
FPointArray traceCharacter(PageItem *b, QString chx, uint ind, float *x, float *y)
FPointArray traceChar(FT_Face face, uint chr, int chs, float *x, float *y)
{
FT_Face face; /* handle to face object */
FT_UInt glyphIndex;
FPointArray pts, pts2;
pts.resize(0);
firstP = FPoint(0,0);
FirstM = true;
QString ch = chx;
int chs = b->Ptext.at(ind)->csize;
if (b->Ptext.at(ind)->cstyle & 64)
{
if (ch.upper() != ch)
{
chs = QMAX(static_cast<int>(b->Ptext.at(ind)->csize * b->OwnPage->doku->VKapit / 100), 1);
ch = ch.upper();
}
}
uint chr = ch[0].unicode();
face = b->OwnPage->doku->FFonts[b->Ptext.at(ind)->cfont];
FT_Set_Char_Size( face, 0, chs*64, 72, 72 );
glyphIndex = FT_Get_Char_Index(face, chr);
FT_Load_Glyph( face, glyphIndex, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP );
1280,4 → 1228,3
*y = face->glyph->metrics.horiBearingY / 64.0;
return pts2;
}
#endif
/trunk/Scribus/scribus/edit1format.cpp
214,7 → 214,7
Layout17->addItem( spacer );
Cancel = new QPushButton( this, "Cancel" );
Cancel->setText( tr( "Cancel" ) );
Cancel->setDefault( true );
OkButton->setDefault( true );
Layout17->addWidget( Cancel );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
Layout17->addItem( spacer_3 );
/trunk/Scribus/scribus/scfonts.cpp
18,6 → 18,7
#include <qfont.h>
#include <qdict.h>
#include <qmap.h>
#include <qdir.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <qtextcodec.h>
26,22 → 27,20
#include <cstdlib>
#include "scfonts.h"
#include "scfonts_ttf.h"
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_OUTLINE_H
#include FT_GLYPH_H
#endif
extern FPointArray traceChar(FT_Face face, uint chr, int chs, float *x, float *y);
 
extern bool loadText(QString nam, QString *Buffer);
extern bool GlyNames(QMap<uint, QString> *GList, QString Dat);
 
SCFonts_Encoding Foi::StdEncoding("Stdenc.txt");
SCFonts_Encoding Foi::TTFEncoding("TTFenc.txt");
 
Foi::Foi(QString scname, QString path, bool embedps, SCFonts_Encoding &encoding) :
SCName(scname), Datei(path), EmbedPS(embedps), Encoding(encoding)
Foi::Foi(QString scname, QString path, bool embedps) :
SCName(scname), Datei(path), EmbedPS(embedps)
{
isOTF = false;
Subset = false;
}
 
QString Foi::RealName()
68,6 → 67,59
{
return GlyNames(GList, Datei);
}
/*
void Foi::FontBez()
{
FT_Face face;
FT_Library library;
QString ts;
QPixmap pm(200, 100);
bool error;
int pen_x;
int YPos = qApp->font().pointSize();
uint n;
error = FT_Init_FreeType( &library );
error = FT_New_Face( library, Datei, 0, &face );
ts = QString(face->family_name) + " " + QString(face->style_name);
pm.fill();
pen_x = 0;
for (n = 0; n < ts.length(); n++)
{
uint dv = ts[n].unicode();
error = FT_Set_Char_Size( face, 0, qApp->font().pointSize()*64, 72, 72 );
FT_Load_Char(face, dv, FT_LOAD_RENDER | FT_LOAD_NO_BITMAP | FT_LOAD_MONOCHROME);
QByteArray bd(face->glyph->bitmap.rows * face->glyph->bitmap.pitch);
uint yy = 0;
uint adv;
if ((face->glyph->bitmap.width % 8) == 0)
adv = face->glyph->bitmap.width / 8;
else
adv = face->glyph->bitmap.width / 8 + 1;
for (int y = 0; y < face->glyph->bitmap.rows; ++y)
{
memcpy(bd.data()+yy, face->glyph->bitmap.buffer+(y * face->glyph->bitmap.pitch), adv);
yy += adv;
}
QBitmap bb(face->glyph->bitmap.width, face->glyph->bitmap.rows, (uchar*)bd.data(), false);
QPixmap pixm(face->glyph->bitmap.width, face->glyph->bitmap.rows);
if (!pixm.isNull())
{
pixm.fill(Qt::black);
pixm.setMask(bb);
QPainter p;
p.begin(&pm);
p.drawPixmap(pen_x+face->glyph->bitmap_left, YPos-face->glyph->bitmap_top, pixm);
p.end();
}
pen_x += face->glyph->advance.x >> 6;
}
int high = qApp->fontMetrics().height();
QPixmap pm2(pen_x, high);
bitBlt(&pm2, 0, 0, &pm, 0, 0, pen_x, high);
Appearance = pm2;
FT_Done_FreeType( library );
return;
} */
 
/*
Class Foi_postscript
78,8 → 130,8
class Foi_postscript : public Foi
{
public:
Foi_postscript(QString scname, QString path, bool embedps, SCFonts_Encoding &encoding) :
Foi(scname,path,embedps,encoding), metricsread(false)
Foi_postscript(QString scname, QString path, bool embedps) :
Foi(scname,path,embedps), metricsread(false)
{
HasMetrics=false;
HasKern = false;
90,40 → 142,11
StdVW = "1";
FontBBox = "0 0 0 0";
IsFixedPitch = false;
#ifdef HAVE_FREETYPE
HasMetrics=true;
#else
QString afm=Datei.left(Datei.length()-3);
QFile f(afm+"afm");
if(f.exists())
HasMetrics=true;
else
{
f.setName(afm+"AFM");
if(f.exists())
HasMetrics=true;
else
{
f.setName(afm+"Afm");
if(f.exists())
HasMetrics=true;
}
}
#endif
}
 
virtual QString RealName()
{
if(cached_RealName)
return(cached_RealName);
QString tmp = "a /NoName";
QString tmp2 = "";
loadText(Datei, &tmp2);
int bd = tmp2.find("/FontName");
tmp = tmp2.mid(bd, 80);
QString rn,dummy;
QTextIStream (&tmp) >> dummy >> rn;
cached_RealName=rn.remove(0,1);
return(cached_RealName);
}
 
131,9 → 154,12
{
if(metricsread)
return(HasMetrics);
#ifdef HAVE_FREETYPE
CharWidth.clear();
GlyphArray.clear();
QString tmp;
float x, y;
FPointArray outlines;
struct GlyphR GRec;
bool error;
FT_Library library;
FT_ULong charcode;
165,6 → 191,11
HasKern = FT_HAS_KERNING(face);
Ascent = tmp.setNum(face->ascender);
Descender = tmp.setNum(face->descender);
numDescender = face->descender / uniEM;
numAscent = face->ascender / uniEM;
underline_pos = face->underline_position / uniEM;
strikeout_pos = numAscent / 3;
strokeWidth = face->underline_thickness / uniEM;
CapHeight = Ascent;
ItalicAngle = "0";
StdVW = "1";
176,137 → 207,19
{
FT_Load_Glyph( face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
CharWidth.insert(charcode, face->glyph->metrics.horiAdvance / uniEM);
outlines = traceChar(face, charcode, 10, &x, &y);
GRec.Outlines = outlines.copy();
GRec.x = x;
GRec.y = y;
GlyphArray.insert(charcode, GRec);
charcode = FT_Get_Next_Char( face, charcode, &gindex );
}
FT_Done_FreeType( library );
HasMetrics=true;
metricsread=true;
#else
QString afnm,tmpaf, afmz, AFMName, Enco;
QStringList wt3, wt4, wtiso;
int AFMIndex, AFMWidth;
float afmwid;
bool stdEnc = true;
AFMIndex = 0;
AFMWidth = 0;
 
for (int am = 0; am < 256; ++am)
CharWidth[am] = 0;
 
afnm=Datei.left(Datei.length()-3);
QFile afm(afnm+"afm");
if(!(afm.exists()))
{
afm.setName(afnm+"Afm");
if(!(afm.exists()))
{
afm.setName(afnm+"AFM");
}
}
if (afm.exists())
{
if (afm.open(IO_ReadOnly))
{
QTextStream ts7(&afm);
tmpaf = ts7.read();
afm.close();
QTextStream ts8(&tmpaf, IO_ReadOnly);
while (!ts8.atEnd())
{
afmz = ts8.readLine();
afmz = afmz.simplifyWhiteSpace();
if (afmz.startsWith("Ascender"))
Ascent = afmz.remove(0, 9);
if (afmz.startsWith("CapHeight"))
CapHeight = afmz.remove(0, 10);
if (afmz.startsWith("Descender"))
Descender = afmz.remove(0, 10);
if (afmz.startsWith("ItalicAngle"))
ItalicAngle = afmz.remove(0, 12);
if (afmz.startsWith("StdVW"))
StdVW = afmz.remove(0, 6);
if (afmz.startsWith("IsFixedPitch"))
{
Enco = afmz.remove(0, 13);
if (Enco == "false")
IsFixedPitch = false;
else
IsFixedPitch = true;
}
if (afmz.startsWith("FontBBox"))
FontBBox = afmz.remove(0, 9);
if (afmz.startsWith("StartCharMetrics"))
break;
if (afmz.startsWith("EncodingScheme"))
{
Enco = afmz.stripWhiteSpace();
Enco = Enco.remove(0, 15);
if (Enco == "FontSpecific")
stdEnc = false;
else
stdEnc = true;
}
}
while (!afmz.startsWith("EndCharMetrics"))
{
afmz = ts8.readLine();
wt3 = QStringList::split(";", afmz);
AFMIndex=0;
AFMName="";
for (uint wtc = 0; wtc < wt3.count(); ++wtc)
{
wt4 = QStringList::split(" ", wt3[wtc]);
if (wt4[0] == "C")
AFMIndex = wt4[1].toInt();
if (wt4[0] == "WX")
AFMWidth = wt4[1].toInt();
if (wt4[0] == "N")
AFMName = wt4[1];
}
afmwid = float(AFMWidth) / 1000.0;
if (AFMIndex > 0) // Whatever the encoding of the font, we need
{ // to extract metrics for ISO-latin1.
// Either we can map from the font's encoding
// to latin 1 by name (if the font has standard
// glyph names), or we can map by code, assuming
// the codes correspond to standard encoding.
if(Encoding.present(AFMName))
{
CharWidth[Encoding[AFMName]] = afmwid;
}
else
{
/* if(StdEncoding.present(AFMIndex))
{
QString &glyph=StdEncoding[AFMIndex];
if(Encoding.present(glyph))
CharWidth[Encoding[glyph]] = afmwid;
else
CharWidth[AFMIndex] = afmwid;
}
else */
CharWidth[AFMIndex] = afmwid;
}
}
else
{
if(Encoding.present(AFMName))
CharWidth[Encoding[AFMName]] = afmwid;
}
}
HasMetrics=true;
metricsread=true;
}
else
{
HasMetrics=false;
}
}
#endif
return(HasMetrics);
}
private:
QString cached_RealName;
bool metricsread;
};
 
319,8 → 232,8
class Foi_pfb : public Foi_postscript
{
public:
Foi_pfb(QString scname, QString path, bool embedps, SCFonts_Encoding &encoding) :
Foi_postscript(scname,path,embedps,encoding)
Foi_pfb(QString scname, QString path, bool embedps) :
Foi_postscript(scname,path,embedps)
{
}
 
404,8 → 317,8
class Foi_pfa : public Foi_postscript
{
public:
Foi_pfa(QString scname, QString path, bool embedps, SCFonts_Encoding &encoding) :
Foi_postscript(scname,path,embedps,encoding)
Foi_pfa(QString scname, QString path, bool embedps) :
Foi_postscript(scname,path,embedps)
{
}
virtual bool EmbedFont(QString &str)
419,11 → 332,6
 
SCFonts::~SCFonts()
{
if(ExtraPath.length())
{
system("xset fp- "+ExtraPath);
system("xset fp rehash");
}
}
 
/* Add a path to the list of fontpaths, ensuring that
441,76 → 349,54
 
void SCFonts::AddScalableFonts(const QString &path)
{
QFile fp(QString(path)+"fonts.scale");
if(!(fp.exists()))
fp.setName(QString(path)+"fonts.dir");
if(fp.open(IO_ReadOnly))
{
int entries;
QString tmp;
QTextStream ts(&fp);
entries = ts.readLine().toInt();
while(tmp = ts.readLine())
FT_Face face;
FT_Library library;
QString ts;
bool error;
error = FT_Init_FreeType( &library );
QDir d(path, "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
if ((d.exists()) && (d.count() != 0))
{
int pos=tmp.find(" ");
QString filename=tmp.left(pos);
QFileInfo fo(QString(path)+filename);
if (!fo.exists())
for (uint dc = 0; dc < d.count(); ++dc)
{
QFileInfo fi(path + d[dc]);
QString ext = fi.extension(false).lower();
if ((ext == "pfa") || (ext == "pfb") || (ext == "ttf") || (ext == "otf"))
FT_New_Face( library, path + d[dc], 0, &face );
else
continue;
tmp=tmp.right(tmp.length()-(pos+1)).stripWhiteSpace();
 
QStringList wt = QStringList::split("-",tmp);
if(wt.count()>4)
{
QString FoEnc = wt[wt.count()-2].lower()+"-"+wt[wt.count()-1].lower();
QString LoEnc = QString(QTextCodec::codecForLocale()->name()).lower().replace(QRegExp(" "), "");
QString FName=wt[1];
QString Style=wt[2];
Style[0] = Style[0].upper();
FName[0] = FName[0].upper();
QString SCName = FName + " " + Style;
// QString SCName = FName[0].upper() + FName.remove(0,1) + " ";
// SCName += Style[0].upper() + Style.remove(0,1);
if (wt[3] == "i") SCName += " Italic";
if (wt[3] == "o") SCName += " Oblique";
#if 0
if (wt[4] != "normal") // sadly, QT seems to ignore this field
ts = QString(face->family_name) + " " + QString(face->style_name);
if (!find(ts))
{
QString scn_wid=wt[4][0].upper() + wt[4].remove(0,1);
SCName+=" " + scn_wid;
}
#endif
if ((!(find(SCName)))
&& ((FoEnc == LoEnc)
|| ((FoEnc == "iso8859-1") && (LoEnc == "iso8859-15"))
|| ((FoEnc == "iso8859-1") && (LoEnc == "utf-8"))
|| (FoEnc == "adobe-fontspecific")))
{
Foi *t=0;
if(filename.contains(".pfa",false))
t=new Foi_pfa(SCName,path+filename,true,Encoding);
else if(filename.contains(".pfb",false))
t=new Foi_pfb(SCName,path+filename,true,Encoding);
else if(filename.contains(".ttf",false))
t=new Foi_ttf(SCName,path+filename,true,Encoding);
if(t)
Foi *t=0;
if(ext == "pfa")
t = new Foi_pfa(ts, path + d[dc], true);
else if(ext == "pfb")
t = new Foi_pfb(ts, path + d[dc], true);
else if(ext == "ttf")
t = new Foi_ttf(ts, path + d[dc], true);
else if(ext == "otf")
t = new Foi_ttf(ts, path + d[dc], true);
if(t)
{
t->Font.setPointSize(12);
t->Font.setRawName(tmp);
t->Font.setPointSize(12);
t->FontEnc = FoEnc;
insert(SCName,t);
t->EmbedPS = true;
t->UseFont = true;
// if(t->HasMetrics)
// t->ReadMetrics();
t->CharWidth[13] = 0;
t->cached_RealName = QString(FT_Get_Postscript_Name(face));
t->Font.setPointSize(12);
if (ext == "otf")
{
t->isOTF = true;
t->Subset = true;
}
insert(ts,t);
t->EmbedPS = true;
t->UseFont = true;
t->CharWidth[13] = 0;
t->Family = QString(face->family_name);
}
}
FT_Done_Face( face );
}
}
fp.close();
}
FT_Done_FreeType( library );
}
 
void SCFonts::AddXFontPath()
592,14 → 478,11
QTextStream tsx(&fx);
while (!tsx.atEnd())
{
ExtraPath += tsx.readLine();
ExtraPath += ",";
ExtraPath = tsx.readLine();
AddPath(ExtraPath);
}
fx.close();
}
ExtraPath = ExtraPath.left(ExtraPath.length()-1);
system("xset fp+ "+ExtraPath);
system("xset fp rehash");
}
}
 
612,13 → 495,3
for(QStrListIterator fpi(FontPath) ; fpi.current() ; ++fpi)
AddScalableFonts(fpi.current());
}
 
void SCFonts::FreeExtraFonts()
{
if(ExtraPath.length())
{
system("xset fp- "+ExtraPath);
system("xset fp rehash");
ExtraPath = "";
}
}
/trunk/Scribus/scribus/docinfo.h
20,7 → 20,7
{
 
public:
DocInfos( QWidget* parent, QString Autor, QString Titel, QString Des );
DocInfos( QWidget* parent, QString Autor, QString Titel, QString Des, QString keyW );
~DocInfos() {};
 
QLabel* TextLabel3;
29,6 → 29,8
QLineEdit* TitelInfo;
QMultiLineEdit* MultiLineEdit1;
QLabel* TextLabel2;
QLabel* TextLabel3a;
QMultiLineEdit* MultiLineEdit2;
QPushButton* Cancel;
QPushButton* OK;
protected:
/trunk/Scribus/scribus/icons/fill.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/Scribus/scribus/icons/outlined.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Scribus/scribus/icons/outlined.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/Scribus/scribus/icons/unlock.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Scribus/scribus/icons/unlock.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/Scribus/scribus/icons/NoPrint.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Scribus/scribus/icons/NoPrint.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/Scribus/scribus/icons/locked.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Scribus/scribus/icons/locked.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/Scribus/scribus/icons/Makefile.am
===================================================================
--- trunk/Scribus/scribus/icons/Makefile.am (revision 67)
+++ trunk/Scribus/scribus/icons/Makefile.am (revision 68)
@@ -1,7 +1,7 @@
####### kdevelop will overwrite this part!!! (begin)##########
-EXTRA_DIST = Kreuz.xpm Bild.xpm Editm.xpm Kreise.xpm Lock.xpm Lupe.xpm Rechtecke.xpm Rotieren.xpm Stift.xpm Text.xpm Unlock.xpm DateiClos.xpm DateiNeu.xpm DateiOpen.xpm DateiPrint.xpm DateiSave.xpm AppIcon.xpm LupeZ.xpm Gross.xpm Klein.xpm DragPix.xpm Rotieren2.xpm HandC.xpm scribus_logo.jpg DateiClos16.png DateiNeu16.png DateiOpen16.png DateiPrint16.png DateiSave16.png editcopy.png editcut.png editdelete.png editpaste.png exit.png doc.png image.png pdf.png postscript.png txt.png Zeichen.xpm Hoch.xpm Kapital.xpm Strike.xpm Tief.xpm Unter.xpm Kern.xpm Spacing.xpm Corner.xpm FlipH.xpm FlipV.xpm Winkel.xpm acrobat.png scribusicon.png text_block.png text_center.png text_left.png text_right.png Text2.xpm spline.png triangle.png Stiftalt.xpm beziertool.png AddNode.png DeleteNode.png MoveAsym.png MoveKontrol.png MoveNode.png MoveSym.png BevelJoin.png ButtCap.png MiterJoin.png RoundJoin.png SquareCap.png ResetNode.png RoundCap.png Reset1Node.png BezierClose.png PolyCut.png AddPoint.png DelPoint.png Split.png Deletelayer.png Layervisible.xpm Lowerlayer.png Newlayer.png Raiselayer.png checkbox.png combobox.png listbox.png pushbutton.png textview.png charset.png goto.png document2.png trashcan.png trashcan2.png gohome.png bottom.png down.png top.png up.png irreg.png oval.png rect.png text_force.png ok.png Revers.png hmirror.png vmirror.png shear_right.png shear_left.png shear_up.png shear_down.png Splash.png back.png start.png forward.png finish.png penciladd.png pencilsub.png
+EXTRA_DIST = Kreuz.xpm Bild.xpm Editm.xpm Kreise.xpm Lock.xpm Lupe.xpm Rechtecke.xpm Rotieren.xpm Stift.xpm Text.xpm Unlock.xpm DateiClos.xpm DateiNeu.xpm DateiOpen.xpm DateiPrint.xpm DateiSave.xpm AppIcon.xpm LupeZ.xpm Gross.xpm Klein.xpm DragPix.xpm Rotieren2.xpm HandC.xpm scribus_logo.jpg DateiClos16.png DateiNeu16.png DateiOpen16.png DateiPrint16.png DateiSave16.png editcopy.png editcut.png editdelete.png editpaste.png exit.png doc.png image.png pdf.png postscript.png txt.png Zeichen.xpm Hoch.xpm Kapital.xpm Strike.xpm Tief.xpm Unter.xpm Kern.xpm Spacing.xpm Corner.xpm FlipH.xpm FlipV.xpm Winkel.xpm acrobat.png scribusicon.png text_block.png text_center.png text_left.png text_right.png Text2.xpm spline.png triangle.png Stiftalt.xpm beziertool.png AddNode.png DeleteNode.png MoveAsym.png MoveKontrol.png MoveNode.png MoveSym.png BevelJoin.png ButtCap.png MiterJoin.png RoundJoin.png SquareCap.png ResetNode.png RoundCap.png Reset1Node.png BezierClose.png PolyCut.png AddPoint.png DelPoint.png Split.png Deletelayer.png Layervisible.xpm Lowerlayer.png Newlayer.png Raiselayer.png checkbox.png combobox.png listbox.png pushbutton.png textview.png charset.png goto.png document2.png trashcan.png trashcan2.png gohome.png bottom.png down.png top.png up.png irreg.png oval.png rect.png text_force.png ok.png Revers.png hmirror.png vmirror.png shear_right.png shear_left.png shear_up.png shear_down.png Splash.png back.png start.png forward.png finish.png penciladd.png pencilsub.png outlined.png fill.png NoPrint.png unlock.png locked.png
install-data-local:
$(mkinstalldirs) $(prefix)/lib/scribus/icons/
@@ -244,6 +244,16 @@
$(INSTALL_DATA) $(srcdir)/penciladd.png $(prefix)/lib/scribus/icons/penciladd.png
$(mkinstalldirs) $(prefix)/lib/scribus/icons/
$(INSTALL_DATA) $(srcdir)/pencilsub.png $(prefix)/lib/scribus/icons/pencilsub.png
+ $(mkinstalldirs) $(prefix)/lib/scribus/icons/
+ $(INSTALL_DATA) $(srcdir)/outlined.png $(prefix)/lib/scribus/icons/outlined.png
+ $(mkinstalldirs) $(prefix)/lib/scribus/icons/
+ $(INSTALL_DATA) $(srcdir)/fill.png $(prefix)/lib/scribus/icons/fill.png
+ $(mkinstalldirs) $(prefix)/lib/scribus/icons/
+ $(INSTALL_DATA) $(srcdir)/locked.png $(prefix)/lib/scribus/icons/locked.png
+ $(mkinstalldirs) $(prefix)/lib/scribus/icons/
+ $(INSTALL_DATA) $(srcdir)/unlock.png $(prefix)/lib/scribus/icons/unlock.png
+ $(mkinstalldirs) $(prefix)/lib/scribus/icons/
+ $(INSTALL_DATA) $(srcdir)/NoPrint.png $(prefix)/lib/scribus/icons/NoPrint.png
uninstall-local:
@@ -367,6 +377,11 @@
-rm -f $(prefix)/lib/scribus/icons/start.png
-rm -f $(prefix)/lib/scribus/icons/penciladd.png
-rm -f $(prefix)/lib/scribus/icons/pencilsub.png
+ -rm -f $(prefix)/lib/scribus/icons/outlined.png
+ -rm -f $(prefix)/lib/scribus/icons/fill.png
+ -rm -f $(prefix)/lib/scribus/icons/unlock.png
+ -rm -f $(prefix)/lib/scribus/icons/locked.png
+ -rm -f $(prefix)/lib/scribus/icons/NoPrint.png
####### kdevelop will overwrite this part!!! (end)############
/trunk/Scribus/scribus/pageitem.h
24,10 → 24,10
#include <qptrlist.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qfont.h>
#include <qvaluestack.h>
#include <qvaluelist.h>
#include "scribusdoc.h"
#include "scpainter.h"
/**
*@author Franz Schmid
*/
38,22 → 38,27
PageItem(Page* pa, int art, float x, float y, float w, float h, float w2, QString fill, QString outline, ScribusDoc *doc);
~PageItem() {};
struct ZZ { QString Zeich;
QColor Farb;
QFont Zsatz;
QString Farb;
QString Farb2;
int shade;
int shade2;
QString ZFo;
float xco;
float yco;
bool Sele;
int Siz;
int Style;
float wide;
float kern;
int scale;
};
/** Zeichnet das Item */
void paintObj(QRect e=QRect(), QPixmap *ppX = 0);
void DrawObj(ScPainter *p, QRect e);
void CopyIt(struct CLBuf *Buffer);
void SetZeichAttr(QPainter *p, QFont *ffo, struct Pti *hl, int *chs, QString *chx);
void SetZeichAttr(struct Pti *hl, int *chs, QString *chx);
void SetFarbe(QColor *tmp, QString farbe, int shad);
void DrawZeichen(QPainter *p, struct Pti *hl);
void DrawZeichen(QPainter *p, struct ZZ *hl);
void DrawZeichenS(ScPainter *p, struct ZZ *hl);
void DrawPoly(QPainter *p, QPointArray pts, QColor BackF, bool bitm = false);
void DrawPolyL(QPainter *p, QPointArray pts);
QString ExpandToken(uint base);
90,6 → 95,12
QString Pcolor2;
/** Abstufung fuer Zeichenfarbe */
int Shade2;
QString TxtStroke;
QString TxtFill;
int ShTxtStroke;
int ShTxtFill;
int TxtScale;
int TxTStyle;
/** Strichstaerke */
float Pwidth;
/** Linienart */
115,7 → 126,6
Page *OwnPage;
/** Darzustellendes Bild */
QImage pixm;
QImage Gpixm;
/** Dateiname des Bildes */
QString Pfile;
QString Pfile2;
233,15 → 243,17
float OldH2;
bool Sizing;
bool toPixmap;
float DevRes;
int DevResX;
int DevResY;
int LayerNr;
bool ScaleType;
bool AspectRatio;
float Transparency;
float TranspStroke;
QValueStack<int> Groups;
bool InvPict;
QValueList<float> DashValues;
float DashOffset;
VGradient fill_gradient;
QString Language;
};
 
#endif
/trunk/Scribus/scribus/fpoint.h
34,6 → 34,8
float y();
void setX(float x);
void setY(float y);
bool operator==(const FPoint &rhs);
bool operator!=(const FPoint &rhs);
FPoint &operator+=( const FPoint &p );
FPoint &operator-=( const FPoint &p );
private:
/trunk/Scribus/scribus/scrap.cpp
123,7 → 123,8
setCaption( tr( "Scrapbook" ) );
setIcon(loadIcon("AppIcon.xpm"));
ScFilename = "";
Prefs = prefs;
Prefs = prefs;
Changed = false;
BiblioLayout = new QVBoxLayout( this );
BiblioLayout->setSpacing( 0 );
BiblioLayout->setMargin( 0 );
188,12 → 189,15
void Biblio::Save()
{
if ((!ScFilename.isEmpty()) && (BibWin->Objekte.count() != 0))
{
BibWin->SaveContents(ScFilename);
Changed = false;
}
}
 
void Biblio::SaveAs()
{
QString fn = QFileDialog::getSaveFileName(0, tr("Scrapbooks (*.scs);;All Files (*)"), this);
QString fn = QFileDialog::getSaveFileName(0, tr("Scrapbooks (*.scs);; All Files (*)"), this);
if (!fn.isEmpty())
{
BibWin->SaveContents(fn);
200,17 → 204,20
ScFilename = fn;
setCaption(fn);
fmenu->setItemEnabled(fSave, 1);
Changed = false;
}
}
 
void Biblio::Load()
{
QString fileName = QFileDialog::getOpenFileName(0,tr("Scrapbooks (*.scs);;All Files (*)"),this);
Save();
QString fileName = QFileDialog::getOpenFileName(0,tr("Scrapbooks (*.scs);; All Files (*)"),this);
if (!fileName.isEmpty())
{
BibWin->ReadContents(fileName);
ScFilename = fileName;
setCaption(fileName);
Changed = false;
}
}
 
269,6 → 276,7
 
void Biblio::NewLib()
{
Save();
BibWin->Objekte.clear();
BibWin->clear();
ScFilename = "";
281,6 → 289,7
BibWin->Objekte.remove(name);
delete ite;
BibWin->arrangeItemsInGrid(true);
Changed = true;
}
 
void Biblio::DropOn(QDropEvent *e)
353,5 → 362,6
QPixmap pm = pre->createPreview(ff);
BibWin->AddObj(nam, ff, pm);
(void) new QIconViewItem(BibWin, nam, pm);
Changed = true;
delete pre;
}
/trunk/Scribus/scribus/page.h
54,10 → 54,9
/** Laedt ein Bild */
void LoadPict(QString fn, int ItNr);
void insertColor(QString nam, float c, float m, float y, float k);
void DrawPageMarks(QPaintEvent *e);
void DrawPageItems(QPaintEvent *e);
void DrawPageMarks(QPaintEvent *e, ScPainter *p, QRect rd);
void DrawPageItems(QPaintEvent *e, ScPainter *painter, QRect rd);
void paintEvent(QPaintEvent *e);
void DrawTransparent(PageItem *b);
void setGroupRect();
void getGroupRect(float *x, float *y, float *w, float *h);
void getGroupRectScreen(float *x, float *y, float *w, float *h);
118,10 → 117,8
FPoint ApplyGridF(FPoint in);
void RefreshItem(PageItem *b);
void RepaintTextRegion(PageItem *b, QRegion alt);
void DrawCursChar(PageItem *b, QPainter *p, int po);
void EmitValues(PageItem *b);
void AdjustPreview(PageItem *b);
void UpdateGradient(PageItem *i);
void FromHRuler(QMouseEvent *m);
void FromVRuler(QMouseEvent *m);
void SetYGuide(QMouseEvent *m);
132,6 → 129,11
void UniteObj();
void SplitObj();
void PasteItem(struct CLBuf *Buffer, bool loading, bool drag = false);
void ItemTextBrush(QString farbe);
void ItemTextBrushS(int sha);
void ItemTextPen(QString farbe);
void ItemTextPenS(int sha);
void ItemTextScale(int sha);
QRegion ViewReg();
/** Liste der Elemente */
QPtrList<PageItem> Items;
204,9 → 206,9
void ItemFont(QString fon);
void chFSize(int size);
void ItemPen(QString farbe);
void ItemBrush(QString farbe, bool vCPal = false);
void ItemBrush(QString farbe);
void ItemPenShade(int sha);
void ItemBrushShade(int sha, bool vCPal = false);
void ItemBrushShade(int sha);
void ItemGradFill(int typ, QString col1, int sh1, QString col2, int sh2);
void QueryFarben();
void SetFrameRect();
277,8 → 279,10
void ItemTextFont(QString);
/** Sendet die Schriftgroesse */
void ItemTextSize(int);
void ItemTextSca(int);
void ItemTextUSval(float);
void ItemTextAbs(int);
void ItemTextFarben(QString, QString, int, int);
/** Text in Textbox selektiert */
void HasTextSel();
void HasNoTextSel();
286,7 → 290,6
void CopyItem();
void ItemTextStil(int);
void LoadPic();
void ModifyIt();
void LoadElem(QString, int, int, bool, bool, ScribusDoc *);
void Amode(int);
void AnnotProps();
298,7 → 301,7
void PStatus(int, uint);
void UndoAvail();
void EditGuides();
void ItemTrans(float);
void ItemTrans(float, float);
void AddBM(PageItem *);
void DelBM(PageItem *);
void NewBMNr(int, int);
/trunk/Scribus/scribus/scpainter.cpp
0,0 → 1,985
/* This file is part of the KDE project.
Copyright (C) 2001, 2002, 2003 The Karbon Developers
 
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
 
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/* Adapted for Scribus 22.08.2003 by Franz Schmid */
// kopainter/libart wrapper
 
#include "scpainter.h"
 
#include <qpaintdevice.h>
#include <qpixmap.h>
#include <qpointarray.h>
#include <qimage.h>
 
#include <libart_lgpl/art_vpath.h>
#include <libart_lgpl/art_bpath.h>
#include <libart_lgpl/art_vpath_bpath.h>
#include <libart_lgpl/art_svp_vpath.h>
#include <libart_lgpl/art_svp_vpath_stroke.h>
#include <libart_lgpl/art_svp.h>
#include <libart_lgpl/art_svp_ops.h>
#include <libart_lgpl/art_affine.h>
#include <libart_lgpl/art_svp_intersect.h>
#include <libart_lgpl/art_rect_svp.h>
#include <libart_lgpl/art_pathcode.h>
#include <libart_lgpl/art_vpath_dash.h>
#include "art_render_misc.h"
#include <libart_lgpl/art_render_svp.h>
#include <libart_lgpl/art_vpath_svp.h>
 
#include "art_rgb_svp.h"
#include "art_render_pattern.h"
 
#include <X11/Xlib.h>
 
#include <gdk-pixbuf-xlibrgb.h>
#include <math.h>
#include "art_kmisc.h"
 
#define INITIAL_ALLOC 300
#define ALLOC_INCREMENT 100
 
ScPainter::ScPainter( QPaintDevice *target, unsigned int w, unsigned int h )
{
m_target = target;
m_width = w;
m_height= h;
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;
fill_gradient = VGradient(VGradient::linear);
stroke_gradient = VGradient(VGradient::linear);
xlib_rgb_init_with_depth( target->x11Display(), XScreenOfDisplay( target->x11Display(),
target->x11Screen() ), target->x11Depth() );
 
gc = XCreateGC( target->x11Display(), target->handle(), 0, 0 );
m_zoomFactor = 1;
}
 
ScPainter::~ScPainter()
{
// If we are in target mode, we created a buffer, else if we used the other ctor
// we didnt.
if( m_target )
art_free( m_buffer );
if( m_path )
art_free( m_path );
if( gc )
XFreeGC( m_target->x11Display(), gc );
}
 
void ScPainter::resize( unsigned int w, unsigned int h )
{
if( !m_buffer || w != m_width || h != m_height )
{
// TODO : realloc?
art_free( m_buffer );
m_buffer = 0;
m_width = w;
m_height = h;
if ( m_width != 0 && m_height != 0 )
m_buffer = art_new( art_u8, m_width * m_height * 4 );
clear();
}
}
 
void ScPainter::begin()
{
}
 
void ScPainter::end()
{
xlib_draw_rgb_32_image( m_target->handle(), gc, 0, 0, m_width, m_height,
XLIB_RGB_DITHER_NONE, m_buffer, m_width * 4 );
}
 
void
ScPainter::clear()
{
if( m_buffer )
memset( m_buffer, qRgba( 255, 255, 255, 255 ), m_width * m_height * 4 );
}
 
void
ScPainter::clear( const QColor &c )
{
if( m_buffer )
memset( m_buffer, c.rgb(), m_width * m_height * 4 );
}
 
void ScPainter::setWorldMatrix( const QWMatrix &mat )
{
m_matrix = mat;
}
 
void ScPainter::setZoomFactor( double zoomFactor )
{
m_zoomFactor = zoomFactor;
}
 
void ScPainter::translate( double x, double y )
{
m_matrix.translate(x, y);
}
 
void ScPainter::rotate( double r )
{
m_matrix.rotate(r);
}
 
void ScPainter::scale( double x, double y )
{
m_matrix.scale(x, y);
}
 
void ScPainter::ensureSpace( unsigned int newindex )
{
if( m_index == 0 )
{
if( !m_path )
m_path = art_new( ArtBpath, INITIAL_ALLOC );
m_alloccount = INITIAL_ALLOC;
}
else if( newindex > m_alloccount )
{
m_alloccount += ALLOC_INCREMENT;
m_path = art_renew( m_path, ArtBpath, m_alloccount );
}
}
 
void ScPainter::moveTo( const double &x, const double &y )
{
ensureSpace( m_index + 1 );
m_path[ m_index ].code = ART_MOVETO;
m_path[ m_index ].x3 = x * m_zoomFactor;
m_path[ m_index ].y3 = y * m_zoomFactor;
m_index++;
}
 
void
ScPainter::lineTo( const double &x, const double &y )
{
ensureSpace( m_index + 1 );
m_path[ m_index ].code = ART_LINETO;
m_path[ m_index ].x3 = x * m_zoomFactor;
m_path[ m_index ].y3 = y * m_zoomFactor;
m_index++;
}
 
void ScPainter::curveTo( FPoint p1, FPoint p2, FPoint p3 )
{
ensureSpace( m_index + 1 );
m_path[ m_index ].code = ART_CURVETO;
m_path[ m_index ].x1 = static_cast<double>(p1.x()) * m_zoomFactor;
m_path[ m_index ].y1 = static_cast<double>(p1.y()) * m_zoomFactor;
m_path[ m_index ].x2 = static_cast<double>(p2.x()) * m_zoomFactor;
m_path[ m_index ].y2 = static_cast<double>(p2.y()) * m_zoomFactor;
m_path[ m_index ].x3 = static_cast<double>(p3.x()) * m_zoomFactor;
m_path[ m_index ].y3 = static_cast<double>(p3.y()) * m_zoomFactor;
m_index++;
}
 
void ScPainter::newPath()
{
m_index = 0;
}
 
void ScPainter::setFillRule( bool fillRule )
{
m_fillRule = fillRule;
}
 
void ScPainter::setFillMode( int fill )
{
fillMode = fill;
}
 
void ScPainter::setGradient(VGradient::VGradientType mode, FPoint orig, FPoint vec, FPoint foc)
{
fill_gradient.setType(mode);
fill_gradient.setOrigin(orig);
fill_gradient.setVector(vec);
fill_gradient.setFocalPoint(foc);
// fill_gradient.setRepeatMethod( VGradient::reflect );
}
 
void ScPainter::fillPath()
{
if( m_index == 0 ) return;
int find = -1;
for( int i = m_index - 1; i >= 0; i-- )
{
if( m_path[i].code == ART_MOVETO_OPEN || m_path[i].code == ART_MOVETO )
{
find = i;
break;
}
}
if( find != -1 && ( m_path[ find ].x3 != m_path[ m_index - 1 ].x3 ||
m_path[ find ].y3 != m_path[ m_index - 1 ].y3 ) )
{
ensureSpace( m_index + 1 );
m_path[ m_index ].code = ART_LINETO;
m_path[ m_index ].x3 = m_path[ find ].x3;
m_path[ m_index ].y3 = m_path[ find ].y3;
m_index++;
m_path[ m_index ].code = ART_END;
}
else
m_path[ m_index++ ].code = ART_END;
if( fillMode != 0)
{
ArtVpath *path = art_bez_path_to_vec( m_path , 0.25 );
drawVPath( path, 0 );
}
m_index--;
}
 
void ScPainter::strokePath()
{
if( m_index == 0 )
return;
if( LineWidth == 0 )
return;
if( m_path[ m_index ].code != ART_END)
m_path[ m_index ].code = ART_END;
ArtVpath *path = art_bez_path_to_vec( m_path , 0.25 );
drawVPath( path, 1 );
}
 
QColor ScPainter::pen()
{
return m_stroke;
}
 
QColor ScPainter::brush()
{
return m_fill;
}
 
void ScPainter::setPen( const QColor &c )
{
m_stroke = c;
}
 
void ScPainter::setPen( const QColor &c, float w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo )
{
m_stroke = c;
LineWidth = w;
PLineEnd = ca;
PLineJoin = jo;
float Dt = QMAX(2*w, 1);
float Da = QMAX(6*w, 1);
QValueList<float> tmp;
m_array.clear();
m_offset = 0;
switch (st)
{
case Qt::SolidLine:
break;
case Qt::DashLine:
m_array.append(Da);
m_array.append(Dt);
break;
case Qt::DotLine:
m_array.append(Dt);
break;
case Qt::DashDotLine:
m_array.append(Da);
m_array.append(Dt);
m_array.append(Dt);
m_array.append(Dt);
break;
case Qt::DashDotDotLine:
m_array.append(Da);
m_array.append(Dt);
m_array.append(Dt);
m_array.append(Dt);
m_array.append(Dt);
m_array.append(Dt);
break;
default:
break;
}
}
 
void ScPainter::setLineWidth( float w )
{
LineWidth = w;
}
 
void ScPainter::setPenOpacity( float op )
{
stroke_trans = op;
}
 
 
void ScPainter::setDash(const QValueList<float>& array, float ofs)
{
m_array = array;
m_offset = ofs;
}
 
void ScPainter::setBrush( const QColor &c )
{
m_fill = c;
}
 
void ScPainter::setBrushOpacity( float op )
{
fill_trans = op;
}
 
void ScPainter::setOpacity( float op )
{
fill_trans = op;
stroke_trans = op;
}
 
void ScPainter::setFont( const QFont &f)
{
m_font = f;
}
 
QFont ScPainter::font()
{
return m_font;
}
 
void ScPainter::save()
{
MStack.push(m_matrix);
}
 
void ScPainter::restore()
{
m_matrix = MStack.pop();
}
 
void ScPainter::setRasterOp( Qt::RasterOp )
{
}
 
void ScPainter::clampToViewport( int &x0, int &y0, int &x1, int &y1 )
{
// clamp to viewport
x0 = QMAX( x0, 0 );
x0 = QMIN( x0, int( m_width ) );
y0 = QMAX( y0, 0 );
y0 = QMIN( y0, int ( m_height ) );
x1 = QMAX( x1, 0 );
x1 = QMIN( x1, int( m_width ) );
y1 = QMAX( y1, 0 );
y1 = QMIN( y1, int( m_height ) );
}
 
void ScPainter::clampToViewport( const ArtSVP &svp, int &x0, int &y0, int &x1, int &y1 )
{
// get SVP bbox
ArtDRect bbox;
art_drect_svp( &bbox, &svp );
// Remove comments if we really decide for SVP bbox usage
//m_bbox = KoRect( bbox.x0, bbox.y0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0 );
 
// clamp to viewport
x0 = int( bbox.x0 );
x0 = QMAX( x0, 0 );
x0 = QMIN( x0, int( m_width ) );
y0 = int( bbox.y0 );
y0 = QMAX( y0, 0 );
y0 = QMIN( y0, int ( m_height ) );
x1 = int( bbox.x1 ) + 1;
x1 = QMAX( x1, 0 );
x1 = QMIN( x1, int( m_width ) );
y1 = int( bbox.y1 ) + 1;
y1 = QMAX( y1, 0 );
y1 = QMIN( y1, int( m_height ) );
}
 
void ScPainter::drawVPath( ArtVpath *vec, int mode )
{
ArtSVP *strokeSvp = 0L;
ArtSVP *fillSvp = 0L;
// set up world matrix
double affine[6];
affine[0] = m_matrix.m11();
affine[1] = m_matrix.m12(); // was 0 in Karbon
affine[2] = m_matrix.m21(); // was 0 in Karbon, don't know why
affine[3] = m_matrix.m22();
affine[4] = m_matrix.dx();
affine[5] = m_matrix.dy();
ArtVpath *temp1 = art_vpath_affine_transform( vec, affine );
art_free( vec );
vec = temp1;
int af = 0;
int as = 0;
art_u32 fillColor = 0;
// filling
QColor color;
if (mode == 0)
{
color = m_fill;
af = qRound( 255 * fill_trans );
fillColor = ( 0 << 24 ) | ( color.blue() << 16 ) | ( color.green() << 8 ) | color.red();
ArtSvpWriter *swr;
ArtSVP *temp;
temp = art_svp_from_vpath( vec );
if( m_fillRule )
swr = art_svp_writer_rewind_new( ART_WIND_RULE_ODDEVEN );
else
swr = art_svp_writer_rewind_new( ART_WIND_RULE_NONZERO );
art_svp_intersector( temp, swr );
fillSvp = art_svp_writer_rewind_reap( swr );
art_svp_free( temp );
}
art_u32 strokeColor = 0;
if (mode == 1)
{
ArtPathStrokeCapType capStyle = ART_PATH_STROKE_CAP_BUTT;
ArtPathStrokeJoinType joinStyle = ART_PATH_STROKE_JOIN_MITER;
color = m_stroke;
as = qRound( 255 * stroke_trans );
strokeColor = ( 0 << 24 ) | ( color.blue() << 16 ) | ( color.green() << 8 ) | color.red();
double ratio = m_zoomFactor;//sqrt(pow(affine[0], 2) + pow(affine[3], 2)) / sqrt(2);
if( m_array.count() > 0 )
{
// there are dashes to be rendered
ArtVpathDash dash;
dash.offset = static_cast<double>(m_offset) * ratio;
dash.n_dash = m_array.count();
double *dashes = new double[ dash.n_dash ];
for( int i = 0; i < dash.n_dash; i++ )
{
dashes[i] = static_cast<double>(m_array[i]) * ratio;
}
dash.dash = dashes;
// get the dashed VPath and use that for the stroke render operation
ArtVpath *vec2 = art_vpath_dash( vec, &dash );
art_free( vec );
vec = vec2;
delete [] dashes;
}
if( PLineEnd == Qt::RoundCap )
capStyle = ART_PATH_STROKE_CAP_ROUND;
else if( PLineEnd == Qt::SquareCap )
capStyle = ART_PATH_STROKE_CAP_SQUARE;
if( PLineJoin == Qt::RoundJoin )
joinStyle = ART_PATH_STROKE_JOIN_ROUND;
else if( PLineJoin == Qt::BevelJoin )
joinStyle = ART_PATH_STROKE_JOIN_BEVEL;
strokeSvp = art_svp_vpath_stroke( vec, joinStyle, capStyle, ratio * LineWidth, 10, 0.25 );
}
int x0, y0, x1, y1;
 
// render the svp to the buffer
 
if( fillSvp )
{
if (fillMode == 2)
applyGradient( fillSvp, true );
else
{
/* if( m_fill && m_fill->type() == VFill::grad )
applyGradient( fillSvp, true );
else if( m_fill && m_fill->type() == VFill::patt )
applyPattern( fillSvp, true );
else
{ */
clampToViewport( *fillSvp, x0, y0, x1, y1 );
if( x0 != x1 && y0 != y1 )
art_rgb_svp_alpha_( fillSvp, x0, y0, x1, y1, fillColor, af, m_buffer + x0 * 4 + y0 * m_width * 4, m_width * 4, 0 );
}
art_svp_free( fillSvp );
}
if( strokeSvp )
{
/* if( m_stroke && m_stroke->type() == VStroke::grad )
applyGradient( strokeSvp, false );
else if( m_stroke && m_stroke->type() == VStroke::patt )
applyPattern( strokeSvp, false );
else
{ */
clampToViewport( *strokeSvp, x0, y0, x1, y1 );
if( x0 != x1 && y0 != y1 )
art_rgb_svp_alpha_( strokeSvp, x0, y0, x1, y1, strokeColor, as, m_buffer + x0 * 4 + y0 * m_width * 4, m_width * 4, 0 );
// }
art_svp_free( strokeSvp );
}
art_free( vec );
}
/*
void
VKoPainter::applyPattern( ArtSVP *svp, bool fill )
{
int x0, y0, x1, y1;
clampToViewport( *svp, x0, y0, x1, y1 );
 
ArtRender *render = 0L;
 
VPattern pat = fill ? m_fill->pattern() : m_stroke->pattern();
if( !pat.isValid() )
pat.load( "pics/cr32-app-karbon.png" );
 
ArtPattern *pattern = art_new( ArtPattern, 1 );
 
double dx = ( pat.vector().x() - pat.origin().x() ) * m_zoomFactor;
double dy = ( pat.vector().y() - pat.origin().y() ) * m_zoomFactor;
 
pattern->twidth = pat.tileWidth();
pattern->theight = pat.tileHeight();
pattern->buffer = pat.pixels();
pattern->opacity = fill ? short( m_fill->color().opacity() * 255.0 ) : short( m_stroke->color().opacity() * 255.0 );
pattern->angle = atan2( dy, dx );
 
if( x0 != x1 && y0 != y1 )
{
render = art_render_new( x0, y0, x1, y1, m_buffer + 4 * int(x0) + m_width * 4 * int(y0), m_width * 4, 3, 8, ART_ALPHA_PREMUL, 0 );
art_render_svp( render, svp );
art_render_pattern( render, pattern, ART_FILTER_HYPER );
}
 
if( render )
art_render_invoke( render );
art_free( pattern );
}
*/
void ScPainter::applyGradient( ArtSVP *svp, bool fill )
{
int x0, y0, x1, y1;
clampToViewport( *svp, x0, y0, x1, y1 );
 
ArtRender *render = 0L;
 
VGradient gradient = fill ? fill_gradient : stroke_gradient;
float opa = fill ? fill_trans : stroke_trans;
 
if (gradient.type() == VGradient::linear)
{
ArtGradientLinear *linear = art_new( ArtGradientLinear, 1 );
 
// TODO : make variable
if( gradient.repeatMethod() == VGradient::none )
linear->spread = ART_GRADIENT_PAD;
else if( gradient.repeatMethod() == VGradient::repeat )
linear->spread = ART_GRADIENT_REPEAT;
else if( gradient.repeatMethod() == VGradient::reflect )
linear->spread = ART_GRADIENT_REFLECT;
 
double _x1 = static_cast<double>(gradient.origin().x());
double _x2 = static_cast<double>(gradient.vector().x());
double _y2 = static_cast<double>(gradient.origin().y());
double _y1 = static_cast<double>(gradient.vector().y());
 
double dx = ( _x2 - _x1 ) * m_zoomFactor;
_y1 = /* m_matrix.m22() * */ _y1 + m_matrix.dy() / m_zoomFactor;
_y2 = /* m_matrix.m22() * */ _y2 + m_matrix.dy() / m_zoomFactor;
 
if (dx == 0.0)
dx = 1;
double dy = ( _y1 - _y2 ) * m_zoomFactor;
if (dy == 0.0)
dy = 1;
double scale = 1.0 / ( dx * dx + dy * dy );
 
linear->a = dx * scale;
linear->b = dy * scale;
linear->c = -( ( _x1 * m_zoomFactor + m_matrix.dx() ) * linear->a +
( _y2 * m_zoomFactor ) * linear->b );
 
// get stop array
int offsets = -1;
linear->stops = buildStopArray( gradient, offsets );
linear->n_stops = offsets;
 
if( x0 != x1 && y0 != y1 )
{
render = art_render_new( x0, y0, x1, y1, m_buffer + 4 * int(x0) + m_width * 4 * int(y0), m_width * 4, 3, 8, ART_ALPHA_PREMUL, 0 );
int opacity = int( opa * 255.0 );
art_render_svp( render, svp );
art_render_mask_solid (render, (opacity << 8) + opacity + (opacity >> 7));
art_karbon_render_gradient_linear( render, linear, ART_FILTER_NEAREST );
art_render_invoke( render );
}
art_free( linear->stops );
art_free( linear );
}
 
else if( gradient.type() == VGradient::radial )
{
ArtGradientRadial *radial = art_new( ArtGradientRadial, 1 );
 
// TODO : make variable
if( gradient.repeatMethod() == VGradient::none )
radial->spread = ART_GRADIENT_PAD;
else if( gradient.repeatMethod() == VGradient::repeat )
radial->spread = ART_GRADIENT_REPEAT;
else if( gradient.repeatMethod() == VGradient::reflect )
radial->spread = ART_GRADIENT_REFLECT;
 
radial->affine[0] = m_matrix.m11();
radial->affine[1] = m_matrix.m12();
radial->affine[2] = m_matrix.m21();
radial->affine[3] = m_matrix.m22();
radial->affine[4] = m_matrix.dx();
radial->affine[5] = m_matrix.dy();
 
double cx = gradient.origin().x() * m_zoomFactor;
double cy = gradient.origin().y() * m_zoomFactor;
double fx = gradient.focalPoint().x() * m_zoomFactor;
double fy = gradient.focalPoint().y() * m_zoomFactor;
double r = sqrt( pow( gradient.vector().x() - gradient.origin().x(), 2 ) +
pow( gradient.vector().y() - gradient.origin().y(), 2 ) );
r *= m_zoomFactor;
 
radial->fx = (fx - cx) / r;
radial->fy = (fy - cy) / r;
 
double aff1[6], aff2[6];
art_affine_scale( aff1, r, r);
art_affine_translate( aff2, cx, cy );
art_affine_multiply( aff1, aff1, aff2 );
art_affine_multiply( aff1, aff1, radial->affine );
art_affine_invert( radial->affine, aff1 );
 
// get stop array
int offsets = -1;
radial->stops = buildStopArray( gradient, offsets );
radial->n_stops = offsets;
 
if( x0 != x1 && y0 != y1 )
{
render = art_render_new( x0, y0, x1, y1, m_buffer + 4 * x0 + m_width * 4 * y0, m_width * 4, 3, 8, ART_ALPHA_PREMUL, 0 );
int opacity = int( opa * 255.0 );
art_render_svp( render, svp );
art_render_mask_solid (render, (opacity << 8) + opacity + (opacity >> 7));
art_karbon_render_gradient_radial( render, radial, ART_FILTER_NEAREST );
art_render_invoke( render );
}
art_free( radial->stops );
art_free( radial );
}
else if( gradient.type() == VGradient::conic )
{
ArtGradientConical *conical = art_new( ArtGradientConical, 1 );
 
// TODO : make variable
if( gradient.repeatMethod() == VGradient::none )
conical->spread = ART_GRADIENT_PAD;
else if( gradient.repeatMethod() == VGradient::repeat )
conical->spread = ART_GRADIENT_REPEAT;
else if( gradient.repeatMethod() == VGradient::reflect )
conical->spread = ART_GRADIENT_REFLECT;
 
double cx = gradient.origin().x() * m_zoomFactor;
cx = m_matrix.m11() * cx + m_matrix.dx();
double cy = gradient.origin().y() * m_zoomFactor;
cy = m_matrix.m22() * cy + m_matrix.dy();
double r = sqrt( pow( gradient.vector().x() - gradient.origin().x(), 2 ) +
pow( gradient.vector().y() - gradient.origin().y(), 2 ) );
r *= m_zoomFactor;
 
conical->cx = cx;
conical->cy = cy;
conical->r = r;
 
// get stop array
int offsets = -1;
conical->stops = buildStopArray( gradient, offsets );
conical->n_stops = offsets;
 
if( x0 != x1 && y0 != y1 )
{
render = art_render_new( x0, y0, x1, y1, m_buffer + 4 * x0 + m_width * 4 * y0, m_width * 4, 3, 8, ART_ALPHA_PREMUL, 0 );
int opacity = int( opa * 255.0 );
art_render_svp( render, svp );
art_render_mask_solid (render, (opacity << 8) + opacity + (opacity >> 7));
art_karbon_render_gradient_conical( render, conical, ART_FILTER_NEAREST );
art_render_invoke( render );
}
art_free( conical->stops );
art_free( conical );
}
}
 
 
ArtGradientStop * ScPainter::buildStopArray( VGradient &gradient, int &offsets )
{
// TODO : make this generic
QPtrVector<VColorStop> colorStops = gradient.colorStops();
offsets = colorStops.count();
 
ArtGradientStop *stopArray = art_new( ArtGradientStop, offsets * 2 - 1 );
 
for( int offset = 0 ; offset < offsets ; offset++ )
{
double ramp = colorStops[ offset ]->rampPoint;
//double mid = colorStops[ offset ]->midPoint;
stopArray[ offset * 2 ].offset = ramp;
 
QColor qStopColor = colorStops[ offset ]->color;
int r = qRed( qStopColor.rgb() );
int g = qGreen( qStopColor.rgb() );
int b = qBlue( qStopColor.rgb() );
art_u32 rgba = (r << 24) | (g << 16) | (b << 8) | qAlpha(qStopColor.rgb());
int a = int( colorStops[offset]->opacity * 255.0 );
// int a = int( fill_trans * 255.0 );
r = (rgba >> 24) * a + 0x80;
r = (r + (r >> 8)) >> 8;
g = ((rgba >> 16) & 0xff) * a + 0x80;
g = (g + (g >> 8)) >> 8;
b = ((rgba >> 8) & 0xff) * a + 0x80;
b = (b + (b >> 8)) >> 8;
stopArray[ offset * 2 ].color[ 0 ] = ART_PIX_MAX_FROM_8(r);
stopArray[ offset * 2 ].color[ 1 ] = ART_PIX_MAX_FROM_8(g);
stopArray[ offset * 2 ].color[ 2 ] = ART_PIX_MAX_FROM_8(b);
stopArray[ offset * 2 ].color[ 3 ] = ART_PIX_MAX_FROM_8(a);
 
if( offset + 1 != offsets )
{
stopArray[ offset * 2 + 1 ].offset = ramp + ( colorStops[ offset + 1 ]->rampPoint - ramp ) * colorStops[ offset ]->midPoint;
 
QColor qStopColor2 = colorStops[ offset + 1 ]->color;
rgba = int(r + ((qRed(qStopColor2.rgb()) - r)) * 0.5) << 24 |
int(g + ((qGreen(qStopColor2.rgb()) - g)) * 0.5) << 16 |
int(b + ((qBlue(qStopColor2.rgb()) - b)) * 0.5) << 8 |
qAlpha(qStopColor2.rgb());
int a = int( colorStops[offset]->opacity * 255.0 );
// int a = int( fill_trans * 255.0 );
r = (rgba >> 24) * a + 0x80;
r = (r + (r >> 8)) >> 8;
g = ((rgba >> 16) & 0xff) * a + 0x80;
g = (g + (g >> 8)) >> 8;
b = ((rgba >> 8) & 0xff) * a + 0x80;
b = (b + (b >> 8)) >> 8;
stopArray[ offset * 2 + 1 ].color[ 0 ] = ART_PIX_MAX_FROM_8(r);
stopArray[ offset * 2 + 1 ].color[ 1 ] = ART_PIX_MAX_FROM_8(g);
stopArray[ offset * 2 + 1 ].color[ 2 ] = ART_PIX_MAX_FROM_8(b);
stopArray[ offset * 2 + 1 ].color[ 3 ] = ART_PIX_MAX_FROM_8(a);
}
}
 
offsets = offsets * 2 - 1;
return stopArray;
}
 
void ScPainter::drawImage( const QImage &image )
{
double affineresult[6];
affineresult[0] = m_matrix.m11() * m_zoomFactor;
affineresult[1] = m_matrix.m12() * m_zoomFactor;
affineresult[2] = m_matrix.m21() * m_zoomFactor;
affineresult[3] = m_matrix.m22() * m_zoomFactor;
affineresult[4] = m_matrix.dx(); // * m_zoomFactor;
affineresult[5] = m_matrix.dy(); // * m_zoomFactor;
ksvg_art_rgb_affine( m_buffer, 0, 0, m_width, m_height, m_width * 4,
image.bits(), image.width(), image.height(), image.width() * 4,
affineresult, ART_FILTER_NEAREST, 0L, qRound( 255 * fill_trans ) );
}
 
void ScPainter::setupPolygon(FPointArray *points)
{
bool nPath = true;
FPoint np, np1, np2, np3;
if (points->size() > 3)
{
newPath();
for (uint poi=0; poi<points->size()-3; poi += 4)
{
if (points->point(poi).x() > 900000)
{
nPath = true;
continue;
}
if (nPath)
{
np = points->point(poi);
ensureSpace( m_index + 1 );
m_path[ m_index ].code = ART_MOVETO;
m_path[ m_index ].x3 = static_cast<double>(np.x()) * m_zoomFactor;
m_path[ m_index ].y3 = static_cast<double>(np.y()) * m_zoomFactor;
m_index++;
nPath = false;
}
np = points->point(poi);
np1 = points->point(poi+1);
np2 = points->point(poi+3);
np3 = points->point(poi+2);
ensureSpace( m_index + 1 );
if ((np == np1) && (np2 == np3))
{
m_path[ m_index ].code = ART_LINETO;
m_path[ m_index ].x3 = static_cast<double>(np3.x()) * m_zoomFactor;
m_path[ m_index ].y3 = static_cast<double>(np3.y()) * m_zoomFactor;
}
else
{
m_path[ m_index ].code = ART_CURVETO;
m_path[ m_index ].x1 = static_cast<double>(np1.x()) * m_zoomFactor;
m_path[ m_index ].y1 = static_cast<double>(np1.y()) * m_zoomFactor;
m_path[ m_index ].x2 = static_cast<double>(np2.x()) * m_zoomFactor;
m_path[ m_index ].y2 = static_cast<double>(np2.y()) * m_zoomFactor;
m_path[ m_index ].x3 = static_cast<double>(np3.x()) * m_zoomFactor;
m_path[ m_index ].y3 = static_cast<double>(np3.y()) * m_zoomFactor;
}
m_index++;
}
}
}
 
void ScPainter::drawPolygon()
{
fillPath();
}
 
void ScPainter::drawPolyLine()
{
strokePath();
}
 
void ScPainter::drawLine(FPoint start, FPoint end)
{
newPath();
moveTo(start.x(), start.y());
lineTo(end.x(), end.y());
strokePath();
 
}
 
void ScPainter::drawRect(double x, double y, double w, double h)
{
newPath();
moveTo( x, y );
lineTo( x+w, y );
lineTo( x+w, y+h );
lineTo( x, y+h );
lineTo( x, y );
fillPath();
strokePath();
}
 
void ScPainter::drawUnderline(FPoint x0, FPoint x2, bool ps, QString *psst)
{
unsigned int m_index2 = 0;
unsigned int m_alloccount2;
m_path2 = 0L;
m_path2 = art_new( ArtBpath, INITIAL_ALLOC );
m_alloccount2 = INITIAL_ALLOC;
m_path2[ m_index2 ].code = ART_MOVETO;
m_path2[ m_index2 ].x3 = x0.x() * m_zoomFactor;
m_path2[ m_index2 ].y3 = x0.y() * m_zoomFactor;
m_index2++;
m_alloccount2 += ALLOC_INCREMENT;
m_path2 = art_renew( m_path2, ArtBpath, m_alloccount2 );
m_path2[ m_index2 ].code = ART_LINETO;
m_path2[ m_index2 ].x3 = x2.x() * m_zoomFactor;
m_path2[ m_index2 ].y3 = x2.y() * m_zoomFactor;
m_index2++;
if( m_path[ m_index ].code != ART_END)
m_path[ m_index ].code = ART_END;
ArtVpath *path = art_bez_path_to_vec( m_path , 0.25 );
m_path2[ m_index2 ].code = ART_END;
ArtVpath *path2 = art_bez_path_to_vec( m_path2 , 0.25 );
 
ArtSVP *strokeSvp = 0L;
ArtSVP *stroke2Svp = 0L;
ArtSVP *stroke3Svp = 0L;
ArtSVP *stroke4Svp = 0L;
ArtSVP *stroke5Svp = 0L;
ArtSVP *stroke6Svp = 0L;
art_u32 strokeColor = 0;
// set up world matrix
double affine[6];
affine[0] = m_matrix.m11();
affine[1] = m_matrix.m12(); // was 0 in Karbon
affine[2] = m_matrix.m21(); // was 0 in Karbon, don't know why
affine[3] = m_matrix.m22();
affine[4] = m_matrix.dx();
affine[5] = m_matrix.dy();
ArtVpath *temp1 = art_vpath_affine_transform( path, affine );
art_free( path );
ArtVpath *temp2 = art_vpath_affine_transform( path2, affine );
art_free( path2 );
int as = 0;
ArtPathStrokeCapType capStyle = ART_PATH_STROKE_CAP_BUTT;
ArtPathStrokeJoinType joinStyle = ART_PATH_STROKE_JOIN_MITER;
QColor color = m_stroke;
as = qRound( 255 * stroke_trans );
strokeColor = ( 0 << 24 ) | ( color.blue() << 16 ) | ( color.green() << 8 ) | color.red();
double ratio = m_zoomFactor;
ArtSvpWriter *swr;
ArtSVP *temp;
temp = art_svp_from_vpath( temp1 );
// if( m_fillRule )
swr = art_svp_writer_rewind_new( ART_WIND_RULE_ODDEVEN );
// else
// swr = art_svp_writer_rewind_new( ART_WIND_RULE_NONZERO );
art_svp_intersector( temp, swr );
strokeSvp = art_svp_writer_rewind_reap( swr );
art_svp_free( temp );
stroke5Svp = art_svp_vpath_stroke( temp1, joinStyle, capStyle, ratio * LineWidth, 10, 0.25 );
stroke6Svp = art_svp_union(strokeSvp, stroke5Svp);
stroke2Svp = art_svp_vpath_stroke( temp2, joinStyle, capStyle, ratio * LineWidth, 10, 0.25 );
stroke3Svp = art_svp_intersect(stroke6Svp, stroke2Svp);
stroke4Svp = art_svp_diff(stroke3Svp, stroke2Svp);
int x_0, y0, x1, y1;
clampToViewport( *stroke4Svp, x_0, y0, x1, y1 );
if( x_0 != x1 && y0 != y1 )
art_rgb_svp_alpha_( stroke4Svp, x_0, y0, x1, y1, strokeColor, as, m_buffer + x_0 * 4 + y0 * m_width * 4, m_width * 4, 0 );
art_svp_free( strokeSvp );
art_svp_free( stroke2Svp );
art_svp_free( stroke3Svp );
art_svp_free( stroke5Svp );
art_svp_free( stroke6Svp );
if (ps)
{
int i;
QString tmp;
ArtVpath *vpath = art_vpath_from_svp(stroke4Svp);
for (i = 0; vpath[i].code != ART_END; i++)
{
tmp.setNum(vpath[i].x - m_matrix.dx());
*psst += tmp+" ";
tmp.setNum(vpath[i].y - x0.y());
*psst += tmp+" ";
if (vpath[i].code == ART_MOVETO)
*psst += "m";
if (vpath[i].code == ART_LINETO)
*psst += "l";
*psst += "\n";
}
art_free( vpath );
}
art_svp_free( stroke4Svp );
art_free( temp1 );
art_free( temp2 );
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/pageitem.cpp
===================================================================
--- trunk/Scribus/scribus/pageitem.cpp (revision 67)
+++ trunk/Scribus/scribus/pageitem.cpp (revision 68)
@@ -18,21 +18,18 @@
#include "pageitem.h"
#include <qpainter.h>
#include <qpen.h>
-#include <qfontmetrics.h>
+#include <qfont.h>
#include <qregion.h>
#include <qpoint.h>
#include <qfileinfo.h>
-#include <qpaintdevicemetrics.h>
#include <qdrawutil.h>
#include <qbitmap.h>
#include <cmath>
#include "page.h"
#include "config.h"
-#ifdef HAVE_FREETYPE
- #include <ft2build.h>
- #include FT_GLYPH_H
-#endif
-extern float Cwidth(ScribusDoc *doc, QPainter *p, QString name, QString ch, int Siz, QString ch2 = " ");
+#include <ft2build.h>
+#include FT_GLYPH_H
+extern float Cwidth(ScribusDoc *doc, QString name, QString ch, int Siz, QString ch2 = " ");
extern QPointArray FlattenPath(FPointArray ina, QValueList<uint> &Segs);
extern float xy2Deg(float x, float y);
extern void BezierPoints(QPointArray *ar, QPoint n1, QPoint n2, QPoint n3, QPoint n4);
@@ -56,7 +53,16 @@
Parent = pa;
Doc = doc;
Pcolor = fill;
- Pcolor2 = outline;
+ if (PType == 4)
+ Pcolor2 = fill;
+ else
+ Pcolor2 = outline;
+ TxtFill = Doc->DpenText;
+ TxtStroke = TxtFill;
+ ShTxtStroke = 100;
+ ShTxtFill = 100;
+ TxtScale = 100;
+ TxTStyle = 0;
Shade = 100;
Shade2 = 100;
GrColor = "";
@@ -72,21 +78,10 @@
FrameOnly = false;
ClipEdited = false;
FrameType = 0;
- QFont ffo;
- QPainter p;
- p.begin(Parent);
- QPaintDeviceMetrics pm(Parent);
- DevRes = 75.0 / static_cast<float>(pm.logicalDpiX());
- ffo = Doc->UsedFonts[Doc->Dfont];
- ffo.setPointSize(static_cast<int>(Doc->Dsize * DevRes));
- DevResX = pm.logicalDpiX();
- DevResY = pm.logicalDpiY();
- p.setFont(ffo);
IFont = Doc->Dfont;
ISize = Doc->Dsize;
LineSp = (Doc->Dsize * static_cast<float>(Doc->AutoLine) / 100) + Doc->Dsize;
Doc->Vorlagen[0].LineSpa = LineSp;
- p.end();
CurX = 0;
CurY = 0;
CPos = 0;
@@ -99,7 +94,6 @@
Ptext.setAutoDelete(true);
Pfile = "";
pixm = QImage();
- Gpixm = QImage();
Pfile2 = "";
Pfile3 = "";
LocalScX = 1;
@@ -191,37 +185,38 @@
ScaleType = true;
AspectRatio = true;
Transparency = 0.0;
+ TranspStroke = 0.0;
Reverse = false;
InvPict = false;
NamedLStyle = "";
+ DashValues.clear();
+ DashOffset = 0;
+ fill_gradient = VGradient(VGradient::linear);
+ Language = doc->Language;
}
/** Zeichnet das Item */
-void PageItem::paintObj(QRect e, QPixmap *ppX)
+void PageItem::DrawObj(ScPainter *p, QRect e)
{
- QPainter p, pp;
+ QColor tmp;
+ FPointArray CL;
+ QPointArray cl;
+ QPainter pf, pp;
+ PageItem *nb;
QPoint pt1, pt2;
+ FPoint gv;
QRegion cm;
- QFont ffo = Doc->UsedFonts[IFont];
- QPointArray Bez(4);
- QPointArray cl;
uint a, nrc, nrc2, zae;
- int desc, asce, xp, yp, leng, absa, aSpa, chs;
+ int desc, asce, absa, aSpa, chs;
uint BuPos, LastSP, BuPos2;
float oldCurY, LastXp, EndX, OFs, OFs2, wide, rota, wid;
- bool outs = false;
- PageItem *nb;
- QColor tmp;
+ float sc = Doc->Scale;
QString chx, chx2, chx3;
struct Pti *hl;
struct ZZ *Zli;
struct ZZ *Zli2;
QPtrList<ZZ> LiList;
-#if QT_VERSION >= 0x030100
- QBitmap bmd;
- QPixmap pmd;
- QPainter pb, pd;
-#endif
+ bool outs = false;
if (!Doc->DoDrawing)
{
Redrawn = true;
@@ -240,702 +235,526 @@
Doc->Vorlagen[xxx].Anach = 0;
}
Doc->Vorlagen[0].Ausri = Ausrich;
- if (toPixmap)
- p.begin(ppX);
- else
- p.begin(Parent);
- QPaintDeviceMetrics pm(Parent);
- DevRes = 75.0 / static_cast<float>(pm.logicalDpiX());
- if ((!toPixmap) && (!Doc->RePos))
+ pf.begin(Parent);
+ pf.translate(static_cast<int>(Xpos*sc), static_cast<int>(Ypos*sc));
+ pf.scale(static_cast<double>(sc), static_cast<double>(sc));
+ pf.rotate(static_cast<double>(Rot));
+ if (!Doc->RePos)
{
if (!e.isEmpty())
- p.setClipRect(e);
+ pf.setClipRect(e);
else
- p.setClipRect(OwnPage->ViewReg().boundingRect());
+ pf.setClipRect(OwnPage->ViewReg().boundingRect());
}
- QRegion gesClip = p.clipRegion();
- p.translate(static_cast<int>(Xpos*Doc->Scale), static_cast<int>(Ypos*Doc->Scale));
- p.scale(static_cast<double>(Doc->Scale), static_cast<double>(Doc->Scale));
- p.rotate(static_cast<double>(Rot));
+ bool doStroke = true;
+ p->setZoomFactor(sc);
+ p->save();
+ p->translate(-e.x(), -e.y());
+ p->translate(Xpos*sc, Ypos*sc);
+ p->rotate(static_cast<double>(Rot));
+ p->setLineWidth(Pwidth);
if (Pcolor != "None")
{
SetFarbe(&tmp, Pcolor, Shade);
- p.setBrush(tmp);
- p.setBackgroundColor(tmp);
+ p->setBrush(tmp);
+ p->setFillMode(1);
}
else
- p.setBrush(NoBrush);
+ p->setFillMode(0);
+ if (GrType != 0)
+ {
+ p->setFillMode(2);
+ p->fill_gradient = fill_gradient;
+ QWMatrix grm;
+ grm.rotate(Rot);
+ FPointArray gra;
+ switch (GrType)
+ {
+ case 1:
+ gra.setPoints(2, 0, 0, Width, 0);
+ gra.map(grm);
+ p->setGradient(VGradient::linear, gra.point(0), gra.point(1));
+ break;
+ case 2:
+ gra.setPoints(2, 0, 0, Height, 0);
+ grm.rotate(90);
+ gra.map(grm);
+ p->setGradient(VGradient::linear, gra.point(0), gra.point(1));
+ break;
+ case 3:
+ gra.setPoints(2, 0, 0, Width, Height);
+ gra.map(grm);
+ p->setGradient(VGradient::linear, gra.point(0), gra.point(1));
+ break;
+ case 4:
+ gra.setPoints(2, 0, Height, Width, 0);
+ gra.map(grm);
+ p->setGradient(VGradient::linear, gra.point(0), gra.point(1));
+ break;
+ case 5:
+ if (Width > Height)
+ gv = FPoint(Width, Height / 2.0);
+ else
+ gv = FPoint(Width / 2.0, Height);
+ p->setGradient(VGradient::radial, FPoint(Width / 2.0,Height / 2.0), gv, FPoint(Width / 2.0,Height / 2.0));
+ break;
+ }
+ }
if (Pcolor2 != "None")
{
SetFarbe(&tmp, Pcolor2, Shade2);
if ((Pwidth == 0) && (PType != 5))
- p.setPen(NoPen);
+ p->setLineWidth(0);
else
- p.setPen(QPen(tmp, QMAX(static_cast<int>(Pwidth*Doc->Scale), 1), PLineArt, PLineEnd, PLineJoin));
+ {
+ p->setPen(tmp, Pwidth, PLineArt, PLineEnd, PLineJoin);
+ if (DashValues.count() != 0)
+ p->setDash(DashValues, DashOffset);
+ }
}
else
- p.setPen(NoPen);
- if (!FrameOnly)
- {
- if (!((Doc->ActPage->Imoved) && (Select)))
+ p->setLineWidth(0);
+ p->setBrushOpacity(1.0 - Transparency);
+ p->setPenOpacity(1.0 - TranspStroke);
+ switch (PType)
{
- switch (PType)
- {
- case 2:
-#if QT_VERSION >= 0x030100
- if (toPixmap)
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))));
- else
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))).intersect(gesClip));
- bmd = QBitmap(static_cast<int>(Width), static_cast<int>(Height));
+ case 2:
+ if (Doc->RePos)
+ break;
+ if ((Pcolor != "None") || (GrType != 0))
+ {
+ p->setupPolygon(&PoLine);
+ p->drawPolygon();
+ }
+ if (Pfile == "")
+ {
+ p->setPen(black, 1, SolidLine, FlatCap, MiterJoin);
+ p->drawLine(FPoint(0, 0), FPoint(Width, Height));
+ p->drawLine(FPoint(0, Height), FPoint(Width, 0));
+ }
+ else
+ {
+ QBitmap bmd = QBitmap(static_cast<int>(Width), static_cast<int>(Height));
bmd.fill(Qt::color0);
+ QPainter pb;
pb.begin(&bmd);
pb.setBrush(Qt::color1);
pb.setPen(QPen(Qt::color1, 1, DotLine, FlatCap, MiterJoin));
DrawPoly(&pb, Clip, pb.brush().color(), true);
pb.end();
- pmd = QPixmap(static_cast<int>(Width), static_cast<int>(Height));
+ QPixmap pmd = QPixmap(static_cast<int>(Width), static_cast<int>(Height));
pmd.fill();
+ QPainter pd;
pd.begin(&pmd);
- if ((Pcolor != "None") || (GrType != 0))
+ if ((!PicArt) || (!PicAvail))
{
- pd.setPen(NoPen);
- SetFarbe(&tmp, Pcolor, Shade);
- pd.setBrush(tmp);
- if (!Doc->RePos)
- {
- if (GrType == 0)
- DrawPoly(&pd, Clip, pd.brush().color());
- else
- {
- if (!Gpixm.isNull())
- pd.drawImage(0, 0, Gpixm);
- }
- }
- }
- if (Pfile == "")
- {
pd.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
- if (!Doc->RePos)
- {
- pd.drawLine(0, 0, static_cast<int>(Width), static_cast<int>(Height));
- pd.drawLine(0, static_cast<int>(Height), static_cast<int>(Width), 0);
- }
- pd.end();
+ pd.drawLine(0, 0, static_cast<int>(Width), static_cast<int>(Height));
+ pd.drawLine(0, static_cast<int>(Height), static_cast<int>(Width), 0);
+ if (PicAvail)
+ pd.setPen(blue);
+ else
+ pd.setPen(red);
+ pd.setBackgroundMode(OpaqueMode);
+ pd.setFont(QFont("Helvetica", 18));
+ QFileInfo fi = QFileInfo(Pfile);
+ int leng = pd.fontMetrics().width(fi.fileName());
+ int xp = static_cast<int>(Width / 2 - leng / 2);
+ int yp = static_cast<int>(Height / 2 + pd.fontMetrics().height() / 2);
+ pd.drawText(xp, yp, fi.fileName());
}
else
{
- if (!Doc->RePos)
+ if ((Pcolor != "None") || (GrType != 0))
{
- if ((!PicArt) || (!PicAvail))
+ pd.setPen(NoPen);
+ SetFarbe(&tmp, Pcolor, Shade);
+ pd.setBrush(tmp);
+ if (!Doc->RePos)
{
- pd.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
- pd.drawLine(0, 0, static_cast<int>(Width), static_cast<int>(Height));
- pd.drawLine(0, static_cast<int>(Height), static_cast<int>(Width), 0);
- if (PicAvail)
- pd.setPen(blue);
- else
- pd.setPen(red);
- pd.save();
- pd.setBackgroundMode(OpaqueMode);
- pd.setFont(QFont("Helvetica", 18));
- QFileInfo fi = QFileInfo(Pfile);
- leng = p.fontMetrics().width(fi.fileName());
- xp = static_cast<int>(Width / 2 - leng / 2);
- yp = static_cast<int>(Height / 2 + p.fontMetrics().height() / 2);
- pd.drawText(xp, yp, fi.fileName());
- pd.restore();
- pd.end();
+ if (GrType == 0)
+ DrawPoly(&pd, Clip, pd.brush().color());
}
- else
- {
- pd.save();
- if (flippedH % 2 != 0)
- {
- pd.translate(Width, 0);
- pd.scale(-1, 1);
- }
- if (flippedV % 2 != 0)
- {
- pd.translate(0, static_cast<int>(Height));
- pd.scale(1, -1);
- }
-
- if ((LocalViewX != 1) || (LocalViewY != 1))
- pd.scale(LocalViewX, LocalViewY);
- if (InvPict)
- {
- QImage ip = pixm.copy();
- ip.invertPixels();
- pd.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), ip);
- }
- else
- pd.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), pixm);
- pd.restore();
- pd.end();
- }
}
- }
- pmd.setMask(bmd);
- p.drawPixmap(0, 0, pmd);
-#else
- if (toPixmap)
- p.setClipRegion(QRegion(p.xForm(Clip)));
- else
- p.setClipRegion(QRegion(p.xForm(Clip)).intersect(gesClip));
- if ((Pcolor != "None") || (GrType != 0))
- {
- p.setPen(NoPen);
- if (!Doc->RePos)
+ if (flippedH % 2 != 0)
{
- if (GrType == 0)
- DrawPoly(&p, Clip, p.brush().color());
- else
- {
- if (!Gpixm.isNull())
- p.drawImage(0, 0, Gpixm);
- }
+ pd.translate(Width, 0);
+ pd.scale(-1, 1);
}
- }
- if (Pfile == "")
- {
- p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
- if (!Doc->RePos)
+ if (flippedV % 2 != 0)
{
- p.drawLine(0, 0, static_cast<int>(Width), static_cast<int>(Height));
- p.drawLine(0, static_cast<int>(Height), static_cast<int>(Width), 0);
+ pd.translate(0, static_cast<int>(Height));
+ pd.scale(1, -1);
}
- }
- else
- {
- if (!Doc->RePos)
+ if ((LocalViewX != 1) || (LocalViewY != 1))
+ pd.scale(LocalViewX, LocalViewY);
+ if (InvPict)
{
- if ((!PicArt) || (!PicAvail))
- {
- p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
- p.drawLine(0, 0, static_cast<int>(Width), static_cast<int>(Height));
- p.drawLine(0, static_cast<int>(Height), static_cast<int>(Width), 0);
- if (PicAvail)
- p.setPen(blue);
- else
- p.setPen(red);
- p.save();
- p.setBackgroundMode(OpaqueMode);
- p.setFont(QFont("Helvetica", 18));
- QFileInfo fi = QFileInfo(Pfile);
- leng = p.fontMetrics().width(fi.fileName());
- xp = static_cast<int>(Width / 2 - leng / 2);
- yp = static_cast<int>(Height / 2 + p.fontMetrics().height() / 2);
- p.drawText(xp, yp, fi.fileName());
- p.restore();
- }
- else
- {
- p.save();
- if (flippedH % 2 != 0)
- {
- p.translate(Width, 0);
- p.scale(-1, 1);
- }
- if (flippedV % 2 != 0)
- {
- p.translate(0, static_cast<int>(Height));
- p.scale(1, -1);
- }
- if ((LocalViewX != 1) || (LocalViewY != 1))
- p.scale(LocalViewX, LocalViewY);
- if (InvPict)
- {
- QImage ip = pixm.copy();
- ip.invertPixels();
- p.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), ip);
- }
- else
- p.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), pixm);
- p.restore();
- }
+ QImage ip = pixm.copy();
+ ip.invertPixels();
+ pd.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), ip);
}
+ else
+ pd.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), pixm);
+ pmd.setMask(bmd);
+ QImage ip2 = pmd.convertToImage();
+ p->drawImage(ip2);
}
-#endif
- if (Pcolor2 != "None")
+ pd.end();
+ }
+ break;
+ case 5:
+ if (Doc->RePos)
+ break;
+ if (NamedLStyle == "")
+ p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+ else
+ {
+ multiLine ml = Doc->MLineStyles[NamedLStyle];
+ for (int it = ml.size()-1; it > -1; it--)
{
- p.setBrush(NoBrush);
- DrawPolyL(&p, Clip);
+ SetFarbe(&tmp, ml[it].Color, ml[it].Shade);
+ p->setPen(tmp, ml[it].Width,
+ static_cast<PenStyle>(ml[it].Dash),
+ static_cast<PenCapStyle>(ml[it].LineEnd),
+ static_cast<PenJoinStyle>(ml[it].LineJoin));
+ p->drawLine(FPoint(0, 0), FPoint(Width, 0));
}
+ doStroke = false;
+ }
+ break;
+ case 1:
+ case 3:
+ case 6:
+ if (Doc->RePos)
break;
- case 4:
- p.save();
-#if QT_VERSION >= 0x030100
- if (toPixmap)
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))));
- else
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))).intersect(gesClip));
- if (PoLine.size() > 16)
+ p->setupPolygon(&PoLine);
+ p->drawPolygon();
+ break;
+ case 7:
+ if (Doc->RePos)
+ break;
+ p->setupPolygon(&PoLine);
+ if (NamedLStyle == "")
+ p->drawPolyLine();
+ else
+ {
+ multiLine ml = Doc->MLineStyles[NamedLStyle];
+ for (int it = ml.size()-1; it > -1; it--)
{
- bmd = QBitmap(static_cast<int>(Width), static_cast<int>(Height));
- bmd.fill(Qt::color0);
- pb.begin(&bmd);
- pb.setBrush(Qt::color1);
- pb.setPen(QPen(Qt::color1, 1, DotLine, FlatCap, MiterJoin));
- DrawPoly(&pb, Clip, pb.brush().color(), true);
- pb.end();
- pmd = QPixmap(static_cast<int>(Width), static_cast<int>(Height));
- pmd.fill();
- pd.begin(&pmd);
+ SetFarbe(&tmp, ml[it].Color, ml[it].Shade);
+ p->setPen(tmp, ml[it].Width,
+ static_cast<PenStyle>(ml[it].Dash),
+ static_cast<PenCapStyle>(ml[it].LineEnd),
+ static_cast<PenJoinStyle>(ml[it].LineJoin));
+ p->drawPolyLine();
+ }
+ }
+ doStroke = false;
+ break;
+ case 4:
+ p->save();
+ if ((Pcolor != "None") || (GrType != 0))
+ {
+ p->setupPolygon(&PoLine);
+ p->drawPolygon();
+ }
+ if ((isAnnotation) && (AnType == 2) && (Pfile != "") && (PicAvail) && (PicArt) && (AnUseIcons))
+ {
+ QBitmap bmd = QBitmap(static_cast<int>(Width), static_cast<int>(Height));
+ bmd.fill(Qt::color0);
+ QPainter pb;
+ pb.begin(&bmd);
+ pb.setBrush(Qt::color1);
+ pb.setPen(QPen(Qt::color1, 1, DotLine, FlatCap, MiterJoin));
+ DrawPoly(&pb, Clip, pb.brush().color(), true);
+ pb.end();
+ QPixmap pmd = QPixmap(static_cast<int>(Width), static_cast<int>(Height));
+ pmd.fill();
+ QPainter pd;
+ pd.begin(&pmd);
+ if ((Pcolor != "None") || (GrType != 0))
+ {
+ pd.setPen(NoPen);
+ SetFarbe(&tmp, Pcolor, Shade);
+ pd.setBrush(tmp);
if (!Doc->RePos)
{
if (GrType == 0)
- {
- if (Pcolor != "None")
- {
- pd.setPen(NoPen);
- SetFarbe(&tmp, Pcolor, Shade);
- pd.setBrush(tmp);
- DrawPoly(&pd, Clip, pd.brush().color());
- }
- }
- else
- {
- if (!Gpixm.isNull())
- pd.drawImage(0, 0, Gpixm);
- }
+ DrawPoly(&pd, Clip, pd.brush().color());
}
- pd.end();
- pmd.setMask(bmd);
- p.drawPixmap(0, 0, pmd);
}
- else
+ pd.drawImage(static_cast<int>(LocalX*LocalScX), static_cast<int>(LocalY*LocalScY), pixm);
+ pmd.setMask(bmd);
+ QImage ip2 = pmd.convertToImage();
+ p->drawImage(ip2);
+ }
+ if ((Ptext.count() != 0) || (Dirty) || (NextBox != 0))
+ {
+ if (NextBox != 0)
{
- if ((toPixmap) || (Doc->RePos))
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))));
-// p.setClipRegion(QRegion(p.xForm(Clip)));
- else
- p.setClipRegion(QRegion(p.xForm(Clip)).intersect(gesClip));
- if (!Doc->RePos)
+ nb = NextBox;
+ while (nb != 0)
{
- if (GrType == 0)
+ a = nb->Ptext.count();
+ for (uint s=0; s<a; ++s)
{
- if (Pcolor != "None")
- {
- p.setPen(NoPen);
- DrawPoly(&p, Clip, p.brush().color());
- }
+ Ptext.append(nb->Ptext.take(0));
}
- else
- {
- if (!Gpixm.isNull())
- p.drawImage(0, 0, Gpixm);
- }
+ nb->Dirty = true;
+ nb = nb->NextBox;
}
+ nb = NextBox;
}
-#else
- if ((toPixmap) || (Doc->RePos))
- p.setClipRegion(QRegion(p.xForm(Clip)));
- else
- p.setClipRegion(QRegion(p.xForm(Clip)).intersect(gesClip));
- if (!Doc->RePos)
+ Doc->Vorlagen[0].LineSpa = LineSp;
+ QRegion cl = QRegion(pf.xForm(Clip));
+ for (a=0; a<OwnPage->Items.count(); ++a)
{
- if (GrType == 0)
+ if (((OwnPage->Items.at(a)->ItemNr > ItemNr)
+ && (OwnPage->Items.at(a)->LayerNr == LayerNr))
+ || (Doc->Layers[OwnPage->Items.at(a)->LayerNr].Level > Doc->Layers[LayerNr].Level))
{
- if (Pcolor != "None")
+ if (OwnPage->Items.at(a)->Textflow)
{
- p.setPen(NoPen);
- DrawPoly(&p, Clip, p.brush().color());
+ pp.begin(Parent);
+ pp.translate(OwnPage->Items.at(a)->Xpos*sc, OwnPage->Items.at(a)->Ypos*sc);
+ pp.scale(sc, sc);
+ pp.rotate(OwnPage->Items.at(a)->Rot);
+ if (OwnPage->Items.at(a)->Textflow2)
+ {
+ QPointArray tcli;
+ tcli.resize(4);
+ tcli.setPoint(0, QPoint(0,0));
+ tcli.setPoint(1, QPoint(qRound(OwnPage->Items.at(a)->Width), 0));
+ tcli.setPoint(2, QPoint(qRound(OwnPage->Items.at(a)->Width), qRound(OwnPage->Items.at(a)->Height)));
+ tcli.setPoint(3, QPoint(0, qRound(OwnPage->Items.at(a)->Height)));
+ cm = QRegion(pp.xForm(tcli));
+ }
+ else
+ cm = QRegion(pp.xForm(OwnPage->Items.at(a)->Clip));
+ pp.end();
+ cl = cl.subtract(cm);
}
}
- else
- {
- if (!Gpixm.isNull())
- p.drawImage(0, 0, Gpixm);
- }
}
-#endif
- if ((isAnnotation) && (AnType == 2))
+ if (flippedH % 2 != 0)
{
- p.save();
- QColorGroup cg;
- cg.setColor( QColorGroup::Foreground, black );
- cg.setColor( QColorGroup::Button, QColor( 211, 211, 211) );
- cg.setColor( QColorGroup::Light, white );
- cg.setColor( QColorGroup::Midlight, QColor( 233, 233, 233) );
- cg.setColor( QColorGroup::Dark, QColor( 105, 105, 105) );
- cg.setColor( QColorGroup::Mid, QColor( 140, 140, 140) );
- cg.setColor( QColorGroup::Text, black );
- cg.setColor( QColorGroup::BrightText, QColor( 236, 236, 236) );
- cg.setColor( QColorGroup::ButtonText, black );
- cg.setColor( QColorGroup::Base, white );
- cg.setColor( QColorGroup::Background, white );
- cg.setColor( QColorGroup::Shadow, black );
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, white );
- bool bsun = false;
- if (AnBsty == 4)
- bsun = true;
- QBrush qb = p.brush();
- if (!Doc->RePos)
- qDrawWinButton(&p, 1, 1, static_cast<int>(Width), static_cast<int>(Height), cg, bsun, &qb);
- p.restore();
+ p->translate(Width * sc, 0);
+ p->scale(-1, 1);
}
- if ((isAnnotation) && (AnType == 2) && (Pfile != "") && (PicAvail) && (PicArt) && (AnUseIcons))
+ if (flippedV % 2 != 0)
{
- p.save();
- p.scale(LocalScX, LocalScY);
- if (!Doc->RePos)
- p.drawImage(static_cast<int>(LocalX), static_cast<int>(LocalY), pixm);
- p.restore();
+ p->translate(0, Height * sc);
+ p->scale(1, -1);
}
- if ((Ptext.count() != 0) || (Dirty) || (NextBox != 0))
+ if ((Doc->AppMode == 7) && (Dirty))
+ Dirty = false;
+ CurX = Extra;
+ CurY = Doc->Vorlagen[0].LineSpa+TExtra;
+ LiList.clear();
+ BuPos = 0;
+ BuPos2 = 0;
+ LastSP = 0;
+ LastXp = 0;
+ outs = false;
+ OFs = 0;
+ OFs2 = 0;
+ aSpa = 0;
+ absa = 0;
+ for (a = 0; a < Ptext.count(); ++a)
{
- if (NextBox != 0)
+ hl = Ptext.at(a);
+ chx = hl->ch;
+ if (hl->ch == QChar(30))
+ chx = ExpandToken(a);
+ absa = hl->cab;
+ if (a == 0)
{
- nb = NextBox;
- while (nb != 0)
+ if (BackBox != 0)
{
- a = nb->Ptext.count();
- for (uint s=0; s<a; ++s)
+ nb = BackBox;
+ while (nb != 0)
{
- Ptext.append(nb->Ptext.take(0));
- }
- nb->CPos = 0;
- nb->Dirty = true;
- nb = nb->NextBox;
- }
- nb = NextBox;
- }
- Doc->Vorlagen[0].LineSpa = LineSp;
- QRegion cl = QRegion(p.xForm(Clip));
-// if ((OwnPage->Items.count()-1) > ItemNr)
-// {
- for (a=0; a<OwnPage->Items.count(); ++a)
- {
- if (((OwnPage->Items.at(a)->ItemNr > ItemNr)
- && (OwnPage->Items.at(a)->LayerNr == LayerNr))
- || (Doc->Layers[OwnPage->Items.at(a)->LayerNr].Level > Doc->Layers[LayerNr].Level))
- {
- if (OwnPage->Items.at(a)->Textflow)
+ if (nb->Ptext.count() != 0)
{
- pp.begin(Parent);
- pp.translate(OwnPage->Items.at(a)->Xpos*Doc->Scale, OwnPage->Items.at(a)->Ypos*Doc->Scale);
- pp.scale(Doc->Scale, Doc->Scale);
- pp.rotate(OwnPage->Items.at(a)->Rot);
- if (OwnPage->Items.at(a)->Textflow2)
+ if (nb->Ptext.at(nb->Ptext.count()-1)->ch == QChar(13))
{
- QPointArray tcli;
- tcli.resize(4);
- tcli.setPoint(0, QPoint(0,0));
- tcli.setPoint(1, QPoint(qRound(OwnPage->Items.at(a)->Width), 0));
- tcli.setPoint(2, QPoint(qRound(OwnPage->Items.at(a)->Width), qRound(OwnPage->Items.at(a)->Height)));
- tcli.setPoint(3, QPoint(0, qRound(OwnPage->Items.at(a)->Height)));
- cm = QRegion(pp.xForm(tcli));
+ CurX += Doc->Vorlagen[absa].First;
+ CurX += Doc->Vorlagen[absa].Indent;
+ CurY += Doc->Vorlagen[absa].Avor;
+ break;
}
else
- cm = QRegion(pp.xForm(OwnPage->Items.at(a)->Clip));
- pp.end();
- cl = cl.subtract(cm);
+ {
+ CurX += Doc->Vorlagen[absa].Indent;
+ break;
+ }
+ nb = nb->BackBox;
}
}
}
- if (flippedH % 2 != 0)
- {
- p.translate(static_cast<int>(Width), 0);
- p.scale(-1, 1);
- }
- if (flippedV % 2 != 0)
- {
- p.translate(0, static_cast<int>(Height));
- p.scale(1, -1);
- }
- if ((Doc->AppMode == 7) && (Dirty))
- {
- if ((CPos < static_cast<int>(Ptext.count())) && (CPos > 2) && (Tinput))
- {
- hl = Ptext.at(CPos-2);
- if (!Doc->RePos)
- p.eraseRect(0, static_cast<int>(hl->yp-LineSp), static_cast<int>(Width), static_cast<int>(Height-hl->yp));
- }
else
{
- if (!Doc->RePos)
- p.eraseRect(0, 0, static_cast<int>(Width), static_cast<int>(Height));
+ CurX += Doc->Vorlagen[absa].First;
+ CurX += Doc->Vorlagen[absa].Indent;
+ CurY += Doc->Vorlagen[absa].Avor;
}
- Dirty = false;
}
- CurX = Extra;
- CurY = Doc->Vorlagen[0].LineSpa+TExtra;
- LiList.clear();
- BuPos = 0;
- BuPos2 = 0;
- LastSP = 0;
- LastXp = 0;
- outs = false;
- OFs = 0;
- OFs2 = 0;
- aSpa = 0;
- absa = 0;
- for (a = 0; a < Ptext.count(); ++a)
+ if ((Doc->Vorlagen[0].LineSpa != Doc->Vorlagen[absa].LineSpa) && (a == 0))
+ CurY += Doc->Vorlagen[absa].Avor;
+ if (LiList.count() == 0)
{
- hl = Ptext.at(a);
- chx = hl->ch;
- if (hl->ch == QChar(30))
- chx = ExpandToken(a);
- absa = hl->cab;
- if (a == 0)
+ CurY += Doc->Vorlagen[absa].LineSpa - Doc->Vorlagen[0].LineSpa;
+ if ((a > 0) && (Ptext.at(a-1)->ch == QChar(13)))
{
- if (BackBox != 0)
- {
- nb = BackBox;
- while (nb != 0)
- {
- if (nb->Ptext.count() != 0)
- {
- if (nb->Ptext.at(nb->Ptext.count()-1)->ch == QChar(13))
- {
- CurX += Doc->Vorlagen[absa].First;
- CurX += Doc->Vorlagen[absa].Indent;
- CurY += Doc->Vorlagen[absa].Avor;
- break;
- }
- else
- {
- CurX += Doc->Vorlagen[absa].Indent;
- break;
- }
- nb = nb->BackBox;
- }
- }
- }
- else
- {
- CurX += Doc->Vorlagen[absa].First;
- CurX += Doc->Vorlagen[absa].Indent;
- CurY += Doc->Vorlagen[absa].Avor;
- }
+ CurX += Doc->Vorlagen[hl->cab].First;
+ CurX += Doc->Vorlagen[hl->cab].Indent;
+ CurY += Doc->Vorlagen[hl->cab].Avor;
}
- if ((Doc->Vorlagen[0].LineSpa != Doc->Vorlagen[absa].LineSpa) && (a == 0))
- {
-// CurY += Doc->Vorlagen[absa].LineSpa - Doc->Vorlagen[0].LineSpa;
- CurY += Doc->Vorlagen[absa].Avor;
- }
- if (hl->ccolor != "None")
- {
- SetFarbe(&tmp, hl->ccolor, hl->cshade);
- p.setPen(tmp);
- }
+ }
+ oldCurY = CurY;
+ chs = hl->csize;
+ SetZeichAttr(hl, &chs, &chx);
+ if (chx == QChar(29))
+ chx2 = " ";
+ else
+ chx2 = chx;
+ if (a < Ptext.count()-1)
+ {
+ if (Ptext.at(a+1)->ch == QChar(29))
+ chx3 = " ";
else
- p.setPen(NoPen);
- if (LiList.count() == 0)
+ chx3 = Ptext.at(a+1)->ch;
+ wide = Cwidth(Doc, hl->cfont, chx2, chs, chx3);
+ }
+ else
+ wide = Cwidth(Doc, hl->cfont, chx2, chs);
+ wide = wide * (hl->cscale / 100.0);
+ desc = static_cast<int>(-(*Doc->AllFonts)[hl->cfont]->numDescender * chs);
+ asce = static_cast<int>((*Doc->AllFonts)[hl->cfont]->numAscent * chs);
+ if (LiList.isEmpty())
+ {
+ pt1 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY+desc+BExtra));
+ pt2 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY-asce));
+ while ((!cl.contains(pf.xForm(pt1))) || (!cl.contains(pf.xForm(pt2))))
{
- CurY += Doc->Vorlagen[absa].LineSpa - Doc->Vorlagen[0].LineSpa;
- if ((a > 0) && (Ptext.at(a-1)->ch == QChar(13)))
- {
- CurX += Doc->Vorlagen[hl->cab].First;
- CurX += Doc->Vorlagen[hl->cab].Indent;
- CurY += Doc->Vorlagen[hl->cab].Avor;
- }
- }
- oldCurY = CurY;
- chs = hl->csize;
- SetZeichAttr(&p, &ffo, hl, &chs, &chx);
- if (chx == QChar(29))
- chx2 = " ";
- else
- chx2 = chx;
- if (a < Ptext.count()-1)
- {
- if (Ptext.at(a+1)->ch == QChar(29))
- chx3 = " ";
- else
- chx3 = Ptext.at(a+1)->ch;
- wide = Cwidth(Doc, &p, hl->cfont, chx2, chs, chx3);
- }
- else
- wide = Cwidth(Doc, &p, hl->cfont, chx2, chs);
- desc = p.fontMetrics().descent();
- asce = p.fontMetrics().ascent();
- if (LiList.isEmpty())
- {
- pt1 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY+desc+BExtra));
+ CurX++;
+ pt1 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY+desc));
pt2 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY-asce));
- while ((!cl.contains(p.xForm(pt1))) || (!cl.contains(p.xForm(pt2))))
+ if (CurX+RExtra > Width)
{
- CurX++;
- pt1 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY+desc));
- pt2 = QPoint(static_cast<int>(CurX), static_cast<int>(CurY-asce));
- if (CurX+RExtra > Width)
+ CurY += Doc->Vorlagen[hl->cab].LineSpa;
+ CurY += Doc->Vorlagen[hl->cab].Anach;
+ CurX = Extra;
+ if (CurY+BExtra > Height)
{
- CurY += Doc->Vorlagen[hl->cab].LineSpa;
- CurY += Doc->Vorlagen[hl->cab].Anach;
- CurX = Extra;
- if (CurY+BExtra > Height)
- {
- nrc = a;
- goto NoRoom;
- }
+ nrc = a;
+ goto NoRoom;
}
}
- CurX += Extra;
}
- hl->xp = CurX+hl->cextra;
- hl->yp = CurY;
- CurY = oldCurY;
- CurX += wide+hl->cextra;
- pt1 = QPoint(static_cast<int>(CurX+RExtra), static_cast<int>(CurY+desc+BExtra));
- pt2 = QPoint(static_cast<int>(CurX+RExtra), static_cast<int>(CurY-asce));
- if ((!cl.contains(p.xForm(pt1))) || (!cl.contains(p.xForm(pt2))))
- outs = true;
- Zli = new ZZ;
- Zli->Zeich = chx;
- Zli->Farb = tmp;
- Zli->Zsatz = p.font();
- Zli->xco = hl->xp;
- Zli->yco = hl->yp;
- Zli->Sele = hl->cselect;
- Zli->Siz = chs;
- Zli->ZFo = hl->cfont;
- Zli->wide = wide;
- if ((hl->ch == " ") && (!outs))
+ CurX += Extra;
+ }
+ hl->xp = CurX+hl->cextra;
+ hl->yp = CurY;
+ CurY = oldCurY;
+ CurX += wide+hl->cextra;
+ pt1 = QPoint(static_cast<int>(CurX+RExtra), static_cast<int>(CurY+desc+BExtra));
+ pt2 = QPoint(static_cast<int>(CurX+RExtra), static_cast<int>(CurY-asce));
+ if ((!cl.contains(pf.xForm(pt1))) || (!cl.contains(pf.xForm(pt2))))
+ outs = true;
+ Zli = new ZZ;
+ Zli->Zeich = chx;
+ Zli->Farb = hl->ccolor;
+ Zli->shade = hl->cshade;
+ Zli->Farb2 = hl->cstroke;
+ Zli->shade2 = hl->cshade2;
+ Zli->xco = hl->xp;
+ Zli->yco = hl->yp;
+ Zli->Sele = hl->cselect;
+ Zli->Siz = chs;
+ Zli->Style = hl->cstyle;
+ Zli->ZFo = hl->cfont;
+ Zli->wide = wide;
+ Zli->kern = hl->cextra;
+ Zli->scale = hl->cscale;
+ if ((hl->ch == " ") && (!outs))
+ {
+ LastXp = hl->xp;
+ LastSP = BuPos;
+ }
+ if ((hl->ch == "-") && (!outs))
+ {
+ LastXp = CurX;
+ LastSP = BuPos;
+ }
+ if ((hl->cstyle & 128) && (!outs))
+ {
+ LastXp = CurX + Cwidth(Doc, hl->cfont, "-", hl->csize);
+ LastSP = BuPos;
+ }
+ LiList.append(Zli);
+ BuPos++;
+ if ((hl->ch == QChar(13)) || (outs))
+ {
+ if (outs)
{
- LastXp = hl->xp;
- LastSP = BuPos;
- }
- if ((hl->ch == "-") && (!outs))
- {
- LastXp = CurX;
- LastSP = BuPos;
- }
- if ((hl->cstyle & 128) && (!outs))
- {
- LastXp = CurX + Cwidth(Doc, &p, hl->cfont, "-", hl->csize);
- LastSP = BuPos;
- }
- LiList.append(Zli);
- BuPos++;
- if ((hl->ch == QChar(13)) || (outs))
- {
- if (outs)
+ if (LastSP != 0) // Hier können auch andere Trennungen eingebaut werden
{
- if (LastSP != 0) // Hier können auch andere Trennungen eingebaut werden
+ a -= BuPos - LastSP;
+ a++;
+ if (Ptext.at(a)->cstyle & 128)
{
- a -= BuPos - LastSP;
- a++;
- if (Ptext.at(a)->cstyle & 128)
- {
- Zli = new ZZ;
- Zli->Zeich = "-";
- Zli->Farb = tmp;
- Zli->Zsatz = p.font();
- Zli->xco = LastXp - Cwidth(Doc, &p, Ptext.at(a)->cfont, "-", Ptext.at(a)->csize);
- Zli->yco = Ptext.at(a)->yp;
- Zli->Sele = Ptext.at(a)->cselect;
- Zli->Siz = Ptext.at(a)->csize;
- Zli->ZFo = Ptext.at(a)->cfont;
- Zli->wide = Cwidth(Doc, &p, Ptext.at(a)->cfont, "-", Ptext.at(a)->csize);
- LiList.insert(LastSP+1, Zli);
- LastSP += 1;
- }
- BuPos = LastSP+1;
- if (Tinput)
- {
- if (!Doc->RePos)
- {
- if (Doc->Vorlagen[absa].Ausri == 0)
- p.eraseRect(static_cast<int>(LastXp), static_cast<int>(CurY-asce), static_cast<int>(Width-LastXp), asce+desc+1);
- else
- p.eraseRect(0, static_cast<int>(CurY-asce), static_cast<int>(Width), asce+desc+1);
- }
- }
- if (Doc->Vorlagen[absa].Ausri != 0)
- {
- EndX = LastXp;
- do
- {
- pt1 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY+desc));
- pt2 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY-asce));
- EndX++;
- }
- while ((cl.contains(p.xForm(pt1))) && (cl.contains(p.xForm(pt2))));
- if (Doc->Vorlagen[absa].Ausri == 2)
- OFs = EndX - LastXp;
- if (Doc->Vorlagen[absa].Ausri == 1)
- OFs = (EndX - LastXp) / 2;
- if ((Doc->Vorlagen[absa].Ausri == 3) || (Doc->Vorlagen[absa].Ausri == 4))
- {
- aSpa = 0;
- for (uint sof = 0; sof<BuPos-1; ++sof)
- {
- if (LiList.at(sof)->Zeich == QChar(32))
- aSpa++;
- }
- if (aSpa > 1)
- {
- OFs2 = (EndX - LastXp) / aSpa;
- }
- else
- {
- if (aSpa == 0)
- OFs2 = 0;
- else
- OFs2 = (EndX - LastXp);
- }
- OFs = 0;
- for (uint yof = 0; yof < LiList.count(); ++yof)
- {
- LiList.at(yof)->xco += OFs;
- Ptext.at(BuPos2)->xp += OFs;
- BuPos2++;
- if (LiList.at(yof)->Zeich == QChar(32))
- OFs += OFs2;
- }
- }
- else
- {
- for (uint xof = 0; xof<LiList.count(); ++xof)
- {
- LiList.at(xof)->xco += OFs;
- Ptext.at(BuPos2)->xp += OFs;
- BuPos2++;
- }
- }
- }
+ Zli = new ZZ;
+ Zli->Zeich = "-";
+ Zli->Farb = Ptext.at(a)->ccolor;
+ Zli->Farb2 = Ptext.at(a)->cstroke;
+ Zli->shade = Ptext.at(a)->cshade;
+ Zli->shade2 = Ptext.at(a)->cshade2;
+ Zli->xco = LastXp - Cwidth(Doc, Ptext.at(a)->cfont, "-", Ptext.at(a)->csize);
+ Zli->yco = Ptext.at(a)->yp;
+ Zli->Sele = Ptext.at(a)->cselect;
+ Zli->Siz = Ptext.at(a)->csize;
+ Zli->Style = Ptext.at(a)->cstyle;
+ Zli->ZFo = Ptext.at(a)->cfont;
+ Zli->wide = Cwidth(Doc, Ptext.at(a)->cfont, "-", Ptext.at(a)->csize);
+ Zli->kern = Ptext.at(a)->cextra;
+ Zli->scale = Ptext.at(a)->cscale;
+ LiList.insert(LastSP+1, Zli);
+ LastSP += 1;
}
- else
- {
- a--;
- BuPos--;
- }
- }
- else
- {
+ BuPos = LastSP+1;
if (Doc->Vorlagen[absa].Ausri != 0)
{
- EndX = CurX;
+ EndX = LastXp;
do
- {
+ {
pt1 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY+desc));
pt2 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY-asce));
EndX++;
- }
- while ((cl.contains(p.xForm(pt1))) && (cl.contains(p.xForm(pt2))));
+ }
+ while ((cl.contains(pf.xForm(pt1))) && (cl.contains(pf.xForm(pt2))));
if (Doc->Vorlagen[absa].Ausri == 2)
- OFs = EndX - CurX - Extra;
+ OFs = EndX - LastXp;
if (Doc->Vorlagen[absa].Ausri == 1)
- OFs = (EndX - CurX - Extra) / 2;
- if (Doc->Vorlagen[absa].Ausri == 3)
- OFs = 0;
- if (Doc->Vorlagen[absa].Ausri == 4)
+ OFs = (EndX - LastXp) / 2;
+ if ((Doc->Vorlagen[absa].Ausri == 3) || (Doc->Vorlagen[absa].Ausri == 4))
{
aSpa = 0;
- for (uint sof = 0; sof<LiList.count(); ++sof)
+ for (uint sof = 0; sof<BuPos-1; ++sof)
{
if (LiList.at(sof)->Zeich == QChar(32))
aSpa++;
}
- if (aSpa != 0)
+ if (aSpa > 1)
+ OFs2 = (EndX - LastXp) / aSpa;
+ else
{
- OFs2 = (EndX - CurX - Extra) / aSpa;
+ if (aSpa == 0)
+ OFs2 = 0;
+ else
+ OFs2 = (EndX - LastXp);
}
- else
- OFs2 = 0;
OFs = 0;
for (uint yof = 0; yof < LiList.count(); ++yof)
{
@@ -943,7 +762,7 @@
Ptext.at(BuPos2)->xp += OFs;
BuPos2++;
if (LiList.at(yof)->Zeich == QChar(32))
- OFs += OFs2;
+ OFs += OFs2;
}
}
else
@@ -955,432 +774,435 @@
BuPos2++;
}
}
- }
+ }
}
- BuPos2 = a;
- BuPos2++;
- uint BuPos3 = BuPos;
- CurY += Doc->Vorlagen[0].LineSpa;
- CurX = Extra;
- if (hl->ch != QChar(13))
- CurX += Doc->Vorlagen[hl->cab].Indent;
else
{
- CurY += Doc->Vorlagen[hl->cab].Anach;
- if (BuPos3 > 0)
- BuPos3 -= 1;
+ a--;
+ BuPos--;
}
- hl->xp = CurX;
- hl->yp = CurY;
- LiList.at(LiList.count()-1)->xco = hl->xp;
- LiList.at(LiList.count()-1)->yco = hl->yp;
- for (uint zc = 0; zc<BuPos3; ++zc)
+ }
+ else
+ {
+ if (Doc->Vorlagen[absa].Ausri != 0)
{
- Zli2 = LiList.at(zc);
- p.setFont(Zli2->Zsatz);
- p.setPen(Zli2->Farb);
- if ((Zli2->Sele) && (Doc->AppMode == 7) && (Select))
+ EndX = CurX;
+ do
{
- p.save();
- wide = Zli2->wide;
- desc = p.fontMetrics().descent();
- asce = p.fontMetrics().ascent();
- p.setPen(NoPen);
- p.setBrush(darkBlue);
- if (!Doc->RePos)
- p.drawRect(static_cast<int>(Zli2->xco), static_cast<int>(Zli2->yco-asce), static_cast<int>(wide+1), asce+desc);
- p.restore();
- p.setPen(white);
+ pt1 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY+desc));
+ pt2 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY-asce));
+ EndX++;
}
- else
+ while ((cl.contains(pf.xForm(pt1))) && (cl.contains(pf.xForm(pt2))));
+ if (Doc->Vorlagen[absa].Ausri == 2)
+ OFs = EndX - CurX - Extra;
+ if (Doc->Vorlagen[absa].Ausri == 1)
+ OFs = (EndX - CurX - Extra) / 2;
+ if (Doc->Vorlagen[absa].Ausri == 3)
+ OFs = 0;
+ if (Doc->Vorlagen[absa].Ausri == 4)
{
- if (Doc->AppMode == 7)
+ aSpa = 0;
+ for (uint sof = 0; sof<LiList.count(); ++sof)
{
- p.save();
- wide = Zli2->wide;
- desc = p.fontMetrics().descent();
- asce = p.fontMetrics().ascent();
- if (!Doc->RePos)
- p.eraseRect(static_cast<int>(Zli2->xco), static_cast<int>(Zli2->yco-asce), static_cast<int>(wide+1), asce+desc);
- p.restore();
+ if (LiList.at(sof)->Zeich == QChar(32))
+ aSpa++;
}
+ if (aSpa != 0)
+ {
+ OFs2 = (EndX - CurX - Extra) / aSpa;
+ }
+ else
+ OFs2 = 0;
+ OFs = 0;
+ for (uint yof = 0; yof < LiList.count(); ++yof)
+ {
+ LiList.at(yof)->xco += OFs;
+ Ptext.at(BuPos2)->xp += OFs;
+ BuPos2++;
+ if (LiList.at(yof)->Zeich == QChar(32))
+ OFs += OFs2;
+ }
}
- if (!Doc->RePos)
- DrawZeichen(&p, Zli2);
- }
- LiList.clear();
- BuPos = 0;
- LastSP = 0;
- LastXp = 0;
- outs = false;
- }
- }
- if (Doc->Vorlagen[absa].Ausri != 0)
- {
- EndX = CurX;
- desc = p.fontMetrics().descent();
- asce = p.fontMetrics().ascent();
- if (Tinput)
- p.eraseRect(0, static_cast<int>(CurY-asce), static_cast<int>(Width), asce+desc+1);
- do
- {
- pt1 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY+desc));
- pt2 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY-asce));
- EndX++;
- }
- while ((cl.contains(p.xForm(pt1))) && (cl.contains(p.xForm(pt2))));
- if (Doc->Vorlagen[absa].Ausri == 2)
- OFs = EndX - CurX - Extra;
- if (Doc->Vorlagen[absa].Ausri == 1)
- OFs = (EndX - CurX - Extra) / 2;
- if (Doc->Vorlagen[absa].Ausri == 3)
- OFs = 0;
- if (Doc->Vorlagen[absa].Ausri == 4)
- {
- aSpa = 0;
- for (uint sof = 0; sof<LiList.count(); ++sof)
- {
- if (LiList.at(sof)->Zeich == QChar(32))
- aSpa++;
- }
- if (aSpa != 0)
- {
- OFs2 = (EndX - CurX - Extra) / aSpa;
- }
else
- OFs2 = 0;
- OFs = 0;
- for (uint yof = 0; yof < LiList.count(); ++yof)
{
- LiList.at(yof)->xco += OFs;
- Ptext.at(BuPos2)->xp += OFs;
- BuPos2++;
- if (LiList.at(yof)->Zeich == QChar(32))
- OFs += OFs2;
- }
- }
- else
- {
- for (uint xof = 0; xof<LiList.count(); ++xof)
- {
+ for (uint xof = 0; xof<LiList.count(); ++xof)
+ {
LiList.at(xof)->xco += OFs;
Ptext.at(BuPos2)->xp += OFs;
BuPos2++;
+ }
}
}
}
- for (uint zc = 0; zc<LiList.count(); ++zc)
+ BuPos2 = a;
+ BuPos2++;
+ uint BuPos3 = BuPos;
+ CurY += Doc->Vorlagen[0].LineSpa;
+ CurX = Extra;
+ if (hl->ch != QChar(13))
+ CurX += Doc->Vorlagen[hl->cab].Indent;
+ else
{
+ CurY += Doc->Vorlagen[hl->cab].Anach;
+ if (BuPos3 > 0)
+ BuPos3 -= 1;
+ }
+ hl->xp = CurX;
+ hl->yp = CurY;
+ LiList.at(LiList.count()-1)->xco = hl->xp;
+ LiList.at(LiList.count()-1)->yco = hl->yp;
+ for (uint zc = 0; zc<BuPos3; ++zc)
+ {
Zli2 = LiList.at(zc);
- p.setFont(Zli2->Zsatz);
- p.setPen(Zli2->Farb);
+ if (Zli2->Farb != "None")
+ {
+ SetFarbe(&tmp, Zli2->Farb, Zli2->shade);
+ p->setBrush(tmp);
+ }
+ if (Zli2->Farb2 != "None")
+ {
+ SetFarbe(&tmp, Zli2->Farb2, Zli2->shade2);
+ p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
+ }
if ((Zli2->Sele) && (Doc->AppMode == 7) && (Select))
{
- p.save();
wide = Zli2->wide;
- desc = p.fontMetrics().descent();
- asce = p.fontMetrics().ascent();
- p.setPen(NoPen);
- p.setBrush(darkBlue);
+ desc = static_cast<int>((*Doc->AllFonts)[Zli2->ZFo]->numDescender * -Zli2->Siz);
+ asce = static_cast<int>((*Doc->AllFonts)[Zli2->ZFo]->numAscent * Zli2->Siz);
+ p->setFillMode(1);
+ p->setBrush(darkBlue);
if (!Doc->RePos)
- p.drawRect(static_cast<int>(Zli2->xco), static_cast<int>(Zli2->yco-asce), static_cast<int>(wide+1), asce+desc);
- p.restore();
- p.setPen(white);
+ p->drawRect(Zli2->xco, Zli2->yco-asce, wide+1, asce+desc);
+ p->setBrush(white);
}
- else
+ if (!Doc->RePos)
{
- if (Doc->AppMode == 7)
- {
- p.save();
- wide = Zli2->wide;
- desc = p.fontMetrics().descent();
- asce = p.fontMetrics().ascent();
- if (!Doc->RePos)
- p.eraseRect(static_cast<int>(Zli2->xco), static_cast<int>(Zli2->yco-asce), static_cast<int>(wide+1), asce+desc);
- p.restore();
- }
+ if (e.intersects(pf.xForm(QRect(Zli2->xco,Zli2->yco-LineSp, Zli2->wide, LineSp))))
+ DrawZeichenS(p, Zli2);
}
- if (!Doc->RePos)
- DrawZeichen(&p, Zli2);
}
LiList.clear();
BuPos = 0;
LastSP = 0;
+ LastXp = 0;
outs = false;
- }
- MaxChars = Ptext.count();
- Redrawn = true;
- p.restore();
- break;
-NoRoom: if (NextBox != 0)
+ }
+ }
+ if (Doc->Vorlagen[absa].Ausri != 0)
+ {
+ EndX = CurX;
+ do
{
- nrc2 = Ptext.count();
- for (uint ss=nrc; ss<nrc2; ++ss)
+ pt1 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY+desc));
+ pt2 = QPoint(static_cast<int>(EndX+RExtra), static_cast<int>(CurY-asce));
+ EndX++;
+ }
+ while ((cl.contains(pf.xForm(pt1))) && (cl.contains(pf.xForm(pt2))));
+ if (Doc->Vorlagen[absa].Ausri == 2)
+ OFs = EndX - CurX - Extra;
+ if (Doc->Vorlagen[absa].Ausri == 1)
+ OFs = (EndX - CurX - Extra) / 2;
+ if (Doc->Vorlagen[absa].Ausri == 3)
+ OFs = 0;
+ if (Doc->Vorlagen[absa].Ausri == 4)
+ {
+ aSpa = 0;
+ for (uint sof = 0; sof<LiList.count(); ++sof)
{
- NextBox->Ptext.append(Ptext.take(nrc));
+ if (LiList.at(sof)->Zeich == QChar(32))
+ aSpa++;
}
- NextBox->Dirty = true;
- if (uint(CPos) > nrc)
+ if (aSpa != 0)
{
- CPos = nrc;
- if ((Doc->AppMode == 7) && (Tinput))
- {
- OwnPage->Deselect(true);
- NextBox->CPos = 1;
- Doc->ActPage = NextBox->OwnPage;
- NextBox->OwnPage->SelectItemNr(NextBox->ItemNr);
- break;
- }
+ OFs2 = (EndX - CurX - Extra) / aSpa;
}
- if (NextBox->OwnPage != OwnPage)
+ else
+ OFs2 = 0;
+ OFs = 0;
+ for (uint yof = 0; yof < LiList.count(); ++yof)
{
- QPainter px;
- px.begin(NextBox->Parent);
- px.translate(static_cast<int>(NextBox->Xpos*Doc->Scale), static_cast<int>(NextBox->Ypos*Doc->Scale));
- px.scale(static_cast<double>(Doc->Scale), static_cast<double>(Doc->Scale));
- px.rotate(static_cast<double>(NextBox->Rot));
- px.eraseRect(0, 0, static_cast<int>(NextBox->Width), static_cast<int>(NextBox->Height));
- px.end();
+ LiList.at(yof)->xco += OFs;
+ Ptext.at(BuPos2)->xp += OFs;
+ BuPos2++;
+ if (LiList.at(yof)->Zeich == QChar(32))
+ OFs += OFs2;
}
- NextBox->paintObj(QRect(0, 0, NextBox->OwnPage->width(), NextBox->OwnPage->height()));
}
else
{
- if (!Doc->RePos)
+ for (uint xof = 0; xof<LiList.count(); ++xof)
{
- p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
- p.setBrush(white);
- p.drawRect(static_cast<int>(Width-16), static_cast<int>(Height-16), 14, 14);
- p.drawLine(static_cast<int>(Width-16), static_cast<int>(Height-16), static_cast<int>(Width-3), static_cast<int>(Height-3));
- p.drawLine(static_cast<int>(Width-16), static_cast<int>(Height-3), static_cast<int>(Width-3), static_cast<int>(Height-16));
+ LiList.at(xof)->xco += OFs;
+ Ptext.at(BuPos2)->xp += OFs;
+ BuPos2++;
}
}
- MaxChars = nrc;
- Redrawn = true;
- p.restore();
- break;
- case 5:
- if (!Doc->RePos)
+ }
+ for (uint zc = 0; zc<LiList.count(); ++zc)
{
- if (NamedLStyle == "")
- p.drawLine(0, 0, qRound(Width), 0);
- else
+ Zli2 = LiList.at(zc);
+ if (Zli2->Farb != "None")
{
- multiLine ml = Doc->MLineStyles[NamedLStyle];
- for (int it = ml.size()-1; it > -1; it--)
- {
- SetFarbe(&tmp, ml[it].Color, ml[it].Shade);
- p.setPen(QPen(tmp,
- QMAX(static_cast<int>(ml[it].Width*Doc->Scale), 1),
- static_cast<PenStyle>(ml[it].Dash),
- static_cast<PenCapStyle>(ml[it].LineEnd),
- static_cast<PenJoinStyle>(ml[it].LineJoin)));
- p.drawLine(0, 0, qRound(Width), 0);
- }
+ SetFarbe(&tmp, Zli2->Farb, Zli2->shade);
+ p->setBrush(tmp);
}
- }
- break;
- case 1:
- case 3:
- case 6:
- if (GrType == 0)
- {
- if (!Doc->RePos)
+ if (Zli2->Farb2 != "None")
{
- DrawPoly(&p, Clip, p.brush().color());
- p.setBrush(NoBrush);
- DrawPolyL(&p, Clip);
+ SetFarbe(&tmp, Zli2->Farb2, Zli2->shade2);
+ p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
}
- }
- else
- {
+ if ((Zli2->Sele) && (Doc->AppMode == 7) && (Select))
+ {
+ wide = Zli2->wide;
+ desc = static_cast<int>((*Doc->AllFonts)[Zli2->ZFo]->numDescender * -Zli2->Siz);
+ asce = static_cast<int>((*Doc->AllFonts)[Zli2->ZFo]->numAscent * Zli2->Siz);
+ p->setFillMode(1);
+ p->setBrush(darkBlue);
+ if (!Doc->RePos)
+ p->drawRect(Zli2->xco, Zli2->yco-asce, wide+1, asce+desc);
+ p->setBrush(white);
+ }
if (!Doc->RePos)
{
-#if QT_VERSION >= 0x030100
- if (toPixmap)
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))));
- else
- p.setClipRegion(QRegion(p.xForm(QRect(0, 0, static_cast<int>(Width), static_cast<int>(Height)))).intersect(gesClip));
- bmd = QBitmap(static_cast<int>(Width), static_cast<int>(Height));
- bmd.fill(Qt::color0);
- pb.begin(&bmd);
- pb.setBrush(Qt::color1);
- pb.setPen(QPen(Qt::color1, 1, DotLine, FlatCap, MiterJoin));
- DrawPoly(&pb, Clip, pb.brush().color(), true);
- pb.end();
- pmd = QPixmap(static_cast<int>(Width), static_cast<int>(Height));
- pmd.fill();
- pd.begin(&pmd);
- if ((!Doc->RePos) && (!Gpixm.isNull()))
- pd.drawImage(0, 0, Gpixm);
- pd.end();
- pmd.setMask(bmd);
- p.drawPixmap(0, 0, pmd);
-#else
- if (toPixmap)
- p.setClipRegion(QRegion(p.xForm(Clip)));
- else
- p.setClipRegion(QRegion(p.xForm(Clip)).intersect(gesClip));
- if (!Gpixm.isNull())
- p.drawImage(0, 0, Gpixm);
-#endif
- p.setBrush(NoBrush);
- DrawPolyL(&p, Clip);
+ if (e.intersects(pf.xForm(QRect(Zli2->xco,Zli2->yco-LineSp, Zli2->wide, LineSp))))
+ DrawZeichenS(p, Zli2);
}
}
- break;
- case 7:
- if (PoLine.size() > 3)
+ LiList.clear();
+ BuPos = 0;
+ LastSP = 0;
+ outs = false;
+ }
+ MaxChars = Ptext.count();
+ Redrawn = true;
+ p->restore();
+ break;
+NoRoom: if (NextBox != 0)
{
- for (uint poi=0; poi<PoLine.size()-3; poi += 4)
+ nrc2 = Ptext.count();
+ for (uint ss=nrc; ss<nrc2; ++ss)
{
- if (PoLine.point(poi).x() > 900000)
- continue;
- BezierPoints(&Bez, PoLine.pointQ(poi), PoLine.pointQ(poi+1), PoLine.pointQ(poi+3), PoLine.pointQ(poi+2));
- if (!Doc->RePos)
+ NextBox->Ptext.append(Ptext.take(nrc));
+ }
+ NextBox->Dirty = true;
+ if (uint(CPos) > nrc)
+ {
+ CPos = nrc;
+ if ((Doc->AppMode == 7) && (Tinput))
{
- if (NamedLStyle == "")
- p.drawCubicBezier(Bez);
- else
- {
- multiLine ml = Doc->MLineStyles[NamedLStyle];
- for (int it = ml.size()-1; it > -1; it--)
- {
- SetFarbe(&tmp, ml[it].Color, ml[it].Shade);
- p.setPen(QPen(tmp,
- QMAX(static_cast<int>(ml[it].Width*Doc->Scale), 1),
- static_cast<PenStyle>(ml[it].Dash),
- static_cast<PenCapStyle>(ml[it].LineEnd),
- static_cast<PenJoinStyle>(ml[it].LineJoin)));
- p.drawCubicBezier(Bez);
- }
- }
+ OwnPage->Deselect(true);
+ NextBox->CPos = 1;
+ Doc->ActPage = NextBox->OwnPage;
+ NextBox->OwnPage->SelectItemNr(NextBox->ItemNr);
+ break;
}
}
+ NextBox->OwnPage->RefreshItem(NextBox);
}
- break;
- case 8:
- if (PoLine.size() > 3)
+ else
{
- if (PoShow)
+ if (!Doc->RePos)
{
- for (uint poi=0; poi<PoLine.size()-3; poi += 4)
- {
- if (PoLine.point(poi).x() > 900000)
- continue;
- BezierPoints(&Bez, PoLine.pointQ(poi), PoLine.pointQ(poi+1), PoLine.pointQ(poi+3), PoLine.pointQ(poi+2));
- if (!Doc->RePos)
- {
- if (NamedLStyle == "")
- p.drawCubicBezier(Bez);
- else
- {
- multiLine ml = Doc->MLineStyles[NamedLStyle];
- for (int it = ml.size()-1; it > -1; it--)
- {
- SetFarbe(&tmp, ml[it].Color, ml[it].Shade);
- p.setPen(QPen(tmp,
- QMAX(static_cast<int>(ml[it].Width*Doc->Scale), 1),
- static_cast<PenStyle>(ml[it].Dash),
- static_cast<PenCapStyle>(ml[it].LineEnd),
- static_cast<PenJoinStyle>(ml[it].LineJoin)));
- p.drawCubicBezier(Bez);
- }
- }
- }
- }
+ p->setPen(black, 1, SolidLine, FlatCap, MiterJoin);
+ p->setBrush(white);
+ p->drawRect(Width-16, Height-16, 14, 14);
+ p->drawLine(FPoint(Width-16, Height-16), FPoint(Width-3, Height-3));
+ p->drawLine(FPoint(Width-16, Height-3), FPoint(Width-3, Height-16));
}
}
- cl = FlattenPath(PoLine, Segments);
- CurX = Extra;
- if (Ptext.count() != 0)
- CurX += Ptext.at(0)->cextra;
- zae = 0;
+ MaxChars = nrc;
+ Redrawn = true;
+ p->restore();
+ break;
+ case 8:
+ if (!PoShow)
+ doStroke = false;
+ cl = FlattenPath(PoLine, Segments);
+ CurX = Extra;
+ if (Ptext.count() != 0)
+ CurX += Ptext.at(0)->cextra;
+ zae = 0;
+ wid = sqrt(pow(cl.point(zae+1).x()-cl.point(zae).x(),2)+pow(cl.point(zae+1).y()-cl.point(zae).y(),2));
+ while (wid < 1)
+ {
+ zae++;
+ if (zae == cl.size()-1)
+ goto PfadEnd;
wid = sqrt(pow(cl.point(zae+1).x()-cl.point(zae).x(),2)+pow(cl.point(zae+1).y()-cl.point(zae).y(),2));
- while (wid < 1)
+ }
+ rota = xy2Deg(cl.point(zae+1).x()-cl.point(zae).x(),cl.point(zae+1).y()-cl.point(zae).y());
+ for (a = 0; a < Ptext.count(); ++a)
+ {
+ CurY = 0;
+ hl = Ptext.at(a);
+ chx = hl->ch;
+ if ((chx == QChar(30)) || (chx == QChar(13)))
+ continue;
+ chs = hl->csize;
+ SetZeichAttr(hl, &chs, &chx);
+ if (chx == QChar(29))
+ chx2 = " ";
+ else
+ chx2 = chx;
+ if (a < Ptext.count()-1)
{
- zae++;
- if (zae == cl.size()-1)
- goto PfadEnd;
- wid = sqrt(pow(cl.point(zae+1).x()-cl.point(zae).x(),2)+pow(cl.point(zae+1).y()-cl.point(zae).y(),2));
+ if (Ptext.at(a+1)->ch == QChar(29))
+ chx3 = " ";
+ else
+ chx3 = Ptext.at(a+1)->ch;
+ wide = Cwidth(Doc, hl->cfont, chx2, chs, chx3);
}
- rota = xy2Deg(cl.point(zae+1).x()-cl.point(zae).x(),cl.point(zae+1).y()-cl.point(zae).y());
- for (a = 0; a < Ptext.count(); ++a)
+ else
+ wide = Cwidth(Doc, hl->cfont, chx2, chs);
+ wide = wide * (hl->cscale / 100.0);
+ if ((CurX+(wide+hl->cextra)/2) >= wid)
{
- CurY = 0;
- hl = Ptext.at(a);
- chx = hl->ch;
- if ((chx == QChar(30)) || (chx == QChar(13)))
- continue;
- if (hl->ccolor != "None")
+ if (zae < cl.size()-1)
{
- SetFarbe(&tmp, hl->ccolor, hl->cshade);
- p.setPen(tmp);
- }
- else
- p.setPen(NoPen);
- chs = hl->csize;
- SetZeichAttr(&p, &ffo, hl, &chs, &chx);
- if (chx == QChar(29))
- chx2 = " ";
- else
- chx2 = chx;
- if (a < Ptext.count()-1)
- {
- if (Ptext.at(a+1)->ch == QChar(29))
- chx3 = " ";
- else
- chx3 = Ptext.at(a+1)->ch;
- wide = Cwidth(Doc, &p, hl->cfont, chx2, chs, chx3);
- }
- else
- wide = Cwidth(Doc, &p, hl->cfont, chx2, chs);
- if ((CurX+(wide+hl->cextra)/2) >= wid)
- {
- if (zae < cl.size()-1)
+ CurX = CurX - wid;
+ wid = 0;
+ EndX = CurX;
+ do
{
- CurX = CurX - wid;
- wid = 0;
- EndX = CurX;
do
{
- do
- {
- zae++;
- if (zae == cl.size()-1)
- goto PfadEnd;
- wid = sqrt(pow(cl.point(zae+1).x()-cl.point(zae).x(),2)+pow(cl.point(zae+1).y()-cl.point(zae).y(),2));
- rota = xy2Deg(cl.point(zae+1).x()-cl.point(zae).x(),cl.point(zae+1).y()-cl.point(zae).y());
- }
- while (wid == 0);
- EndX -= wid;
+ zae++;
+ if (zae == cl.size()-1)
+ goto PfadEnd;
+ wid = sqrt(pow(cl.point(zae+1).x()-cl.point(zae).x(),2)+pow(cl.point(zae+1).y()-cl.point(zae).y(),2));
+ rota = xy2Deg(cl.point(zae+1).x()-cl.point(zae).x(),cl.point(zae+1).y()-cl.point(zae).y());
}
- while (wid < EndX);
- CurX = EndX + wid;
+ while (wid == 0);
+ EndX -= wid;
}
- else
- goto PfadEnd;
+ while (wid < EndX);
+ CurX = EndX + wid;
}
- p.save();
- p.translate(cl.point(zae).x(), cl.point(zae).y());
- p.rotate(rota);
- hl->xp = CurX+hl->cextra;
- hl->yp = CurY+BaseOffs;
- hl->PtransX = cl.point(zae).x();
- hl->PtransY = cl.point(zae).y();
- hl->PRot = rota;
- if (!Doc->RePos)
- DrawZeichen(&p, hl);
- p.restore();
- CurX += wide+hl->cextra;
+ else
+ goto PfadEnd;
}
+ p->save();
+ p->translate(cl.point(zae).x()*sc, cl.point(zae).y()*sc);
+ p->rotate(rota);
+ hl->xp = CurX+hl->cextra;
+ hl->yp = CurY+BaseOffs;
+ hl->PtransX = cl.point(zae).x();
+ hl->PtransY = cl.point(zae).y();
+ hl->PRot = rota;
+ Zli = new ZZ;
+ Zli->Zeich = chx;
+ if (hl->ccolor != "None")
+ {
+ SetFarbe(&tmp, hl->ccolor, hl->cshade);
+ p->setBrush(tmp);
+ }
+ if (hl->cstroke != "None")
+ {
+ SetFarbe(&tmp, hl->cstroke, hl->cshade2);
+ p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
+ }
+ Zli->Farb = hl->ccolor;
+ Zli->Farb2 = hl->cstroke;
+ Zli->shade = hl->cshade;
+ Zli->shade2 = hl->cshade2;
+ Zli->xco = hl->xp;
+ Zli->yco = hl->yp;
+ Zli->Sele = hl->cselect;
+ Zli->Siz = chs;
+ Zli->Style = hl->cstyle;
+ Zli->ZFo = hl->cfont;
+ Zli->wide = wide;
+ Zli->kern = hl->cextra;
+ Zli->scale = hl->cscale;
+ if (!Doc->RePos)
+ DrawZeichenS(p, Zli);
+ delete Zli;
+ p->restore();
+ p->setZoomFactor(sc);
+ CurX += wide+hl->cextra;
+ }
PfadEnd: MaxChars = Ptext.count();
- break;
+ break;
+ default:
+ break;
+ }
+ if ((doStroke) && (!Doc->RePos))
+ {
+ if (Pcolor2 != "None")
+ {
+ SetFarbe(&tmp, Pcolor2, Shade2);
+ p->setPen(tmp, Pwidth, PLineArt, PLineEnd, PLineJoin);
+ if (DashValues.count() != 0)
+ p->setDash(DashValues, DashOffset);
}
+ else
+ p->setLineWidth(0);
+ p->setupPolygon(&PoLine);
+ if (NamedLStyle == "")
+ p->drawPolyLine();
+ else
+ {
+ multiLine ml = Doc->MLineStyles[NamedLStyle];
+ for (int it = ml.size()-1; it > -1; it--)
+ {
+ SetFarbe(&tmp, ml[it].Color, ml[it].Shade);
+ p->setPen(tmp, ml[it].Width,
+ static_cast<PenStyle>(ml[it].Dash),
+ static_cast<PenCapStyle>(ml[it].LineEnd),
+ static_cast<PenJoinStyle>(ml[it].LineJoin));
+ p->drawPolyLine();
+ }
+ }
}
- }
- p.setClipping(false);
- p.setClipRegion(gesClip);
+ if ((!Tinput) && (!Doc->RePos))
+ {
+ if ((Frame) && (Doc->ShFrames) && ((PType == 2) || (PType == 4)))
+ {
+ p->setPen(black, 1, DotLine, FlatCap, MiterJoin);
+ if ((isBookmark) || (isAnnotation))
+ p->setPen(blue, 1, DotLine, FlatCap, MiterJoin);
+ if ((BackBox != 0) || (NextBox != 0))
+ p->setPen(red, 1, SolidLine, FlatCap, MiterJoin);
+ if (Locked)
+ p->setPen(darkRed, 1, SolidLine, FlatCap, MiterJoin);
+ p->setFillMode(0);
+ p->setupPolygon(&PoLine);
+ p->drawPolyLine();
+ }
+ }
+ Tinput = false;
+ FrameOnly = false;
+ Dirty = false;
+ p->restore();
+ pf.end();
+}
+
+void PageItem::paintObj(QRect e, QPixmap *ppX)
+{
+ QPainter p;
+ if (!Doc->DoDrawing)
+ {
+ Redrawn = true;
+ Tinput = false;
+ FrameOnly = false;
+ Dirty = false;
+ return;
+ }
+ if (toPixmap)
+ p.begin(ppX);
+ else
+ p.begin(Parent);
+ if ((!toPixmap) && (!Doc->RePos))
+ {
+ if (!e.isEmpty())
+ p.setClipRect(e);
+ else
+ p.setClipRect(OwnPage->ViewReg().boundingRect());
+ }
+ p.translate(static_cast<int>(Xpos*Doc->Scale), static_cast<int>(Ypos*Doc->Scale));
+ p.scale(static_cast<double>(Doc->Scale), static_cast<double>(Doc->Scale));
+ p.rotate(static_cast<double>(Rot));
if (Sizing)
{
p.setRasterOp(XorROP);
@@ -1506,29 +1328,20 @@
}
}
-void PageItem::SetZeichAttr(QPainter *p, QFont *ffo, struct Pti *hl, int *chs, QString *chx)
+void PageItem::SetZeichAttr(struct Pti *hl, int *chs, QString *chx)
{
- QFont ff(Doc->UsedFonts[hl->cfont]);
- ff.setPointSize(QMAX(static_cast<int>(hl->csize*DevRes), 1));
- p->setFont(ff);
- int asce = p->fontMetrics().ascent();
+ int asce = static_cast<int>((*Doc->AllFonts)[hl->cfont]->numAscent * hl->csize);
int chst = hl->cstyle & 127;
if (chst != 0)
{
- if (chst & 16)
- ff.setStrikeOut(true);
- if (chst & 8)
- ff.setUnderline(true);
if (chst & 1)
{
CurY -= asce * Doc->VHoch / 100;
- ff.setPointSize(QMAX(static_cast<int>(hl->csize * DevRes * Doc->VHochSc / 100), 1));
*chs = QMAX(static_cast<int>(hl->csize * Doc->VHochSc / 100), 1);
}
if (chst & 2)
{
CurY += asce * Doc->VTief / 100;
- ff.setPointSize(QMAX(static_cast<int>(hl->csize * DevRes * Doc->VTiefSc / 100) ,1));
*chs = QMAX(hl->csize * Doc->VTiefSc / 100, 1);
}
if (chst & 64)
@@ -1535,140 +1348,81 @@
{
if (chx->upper() != *chx)
{
- ff.setPointSize(QMAX(static_cast<int>(hl->csize * DevRes * Doc->VKapit / 100), 1));
*chs = QMAX(static_cast<int>(hl->csize * Doc->VKapit / 100), 1);
*chx = chx->upper();
}
}
}
- p->setFont(ff);
}
-void PageItem::DrawZeichen(QPainter *p, struct Pti *hl)
+void PageItem::DrawZeichenS(ScPainter *p, struct ZZ *hl)
{
- struct ZZ *Zli;
- Zli = new ZZ;
- Zli->Zeich = hl->ch;
- Zli->xco = hl->xp;
- Zli->yco = hl->yp;
- Zli->Sele = hl->cselect;
- Zli->Siz = hl->csize;
- Zli->ZFo = hl->cfont;
- if (hl->ch == QChar(29))
- Zli->wide = Cwidth(Doc, p, hl->cfont, " ", hl->csize);
- else
- Zli->wide = Cwidth(Doc, p, hl->cfont, hl->ch, hl->csize);
- DrawZeichen(p, Zli);
- delete Zli;
-}
-
-void PageItem::DrawZeichen(QPainter *p, struct ZZ *hl)
-{
- QRegion cr = p->clipRegion();
- QRect rr = QRect(static_cast<int>(hl->xco), static_cast<int>(hl->yco - LineSp), static_cast<int>(hl->wide), static_cast<int>(LineSp));
- if (!cr.contains(p->xForm(rr)))
- return;
QString ccx = hl->Zeich;
if (ccx == QChar(29))
ccx = " ";
-#ifdef HAVE_FREETYPE
- FT_Face face;
+ if (ccx == QChar(13))
+ return;
+ float csi = static_cast<double>(hl->Siz) / 10.0;
uint chr = ccx[0].unicode();
- if ((chr > 128) || (Doc->Scale > 1))
+ if ((*Doc->AllFonts)[hl->ZFo]->CharWidth.contains(chr))
{
- if ((*Doc->AllFonts)[hl->ZFo]->CharWidth.contains(chr))
+ QWMatrix chma;
+ chma.scale(csi, csi);
+ FPointArray gly = (*Doc->AllFonts)[hl->ZFo]->GlyphArray[chr].Outlines.copy();
+ if (gly.size() > 4)
{
- face = Doc->FFonts[hl->ZFo];
- FT_Set_Char_Size(Doc->FFonts[hl->ZFo], 0, QMAX(hl->Siz*64, 1), qRound(QMAX(1, DevResX * Doc->Scale)), qRound(QMAX(1, DevResY * Doc->Scale)));
- FT_Load_Char(face, chr, FT_LOAD_RENDER | FT_LOAD_NO_BITMAP | FT_LOAD_MONOCHROME);
- QByteArray bd(face->glyph->bitmap.rows * face->glyph->bitmap.pitch);
- uint yy = 0;
- uint adv;
- if ((face->glyph->bitmap.width % 8) == 0)
- adv = face->glyph->bitmap.width / 8;
- else
- adv = face->glyph->bitmap.width / 8 + 1;
- for (int y = 0; y < face->glyph->bitmap.rows; ++y)
+ gly.map(chma);
+ chma = QWMatrix();
+ chma.scale(hl->scale / 100.0, 1);
+ gly.map(chma);
+ chma = QWMatrix();
+ if (Reverse)
{
- memcpy(bd.data()+yy, face->glyph->bitmap.buffer+(y * face->glyph->bitmap.pitch), adv);
- yy += adv;
+ chma.scale(-1, 1);
+ chma.translate(-hl->wide, 0);
+ gly.map(chma);
+ chma = QWMatrix();
+ chma.translate(hl->xco, hl->yco-hl->Siz);
}
- QBitmap bb(face->glyph->bitmap.width, face->glyph->bitmap.rows, (uchar*)bd.data(), false);
- QPixmap pixm(face->glyph->bitmap.width, face->glyph->bitmap.rows);
- if (!pixm.isNull())
+ else
+ chma.translate(hl->xco, hl->yco-hl->Siz);
+ gly.map(chma);
+ p->setupPolygon(&gly);
+ p->setFillMode(1);
+ if (hl->Farb != "None")
+ p->fillPath();
+ if ((hl->Style & 4) && (hl->Farb2 != "None"))
{
- pixm.fill(p->pen().color());
- pixm.setMask(bb);
- p->save();
- if (Reverse)
- {
- p->translate(static_cast<int>(hl->xco), static_cast<int>(hl->yco));
- p->scale(-1, 1);
- p->scale(static_cast<double>(1.0 / Doc->Scale), static_cast<double>(1.0 / Doc->Scale));
- p->translate(-pixm.width(), 0);
- p->drawPixmap(-face->glyph->bitmap_left, -face->glyph->bitmap_top, pixm);
- }
- else
- {
- p->translate(static_cast<int>(hl->xco), static_cast<int>(hl->yco));
- p->scale(static_cast<double>(1.0 / Doc->Scale), static_cast<double>(1.0 / Doc->Scale));
- p->drawPixmap(face->glyph->bitmap_left, -face->glyph->bitmap_top, pixm);
- }
- p->restore();
+ p->setLineWidth((*Doc->AllFonts)[hl->ZFo]->strokeWidth * hl->Siz / 2);
+ p->strokePath();
}
- if (p->font().strikeOut())
- {
- int st = -p->fontMetrics().strikeOutPos();
- QPen px = p->pen();
- px.setWidth(QMAX(p->fontMetrics().lineWidth(), 1));
- p->setPen(px);
- p->drawLine(static_cast<int>(hl->xco), static_cast<int>(hl->yco)+st, static_cast<int>(hl->xco)+static_cast<int>(hl->wide), static_cast<int>(hl->yco)+st);
- }
- if (p->font().underline())
- {
- int st = p->fontMetrics().underlinePos();
- QPen px = p->pen();
- px.setWidth(QMAX(p->fontMetrics().lineWidth(), 1));
- p->setPen(px);
- p->drawLine(static_cast<int>(hl->xco), static_cast<int>(hl->yco)+st, static_cast<int>(hl->xco)+static_cast<int>(hl->wide), static_cast<int>(hl->yco)+st);
- }
}
- else
+ if (hl->Style & 16)
{
- QPen px = p->pen();
- px.setWidth(1);
- p->setPen(px);
- p->setBrush(NoBrush);
- p->drawRect(QRect(static_cast<int>(hl->xco), static_cast<int>(hl-&g