Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dvi/pixbuf-device.c
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2007-01-08 12:25:31 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2007-01-08 12:25:31 (GMT)
commit13a06349251874bd35d2f03c3fc93217cee749a2 (patch)
treea681279b008acb19f686ee265aaed2be0da8d9e8 /dvi/pixbuf-device.c
parentafb550ab779e00918d8fe24742abee3a81ebfe93 (diff)
Reorganize source tree.
2007-01-08 Nickolay V. Shmyrev <nshmyrev@yandex.ru> * Makefile.am: * backend/Makefile.am: * backend/comics/Makefile.am: * backend/djvu/Makefile.am: * backend/dvi/Makefile.am: * backend/ev-async-renderer.c: * backend/ev-async-renderer.h: * backend/ev-attachment.c: * backend/ev-attachment.h: * backend/ev-backend-marshal.c: * backend/ev-document-factory.c: * backend/ev-document-factory.h: * backend/ev-document-find.c: * backend/ev-document-find.h: * backend/ev-document-fonts.c: * backend/ev-document-fonts.h: * backend/ev-document-images.c: * backend/ev-document-images.h: * backend/ev-document-info.h: * backend/ev-document-links.c: * backend/ev-document-links.h: * backend/ev-document-misc.c: * backend/ev-document-misc.h: * backend/ev-document-security.c: * backend/ev-document-security.h: * backend/ev-document-thumbnails.c: * backend/ev-document-thumbnails.h: * backend/ev-document-transition.c: * backend/ev-document-transition.h: * backend/ev-document.c: * backend/ev-document.h: * backend/ev-file-exporter.c: * backend/ev-file-exporter.h: * backend/ev-image.c: * backend/ev-image.h: * backend/ev-link-action.c: * backend/ev-link-action.h: * backend/ev-link-dest.c: * backend/ev-link-dest.h: * backend/ev-link.c: * backend/ev-link.h: * backend/ev-render-context.c: * backend/ev-render-context.h: * backend/ev-selection.c: * backend/ev-selection.h: * backend/impress/Makefile.am: * backend/pdf/Makefile.am: * backend/pixbuf/Makefile.am: * backend/ps/Makefile.am: * backend/ps/ps-document.c: (push_pixbuf), (interpreter_failed), (ps_document_widget_event), (setup_pixmap), (setup_page), (input), (start_interpreter), (stop_interpreter), (document_load), (ps_document_next_page), (render_page): * backend/tiff/Makefile.am: * comics/Makefile.am: * comics/comics-document.c: * comics/comics-document.h: * configure.ac: * cut-n-paste/zoom-control/ephy-zoom-control.c: * djvu/Makefile.am: * djvu/djvu-document-private.h: * djvu/djvu-document.c: * djvu/djvu-document.h: * djvu/djvu-links.c: * djvu/djvu-links.h: * djvu/djvu-text-page.c: * djvu/djvu-text-page.h: * djvu/djvu-text.c: * djvu/djvu-text.h: * dvi/Makefile.am: * dvi/dvi-document.c: * dvi/dvi-document.h: * dvi/fonts.c: * dvi/fonts.h: * dvi/mdvi-lib/Makefile.am: * dvi/mdvi-lib/afmparse.c: * dvi/mdvi-lib/afmparse.h: * dvi/mdvi-lib/bitmap.c: * dvi/mdvi-lib/bitmap.h: * dvi/mdvi-lib/color.c: * dvi/mdvi-lib/color.h: * dvi/mdvi-lib/common.c: * dvi/mdvi-lib/common.h: * dvi/mdvi-lib/defaults.h: * dvi/mdvi-lib/dvimisc.c: * dvi/mdvi-lib/dviopcodes.h: * dvi/mdvi-lib/dviread.c: * dvi/mdvi-lib/files.c: * dvi/mdvi-lib/font.c: * dvi/mdvi-lib/fontmap.c: * dvi/mdvi-lib/fontmap.h: * dvi/mdvi-lib/fontsrch.c: * dvi/mdvi-lib/gf.c: * dvi/mdvi-lib/hash.c: * dvi/mdvi-lib/hash.h: * dvi/mdvi-lib/list.c: * dvi/mdvi-lib/mdvi.h: * dvi/mdvi-lib/pagesel.c: * dvi/mdvi-lib/paper.c: * dvi/mdvi-lib/paper.h: * dvi/mdvi-lib/pk.c: * dvi/mdvi-lib/private.h: * dvi/mdvi-lib/setup.c: * dvi/mdvi-lib/sp-epsf.c: * dvi/mdvi-lib/special.c: * dvi/mdvi-lib/sysdeps.h: * dvi/mdvi-lib/t1.c: * dvi/mdvi-lib/tfm.c: * dvi/mdvi-lib/tfmfile.c: * dvi/mdvi-lib/tt.c: * dvi/mdvi-lib/util.c: * dvi/mdvi-lib/vf.c: * dvi/pixbuf-device.c: * dvi/pixbuf-device.h: * impress/Makefile.am: * impress/common.h: * impress/document.c: * impress/f_oasis.c: * impress/f_oo13.c: * impress/iksemel.c: * impress/iksemel.h: * impress/imposter.h: * impress/impress-document.c: * impress/impress-document.h: * impress/internal.h: * impress/r_back.c: * impress/r_draw.c: * impress/r_geometry.c: * impress/r_gradient.c: * impress/r_style.c: * impress/r_text.c: * impress/render.c: * impress/render.h: * impress/zip.c: * impress/zip.h: * lib/Makefile.am: * lib/ev-debug.c: * lib/ev-debug.h: * lib/ev-file-helpers.c: * lib/ev-file-helpers.h: * lib/ev-gui.c: * lib/ev-gui.h: * lib/ev-tooltip.c: * lib/ev-tooltip.h: * libdocument/Makefile.am: * libdocument/ev-file-helpers.c: * pdf/Makefile.am: * pdf/ev-poppler.cc: * pdf/ev-poppler.h: * pixbuf/Makefile.am: * pixbuf/pixbuf-document.c: * pixbuf/pixbuf-document.h: * properties/Makefile.am: * ps/Makefile.am: * ps/gsdefaults.c: * ps/gsdefaults.h: * ps/gsio.c: * ps/gsio.h: * ps/gstypes.h: * ps/ps-document.c: * ps/ps-document.h: * ps/ps.c: * ps/ps.h: * shell/Makefile.am: * shell/ev-application.h: * shell/ev-sidebar-links.c: * shell/ev-sidebar-links.h: * shell/ev-utils.c: (ev_gui_sanitise_popup_position), (ev_gui_menu_position_tree_selection): * shell/ev-utils.h: * shell/ev-view.c: (ev_view_finalize): * shell/ev-window.c: * shell/main.c: (main): * thumbnailer/Makefile.am: * tiff/Makefile.am: * tiff/tiff-document.c: * tiff/tiff-document.h: * tiff/tiff2ps.c: * tiff/tiff2ps.h: Reorganize source tree. svn path=/trunk/; revision=2197
Diffstat (limited to 'dvi/pixbuf-device.c')
-rw-r--r--dvi/pixbuf-device.c220
1 files changed, 0 insertions, 220 deletions
diff --git a/dvi/pixbuf-device.c b/dvi/pixbuf-device.c
deleted file mode 100644
index 1ef4365..0000000
--- a/dvi/pixbuf-device.c
+++ /dev/null
@@ -1,220 +0,0 @@
-#include "pixbuf-device.h"
-#include <gtk/gtk.h>
-
-typedef struct _DviPixbufDevice
-{
- GdkPixbuf *pixbuf;
-
- gboolean valid;
-
- gint xmargin;
- gint ymargin;
-
- Ulong fg;
- Ulong bg;
-
-} DviPixbufDevice;
-
-static void dvi_pixbuf_draw_rule(DviContext *dvi, int x, int y, Uint w, Uint h, int fill);
-
-static void dvi_pixbuf_draw_glyph(DviContext *dvi, DviFontChar *ch, int x0, int y0)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) dvi->device.device_data;
-
- int x, y, w, h;
- int isbox;
- DviGlyph *glyph;
-
- glyph = &ch->grey;
-
- isbox = (glyph->data == NULL || (dvi->params.flags & MDVI_PARAM_CHARBOXES));
-
- x = - glyph->x + x0 + c_device->xmargin;
- y = - glyph->y + y0 + c_device->ymargin;
- w = glyph->w;
- h = glyph->h;
-
- if (x < 0 || y < 0
- || x + w > gdk_pixbuf_get_width (c_device->pixbuf)
- || y + h > gdk_pixbuf_get_height (c_device->pixbuf))
- return;
-
- if (isbox) {
- dvi_pixbuf_draw_rule(dvi, x - c_device->xmargin, y - c_device->ymargin, w, h, FALSE);
- }
- else {
- gdk_pixbuf_copy_area (GDK_PIXBUF (glyph->data),
- 0, 0,
- w, h,
- c_device->pixbuf, x, y);
- }
-}
-
-static void dvi_pixbuf_draw_rule(DviContext *dvi, int x, int y, Uint w, Uint h, int fill)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) dvi->device.device_data;
- gint rowstride;
- guchar *p;
- gint i, j;
- gint red, green, blue;
-
- red = (c_device->fg >> 16) & 0xff;
- green = (c_device->fg >> 8) & 0xff;
- blue = c_device->fg & 0xff;
-
- x += c_device->xmargin; y += c_device->ymargin;
-
- if (x < 0 || y < 0
- || x + w > gdk_pixbuf_get_width (c_device->pixbuf)
- || y + h > gdk_pixbuf_get_height (c_device->pixbuf))
- return;
-
- rowstride = gdk_pixbuf_get_rowstride (c_device->pixbuf);
- p = gdk_pixbuf_get_pixels (c_device->pixbuf) + rowstride * y + 3 * x;
-
- for (i = 0; i < h; i++) {
- if (i == 0 || i == h - 1 || fill) {
- for (j = 0; j < w; j++) {
- p[j * 3] = red;
- p[j * 3 + 1] = green;
- p[j * 3 + 2] = blue;
- }
- } else {
- p[0] = red;
- p[1] = green;
- p[2] = blue;
- p[(w - 1) * 3] = red;
- p[(w - 1) * 3 + 1] = green;
- p[(w - 1) * 3 + 2] = blue;
- }
- p += rowstride;
- }
-}
-
-static int dvi_pixbuf_interpolate_colors(void *device_data,
- Ulong *pixels, int nlevels, Ulong fg, Ulong bg, double g, int density)
-{
- double frac;
- GdkColor color, color_fg, color_bg;
- int i, n;
-
- color_bg.red = (bg >> 16) & 0xff;
- color_bg.green = (bg >> 8) & 0xff;
- color_bg.blue = bg & 0xff;
-
- color_fg.red = fg >> 16 & 0xff;
- color_fg.green = fg >> 8 & 0xff;
- color_fg.blue = fg & 0xff;
-
- n = nlevels - 1;
- for(i = 0; i < nlevels; i++) {
- if(g > 0)
- frac = pow((double)i / n, 1 / g);
- else
- frac = 1 - pow((double)(n - i) / n, -g);
- color.red = frac * ((double)color_fg.red - color_bg.red) + color_bg.red;
- color.green = frac * ((double)color_fg.green - color_bg.green) + color_bg.green;
- color.blue = frac * ((double)color_fg.blue - color_bg.blue) + color_bg.blue;
-
- pixels[i] = (color.red << 16) + (color.green << 8) + color.blue + 0xff000000;
- }
-
- return nlevels;
-}
-
-static void *dvi_pixbuf_create_image(void *device_data, Uint w, Uint h, Uint bpp)
-{
-
- return gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h);
-
- return NULL;
-}
-
-static void dvi_pixbuf_free_image(void *ptr)
-{
- g_object_unref (GDK_PIXBUF(ptr));
-}
-
-static void dvi_pixbuf_put_pixel(void *image, int x, int y, Ulong color)
-{
- guchar *p;
-
- p = gdk_pixbuf_get_pixels (GDK_PIXBUF(image)) + y * gdk_pixbuf_get_rowstride(GDK_PIXBUF(image)) + x * 3;
-
- p[0] = (color >> 16) & 0xff;
- p[1] = (color >> 8) & 0xff;
- p[2] = color & 0xff;
-}
-
-static void dvi_pixbuf_set_color(void *device_data, Ulong fg, Ulong bg)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) device_data;
-
- c_device->fg = fg;
-
- return;
-}
-
-void mdvi_pixbuf_device_init (DviDevice *device)
-{
- device->device_data =
- g_new0 (DviPixbufDevice, 1);
-
- device->draw_glyph = dvi_pixbuf_draw_glyph;
- device->draw_rule = dvi_pixbuf_draw_rule;
- device->alloc_colors = dvi_pixbuf_interpolate_colors;
- device->create_image = dvi_pixbuf_create_image;
- device->free_image = dvi_pixbuf_free_image;
- device->put_pixel = dvi_pixbuf_put_pixel;
- device->set_color = dvi_pixbuf_set_color;
- device->refresh = NULL;
-
- return;
-}
-
-void mdvi_pixbuf_device_free (DviDevice *device)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) device->device_data;
-
- if (c_device->pixbuf)
- g_object_unref (c_device->pixbuf);
-
- g_free (c_device);
-}
-
-GdkPixbuf *
-mdvi_pixbuf_device_get_pixbuf (DviDevice *device)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) device->device_data;
-
- return g_object_ref (c_device->pixbuf);
-}
-
-void
-mdvi_pixbuf_device_render (DviContext * dvi)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) dvi->device.device_data;
- gint page_width;
- gint page_height;
-
- if (c_device->pixbuf)
- g_object_unref (c_device->pixbuf);
-
- page_width = dvi->dvi_page_w * dvi->params.conv + 2 * c_device->xmargin;
- page_height = dvi->dvi_page_h * dvi->params.vconv + 2 * c_device->ymargin;
-
- c_device->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, page_width, page_height);
- gdk_pixbuf_fill (c_device->pixbuf, 0xffffffff);
-
- mdvi_dopage (dvi, dvi->currpage);
-}
-
-
-void
-mdvi_pixbuf_device_set_margins (DviDevice *device, gint xmargin, gint ymargin)
-{
- DviPixbufDevice *c_device = (DviPixbufDevice *) device->device_data;
-
- c_device->xmargin = xmargin;
- c_device->ymargin = ymargin;
-}