Пример #1
0
void image_new_blank(image_t *image, gdouble rel_w, gdouble rel_h) {
    double w, h;
    get_abs_pos(rel_w, rel_h, &w, &h);
    image->layer = create_layer(w, h);
    image->rotation = 0;
    image->surface = create_surface(w, h);
    image->pbuf = NULL;
    
    add_layer(image->layer);
}
Пример #2
0
void image_set_position(image_t *image, gdouble rel_x, gdouble rel_y) {
    gdouble x, y;
    get_abs_pos(rel_x, rel_y, &x, &y);
    image->layer->x = x;
    image->layer->y = y;
}
Пример #3
0
DispPoint View::abs_from_rel(DispPoint coord) const {
    
    DispPoint abs_pos = get_abs_pos();
        return DispPoint(abs_pos.x + coord.x,
                         abs_pos.y + coord.y);
}
Пример #4
0
//bool View::rel_point_is_on_me(DispPoint coord) {
//    
//    return (coord.x >= pos.x && coord.y >= pos.y
//            && coord.x < pos.x + w && coord.y < pos.y + h);
//}
bool View::abs_point_is_on_me(DispPoint coord) const {
    
    DispPoint abs_pos = get_abs_pos();
    return (coord.x >= abs_pos.x && coord.y >= abs_pos.y
            && coord.x < abs_pos.x + w && coord.y < abs_pos.y + h);
}