]> gitweb.factorcode.org Git - factor.git/blob - extra/images/viewer/prettyprint/prettyprint.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / extra / images / viewer / prettyprint / prettyprint.factor
1 USING: accessors hashtables images images.viewer io io.styles
2 kernel math namespaces prettyprint.custom prettyprint.sections
3 sequences ui.gadgets.panes ;
4 FROM: images => image ;
5 IN: images.viewer.prettyprint
6
7 TUPLE: image-section < section
8     image ;
9
10 CONSTANT: approx-pixels-per-cell 8
11
12 : <image-section> ( image -- section )
13     dup dim>> first approx-pixels-per-cell /i image-section new-section
14         over >>image
15         swap presented associate >>style ;
16
17 M: image-section long-section
18     short-section ;
19 M: image-section short-section
20     image>> <image-gadget> output-stream get write-gadget ;
21
22 M: image pprint*
23     <image-section> add-section ;