add `get-device-scale' to dc<%>
This commit is contained in:
parent
3207efddb0
commit
e8cb27c08c
|
@ -151,6 +151,9 @@
|
||||||
(define/override (get-size)
|
(define/override (get-size)
|
||||||
(values (/ page-width page-scaling) (/ page-height page-scaling)))
|
(values (/ page-width page-scaling) (/ page-height page-scaling)))
|
||||||
|
|
||||||
|
(define/override (get-device-scale)
|
||||||
|
(values page-scaling page-scaling))
|
||||||
|
|
||||||
(define current-page 0)
|
(define current-page 0)
|
||||||
|
|
||||||
(define/public (get-page-count) (length pages))
|
(define/public (get-page-count) (length pages))
|
||||||
|
|
|
@ -222,6 +222,9 @@
|
||||||
(define/override (get-size)
|
(define/override (get-size)
|
||||||
(values (/ page-width page-scaling) (/ page-height page-scaling)))
|
(values (/ page-width page-scaling) (/ page-height page-scaling)))
|
||||||
|
|
||||||
|
(define/override (get-device-scale)
|
||||||
|
(values page-scaling page-scaling))
|
||||||
|
|
||||||
(define/override (end-doc)
|
(define/override (end-doc)
|
||||||
(send (new printout%
|
(send (new printout%
|
||||||
[op-gtk (gtk_print_operation_new)]
|
[op-gtk (gtk_print_operation_new)]
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
get-char-height
|
get-char-height
|
||||||
get-char-width
|
get-char-width
|
||||||
get-clipping-region
|
get-clipping-region
|
||||||
|
get-device-scale
|
||||||
get-font
|
get-font
|
||||||
get-gl-context
|
get-gl-context
|
||||||
get-initial-matrix
|
get-initial-matrix
|
||||||
|
|
|
@ -129,8 +129,9 @@
|
||||||
;; the color is for a background.
|
;; the color is for a background.
|
||||||
install-color
|
install-color
|
||||||
|
|
||||||
;; The public get-size method:
|
;; The public get-size & get-device-scale methods:
|
||||||
get-size
|
get-size
|
||||||
|
get-device-scale
|
||||||
|
|
||||||
;; set-auto-scroll : real real -> void
|
;; set-auto-scroll : real real -> void
|
||||||
;;
|
;;
|
||||||
|
@ -197,6 +198,7 @@
|
||||||
(define/public (collapse-bitmap-b&w?) #f)
|
(define/public (collapse-bitmap-b&w?) #f)
|
||||||
|
|
||||||
(define/public (get-size) (values 0.0 0.0))
|
(define/public (get-size) (values 0.0 0.0))
|
||||||
|
(define/public (get-device-scale) (values 1.0 1.0))
|
||||||
|
|
||||||
(define/public (set-auto-scroll dx dy) (void))
|
(define/public (set-auto-scroll dx dy) (void))
|
||||||
|
|
||||||
|
@ -612,6 +614,10 @@
|
||||||
(check-ok 'get-size)
|
(check-ok 'get-size)
|
||||||
(super get-size))
|
(super get-size))
|
||||||
|
|
||||||
|
(define/override (get-device-scale)
|
||||||
|
(check-ok 'get-device-scale)
|
||||||
|
(super get-device-scale))
|
||||||
|
|
||||||
(def/public (suspend-flush) (void))
|
(def/public (suspend-flush) (void))
|
||||||
(def/public (resume-flush) (void))
|
(def/public (resume-flush) (void))
|
||||||
(def/public (flush) (void))
|
(def/public (flush) (void))
|
||||||
|
|
|
@ -142,6 +142,9 @@
|
||||||
(values h w)
|
(values h w)
|
||||||
(values w h))))
|
(values w h))))
|
||||||
|
|
||||||
|
(define/override (get-device-scale)
|
||||||
|
(values scale-x scale-y))
|
||||||
|
|
||||||
(define/override (end-cr)
|
(define/override (end-cr)
|
||||||
(cairo_surface_finish s)
|
(cairo_surface_finish s)
|
||||||
(cairo_destroy c)
|
(cairo_destroy c)
|
||||||
|
|
|
@ -540,6 +540,21 @@ Gets the current clipping region, returning @scheme[#f] if the drawing
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@defmethod[(get-device-scale)
|
||||||
|
(values (and/c real? (not/c negative?))
|
||||||
|
(and/c real? (not/c negative?)))]{
|
||||||
|
|
||||||
|
Gets an ``external'' scaling factor for drawing coordinates to the
|
||||||
|
target device. For most DCs, the result is @racket[1.0] and
|
||||||
|
@racket[1.0].
|
||||||
|
|
||||||
|
A @racket[post-script-dc%] or @racket[pdf-dc%] object returns scaling
|
||||||
|
factors determined via @xmethod[ps-setup% get-scaling] at the time
|
||||||
|
that the DC was created. A @racket[printer-dc%] may also have a
|
||||||
|
user-configured scaling factor.}
|
||||||
|
|
||||||
|
|
||||||
@defmethod[(get-font)
|
@defmethod[(get-font)
|
||||||
(is-a?/c font%)]{
|
(is-a?/c font%)]{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user