~matthewpetroff/inkscape/gsoc-2013-unit-refactor

« back to all changes in this revision

Viewing changes to src/extension/internal/emf-win32-print.cpp

  • Committer: Matthew Petroff
  • Date: 2013-08-01 20:28:56 UTC
  • Revision ID: matthew@mpetroff.net-20130801202856-jt6mo0aahhgpvjpv
Fixed Windows compile bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include "helper/geom.h"
37
37
#include "helper/geom-curves.h"
38
38
#include "sp-item.h"
 
39
#include "util/units.h"
39
40
 
40
41
#include "style.h"
41
42
#include "inkscape-version.h"
127
128
        if (bbox) d = *bbox;
128
129
    }
129
130
 
130
 
    d *= Geom::Scale(Inkscape::Util::Quantity::Convert(1, "px", "in"));
 
131
    d *= Geom::Scale(Inkscape::Util::Quantity::convert(1, "px", "in"));
131
132
 
132
133
    float dwInchesX = d.width();
133
134
    float dwInchesY = d.height();
194
195
        snprintf(buff, sizeof(buff)-1, "Screen=%dx%dpx, %dx%dmm", PixelsX, PixelsY, MMX, MMY);
195
196
        GdiComment(hdc, strlen(buff), (BYTE*) buff);
196
197
 
197
 
        snprintf(buff, sizeof(buff)-1, "Drawing=%.1lfx%.1lfpx, %.1lfx%.1lfmm", _width, _height, dwInchesX * Inkscape::Util::Quantity::Convert(1, "in", "mm"), dwInchesY * Inkscape::Util::Quantity::Convert(1, "in", "mm"));
 
198
        snprintf(buff, sizeof(buff)-1, "Drawing=%.1lfx%.1lfpx, %.1lfx%.1lfmm", _width, _height, dwInchesX * Inkscape::Util::Quantity::convert(1, "in", "mm"), dwInchesY * Inkscape::Util::Quantity::convert(1, "in", "mm"));
198
199
        GdiComment(hdc, strlen(buff), (BYTE*) buff);
199
200
    }
200
201
 
303
304
 
304
305
        double scale = sqrt( (p[X]*p[X]) + (p[Y]*p[Y]) ) / sqrt(2);
305
306
 
306
 
        DWORD linewidth = MAX( 1, (DWORD) (scale * style->stroke_width.computed * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI) );
 
307
        DWORD linewidth = MAX( 1, (DWORD) (scale * style->stroke_width.computed * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI) );
307
308
 
