all files / graphics/images/ pdf-image.js

37.5% Statements 12/32
0% Branches 0/2
18.18% Functions 2/11
37.5% Lines 12/32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70                                                                                                                    
define(["require", "exports", "./../../drawing/pdf-drawing", "./../enum", "./../unit-convertor"], function (require, exports, pdf_drawing_1, enum_1, unit_convertor_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfImage = (function () {
        function PdfImage() {
        }
        Object.defineProperty(PdfImage.prototype, "width", {
            get: function () {
                return this.imageWidth;
            },
            set: function (value) {
                this.imageWidth = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfImage.prototype, "height", {
            get: function () {
                return this.imageHeight;
            },
            set: function (value) {
                this.imageHeight = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfImage.prototype, "size", {
            set: function (value) {
                this.width = value.width;
                this.height = value.height;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfImage.prototype, "physicalDimension", {
            get: function () {
                this.imagePhysicalDimension = this.getPointSize(this.width, this.height, this.horizontalResolution, this.verticalResolution);
                return new pdf_drawing_1.SizeF(this.width, this.height);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfImage.prototype, "element", {
            get: function () {
                return this.imageStream;
            },
            enumerable: true,
            configurable: true
        });
        PdfImage.prototype.getPointSize = function (width, height, horizontalResolution, verticalResolution) {
            if (typeof horizontalResolution === 'undefined') {
                var dpiX = unit_convertor_1.PdfUnitConverter.horizontalResolution;
                var dpiY = unit_convertor_1.PdfUnitConverter.verticalResolution;
                var size = this.getPointSize(width, height, dpiX, dpiY);
                return size;
            }
            else {
                var ucX = new unit_convertor_1.PdfUnitConverter(horizontalResolution);
                var ucY = new unit_convertor_1.PdfUnitConverter(verticalResolution);
                var ptWidth = ucX.convertUnits(width, enum_1.PdfGraphicsUnit.Pixel, enum_1.PdfGraphicsUnit.Point);
                var ptHeight = ucY.convertUnits(height, enum_1.PdfGraphicsUnit.Pixel, enum_1.PdfGraphicsUnit.Point);
                var size = new pdf_drawing_1.SizeF(ptWidth, ptHeight);
                return size;
            }
        };
        return PdfImage;
    }());
    exports.PdfImage = PdfImage;
});