staticvoid
demo2_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation, int for_size, int *minimum, int *natural, int *minimum_baseline, int *natural_baseline)
{
GtkWidget *child; int minimum_size = 0; int natural_size = 0;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{ int child_min = 0, child_nat = 0;
if (!gtk_widget_should_layout (child)) continue;
gtk_widget_measure (child, orientation, -1,
&child_min, &child_nat,
NULL, NULL);
minimum_size = MAX (minimum_size, child_min);
natural_size = MAX (natural_size, child_nat);
}
/* Spherical coordinates */ #define SX(r,t,p) ((r) * sin (t) * cos (p)) #define SZ(r,t,p) ((r) * sin (t) * sin (p)) #define SY(r,t,p) ((r) * cos (t))
staticdouble
map_offset (double x)
{
x = fmod (x, 180.0); if (x < 0.0)
x += 180.0;
return x;
}
staticvoid
demo2_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget, int width, int height, int baseline)
{
GtkWidget *child;
GtkRequisition child_req; int i, j, k; float x0, y0; float w, h;
graphene_point3d_t p1, p2, p3, p4;
graphene_point3d_t q1, q2, q3, q4; double t_1, t_2, p_1, p_2; double r;
graphene_matrix_t m;
GskTransform *transform; double position = DEMO2_LAYOUT (layout_manager)->position; double offset = DEMO2_LAYOUT (layout_manager)->offset;
/* for simplicity, assume all children are the same size */
gtk_widget_get_preferred_size (gtk_widget_get_first_child (widget), &child_req, NULL);
w = child_req.width;
h = child_req.height;
r = 300;
x0 = y0 = 300;
for (child = gtk_widget_get_first_child (widget), i = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), i++)
{
j = i / 36;
k = i % 36;
/* Get a matrix that moves p1 -> q1, p2 -> q2, ... */
perspective_3d (&p4, &p3, &p2, &p1,
&q1, &q2, &q3, &q4,
&m);
transform = gsk_transform_matrix (NULL, &m);
/* Since our matrix was built for transforming points with z = 1, *prependatranslationtothez=1plane.
*/
transform = gsk_transform_translate_3d (transform,
&GRAPHENE_POINT3D_INIT (0, 0, 1));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.