Hi guys,
Using Pharo 6.1/Win here.
Is there any way to adjust a RTView canvas to a fixed size, say 620 x 744 px, before the elements gets added into the view?
This is what I've tried so far:
1) Empty canvas manually set to 620 x 744 px produces 1x1 image:
| view | view := RTView new setCanvas: (TRCanvas new extent: 620 @ 744; yourself); yourself. (RTCanvasExporter canvas: view canvas) format: #png; fileName: 'test_empty.png'; export.
2) Non-empty canvas manually set to 620 x 744 px produces 25x15 image:
| view elems | view := RTView new setCanvas: (TRCanvas new extent: 620 @ 744; yourself); yourself. elems := (RTBox new color: Color blue) elementsOn: (1 to: 5). view addAll: elems. RTGridLayout on: view elements. (RTCanvasExporter canvas: view canvas) format: #png; fileName: 'test_5elems.png'; export.
3) Idem 2) adding #scale: 10 -> 250x150px ... #scale: 24.8 -> 620 px
| view elems | view := RTView new setCanvas: (TRCanvas new extent: 620 @ 744; yourself); yourself. elems := (RTBox new color: Color blue) elementsOn: (1 to: 5). view addAll: elems. RTGridLayout on: view elements. (RTCanvasExporter canvas: view canvas) format: #png; scale: 12.4; fileName: 'test_5elems_scaled.png'; export.
4) Adding #oversizedBy: to 3) finally makes the trick:
| view elems | view := RTView new setCanvas: (TRCanvas new extent: 620 @ 744; yourself); yourself. elems := (RTBox new color: Color blue) elementsOn: (1 to: 5). view addAll: elems. RTGridLayout on: view elements. (RTCanvasExporter canvas: view canvas) format: #png; scale: 24.8; oversizedBy: 0 @ 15; fileName: 'test_5elems_scale2_osized.png'; export.
- So setting manually canvas extent doesn't have any effect? - Any way also to set a fixed margin or padding size (distance between image element and border)?
Cheers,
Hernán