21#include <Cocoa/Cocoa.h>
24# include FT_FREETYPE_H
62 assert(
nPoints != 0 &&
"ConvertPointsROOTToCocoa, nPoints parameter is 0");
63 assert(
xy != 0 &&
"ConvertPointsROOTToCocoa, xy parameter is null");
64 assert(drawable != 0 &&
"ConvertPointsROOTToCocoa, drawable parameter is null");
66 const auto scaleFactor = drawable.fScaleFactor;
83 Error(
"TGQuartz",
"TTFhandle::Init() failed");
96 Error(
"TGQuartz",
"TTFhandle::Init() failed");
113 ::Warning(
"DrawBoxW",
"Invalid view/window for XOR-mode");
157 Error(
"DrawBoxW",
"Can not find color for index %d",
int(
attline.GetLineColor()));
162 Error(
"DrawBoxW",
"SetFillAreaParameters failed");
213 if (drawable.fScaleFactor > 1.) {
220 Error(
"DrawFillAreaW",
"Could not find TColor for index %d",
attfill.GetFillColor());
230 Error(
"DrawFillAreaW",
"SetFillAreaParameters failed");
266 ::Warning(
"DrawLineW",
"Invalid view/window for XOR-mode");
288 Error(
"DrawLineW",
"Could not set line color for index %d",
int(
attline.GetLineColor()));
335 Error(
"DrawPolyLineW",
"Could not find TColor for index %d",
attline.GetLineColor());
345 if (drawable.fScaleFactor > 1.)
370 for(
Int_t i = 0; i < 2*
n; i += 2)
397 Error(
"DrawPolyMarker",
"Could not find TColor for index %d",
attmark.GetMarkerColor());
407 if (drawable.fScaleFactor > 1.)
451 for (std::size_t i = 0; i <
unichars.size(); ++i)
472 if (
atttext.GetTextSize() < 1.5)
498 }
catch (
const std::exception &
e) {
499 Error(
"DrawTextW",
"Exception from Quartz::TextLine: %s",
e.what());
518 Error(
"DrawTextW",
"wchar_t string to draw, but TTF initialization failed");
537 if (
att.GetTextSize() < 1.5)
544 ttf.SetTextFont(
att.GetTextFont());
545 ttf.SetTextSize(
att.GetTextSize());
587 Error(
"DrawTextW",
"fSelectedDrawable is neither QuartzPixmap nor a double buffered window");
600 if (
w <= 0 ||
h <= 0)
618 Error(
"DrawTextW",
"pixmap creation failed");
635 Error(
"DrawTextW",
"problem with reading background pixels");
967 Error(
"SetTextFont",
"Direct TTF font setting not supported");
1069 for (
unsigned y = 0;
y <
source->rows;
y++) {
1070 for (
unsigned x = 0;
x <
source->width;
x++) {
1102 for (
int x = 3;
x > 0; --
x) {
1111 const unsigned char *s =
source->buffer;
1112 for (
unsigned y = 0;
y <
source->rows; ++
y) {
1113 for (
unsigned x = 0;
x <
source->width; ++
x) {
1114 unsigned char d = (((*s++ & 0xff) + 10) * 5) / 256;
1119 UChar_t(
double(col[
d].fGreen) / 0xffff * 255),
1120 UChar_t(
double(col[
d].fBlue) / 0xffff * 255), 255};
1127 unsigned char rgba[4] = {};
1130 unsigned char d = 0;
1132 const unsigned char *row =
source->buffer;
1133 for (
unsigned y = 0;
y <
source->rows; ++
y) {
1135 const unsigned char *s = row;
1136 for (
unsigned x = 0;
x <
source->width; ++
x) {
1159 if (
value ==
"auto") {
1161 }
else if (
value ==
"no")
1164 assert(
value ==
"yes" &&
"SetAA, value must be 'yes', 'no' or 'auto'");
1173 assert(
valuefa ==
"yes" &&
"SetAA, value must be 'yes', 'no' or 'auto'");
1184 if (!drawable || !drawable.attFill)
1186 return *drawable.attFill;
1194 if (!drawable || !drawable.attLine)
1196 return *drawable.attLine;
1204 if (!drawable || !drawable.attMarker)
1206 return *drawable.attMarker;
1214 if (!drawable || !drawable.attText)
1216 return *drawable.attText;
1222 assert(
calledFrom != 0 &&
"GetDrawableChecked, calledFrom parameter is null");
1228 if (!drawable.fIsPixmap) {
1239 Error(
calledFrom,
"Selected drawable is neither a pixmap, nor a double buffered window");
1244 if (!drawable.fContext) {
Handle_t WinContext_t
Window drawing context.
Handle_t Drawable_t
Drawable handle.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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.
std::vector< UniChar > quartz_get_greek_unicars(const char *text)
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
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 SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
virtual Float_t GetTextSize() const
Return the text size.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
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 DrawFTGlyph(void *pixmap, void *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
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.
Bool_t GetTextExtentA(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override
Returns the size of the specified character string "mess" for font and size.
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.
std::vector< TPoint > fConvertedPoints
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 GetTextExtent(UInt_t &w, UInt_t &h, char *text) override
Returns the size of the specified character string "mess".
Int_t GetFontAscent() const override
Returns the ascent of the current font (in pixels).
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.
Bool_t GetFontAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override
Returns ascent/descent for specified character string "mess" with font and 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 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)
Int_t GetFontDescent() const override
Returns the descent of the current font (in pixels.
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.
static Bool_t GetSmoothing()
static void SetSmoothing(Bool_t state)
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 DrawPolyLine(CGContextRef ctx, Int_t n, TPoint *xy)
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)
Bool_t SetFillAreaParameters(CGContextRef ctx, unsigned *patternIndex, const TAttFill &attfill)
void DrawFillArea(CGContextRef ctx, Int_t n, TPoint *xy, Bool_t drawShadow, const TAttFill &attfill)
void DrawPolyMarker(CGContextRef ctx, const std::vector< TPoint > &marker, Size_t markerSize, Style_t markerStyle)
Bool_t SetFillColor(CGContextRef ctx, Color_t colorIndex)
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 Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
ULong_t fPixel
color pixel value (index in color table)
UShort_t fRed
red component (0..65535)
UShort_t fGreen
green component (0..65535)
UShort_t fBlue
blue component (0..65535)