2006-07-01 22:16:05 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2006 Richard Wilson <info@tinct.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-07-01 22:16:05 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Knockout rendering (implementation).
|
2008-09-15 22:47:37 +04:00
|
|
|
*
|
|
|
|
* Knockout rendering is an optimisation which is particularly for
|
|
|
|
* unaccelerated screen redraw. It tries to avoid plotting the same area more
|
|
|
|
* than once.
|
|
|
|
*
|
|
|
|
* If the object is to plot two overlapping rectangles (one large, one small),
|
|
|
|
* such as:
|
|
|
|
*
|
|
|
|
* +-----------------+
|
|
|
|
* |#################|
|
|
|
|
* |####+-------+####|
|
|
|
|
* |####|:::::::|####|
|
|
|
|
* |####|:::::::|####|
|
|
|
|
* |####|:::::::|####|
|
|
|
|
* |####+-------+####|
|
|
|
|
* |#################|
|
|
|
|
* +-----------------+
|
|
|
|
*
|
|
|
|
* Without knockout rendering we plot the bottom rectangle and then the top one:
|
|
|
|
*
|
|
|
|
* +-----------------+ +-----------------+
|
|
|
|
* |#################| |#################|
|
|
|
|
* |#################| |####+-------+####|
|
|
|
|
* |#################| |####|:::::::|####|
|
|
|
|
* |#################| and then, |####|:::::::|####|
|
|
|
|
* |#################| |####|:::::::|####|
|
|
|
|
* |#################| |####+-------+####|
|
|
|
|
* |#################| |#################|
|
|
|
|
* +-----------------+ +-----------------+
|
|
|
|
*
|
|
|
|
* With knockoout rendering, the bottom rectangle is split up into smaller
|
|
|
|
* ones and each pixel is just plotted once:
|
|
|
|
*
|
|
|
|
* +-----------------+
|
|
|
|
* |#################|
|
|
|
|
* +----+-------+----+
|
|
|
|
* |####|:::::::|####|
|
|
|
|
* |####|:::::::|####|
|
|
|
|
* |####|:::::::|####|
|
|
|
|
* +----+-------+----+
|
|
|
|
* |#################|
|
|
|
|
* +-----------------+
|
2006-07-01 22:16:05 +04:00
|
|
|
*/
|
|
|
|
|
2006-07-04 23:46:20 +04:00
|
|
|
#define NDEBUG
|
2006-07-01 22:16:05 +04:00
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "desktop/knockout.h"
|
|
|
|
#include "desktop/plotters.h"
|
|
|
|
#include "image/bitmap.h"
|
|
|
|
#include "utils/log.h"
|
2006-07-01 22:16:05 +04:00
|
|
|
|
2006-07-02 05:36:02 +04:00
|
|
|
#define KNOCKOUT_ENTRIES 3072 /* 40 bytes each */
|
2006-07-02 17:18:29 +04:00
|
|
|
#define KNOCKOUT_BOXES 768 /* 28 bytes each */
|
2006-07-02 05:36:02 +04:00
|
|
|
#define KNOCKOUT_POLYGONS 3072 /* 4 bytes each */
|
2006-07-01 22:16:05 +04:00
|
|
|
|
2006-07-02 20:17:51 +04:00
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
struct knockout_box;
|
|
|
|
struct knockout_entry;
|
|
|
|
|
2006-07-02 20:17:51 +04:00
|
|
|
|
2006-07-10 13:52:31 +04:00
|
|
|
static void knockout_set_plotters(void);
|
2006-07-01 22:16:05 +04:00
|
|
|
static void knockout_calculate(int x0, int y0, int x1, int y1, struct knockout_box *box);
|
|
|
|
static bool knockout_plot_fill_recursive(struct knockout_box *box, colour c);
|
|
|
|
static bool knockout_plot_bitmap_tile_recursive(struct knockout_box *box,
|
|
|
|
struct knockout_entry *entry);
|
|
|
|
|
|
|
|
static bool knockout_plot_clg(colour c);
|
|
|
|
static bool knockout_plot_rectangle(int x0, int y0, int width, int height,
|
|
|
|
int line_width, colour c, bool dotted, bool dashed);
|
|
|
|
static bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
|
|
|
|
colour c, bool dotted, bool dashed);
|
2009-02-03 04:27:54 +03:00
|
|
|
static bool knockout_plot_polygon(const int *p, unsigned int n, colour fill);
|
2006-07-01 22:16:05 +04:00
|
|
|
static bool knockout_plot_fill(int x0, int y0, int x1, int y1, colour c);
|
|
|
|
static bool knockout_plot_clip(int clip_x0, int clip_y0,
|
|
|
|
int clip_x1, int clip_y1);
|
2008-04-07 15:15:09 +04:00
|
|
|
static bool knockout_plot_text(int x, int y, const struct css_style *style,
|
2006-07-01 22:16:05 +04:00
|
|
|
const char *text, size_t length, colour bg, colour c);
|
|
|
|
static bool knockout_plot_disc(int x, int y, int radius, colour colour, bool filled);
|
|
|
|
static bool knockout_plot_arc(int x, int y, int radius, int angle1, int angle2,
|
|
|
|
colour c);
|
|
|
|
static bool knockout_plot_bitmap(int x, int y, int width, int height,
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
struct bitmap *bitmap, colour bg, struct content *content);
|
2006-07-01 22:16:05 +04:00
|
|
|
static bool knockout_plot_bitmap_tile(int x, int y, int width, int height,
|
|
|
|
struct bitmap *bitmap, colour bg,
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
bool repeat_x, bool repeat_y, struct content *content);
|
2008-07-30 23:17:27 +04:00
|
|
|
static bool knockout_plot_flush(void);
|
2006-07-01 22:16:05 +04:00
|
|
|
static bool knockout_plot_group_start(const char *name);
|
|
|
|
static bool knockout_plot_group_end(void);
|
2009-02-03 04:27:54 +03:00
|
|
|
static bool knockout_plot_path(const float *p, unsigned int n, colour fill,
|
|
|
|
float width, colour c, const float transform[6]);
|
2006-07-01 22:16:05 +04:00
|
|
|
|
|
|
|
|
|
|
|
const struct plotter_table knockout_plotters = {
|
|
|
|
knockout_plot_clg,
|
|
|
|
knockout_plot_rectangle,
|
|
|
|
knockout_plot_line,
|
|
|
|
knockout_plot_polygon,
|
|
|
|
knockout_plot_fill,
|
|
|
|
knockout_plot_clip,
|
|
|
|
knockout_plot_text,
|
|
|
|
knockout_plot_disc,
|
|
|
|
knockout_plot_arc,
|
|
|
|
knockout_plot_bitmap,
|
|
|
|
knockout_plot_bitmap_tile,
|
|
|
|
knockout_plot_group_start,
|
2006-08-19 23:31:07 +04:00
|
|
|
knockout_plot_group_end,
|
2007-11-29 08:50:21 +03:00
|
|
|
knockout_plot_flush,
|
|
|
|
knockout_plot_path,
|
2008-07-30 23:17:27 +04:00
|
|
|
true
|
2006-07-01 22:16:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
KNOCKOUT_PLOT_CLG, /* translated to _FILL */
|
|
|
|
KNOCKOUT_PLOT_RECTANGLE,
|
|
|
|
KNOCKOUT_PLOT_LINE,
|
|
|
|
KNOCKOUT_PLOT_POLYGON,
|
|
|
|
KNOCKOUT_PLOT_FILL, /* knockout, knocked out */
|
|
|
|
KNOCKOUT_PLOT_CLIP,
|
|
|
|
KNOCKOUT_PLOT_TEXT,
|
|
|
|
KNOCKOUT_PLOT_DISC,
|
|
|
|
KNOCKOUT_PLOT_ARC,
|
|
|
|
KNOCKOUT_PLOT_BITMAP, /* knockout */
|
|
|
|
KNOCKOUT_PLOT_BITMAP_TILE, /* knockout, knocked out */
|
|
|
|
KNOCKOUT_PLOT_GROUP_START,
|
|
|
|
KNOCKOUT_PLOT_GROUP_END,
|
|
|
|
} knockout_type;
|
|
|
|
|
|
|
|
|
|
|
|
struct knockout_box {
|
|
|
|
struct {
|
|
|
|
int x0;
|
|
|
|
int y0;
|
|
|
|
int x1;
|
|
|
|
int y1;
|
|
|
|
} bbox;
|
2006-07-02 17:18:29 +04:00
|
|
|
bool deleted; /* box has been deleted, ignore */
|
2006-07-01 22:16:05 +04:00
|
|
|
struct knockout_box *child;
|
|
|
|
struct knockout_box *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct knockout_entry {
|
|
|
|
knockout_type type;
|
|
|
|
struct knockout_box *box; /* relating series of knockout clips */
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
colour c;
|
|
|
|
} clg;
|
|
|
|
struct {
|
|
|
|
int x0;
|
|
|
|
int y0;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int line_width;
|
|
|
|
colour c;
|
|
|
|
bool dotted;
|
|
|
|
bool dashed;
|
|
|
|
} rectangle;
|
|
|
|
struct {
|
|
|
|
int x0;
|
|
|
|
int y0;
|
|
|
|
int x1;
|
|
|
|
int y1;
|
|
|
|
int width;
|
|
|
|
colour c;
|
|
|
|
bool dotted;
|
|
|
|
bool dashed;
|
|
|
|
} line;
|
|
|
|
struct {
|
|
|
|
int *p;
|
|
|
|
unsigned int n;
|
|
|
|
colour fill;
|
|
|
|
} polygon;
|
|
|
|
struct {
|
|
|
|
int x0;
|
|
|
|
int y0;
|
|
|
|
int x1;
|
|
|
|
int y1;
|
|
|
|
colour c;
|
|
|
|
} fill;
|
|
|
|
struct {
|
|
|
|
int x0;
|
|
|
|
int y0;
|
|
|
|
int x1;
|
|
|
|
int y1;
|
|
|
|
} clip;
|
|
|
|
struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
2008-04-07 15:15:09 +04:00
|
|
|
const struct css_style *style;
|
2006-07-01 22:16:05 +04:00
|
|
|
const char *text;
|
|
|
|
size_t length;
|
|
|
|
colour bg;
|
|
|
|
colour c;
|
|
|
|
} text;
|
|
|
|
struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int radius;
|
|
|
|
colour colour;
|
|
|
|
bool filled;
|
|
|
|
} disc;
|
|
|
|
struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int radius;
|
|
|
|
int angle1;
|
|
|
|
int angle2;
|
|
|
|
colour c;
|
|
|
|
} arc;
|
|
|
|
struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
struct bitmap *bitmap;
|
|
|
|
colour bg;
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
struct content *content;
|
2006-07-01 22:16:05 +04:00
|
|
|
} bitmap;
|
|
|
|
struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
struct bitmap *bitmap;
|
|
|
|
colour bg;
|
|
|
|
bool repeat_x;
|
|
|
|
bool repeat_y;
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
struct content *content;
|
2006-07-01 22:16:05 +04:00
|
|
|
} bitmap_tile;
|
|
|
|
struct {
|
|
|
|
const char *name;
|
|
|
|
} group_start;
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-30 03:19:24 +04:00
|
|
|
static struct knockout_entry knockout_entries[KNOCKOUT_ENTRIES];
|
|
|
|
static struct knockout_box knockout_boxes[KNOCKOUT_BOXES];
|
|
|
|
static int knockout_polygons[KNOCKOUT_POLYGONS];
|
|
|
|
static int knockout_entry_cur = 0;
|
|
|
|
static int knockout_box_cur = 0;
|
|
|
|
static int knockout_polygon_cur = 0;
|
|
|
|
static struct knockout_box *knockout_list = NULL;
|
|
|
|
|
|
|
|
static struct plotter_table real_plot;
|
|
|
|
|
|
|
|
static int clip_x0_cur;
|
|
|
|
static int clip_y0_cur;
|
|
|
|
static int clip_x1_cur;
|
|
|
|
static int clip_y1_cur;
|
|
|
|
static int nested_depth = 0;
|
2006-07-02 04:08:54 +04:00
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/**
|
|
|
|
* Start a knockout plotting session
|
|
|
|
*
|
|
|
|
* \param plotter the plotter to use
|
|
|
|
* \return true on success, false otherwise
|
|
|
|
*/
|
|
|
|
bool knockout_plot_start(struct plotter_table *plotter)
|
|
|
|
{
|
2006-07-02 20:17:51 +04:00
|
|
|
/* check if we're recursing */
|
|
|
|
if (nested_depth++ > 0) {
|
|
|
|
/* we should already have the knockout renderer as default */
|
2007-12-11 05:45:38 +03:00
|
|
|
assert(plotter->clg == knockout_plotters.clg);
|
2006-07-02 20:17:51 +04:00
|
|
|
return true;
|
|
|
|
}
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* end any previous sessions */
|
|
|
|
if (knockout_entry_cur > 0)
|
|
|
|
knockout_plot_end();
|
|
|
|
|
|
|
|
/* take over the plotter */
|
|
|
|
real_plot = *plotter;
|
2006-07-10 13:52:31 +04:00
|
|
|
knockout_set_plotters();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* End a knockout plotting session
|
|
|
|
*
|
|
|
|
* \return true on success, false otherwise
|
|
|
|
*/
|
|
|
|
bool knockout_plot_end(void)
|
2006-07-02 20:17:51 +04:00
|
|
|
{
|
|
|
|
/* only output when we've finished any nesting */
|
|
|
|
if (--nested_depth == 0)
|
|
|
|
return knockout_plot_flush();
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-02 20:17:51 +04:00
|
|
|
assert(nested_depth > 0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flush the current knockout session to empty the buffers
|
|
|
|
*
|
|
|
|
* \return true on success, false otherwise
|
|
|
|
*/
|
|
|
|
bool knockout_plot_flush(void)
|
2006-07-01 22:16:05 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
bool success = true;
|
|
|
|
struct knockout_box *box;
|
|
|
|
|
2006-07-02 05:36:02 +04:00
|
|
|
/* debugging information */
|
|
|
|
LOG(("Entries are %i/%i, %i/%i, %i/%i",
|
|
|
|
knockout_entry_cur, KNOCKOUT_ENTRIES,
|
|
|
|
knockout_box_cur, KNOCKOUT_BOXES,
|
|
|
|
knockout_polygon_cur, KNOCKOUT_POLYGONS));
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* release our plotter */
|
|
|
|
plot = real_plot;
|
|
|
|
|
|
|
|
for (i = 0; i < knockout_entry_cur; i++) {
|
|
|
|
switch (knockout_entries[i].type) {
|
|
|
|
case KNOCKOUT_PLOT_CLG:
|
|
|
|
success &= plot.clg(
|
|
|
|
knockout_entries[i].data.clg.c);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_RECTANGLE:
|
|
|
|
success &= plot.rectangle(
|
|
|
|
knockout_entries[i].data.rectangle.x0,
|
|
|
|
knockout_entries[i].data.rectangle.y0,
|
|
|
|
knockout_entries[i].data.rectangle.width,
|
|
|
|
knockout_entries[i].data.rectangle.height,
|
|
|
|
knockout_entries[i].data.rectangle.line_width,
|
|
|
|
knockout_entries[i].data.rectangle.c,
|
|
|
|
knockout_entries[i].data.rectangle.dotted,
|
|
|
|
knockout_entries[i].data.rectangle.dashed);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_LINE:
|
|
|
|
success &= plot.line(
|
|
|
|
knockout_entries[i].data.line.x0,
|
|
|
|
knockout_entries[i].data.line.y0,
|
|
|
|
knockout_entries[i].data.line.x1,
|
|
|
|
knockout_entries[i].data.line.y1,
|
|
|
|
knockout_entries[i].data.line.width,
|
|
|
|
knockout_entries[i].data.line.c,
|
|
|
|
knockout_entries[i].data.line.dotted,
|
|
|
|
knockout_entries[i].data.line.dashed);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_POLYGON:
|
|
|
|
success &= plot.polygon(
|
|
|
|
knockout_entries[i].data.polygon.p,
|
|
|
|
knockout_entries[i].data.polygon.n,
|
|
|
|
knockout_entries[i].data.polygon.fill);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_FILL:
|
|
|
|
box = knockout_entries[i].box->child;
|
|
|
|
if (box)
|
|
|
|
success &= knockout_plot_fill_recursive(box,
|
|
|
|
knockout_entries[i].data.fill.c);
|
|
|
|
else if (!knockout_entries[i].box->deleted)
|
|
|
|
success &= plot.fill(
|
|
|
|
knockout_entries[i].data.fill.x0,
|
|
|
|
knockout_entries[i].data.fill.y0,
|
|
|
|
knockout_entries[i].data.fill.x1,
|
|
|
|
knockout_entries[i].data.fill.y1,
|
|
|
|
knockout_entries[i].data.fill.c);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_CLIP:
|
|
|
|
success &= plot.clip(
|
|
|
|
knockout_entries[i].data.clip.x0,
|
|
|
|
knockout_entries[i].data.clip.y0,
|
|
|
|
knockout_entries[i].data.clip.x1,
|
|
|
|
knockout_entries[i].data.clip.y1);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_TEXT:
|
|
|
|
success &= plot.text(
|
|
|
|
knockout_entries[i].data.text.x,
|
|
|
|
knockout_entries[i].data.text.y,
|
|
|
|
knockout_entries[i].data.text.style,
|
|
|
|
knockout_entries[i].data.text.text,
|
|
|
|
knockout_entries[i].data.text.length,
|
|
|
|
knockout_entries[i].data.text.bg,
|
|
|
|
knockout_entries[i].data.text.c);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_DISC:
|
|
|
|
success &= plot.disc(
|
|
|
|
knockout_entries[i].data.disc.x,
|
|
|
|
knockout_entries[i].data.disc.y,
|
|
|
|
knockout_entries[i].data.disc.radius,
|
|
|
|
knockout_entries[i].data.disc.colour,
|
|
|
|
knockout_entries[i].data.disc.filled);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_ARC:
|
|
|
|
success &= plot.arc(
|
|
|
|
knockout_entries[i].data.arc.x,
|
|
|
|
knockout_entries[i].data.arc.y,
|
|
|
|
knockout_entries[i].data.arc.radius,
|
|
|
|
knockout_entries[i].data.arc.angle1,
|
|
|
|
knockout_entries[i].data.arc.angle2,
|
|
|
|
knockout_entries[i].data.arc.c);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_BITMAP:
|
|
|
|
success &= plot.bitmap(
|
|
|
|
knockout_entries[i].data.bitmap.x,
|
|
|
|
knockout_entries[i].data.bitmap.y,
|
|
|
|
knockout_entries[i].data.bitmap.width,
|
|
|
|
knockout_entries[i].data.bitmap.height,
|
|
|
|
knockout_entries[i].data.bitmap.bitmap,
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
knockout_entries[i].data.bitmap.bg,
|
|
|
|
knockout_entries[i].data.bitmap.content);
|
2006-07-01 22:16:05 +04:00
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_BITMAP_TILE:
|
|
|
|
box = knockout_entries[i].box->child;
|
|
|
|
if (box) {
|
|
|
|
success &= knockout_plot_bitmap_tile_recursive(box,
|
|
|
|
&knockout_entries[i]);
|
|
|
|
} else if (!knockout_entries[i].box->deleted) {
|
|
|
|
success &= plot.bitmap_tile(
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.x,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.y,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.width,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.height,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.bitmap,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.bg,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.repeat_x,
|
|
|
|
knockout_entries[i].data.
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
bitmap_tile.repeat_y,
|
|
|
|
knockout_entries[i].data.
|
|
|
|
bitmap_tile.content);
|
2006-07-01 22:16:05 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_GROUP_START:
|
|
|
|
success &= plot.group_start(
|
|
|
|
knockout_entries[i].data.group_start.name);
|
|
|
|
break;
|
|
|
|
case KNOCKOUT_PLOT_GROUP_END:
|
|
|
|
success &= plot.group_end();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
knockout_entry_cur = 0;
|
|
|
|
knockout_box_cur = 0;
|
|
|
|
knockout_polygon_cur = 0;
|
|
|
|
knockout_list = NULL;
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-02 21:23:49 +04:00
|
|
|
/* re-instate knockout plotters if we are still active */
|
|
|
|
if (nested_depth > 0)
|
2006-07-10 13:52:31 +04:00
|
|
|
knockout_set_plotters();
|
2006-07-01 22:16:05 +04:00
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-10 13:52:31 +04:00
|
|
|
/**
|
|
|
|
* Override the current plotters with the knockout plotters
|
|
|
|
*/
|
|
|
|
void knockout_set_plotters(void)
|
|
|
|
{
|
|
|
|
plot = knockout_plotters;
|
|
|
|
if (!real_plot.group_start)
|
|
|
|
plot.group_start = NULL;
|
|
|
|
if (!real_plot.group_end)
|
|
|
|
plot.group_end = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/**
|
|
|
|
* Knockout a section of previous rendering
|
|
|
|
*
|
|
|
|
* \param x0 the left edge of the removal box
|
|
|
|
* \param y0 the bottom edge of the removal box
|
|
|
|
* \param x1 the right edge of the removal box
|
|
|
|
* \param y1 the top edge of the removal box
|
2006-07-02 17:18:29 +04:00
|
|
|
* \param box the parent box set to consider, or NULL for top level
|
2006-07-01 22:16:05 +04:00
|
|
|
*/
|
2006-07-02 17:18:29 +04:00
|
|
|
void knockout_calculate(int x0, int y0, int x1, int y1, struct knockout_box *owner)
|
2006-07-01 22:16:05 +04:00
|
|
|
{
|
2006-07-02 17:18:29 +04:00
|
|
|
struct knockout_box *box;
|
2006-07-01 22:16:05 +04:00
|
|
|
struct knockout_box *parent;
|
2006-07-02 17:18:29 +04:00
|
|
|
struct knockout_box *prev = NULL;
|
2006-07-01 22:16:05 +04:00
|
|
|
int nx0, ny0, nx1, ny1;
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-02 17:18:29 +04:00
|
|
|
if (owner == NULL)
|
|
|
|
box = knockout_list;
|
|
|
|
else
|
|
|
|
box = owner->child;
|
2006-07-01 22:16:05 +04:00
|
|
|
|
|
|
|
for (parent = box; parent; parent = parent->next) {
|
2006-07-02 17:18:29 +04:00
|
|
|
/* permanently delink deleted nodes */
|
|
|
|
if (parent->deleted) {
|
|
|
|
if (prev) {
|
|
|
|
/* not the first valid element: just skip future */
|
|
|
|
prev->next = parent->next;
|
|
|
|
} else {
|
|
|
|
if (owner) {
|
|
|
|
/* first valid element: update child reference */
|
|
|
|
owner->child = parent->next;
|
2006-07-02 21:23:49 +04:00
|
|
|
/* have we deleted all child nodes? */
|
2006-07-02 17:18:29 +04:00
|
|
|
if (!owner->child)
|
|
|
|
owner->deleted = true;
|
|
|
|
} else {
|
|
|
|
/* we are the head of the list */
|
|
|
|
knockout_list = parent->next;
|
|
|
|
}
|
|
|
|
}
|
2006-07-01 22:16:05 +04:00
|
|
|
continue;
|
2006-07-02 17:18:29 +04:00
|
|
|
} else {
|
|
|
|
prev = parent;
|
|
|
|
}
|
|
|
|
|
2006-07-02 05:36:02 +04:00
|
|
|
/* get the parent dimensions */
|
|
|
|
nx0 = parent->bbox.x0;
|
|
|
|
ny0 = parent->bbox.y0;
|
|
|
|
nx1 = parent->bbox.x1;
|
|
|
|
ny1 = parent->bbox.y1;
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* reject non-overlapping boxes */
|
2006-07-02 05:36:02 +04:00
|
|
|
if ((nx0 >= x1) || (nx1 <= x0) || (ny0 >= y1) || (ny1 <= y0))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* check for a total knockout */
|
|
|
|
if ((x0 <= nx0) && (x1 >= nx1) && (y0 <= ny0) && (y1 >= ny1)) {
|
|
|
|
parent->deleted = true;
|
2006-07-01 22:16:05 +04:00
|
|
|
continue;
|
2006-07-02 05:36:02 +04:00
|
|
|
}
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* has the box been replaced by children? */
|
|
|
|
if (parent->child) {
|
2006-07-02 17:18:29 +04:00
|
|
|
knockout_calculate(x0, y0, x1, y1, parent);
|
2006-07-01 22:16:05 +04:00
|
|
|
} else {
|
|
|
|
/* we need a maximum of 4 child boxes */
|
2006-07-02 05:36:02 +04:00
|
|
|
if (knockout_box_cur + 4 >= KNOCKOUT_BOXES) {
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clip top */
|
|
|
|
if (y1 < ny1) {
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x0 = nx0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y0 = y1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x1 = nx1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y1 = ny1;
|
|
|
|
knockout_boxes[knockout_box_cur].deleted = false;
|
|
|
|
knockout_boxes[knockout_box_cur].child = NULL;
|
|
|
|
knockout_boxes[knockout_box_cur].next = parent->child;
|
|
|
|
parent->child = &knockout_boxes[knockout_box_cur++];
|
|
|
|
ny1 = y1;
|
|
|
|
}
|
|
|
|
/* clip bottom */
|
|
|
|
if (y0 > ny0) {
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x0 = nx0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y0 = ny0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x1 = nx1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y1 = y0;
|
|
|
|
knockout_boxes[knockout_box_cur].deleted = false;
|
|
|
|
knockout_boxes[knockout_box_cur].child = NULL;
|
|
|
|
knockout_boxes[knockout_box_cur].next = parent->child;
|
|
|
|
parent->child = &knockout_boxes[knockout_box_cur++];
|
|
|
|
ny0 = y0;
|
|
|
|
}
|
|
|
|
/* clip right */
|
|
|
|
if (x1 < nx1) {
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x0 = x1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y0 = ny0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x1 = nx1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y1 = ny1;
|
|
|
|
knockout_boxes[knockout_box_cur].deleted = false;
|
|
|
|
knockout_boxes[knockout_box_cur].child = NULL;
|
|
|
|
knockout_boxes[knockout_box_cur].next = parent->child;
|
|
|
|
parent->child = &knockout_boxes[knockout_box_cur++];
|
|
|
|
nx1 = x1;
|
|
|
|
}
|
|
|
|
/* clip left */
|
|
|
|
if (x0 > nx0) {
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x0 = nx0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y0 = ny0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x1 = x0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y1 = ny1;
|
|
|
|
knockout_boxes[knockout_box_cur].deleted = false;
|
|
|
|
knockout_boxes[knockout_box_cur].child = NULL;
|
|
|
|
knockout_boxes[knockout_box_cur].next = parent->child;
|
|
|
|
parent->child = &knockout_boxes[knockout_box_cur++];
|
|
|
|
//nx0 = x0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_fill_recursive(struct knockout_box *box, colour c)
|
|
|
|
{
|
|
|
|
bool success = true;
|
|
|
|
struct knockout_box *parent;
|
|
|
|
|
|
|
|
for (parent = box; parent; parent = parent->next) {
|
|
|
|
if (parent->deleted)
|
|
|
|
continue;
|
|
|
|
if (parent->child)
|
|
|
|
knockout_plot_fill_recursive(parent->child, c);
|
|
|
|
else
|
|
|
|
success &= plot.fill(parent->bbox.x0,
|
|
|
|
parent->bbox.y0,
|
|
|
|
parent->bbox.x1,
|
|
|
|
parent->bbox.y1,
|
|
|
|
c);
|
|
|
|
}
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_bitmap_tile_recursive(struct knockout_box *box,
|
|
|
|
struct knockout_entry *entry)
|
|
|
|
{
|
|
|
|
bool success = true;
|
|
|
|
struct knockout_box *parent;
|
|
|
|
|
|
|
|
for (parent = box; parent; parent = parent->next) {
|
|
|
|
if (parent->deleted)
|
|
|
|
continue;
|
|
|
|
if (parent->child)
|
|
|
|
knockout_plot_bitmap_tile_recursive(parent->child, entry);
|
|
|
|
else {
|
|
|
|
success &= plot.clip(parent->bbox.x0,
|
|
|
|
parent->bbox.y0,
|
|
|
|
parent->bbox.x1,
|
|
|
|
parent->bbox.y1);
|
|
|
|
success &= plot.bitmap_tile(entry->data.bitmap_tile.x,
|
|
|
|
entry->data.bitmap_tile.y,
|
|
|
|
entry->data.bitmap_tile.width,
|
|
|
|
entry->data.bitmap_tile.height,
|
|
|
|
entry->data.bitmap_tile.bitmap,
|
|
|
|
entry->data.bitmap_tile.bg,
|
|
|
|
entry->data.bitmap_tile.repeat_x,
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
entry->data.bitmap_tile.repeat_y,
|
|
|
|
entry->data.bitmap_tile.content);
|
2006-07-01 22:16:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool knockout_plot_clg(colour c)
|
|
|
|
{
|
|
|
|
return knockout_plot_fill(clip_x0_cur, clip_y0_cur, clip_x1_cur, clip_y1_cur, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_rectangle(int x0, int y0, int width, int height,
|
|
|
|
int line_width, colour c, bool dotted, bool dashed)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.x0 = x0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.y0 = y0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.width = width;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.height = height;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.line_width = line_width;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.c = c;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.dotted = dotted;
|
|
|
|
knockout_entries[knockout_entry_cur].data.rectangle.dashed = dashed;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_RECTANGLE;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
|
|
|
|
colour c, bool dotted, bool dashed)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.x0 = x0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.y0 = y0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.x1 = x1;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.y1 = y1;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.width = width;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.c = c;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.dotted = dotted;
|
|
|
|
knockout_entries[knockout_entry_cur].data.line.dashed = dashed;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_LINE;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 04:27:54 +03:00
|
|
|
bool knockout_plot_polygon(const int *p, unsigned int n, colour fill)
|
2006-07-01 22:16:05 +04:00
|
|
|
{
|
|
|
|
bool success = true;
|
|
|
|
int *dest;
|
|
|
|
|
|
|
|
/* ensure we have sufficient room even when flushed */
|
|
|
|
if (n * 2 >= KNOCKOUT_POLYGONS) {
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2007-12-11 05:45:38 +03:00
|
|
|
success = real_plot.polygon(p, n, fill);
|
2006-07-01 22:16:05 +04:00
|
|
|
return success;
|
|
|
|
}
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* ensure we have enough room right now */
|
|
|
|
if (knockout_polygon_cur + n * 2 >= KNOCKOUT_POLYGONS)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* copy our data */
|
|
|
|
dest = &(knockout_polygons[knockout_polygon_cur]);
|
|
|
|
memcpy(dest, p, n * 2 * sizeof(int));
|
|
|
|
knockout_polygon_cur += n * 2;
|
|
|
|
knockout_entries[knockout_entry_cur].data.polygon.p = dest;
|
|
|
|
knockout_entries[knockout_entry_cur].data.polygon.n = n;
|
|
|
|
knockout_entries[knockout_entry_cur].data.polygon.fill = fill;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_POLYGON;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 04:27:54 +03:00
|
|
|
bool knockout_plot_path(const float *p, unsigned int n, colour fill,
|
|
|
|
float width, colour c, const float transform[6])
|
2007-11-29 08:50:21 +03:00
|
|
|
{
|
2007-12-11 05:45:38 +03:00
|
|
|
knockout_plot_flush();
|
|
|
|
return real_plot.path(p, n, fill, width, c, transform);
|
2007-11-29 08:50:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
bool knockout_plot_fill(int x0, int y0, int x1, int y1, colour c)
|
|
|
|
{
|
2006-07-02 17:18:29 +04:00
|
|
|
int kx0, ky0, kx1, ky1;
|
|
|
|
|
|
|
|
/* get our bounds */
|
|
|
|
kx0 = (x0 > clip_x0_cur) ? x0 : clip_x0_cur;
|
|
|
|
ky0 = (y0 > clip_y0_cur) ? y0 : clip_y0_cur;
|
|
|
|
kx1 = (x1 < clip_x1_cur) ? x1 : clip_x1_cur;
|
|
|
|
ky1 = (y1 < clip_y1_cur) ? y1 : clip_y1_cur;
|
|
|
|
if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur) ||
|
|
|
|
(ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
|
|
|
|
return true;
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* fills both knock out and get knocked out */
|
2006-07-02 17:18:29 +04:00
|
|
|
knockout_calculate(kx0, ky0, kx1, ky1, NULL);
|
2006-07-01 22:16:05 +04:00
|
|
|
knockout_boxes[knockout_box_cur].bbox.x0 = x0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y0 = y0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x1 = x1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y1 = y1;
|
|
|
|
knockout_boxes[knockout_box_cur].deleted = false;
|
|
|
|
knockout_boxes[knockout_box_cur].child = NULL;
|
|
|
|
knockout_boxes[knockout_box_cur].next = knockout_list;
|
|
|
|
knockout_list = &knockout_boxes[knockout_box_cur];
|
|
|
|
knockout_entries[knockout_entry_cur].box = &knockout_boxes[knockout_box_cur];
|
|
|
|
knockout_entries[knockout_entry_cur].data.fill.x0 = x0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.fill.y0 = y0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.fill.x1 = x1;
|
|
|
|
knockout_entries[knockout_entry_cur].data.fill.y1 = y1;
|
|
|
|
knockout_entries[knockout_entry_cur].data.fill.c = c;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_FILL;
|
|
|
|
if ((++knockout_entry_cur >= KNOCKOUT_ENTRIES) ||
|
|
|
|
(++knockout_box_cur >= KNOCKOUT_BOXES))
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_clip(int clip_x0, int clip_y0,
|
|
|
|
int clip_x1, int clip_y1)
|
|
|
|
{
|
|
|
|
if (clip_x1 < clip_x0 || clip_y0 > clip_y1) {
|
|
|
|
LOG(("bad clip rectangle %i %i %i %i",
|
|
|
|
clip_x0, clip_y0, clip_x1, clip_y1));
|
|
|
|
return false;
|
|
|
|
}
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* memorise clip for bitmap tiling */
|
|
|
|
clip_x0_cur = clip_x0;
|
|
|
|
clip_y0_cur = clip_y0;
|
|
|
|
clip_x1_cur = clip_x1;
|
|
|
|
clip_y1_cur = clip_y1;
|
|
|
|
|
|
|
|
knockout_entries[knockout_entry_cur].data.clip.x0 = clip_x0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.clip.y0 = clip_y0;
|
|
|
|
knockout_entries[knockout_entry_cur].data.clip.x1 = clip_x1;
|
|
|
|
knockout_entries[knockout_entry_cur].data.clip.y1 = clip_y1;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_CLIP;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-07 15:15:09 +04:00
|
|
|
bool knockout_plot_text(int x, int y, const struct css_style *style,
|
2006-07-01 22:16:05 +04:00
|
|
|
const char *text, size_t length, colour bg, colour c)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.x = x;
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.y = y;
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.style = style;
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.text = text;
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.length = length;
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.bg = bg;
|
|
|
|
knockout_entries[knockout_entry_cur].data.text.c = c;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_TEXT;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_disc(int x, int y, int radius, colour colour, bool filled)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].data.disc.x = x;
|
|
|
|
knockout_entries[knockout_entry_cur].data.disc.y = y;
|
|
|
|
knockout_entries[knockout_entry_cur].data.disc.radius = radius;
|
|
|
|
knockout_entries[knockout_entry_cur].data.disc.colour = colour;
|
|
|
|
knockout_entries[knockout_entry_cur].data.disc.filled = filled;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_DISC;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool knockout_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].data.arc.x = x;
|
|
|
|
knockout_entries[knockout_entry_cur].data.arc.y = y;
|
|
|
|
knockout_entries[knockout_entry_cur].data.arc.radius = radius;
|
|
|
|
knockout_entries[knockout_entry_cur].data.arc.angle1 = angle1;
|
|
|
|
knockout_entries[knockout_entry_cur].data.arc.angle2 = angle2;
|
|
|
|
knockout_entries[knockout_entry_cur].data.arc.c = c;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_ARC;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool knockout_plot_bitmap(int x, int y, int width, int height,
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
struct bitmap *bitmap, colour bg, struct content *content)
|
2006-07-01 22:16:05 +04:00
|
|
|
{
|
2006-07-02 17:18:29 +04:00
|
|
|
int kx0, ky0, kx1, ky1;
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* opaque bitmaps knockout, but don't get knocked out */
|
2006-07-02 17:18:29 +04:00
|
|
|
if (bitmap_get_opaque(bitmap)) {
|
|
|
|
/* get our bounds */
|
|
|
|
kx0 = (x > clip_x0_cur) ? x : clip_x0_cur;
|
|
|
|
ky0 = (y > clip_y0_cur) ? y : clip_y0_cur;
|
|
|
|
kx1 = (x + width < clip_x1_cur) ? x + width : clip_x1_cur;
|
|
|
|
ky1 = (y + height< clip_y1_cur) ? y + height: clip_y1_cur;
|
|
|
|
if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur) ||
|
|
|
|
(ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
|
|
|
|
return true;
|
|
|
|
knockout_calculate(kx0, ky0, kx1, ky1, NULL);
|
|
|
|
}
|
2006-07-01 22:16:05 +04:00
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.x = x;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.y = y;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.width = width;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.height = height;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.bitmap = bitmap;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.bg = bg;
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap.content = content;
|
2006-07-01 22:16:05 +04:00
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_BITMAP;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool knockout_plot_bitmap_tile(int x, int y, int width, int height,
|
|
|
|
struct bitmap *bitmap, colour bg,
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
bool repeat_x, bool repeat_y, struct content *content)
|
2006-07-01 22:16:05 +04:00
|
|
|
{
|
2006-07-02 17:18:29 +04:00
|
|
|
int kx0, ky0, kx1, ky1;
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-07-02 17:18:29 +04:00
|
|
|
/* get our bounds */
|
|
|
|
kx0 = clip_x0_cur;
|
|
|
|
ky0 = clip_y0_cur;
|
|
|
|
kx1 = clip_x1_cur;
|
|
|
|
ky1 = clip_y1_cur;
|
|
|
|
if (!repeat_x) {
|
|
|
|
if (x > kx0)
|
|
|
|
kx0 = x;
|
|
|
|
if (x + width < kx1)
|
|
|
|
kx1 = x + width;
|
|
|
|
if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!repeat_y) {
|
|
|
|
if (y > ky0)
|
|
|
|
ky0 = y;
|
|
|
|
if (y + height < ky1)
|
|
|
|
ky1 = y + height;
|
|
|
|
if ((ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-07-01 22:16:05 +04:00
|
|
|
/* tiled bitmaps both knock out and get knocked out */
|
2006-07-02 17:18:29 +04:00
|
|
|
if (bitmap_get_opaque(bitmap))
|
|
|
|
knockout_calculate(kx0, ky0, kx1, ky1, NULL);
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x0 = kx0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y0 = ky0;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.x1 = kx1;
|
|
|
|
knockout_boxes[knockout_box_cur].bbox.y1 = ky1;
|
2006-07-01 22:16:05 +04:00
|
|
|
knockout_boxes[knockout_box_cur].deleted = false;
|
|
|
|
knockout_boxes[knockout_box_cur].child = NULL;
|
|
|
|
knockout_boxes[knockout_box_cur].next = knockout_list;
|
|
|
|
knockout_list = &knockout_boxes[knockout_box_cur];
|
|
|
|
knockout_entries[knockout_entry_cur].box = &knockout_boxes[knockout_box_cur];
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.x = x;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.y = y;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.width = width;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.height = height;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.bitmap = bitmap;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.bg = bg;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.repeat_x = repeat_x;
|
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.repeat_y = repeat_y;
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
knockout_entries[knockout_entry_cur].data.bitmap_tile.content = content;
|
2006-07-01 22:16:05 +04:00
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_BITMAP_TILE;
|
|
|
|
if ((++knockout_entry_cur >= KNOCKOUT_ENTRIES) ||
|
|
|
|
(++knockout_box_cur >= KNOCKOUT_BOXES))
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-02 17:18:29 +04:00
|
|
|
return knockout_plot_clip(clip_x0_cur, clip_y0_cur, clip_x1_cur, clip_y1_cur);
|
2006-07-01 22:16:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool knockout_plot_group_start(const char *name)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].data.group_start.name = name;
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_GROUP_START;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool knockout_plot_group_end(void)
|
|
|
|
{
|
|
|
|
knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_GROUP_END;
|
|
|
|
if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
|
2006-07-02 20:17:51 +04:00
|
|
|
knockout_plot_flush();
|
2006-07-01 22:16:05 +04:00
|
|
|
return true;
|
|
|
|
}
|