21#include <Cocoa/Cocoa.h>
54 assert(
nPoints != 0 &&
"ConvertPointsROOTToCocoa, nPoints parameter is 0");
55 assert(
xy != 0 &&
"ConvertPointsROOTToCocoa, xy parameter is null");
56 assert(drawable != 0 &&
"ConvertPointsROOTToCocoa, drawable parameter is null");
58 const auto scaleFactor = drawable.fScaleFactor;
75 Error(
"TGQuartz",
"TTFhandle::Init() failed");
88 Error(
"TGQuartz",
"TTFhandle::Init() failed");
105 ::Warning(
"DrawBoxW",
"Invalid view/window for XOR-mode");
149 Error(
"DrawBoxW",
"Can not find color for index %d",
int(
attline.GetLineColor()));
154 Error(
"DrawBoxW",
"SetFillAreaParameters failed");
198 std::vector<TPoint>
pnts;
207 if (drawable.fScaleFactor > 1.) {
214 Error(
"DrawFillAreaW",
"Could not find TColor for index %d",
attfill.GetFillColor());
224 Error(
"DrawFillAreaW",
"SetFillAreaParameters failed");
260 ::Warning(
"DrawLineW",
"Invalid view/window for XOR-mode");
282 Error(
"DrawLineW",
"Could not set line color for index %d",
int(
attline.GetLineColor()));
320 ::Warning(
"DrawPolyLineW",
"Invalid view/window for XOR-mode");
340 Error(
"DrawPolyLineW",
"Could not find TColor for index %d",
attline.GetLineColor());
347 std::vector<TPoint>
pnts;
352 if (drawable.fScaleFactor > 1.)
377 for(
Int_t i = 0; i < 2*
n; i += 2)
394 ::Warning(
"DrawPolyMarkerW",
"Invalid view/window for XOR-mode");
407 std::vector<TPoint>
pnts;
440 Error(
"DrawTextW",
"char string to draw, but TTF initialization failed");
458 if (
att.GetTextSize() < 1.5)
464 ttf.SetTextFont(
att.GetTextFont());
465 ttf.SetTextSize(
att.GetTextSize());
489 Error(
"DrawTextW",
"wchar_t string to draw, but TTF initialization failed");
507 if (
att.GetTextSize() < 1.5)
513 ttf.SetTextFont(
att.GetTextFont());
514 ttf.SetTextSize(
att.GetTextSize());
546 Error(
"DrawTTFglyphsW",
"fSelectedDrawable is neither QuartzPixmap nor a double buffered window");
556 Error(
"DrawTTFglyphsW",
"pixmap creation failed");
573 Error(
"DrawTTFglyphsW",
"problem with reading background pixels");
610 if (
ttf.GetSmoothing()) {
622 for (
unsigned y = 0;
y <
rows;
y++) {
623 for (
unsigned x = 0;
x <
width;
x++) {
646 col[0].fPixel = back;
655 for (
int x = 3;
x > 0; --
x) {
656 col[
x].fRed = (
col[4].fRed *
x +
col[0].fRed * (4 -
x)) / 4;
657 col[
x].fGreen = (
col[4].fGreen *
x +
col[0].fGreen * (4 -
x)) / 4;
658 col[
x].fBlue = (
col[4].fBlue *
x +
col[0].fBlue * (4 -
x)) / 4;
664 const unsigned char *s = buffer;
665 for (
unsigned y = 0;
y <
rows; ++
y) {
666 for (
unsigned x = 0;
x <
width; ++
x) {
667 unsigned char d = (((*s++ & 0xff) + 10) * 5) / 256;
673 UChar_t(
double(
col[
d].fBlue) / 0xffff * 255), 255};
680 unsigned char rgba[4] = {};
685 const unsigned char *row = buffer;
686 for (
unsigned y = 0;
y <
rows; ++
y) {
688 const unsigned char *s = row;
689 for (
unsigned x = 0;
x <
width; ++
x) {
846 Error(
"SetTextFont",
"Direct TTF font setting not supported");
930 if (
value ==
"auto") {
932 }
else if (
value ==
"no")
935 assert(
value ==
"yes" &&
"SetAA, value must be 'yes', 'no' or 'auto'");
944 assert(
valuefa ==
"yes" &&
"SetAA, value must be 'yes', 'no' or 'auto'");
955 if (!drawable || !drawable.attFill)
957 return *drawable.attFill;
965 if (!drawable || !drawable.attLine)
967 return *drawable.attLine;
975 if (!drawable || !drawable.attMarker)
977 return *drawable.attMarker;
985 if (!drawable || !drawable.attText)
987 return *drawable.attText;
993 assert(
calledFrom != 0 &&
"GetDrawableChecked, calledFrom parameter is null");
999 if (!drawable.fIsPixmap) {
1010 Error(
calledFrom,
"Selected drawable is neither a pixmap, nor a double buffered window");
1015 if (!drawable.fContext) {
Handle_t WinContext_t
Window drawing context.
Handle_t Drawable_t
Drawable handle.
short Style_t
Style number (short)
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
constexpr ULong_t kBitsPerByte
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
short Width_t
Line width (short)
float Float_t
Float 4 bytes (float)
short Font_t
Font number (short)
short Short_t
Signed Short integer 2 bytes (short)
short SCoord_t
Screen coordinates (short)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t GetWindowSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t markerstyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t textsize
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Fill Area Attributes class.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
TColorGradient extends basic TColor.
The color creation and management class.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D.
Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color) override
Allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware...
std::unique_ptr< ROOT::MacOSX::Details::CocoaPrivate > fPimpl
!
void QueryColor(Colormap_t cmap, ColorStruct_t &color) override
Returns the current RGB value for the pixel in the "color" structure.
WinContext_t GetSelectedContext()
Drawable_t fSelectedDrawable
ULong_t GetPixel(Color_t cindex) override
Returns pixel value associated to specified ROOT color number "cindex".
void SetLineWidth(Width_t width) override
Set the line width.
TAttMarker & GetAttMarker(WinContext_t wctxt)
void SetAttLine(WinContext_t wctxt, const TAttLine &att) override
Set line attributes for specified window.
void SetMarkerColor(Color_t cindex) override
Set the marker color.
void SetFillStyle(Style_t style) override
Set the fill area style.
void SetOpacity(Int_t percent) override
Sets opacity of the current window.
void SetFillColor(Color_t cindex) override
Set the fill area color.
void DrawPolyLine(Int_t n, TPoint *xy) override
Draws a line through all points in the list.
Float_t GetTextMagnitude() override
Returns the current font magnification factor.
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for specified window.
void DrawFillArea(Int_t n, TPoint *xy) override
Fills area described by the polygon.
void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draws a text string using current font.
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draws a line.
void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw text on specified window.
void SetTextColor(Color_t cindex) override
Set the text color.
void SetMarkerStyle(Style_t markerstyle) override
Set the marker style.
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draws a box between [x1,y1] and [x2,y2] according to the "mode".
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
void SetTextAlign(Short_t talign=11) override
Set the text alignment.
TAttText & GetAttText(WinContext_t wctxt)
void SetLineColor(Color_t cindex) override
Set the line color.
void SetTextFont(Font_t fontnumber) override
Set the text font.
void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override
Set marker attributes for specified window.
void SetMarkerSize(Float_t markersize) override
Set the marker size.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic) override
Draws a cell array.
void DrawLinesSegmentsW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw line segments on specified window.
void SetTextSize(Float_t textsize) override
Set the text size.
void DrawPolyMarkerW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw poly marker on specified window.
void DrawLineW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw line on specified window.
void DrawTTFglyphsW(WinContext_t wctxt, Int_t x, Int_t y, TTFhandle &ttf, ETextMode mode) override
Draw TTFglyphs on specified window Will be invoked only if HasTTFonts method returns true.
void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw poly line on specified window.
void SetLineStyle(Style_t linestyle) override
Set the line style.
TAttFill & GetAttFill(WinContext_t wctxt)
void DrawBoxW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw box on specified window.
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opactity for specified window.
void DrawPolyMarker(Int_t n, TPoint *xy) override
Draws "n" markers with the current attributes at position [x,y].
void * GetPixmapDrawable(void *drawable0, const char *calledFrom) const
void DrawFillAreaW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw fill area on specified window.
TAttLine & GetAttLine(WinContext_t wctxt)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Dynamic handle to work with freetype 2 library.
QuartzPixmap * fBackBuffer
QuartzWindow * fQuartzWindow
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
int LocalYROOTToCocoa(NSView< X11Window > *parentView, CGFloat yROOT)
bool AdjustCropArea(const Rectangle &srcRect, Rectangle &cropArea)
void DrawBox(CGContextRef ctx, Int_t x1, Int_t y1, Int_t x2, Int_t y2, bool hollow)
Bool_t SetLineColor(CGContextRef ctx, Color_t colorIndex)
void DrawPolyMarker(CGContextRef ctx, unsigned nPoints, const TPoint *marker, const TAttMarker &attmark, float scaleFactor)
Bool_t SetFillAreaParameters(CGContextRef ctx, unsigned *patternIndex, const TAttFill &attfill)
void DrawPolyLine(CGContextRef ctx, Int_t n, const TPoint *xy)
void DrawFillArea(CGContextRef ctx, Int_t n, TPoint *xy, Bool_t drawShadow, const TAttFill &attfill)
void DrawPolygonWithGradientFill(CGContextRef ctx, const TColorGradient *extendedColor, const CGSize &sizeOfDrawable, Int_t nPoints, const TPoint *xy, Bool_t drawShadow)
void DrawLine(CGContextRef ctx, Int_t x1, Int_t y1, Int_t x2, Int_t y2)
void SetLineWidth(CGContextRef ctx, Int_t width)
void SetLineStyle(CGContextRef ctx, Int_t lstyle)
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.