308
309
        if (style->stroke_linecap.computed == 0) {
309
310
            linecap = PS_ENDCAP_FLAT;
340
341
                n_dash = style->stroke_dash.n_dash;
341
342
                dash = new DWORD[n_dash];
342
343
                for (i = 0; i < style->stroke_dash.n_dash; i++) {
343
 
                    dash[i] = (DWORD) (style->stroke_dash.dash[i] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
344
                    dash[i] = (DWORD) (style->stroke_dash.dash[i] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
344
345
                }
345
346
            }
346
347
        }
543
544
 
544
545
        Geom::Point p0 = pit->initialPoint();
545
546
 
546
 
        p0[X] = (p0[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
547
 
        p0[Y] = (p0[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
547
        p0[X] = (p0[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
548
        p0[Y] = (p0[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
548
549
        
549
550
        LONG const x0 = (LONG) round(p0[X]);
550
551
        LONG const y0 = (LONG) round(rc.bottom-p0[Y]);
563
564
                //Geom::Point p0 = cit->initialPoint();
564
565
                Geom::Point p1 = cit->finalPoint();
565
566
 
566
 
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
567
 
                p1[X] = (p1[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
568
 
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
569
 
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
567
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
568
                p1[X] = (p1[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
569
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
570
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
570
571
                
571
572
                //LONG const x0 = (LONG) round(p0[X]);
572
573
                //LONG const y0 = (LONG) round(rc.bottom-p0[Y]);
585
586
                Geom::Point p2 = points[2];
586
587
                Geom::Point p3 = points[3];
587
588
 
588
 
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
589
 
                p1[X] = (p1[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
590
 
                p2[X] = (p2[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
591
 
                p3[X] = (p3[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
592
 
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
593
 
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
594
 
                p2[Y] = (p2[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
595
 
                p3[Y] = (p3[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
589
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
590
                p1[X] = (p1[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
591
                p2[X] = (p2[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
592
                p3[X] = (p3[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
593
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
594
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
595
                p2[Y] = (p2[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
596
                p3[Y] = (p3[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
596
597
                
597
598
                //LONG const x0 = (LONG) round(p0[X]);
598
599
                //LONG const y0 = (LONG) round(rc.bottom-p0[Y]);
715
716
 
716
717
        Geom::Point p0 = pit->initialPoint();
717
718
 
718
 
        p0[X] = (p0[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
719
 
        p0[Y] = (p0[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
719
        p0[X] = (p0[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
720
        p0[Y] = (p0[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
720
721
        
721
722
        LONG const x0 = (LONG) round(p0[X]);
722
723
        LONG const y0 = (LONG) round(rc.bottom-p0[Y]);
733
734
                //Geom::Point p0 = cit->initialPoint();
734
735
                Geom::Point p1 = cit->finalPoint();
735
736
 
736
 
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
737
 
                p1[X] = (p1[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
738
 
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
739
 
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
737
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
738
                p1[X] = (p1[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
739
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
740
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
740
741
                
741
742
                //LONG const x0 = (LONG) round(p0[X]);
742
743
                //LONG const y0 = (LONG) round(rc.bottom-p0[Y]);
753
754
                Geom::Point p2 = points[2];
754
755
                Geom::Point p3 = points[3];
755
756
 
756
 
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
757
 
                p1[X] = (p1[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
758
 
                p2[X] = (p2[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
759
 
                p3[X] = (p3[X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
760
 
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
761
 
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
762
 
                p2[Y] = (p2[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
763
 
                p3[Y] = (p3[Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
757
                //p0[X] = (p0[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
758
                p1[X] = (p1[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
759
                p2[X] = (p2[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
760
                p3[X] = (p3[X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
761
                //p0[Y] = (p0[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
762
                p1[Y] = (p1[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
763
                p2[Y] = (p2[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
764
                p3[Y] = (p3[Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
764
765
                
765
766
                //LONG const x0 = (LONG) round(p0[X]);
766
767
                //LONG const y0 = (LONG) round(rc.bottom-p0[Y]);
828
829
        LOGFONTW *lf = (LOGFONTW*)g_malloc(sizeof(LOGFONTW));
829
830
        g_assert(lf != NULL);
830
831
        
831
 
        lf->lfHeight = -style->font_size.computed * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI;
 
832
        lf->lfHeight = -style->font_size.computed * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI;
832
833
        lf->lfWidth = 0;
833
834
        lf->lfEscapement = rot;
834
835
        lf->lfOrientation = rot;
877
878
    SetBkMode(hdc, TRANSPARENT);
878
879
 
879
880
    Geom::Point p2 = p * tf;
880
 
    p2[Geom::X] = (p2[Geom::X] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
881
 
    p2[Geom::Y] = (p2[Geom::Y] * Inkscape::Util::Quantity::Convert(1, "px", "in") * dwDPI);
 
881
    p2[Geom::X] = (p2[Geom::X] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
 
882
    p2[Geom::Y] = (p2[Geom::Y] * Inkscape::Util::Quantity::convert(1, "px", "in") * dwDPI);
882
883
 
883
884
    LONG const xpos = (LONG) round(p2[Geom::X]);
884
885
    LONG const ypos = (LONG) round(rc.bottom - p2[Geom::Y]);