本文整理汇总了C++中Graphic31类的典型用法代码示例。如果您正苦于以下问题:C++ Graphic31类的具体用法?C++ Graphic31怎么用?C++ Graphic31使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Graphic31类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getextent_gs
void PolyGraphic::getextent_gs (
Coord& l, Coord& b, Coord& cx, Coord& cy, float& tol, Graphic31* gs
) {
Extent e;
l = b = cx = cy = tol = 0.0;
Graphic31 gstemp;
Transformer ttemp;
Extent te;
gstemp.transformer(&ttemp);
GlyphIndex count = _body->count();
for (GlyphIndex i = 0; i < count; i++) {
Graphic31* gr = (Graphic31*) _body->component(i);
concatgs_(gr, gr, gs, &gstemp);
concatXform_(gr, nil, gr->transformer(), &ttemp);
getextent_(gr, te._left, te._bottom, te._cx, te._cy, te._tol, &gstemp);
e.Merge(te);
}
gstemp.transformer(nil); // to avoid deleting ttemp explicitly
l = e._left; b = e._bottom; cx = l+(e._cx-l)*2.0; cy = b+(e._cy-b)*2.0;
tol = e._tol;
Transformer* tx = gs->transformer();
if (tx != nil) {
corners(l, b, cx, cy, *tx);
}
cx = (cx + l)/2.0;
cy = (cy + b)/2.0;
}
示例2: remove_
void PolyGraphic::remove_ (GlyphIndex i) {
Graphic31* gr = (Graphic31*)_body->component(i);
if (gr != nil) {
gr->parent(nil);
}
_body->remove(i);
}
示例3: effect
boolean GraphicMaster::effect (const Event& e, Tool31& tool) {
boolean flag = true;
Window* w = e.window();
if (w != nil) {
w->cursor(window_cursor);
Canvas* c = w->canvas();
long count = _gr_list->count();
Coord l, b, r, t;
for (long i = 0; i < count && flag; i++) {
Graphic31* target = _gr_list->item(i);
target->getbounds(l, b, r, t);
c->damage(l, b, r, t);
flag = target->effect(e, tool);
if (flag) {
target->getbounds(l, b, r, t);
c->damage(l, b, r, t);
}
target->flush();
CanvasRep& rep = *c->rep();
CanvasDamage& cd = rep.damage_;
rep.start_repair();
drawclipped(c, cd.left, cd.bottom, cd.right, cd.top);
rep.finish_repair();
}
_gr_list->remove_all();
}
return flag;
}
示例4: GraphicMaster
Glyph* GraphicMaster::clone () const {
Graphic31* pg = new GraphicMaster((Graphic31*)this);
GlyphIndex count = _body->count();
for (GlyphIndex i = 0; i < count; i++) {
Glyph* gr = _body->component(i);
pg->append(gr->clone());
}
return pg;
}
示例5: parent
void Graphic31::parentXform (Transformer& t) {
Transformer identity;
Graphic31* p = parent();
if (p == nil) {
*(&t) = *(&identity);
} else {
p->eqv_transformer(t);
}
}
示例6: count_
void PolyGraphic::flush () {
GlyphIndex count = count_();
for (GlyphIndex i = 0; i < count; i++) {
Graphic31* gr = component_(i);
concat_(gr, gr, this, gr);
gr->flush();
}
Graphic31 n;
*((Graphic31*) this) = *(&n);
}
示例7: last_intersecting
Graphic31* PolyGraphic::last_intersecting (BoxObj& b) {
GlyphIndex count = _body->count();
for (GlyphIndex i = count-1; i >= 0; i--) {
Graphic31* gr = (Graphic31*) _body->component(i);
if (gr->intersects(b)) {
return gr;
}
}
return nil;
}
示例8: last_containing
Graphic31* PolyGraphic::last_containing (PointObj& pt) {
GlyphIndex count = _body->count();
for (GlyphIndex i = count-1; i >= 0; i--) {
Graphic31* gr = (Graphic31*) _body->component(i);
if (gr->contains(pt)) {
return gr;
}
}
return nil;
}
示例9: last_within
Graphic31* PolyGraphic::last_within (BoxObj& gb) {
GlyphIndex count = _body->count();
Coord l, b, r, t;
for (GlyphIndex i = count-1; i >= 0; i--) {
Graphic31* gr = (Graphic31*) _body->component(i);
gr->getbounds(l, b, r, t);
BoxObj box(l, b, r, t);
if (box.Within(gb)) {
return gr;
}
}
return nil;
}
示例10: event
boolean GlyphGrabber::event (Event& e) {
Graphic31* root = _gviewer->root();
Tool31& tool = _gviewer->tool();
Canvas* c = e.window()->canvas();
c->push_clipping();
c->clip_rect(_a->left(), _a->bottom(), _a->right(), _a->top());
boolean ok = root->grasp(e, tool);
Event ev;
Session* s = Session::instance();
while(ok) {
s->read(ev);
ok = root->manipulating(ev, tool);
}
ok = root->effect(ev, tool);
c->pop_clipping();
return ok;
}
示例11: switch
boolean GraphicMaster::grasp (const Event& e, Tool31& tool) {
if (window_cursor == nil) {
window_cursor = e.window()->cursor();
}
boolean flag = false;
unsigned int tool_type = tool.tool();
switch (tool_type) {
case Tool31::move:
case Tool31::scale:
case Tool31::rotate:
{
float tol = 2.0;
BoxObj box(
e.pointer_x()-tol, e.pointer_y()-tol,
e.pointer_x()+tol, e.pointer_y()+tol
);
Graphic31* target = last_intersecting(box);
if (target != nil) {
Window* w = e.window();
Canvas* c = w->canvas();
w->cursor(grabber_cursor);
ToolState& ts = tool.toolstate();
total_gs(ts._gs);
_gr_list->append(target);
Coord l, b, r, t;
target->getbounds(l, b, r, t);
c->damage(l, b, r, t);
flag = target->grasp(e, tool);
if (flag) {
target->getbounds(l, b, r, t);
c->damage(l, b, r, t);
}
CanvasRep& rep = *c->rep();
CanvasDamage& cd = rep.damage_;
rep.start_repair();
drawclipped(c, cd.left, cd.bottom, cd.right, cd.top);
rep.finish_repair();
}
break;
}
}
return flag;
}
示例12: intersects_gs
boolean PolyGraphic::intersects_gs (BoxObj& box, Graphic31* gs) {
GlyphIndex count = _body->count();
Graphic31 gstemp;
Transformer ttemp;
gstemp.transformer(&ttemp);
for (GlyphIndex i = 0; i < count; i++) {
Graphic31* gr = (Graphic31*) _body->component(i);
concat_(gr, gr, gs, &gstemp);
if (intersects_(gr, box, &gstemp)) {
gstemp.transformer(nil);
return true;
}
}
gstemp.transformer(nil); /* to avoid deleting ttemp explicitly*/
return false;
}
示例13: Transformer
void Graphic31::draw(Canvas* c, const Allocation& a) const {
if (c != nil) {
boolean no_transformer = !_t;
if (no_transformer) {
((Graphic31*)this)->_t = new Transformer();
_t->Translate(a.x(), a.y());
}
Graphic31* gr = (Graphic31*) this;
CanvasDamage& cd = c->rep()->damage_;
gr->drawclipped(
c, cd.left, cd.bottom, cd.right, cd.top
);
if (no_transformer) {
_t->Translate(-a.x(), -a.y());
delete _t;
((Graphic31*)this)->_t = nil;
}
}
}
示例14: manipulating
boolean GraphicMaster::manipulating (const Event& e, Tool31& tool) {
boolean flag = true;
long count = _gr_list->count();
Coord l, b, r, t;
Window* w = e.window();
Canvas* c = w->canvas();
for (long i = 0; i < count && flag; i++) {
Graphic31* target = _gr_list->item(i);
target->getbounds(l, b, r, t);
c->damage(l, b, r, t);
flag = target->manipulating(e, tool);
if (flag) {
target->getbounds(l, b, r, t);
c->damage(l, b, r, t);
}
CanvasRep& rep = *c->rep();
CanvasDamage& cd = rep.damage_;
rep.start_repair();
drawclipped(c, cd.left, cd.bottom, cd.right, cd.top);
rep.finish_repair();
w->display()->flush();
}
return flag;
}
示例15: replace_
void PolyGraphic::replace_ (GlyphIndex i, Graphic31* g) {
Graphic31* gr = (Graphic31*) _body->component(i);
gr->parent(nil);
_body->replace(i, g);
g->parent(this);
}