1 /** This file is part of Shapes.
3 ** Shapes is free software: you can redistribute it and/or modify
4 ** it under the terms of the GNU General Public License as published by
5 ** the Free Software Foundation, either version 3 of the License, or
8 ** Shapes is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ** GNU General Public License for more details.
13 ** You should have received a copy of the GNU General Public License
14 ** along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 ** Copyright 2009, 2014, 2015 Henrik Tidefelt
19 /** This example shows that the bounding box of the imported raster graphics is computed correctly.
20 ** Black squares are placed so that the touch the raster image each corner.
24 ##lookin ..Shapes..Layout
26 img: [import_raster `raster_data/logo-low.jpg´ resolution:3bp] /** Load image with large pixels so that the lossy compression becomes obvious. **/
27 imgNatural: [import_raster `raster_data/logo-low.jpg´ override:false] /** Load image with resolution according to file. However, if the file **/
28 sq: [fill [rectangle (0cm,0cm) (1cm,1cm)]]
31 •page << @nonstroking:[gray 0.5] | [fill [bbox [bboxed_enlarge img (7mm,7mm)]]] /** Make gray background, so that the boundary of the raster image becomes visible. **/
33 << sq >> [center z:(1,1) ...] >> [shift ([xmin bb],[ymin bb])]
34 << sq >> [center z:(~1,1) ...] >> [shift ([xmax bb],[ymin bb])]
35 << sq >> [center z:(1,~1) ...] >> [shift ([xmin bb],[ymax bb])]
36 << sq >> [center z:(~1,~1) ...] >> [shift ([xmax bb],[ymax bb])]
37 << imgNatural >> center >> [shift ([xmin bb],[ymin bb])]