Exemple #1
0
void Graphic::transform (Coord& x, Coord& y, Graphic* g) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->Transform(x, y);
    }
}
Exemple #2
0
void Graphic::invTransform (Coord& tx, Coord& ty, Graphic* g) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->InvTransform(tx, ty);
    }
}
Exemple #3
0
void Graphic::transform (float x, float y, float& tx, float& ty, Graphic* g) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->Transform(x, y, tx, ty);
    } else {
        tx = x;
        ty = y;
    }
}
Exemple #4
0
void Graphic::transform (Coord x, Coord y, Coord& tx, Coord& ty, Graphic* g) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->Transform(x, y, tx, ty);
    } else {
        tx = x;
        ty = y;
    }
}
Exemple #5
0
void Graphic::invTransformList(
    Coord tx[], Coord ty[], int n, Coord x[], Coord y[], Graphic* g
) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->InvTransformList(tx, ty, n, x, y);
    } else {
        ArrayCopy(tx, ty, n, x, y);
    }
}
Exemple #6
0
void Graphic::invTransformRect (
    float x0, float y0, float x1, float y1,
    float& nx0, float& ny0, float& nx1, float& ny1, Graphic* g
) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();
    nx0 = x0; ny0 = y0; nx1 = x1; ny1 = y1;

    if (t != nil) {
        t->InvTransformRect(nx0, ny0, nx1, ny1);
    }
}
Exemple #7
0
void Graphic::invTransform (
    float tx, float ty, float& x, float& y, Graphic* g
) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->InvTransform(tx, ty, x, y);
    } else {
        x = tx;
        y = ty;
    }
}
Exemple #8
0
void Graphic::invTransform (
    Coord tx, Coord ty, Coord& x, Coord& y, Graphic* g
) {
    Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();

    if (t != nil) {
        t->InvTransform(tx, ty, x, y);
    } else {
        x = tx;
        y = ty;
    }
}
Exemple #9
0
PictSelection::PictSelection (Graphic* gs) : (gs) {
    valid = true;
}

// PictSelection knows it's the outermost PictSelection because it was
// called with a FILE* pointer, so it must read a version number, skip
// over its name, read its graphic state and children, and scale
// itself back to screen coordinates when it's finished.

PictSelection::PictSelection (FILE* stream, State* state) : (nil) {
    int fd = fileno(stream);
    istream from(fd);
    ReadVersion(from);
    ReadGridSpacing(from);
    if (versionnumber < 3) {
	Skip(from);
    }
    ReadPictGS(from, state);
    ReadChildren(from, state);
    ScaleToScreenCoords();
    valid = from.good();
}

// Copy returns a copy of the PictSelection.

Graphic* PictSelection::Copy () {
    Selection* copy = new PictSelection(this);
    for (First(); !AtEnd(); Next()) {
	copy->Append(GetCurrent()->Copy());
    }
    return copy;
}

// HasChildren returns true so Idraw can ungroup this Picture.

boolean PictSelection::HasChildren () {
    return Picture::HasChildren();
}

// Propagate must preserve the PictSelection's transformation matrix
// if it has any.

void PictSelection::Propagate () {
    Transformer* original = GetTransformer();
    if (original != nil) {
	original->Reference();
	Selection::Propagate();
	SetTransformer(original);
	delete original;
    } else {
	Selection::Propagate();
    }
}
Exemple #10
0
void BitmapGraphic::Write (ostream& out) {
    Catalog* catalog = unidraw->GetCatalog();

    catalog->WriteBgFilled(BgFilled(), out);
    catalog->WriteBrush(GetBrush(), out);
    catalog->WriteColor(GetFgColor(), out);
    catalog->WriteColor(GetBgColor(), out);
    catalog->WriteFont(GetFont(), out);
    catalog->WritePattern(GetPattern(), out);
    catalog->WriteTransformer(GetTransformer(), out);

    catalog->WriteString(_fg_name, out);
}