Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions graf2d/postscript/inc/TImageDump.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class TImageDump : public TVirtualPS {
void DrawDashPolyLine(Int_t npoints, TPoint *pt, UInt_t nDash,
const char* pDash, const char* col, UInt_t thick);

template<typename T>
void DrawPolyMarkerShape(Int_t n, T *x, T *y);

public:
TImageDump();
TImageDump(const char *filename, Int_t type = -111);
Expand Down
38 changes: 18 additions & 20 deletions graf2d/postscript/src/TImageDump.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,11 @@ void TImageDump::DrawFrame(Double_t x1, Double_t y1, Double_t x2, Double_t y2,
fImage->DrawFillArea(6, frame, col->AsHexString());
}

////////////////////////////////////////////////////////////////////////////////
/// not used

void TImageDump::DrawPolyMarker(Int_t, Float_t *, Float_t *)
{
}

////////////////////////////////////////////////////////////////////////////////
/// draw polymarker

void TImageDump::DrawPolyMarker(Int_t n, Double_t *xw, Double_t *yw)
template<typename T>
void TImageDump::DrawPolyMarkerShape(Int_t n, T *xw, T *yw)
{
if (!gPad || !fImage)
return;
Expand All @@ -294,18 +288,6 @@ void TImageDump::DrawPolyMarker(Int_t n, Double_t *xw, Double_t *yw)
// prefer to use triangles while image not always correctly fill complex polygon
auto markerType = GetMarkerShape(markerSize, markerShape, gStyle->GetImageScaling(), TAttMarker::kPreferTriangles | TAttMarker::kDotAsLines);

// workaround of ASImage error - it is not able to draw circle with transparent color
if ((markerType == TAttMarker::kShapeFilledCircle) && (col->GetAlpha() < 1.)) {
Double_t r = markerSize / 2;
const int pts = 100;
const Double_t delta = TMath::TwoPi() / pts;
markerShape.reserve(pts + 1);
Double_t angle = 0.;
for (int i = 0; i <= pts; ++i, angle += delta)
markerShape.emplace_back(std::round(r * TMath::Cos(angle)), std::round(r * TMath::Sin(angle)));
markerType = TAttMarker::kShapeFilledArea;
}

for (Int_t i = 0; i < n; i++) {
auto ix = XtoPixel(xw[i]);
auto iy = YtoPixel(yw[i]);
Expand Down Expand Up @@ -351,6 +333,22 @@ void TImageDump::DrawPolyMarker(Int_t n, Double_t *xw, Double_t *yw)
}
}

////////////////////////////////////////////////////////////////////////////////
/// draw polymarker

void TImageDump::DrawPolyMarker(Int_t n, Float_t *xw, Float_t *yw)
{
DrawPolyMarkerShape<Float_t>(n, xw, yw);
}

////////////////////////////////////////////////////////////////////////////////
/// draw polymarker

void TImageDump::DrawPolyMarker(Int_t n, Double_t *xw, Double_t *yw)
{
DrawPolyMarkerShape<Double_t>(n, xw, yw);
}

////////////////////////////////////////////////////////////////////////////////
/// This function defines a path with xw and yw and draw it according the
/// value of nn:
Expand Down
2 changes: 1 addition & 1 deletion test/stressGraphics.ref
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
waves 3303861 100 712476 3000 62688 19000 123056 7000 3396789 1000
tf12 3954 100 14767 300 17378 7800 9629 2000 3794 200
tspline 9190 100 22268 300 27691 7800 20712 2000 9230 200
tscatter 16500 200 22671 400 28599 7800 22100 2000 16400 200
tscatter 16500 200 22671 400 28599 7800 31550 2000 16400 200
tefficiency 12926 200 24425 300 24021 6800 12637 2000 12584 200
profile_2d 29664 200 19472 300 23024 6500 12821 2000 31317 200
profile_2dpoly 26463 400 23578 300 38792 8500 30458 4000 26759 400
Expand Down
2 changes: 1 addition & 1 deletion test/stressGraphics_zlibng.ref
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
waves 3303861 100 709815 3000 62761 19000 122867 7000 3396789 1000
tf12 3954 100 14767 300 17378 7800 9629 2000 3794 200
tspline 9190 100 22268 300 27691 7800 20712 2000 9230 200
tscatter 16500 200 22471 400 28599 7800 22000 2000 16400 200
tscatter 16500 200 22471 400 28599 7800 31550 2000 16400 200
tefficiency 12926 200 24425 300 24021 6800 12637 2000 12584 200
profile_2d 29664 200 19472 300 23024 6500 12821 2000 31317 200
profile_2dpoly 26463 400 23578 300 38792 8500 30458 4000 26759 400
Expand Down
Loading