You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm thinking that each atomic piece of content (heading, quote, image, footer, page num, etc) should have a rendering function which takes a rect and a float as arguments, and the renderer is allowed to use a percentage of the specified rect area for rendering its content.
This might be something like:
rect heading(String text, rect area, float amount){
text(text, area.x, area.y, area.w, area.h*amount);
return rect(area.x, area.y+area.h*amount, area.w, area.h*(1-amount));
}
rect image(PImage img, rect area, float amount){
if (image.width > image .height){
image(img, area.x, area.y, area.w, area.h*amount);
return rect(area.x, area.y+area.h*amount, area.w, area.h*(1-amount));
} else {
image(img, area.x, area.y, area.w*amount, area.h);
return rect(area.x+area.w*amount, area.y, area.w*(1-amount), area.h);
}
}
void render(PageData pd){
rect r = heading(pd.heading, rect(0, 0, pd.contentWidthPx, pd.contentHeightPx), .25);
r = image(pd.imageContent[0], r, 2.0/3);
}
The text was updated successfully, but these errors were encountered:
We started working toward this with commit 5211bd4
Currently we have a ContentBox render(...) interface, this might want to be expanded to include a query or layout interface for pre-render calculations. the render function returns a Rectangle representing the actual area that the element used (whereas the Rectangle argument is the area available)
I'm thinking that each atomic piece of content (heading, quote, image, footer, page num, etc) should have a rendering function which takes a rect and a float as arguments, and the renderer is allowed to use a percentage of the specified rect area for rendering its content.
This might be something like:
The text was updated successfully, but these errors were encountered: