Exemplo n.º 1
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();
    }
}
Exemplo n.º 2
0
void Painter::Copy(Painter* copy) {
    foreground = nil;
    background = nil;
    pattern = nil;
    br = nil;
    font = nil;
    style = 0;
    matrix = nil;
    SetColors(copy->foreground, copy->background);
    SetPattern(copy->pattern);
    SetBrush(copy->br);
    SetFont(copy->font);
    SetStyle(copy->style);
    SetTransformer(copy->matrix);
    SetOrigin(copy->xoff, copy->yoff);
    MoveTo(copy->curx, copy->cury);
}
Exemplo n.º 3
0
void BitmapGraphic::Read (istream& in) {
    Catalog* catalog = unidraw->GetCatalog();
    char* fg_name;

    FillBg(catalog->ReadBgFilled(in));
    SetBrush(catalog->ReadBrush(in));
    PSColor* fg = catalog->ReadColor(in);
    PSColor* bg = catalog->ReadColor(in);
    SetColors(fg, bg);
    SetFont(catalog->ReadFont(in));
    SetPattern(catalog->ReadPattern(in));

    Transformer* t = catalog->ReadTransformer(in);
    SetTransformer(t);
    Unref(t);

    fg_name = catalog->ReadString(in);
    Init(fg_name);
    delete fg_name;
}