* Cleanup in the Gradient department. No fuctional change.
Renamed BGradient::color_step to BGradient::ColorStop as it's called everywhere else. Also renamed BGradient::gradient_type to just BGradient::Type. Renamed BGradient::Type() to GetType(). * Simplification of method names in Painter.cpp. Some not yet complete and yet inactive code to accelerate vertical gradients (bypassing AGG for this special case). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29214 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku.
|
* Copyright 2006-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -21,7 +21,7 @@ class BRect;
|
|||||||
|
|
||||||
class BGradient : public BArchivable {
|
class BGradient : public BArchivable {
|
||||||
public:
|
public:
|
||||||
enum gradient_type {
|
enum Type {
|
||||||
TYPE_LINEAR = 0,
|
TYPE_LINEAR = 0,
|
||||||
TYPE_RADIAL,
|
TYPE_RADIAL,
|
||||||
TYPE_RADIAL_FOCUS,
|
TYPE_RADIAL_FOCUS,
|
||||||
@@ -30,13 +30,13 @@ public:
|
|||||||
TYPE_NONE
|
TYPE_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
struct color_step {
|
struct ColorStop {
|
||||||
color_step(const rgb_color c, float o);
|
ColorStop(const rgb_color c, float o);
|
||||||
color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o);
|
ColorStop(uint8 r, uint8 g, uint8 b, uint8 a, float o);
|
||||||
color_step(const color_step& other);
|
ColorStop(const ColorStop& other);
|
||||||
color_step();
|
ColorStop();
|
||||||
|
|
||||||
bool operator!=(const color_step& other) const;
|
bool operator!=(const ColorStop& other) const;
|
||||||
|
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
float offset;
|
float offset;
|
||||||
@@ -53,26 +53,26 @@ public:
|
|||||||
|
|
||||||
bool operator==(const BGradient& other) const;
|
bool operator==(const BGradient& other) const;
|
||||||
bool operator!=(const BGradient& other) const;
|
bool operator!=(const BGradient& other) const;
|
||||||
bool ColorStepsAreEqual(const BGradient& other) const;
|
bool ColorStopsAreEqual(const BGradient& other) const;
|
||||||
|
|
||||||
void SetColors(const BGradient& other);
|
void SetColorStops(const BGradient& other);
|
||||||
|
|
||||||
int32 AddColor(const rgb_color& color, float offset);
|
int32 AddColor(const rgb_color& color, float offset);
|
||||||
bool AddColor(const color_step& color, int32 index);
|
bool AddColorStop(const ColorStop& colorStop, int32 index);
|
||||||
|
|
||||||
bool RemoveColor(int32 index);
|
bool RemoveColor(int32 index);
|
||||||
|
|
||||||
bool SetColor(int32 index, const color_step& step);
|
bool SetColorStop(int32 index, const ColorStop& colorStop);
|
||||||
bool SetColor(int32 index, const rgb_color& color);
|
bool SetColor(int32 index, const rgb_color& color);
|
||||||
bool SetOffset(int32 index, float offset);
|
bool SetOffset(int32 index, float offset);
|
||||||
|
|
||||||
int32 CountColors() const;
|
int32 CountColorStops() const;
|
||||||
color_step* ColorAt(int32 index) const;
|
ColorStop* ColorStopAt(int32 index) const;
|
||||||
color_step* ColorAtFast(int32 index) const;
|
ColorStop* ColorStopAtFast(int32 index) const;
|
||||||
color_step* Colors() const;
|
ColorStop* ColorStops() const;
|
||||||
void SortColorStepsByOffset();
|
void SortColorStopsByOffset();
|
||||||
|
|
||||||
gradient_type Type() const
|
Type GetType() const
|
||||||
{ return fType; }
|
{ return fType; }
|
||||||
|
|
||||||
void MakeEmpty();
|
void MakeEmpty();
|
||||||
@@ -102,8 +102,8 @@ private:
|
|||||||
} conic;
|
} conic;
|
||||||
} fData;
|
} fData;
|
||||||
|
|
||||||
BList fColors;
|
BList fColorStops;
|
||||||
gradient_type fType;
|
Type fType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GRADIENT_H
|
#endif // _GRADIENT_H
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ public:
|
|||||||
void DrawRadialFocus(BRect update);
|
void DrawRadialFocus(BRect update);
|
||||||
void DrawDiamond(BRect update);
|
void DrawDiamond(BRect update);
|
||||||
void DrawConic(BRect update);
|
void DrawConic(BRect update);
|
||||||
void SetType(BGradient::gradient_type type);
|
void SetType(BGradient::Type type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BGradient::gradient_type fType;
|
BGradient::Type fType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -426,7 +426,7 @@ GradientsView::DrawConic(BRect update)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GradientsView::SetType(BGradient::gradient_type type)
|
GradientsView::SetType(BGradient::Type type)
|
||||||
{
|
{
|
||||||
fType = type;
|
fType = type;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ GradientControl::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMe
|
|||||||
float offset = _OffsetFor(where);
|
float offset = _OffsetFor(where);
|
||||||
|
|
||||||
if (fDraggingStepIndex >= 0) {
|
if (fDraggingStepIndex >= 0) {
|
||||||
BGradient::color_step* step = fGradient->ColorAt(fDraggingStepIndex);
|
BGradient::ColorStop* step = fGradient->ColorAt(fDraggingStepIndex);
|
||||||
if (step) {
|
if (step) {
|
||||||
if (fGradient->SetOffset(fDraggingStepIndex, offset)) {
|
if (fGradient->SetOffset(fDraggingStepIndex, offset)) {
|
||||||
_UpdateColors();
|
_UpdateColors();
|
||||||
@@ -201,7 +201,7 @@ GradientControl::MessageReceived(BMessage* message)
|
|||||||
if (restore_color_from_message(message, color, 0) >= B_OK) {
|
if (restore_color_from_message(message, color, 0) >= B_OK) {
|
||||||
bool update = false;
|
bool update = false;
|
||||||
if (fDropIndex >= 0) {
|
if (fDropIndex >= 0) {
|
||||||
if (BGradient::color_step* step
|
if (BGradient::ColorStop* step
|
||||||
= fGradient->ColorAt(fDropIndex)) {
|
= fGradient->ColorAt(fDropIndex)) {
|
||||||
color.alpha = step->color.alpha;
|
color.alpha = step->color.alpha;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ GradientControl::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
case B_END:
|
case B_END:
|
||||||
case B_LEFT_ARROW:
|
case B_LEFT_ARROW:
|
||||||
case B_RIGHT_ARROW: {
|
case B_RIGHT_ARROW: {
|
||||||
if (BGradient::color_step* step
|
if (BGradient::ColorStop* step
|
||||||
= fGradient->ColorAt(fCurrentStepIndex)) {
|
= fGradient->ColorAt(fCurrentStepIndex)) {
|
||||||
BRect r = _GradientBitmapRect();
|
BRect r = _GradientBitmapRect();
|
||||||
float x = r.left + r.Width() * step->offset;
|
float x = r.left + r.Width() * step->offset;
|
||||||
@@ -381,7 +381,7 @@ GradientControl::Draw(BRect updateRect)
|
|||||||
markerPos.y = b.bottom + 4.0;
|
markerPos.y = b.bottom + 4.0;
|
||||||
BPoint leftBottom(-6.0, 6.0);
|
BPoint leftBottom(-6.0, 6.0);
|
||||||
BPoint rightBottom(6.0, 6.0);
|
BPoint rightBottom(6.0, 6.0);
|
||||||
for (int32 i = 0; BGradient::color_step* step = fGradient->ColorAt(i);
|
for (int32 i = 0; BGradient::ColorStop* step = fGradient->ColorAt(i);
|
||||||
i++) {
|
i++) {
|
||||||
markerPos.x = b.left + (b.Width() * step->offset);
|
markerPos.x = b.left + (b.Width() * step->offset);
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ GradientControl::SetCurrentStop(const rgb_color& color)
|
|||||||
bool
|
bool
|
||||||
GradientControl::GetCurrentStop(rgb_color* color) const
|
GradientControl::GetCurrentStop(rgb_color* color) const
|
||||||
{
|
{
|
||||||
BGradient::color_step* stop
|
BGradient::ColorStop* stop
|
||||||
= fGradient->ColorAt(fCurrentStepIndex);
|
= fGradient->ColorAt(fCurrentStepIndex);
|
||||||
if (stop && color) {
|
if (stop && color) {
|
||||||
*color = stop->color;
|
*color = stop->color;
|
||||||
@@ -617,7 +617,7 @@ GradientControl::_StepIndexFor(BPoint where) const
|
|||||||
int32 index = -1;
|
int32 index = -1;
|
||||||
BRect r = _GradientBitmapRect();
|
BRect r = _GradientBitmapRect();
|
||||||
BRect markerFrame(Bounds());
|
BRect markerFrame(Bounds());
|
||||||
for (int32 i = 0; BGradient::color_step* step
|
for (int32 i = 0; BGradient::ColorStop* step
|
||||||
= fGradient->ColorAt(i); i++) {
|
= fGradient->ColorAt(i); i++) {
|
||||||
markerFrame.left = markerFrame.right = r.left
|
markerFrame.left = markerFrame.right = r.left
|
||||||
+ (r.Width() * step->offset);
|
+ (r.Width() * step->offset);
|
||||||
@@ -648,7 +648,7 @@ GradientControl::_UpdateCurrentColor() const
|
|||||||
if (!fMessage || !fTarget || !fTarget->Looper())
|
if (!fMessage || !fTarget || !fTarget->Looper())
|
||||||
return;
|
return;
|
||||||
// set the CanvasView current color
|
// set the CanvasView current color
|
||||||
if (BGradient::color_step* step = fGradient->ColorAt(fCurrentStepIndex)) {
|
if (BGradient::ColorStop* step = fGradient->ColorAt(fCurrentStepIndex)) {
|
||||||
BMessage message(*fMessage);
|
BMessage message(*fMessage);
|
||||||
store_color_in_message(&message, step->color);
|
store_color_in_message(&message, step->color);
|
||||||
fTarget->Looper()->PostMessage(&message, fTarget);
|
fTarget->Looper()->PostMessage(&message, fTarget);
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ FlatIconExporter::_WriteGradient(LittleEndianBuffer& buffer,
|
|||||||
bool alpha = false;
|
bool alpha = false;
|
||||||
bool gray = true;
|
bool gray = true;
|
||||||
for (int32 i = 0; i < gradientStopCount; i++) {
|
for (int32 i = 0; i < gradientStopCount; i++) {
|
||||||
BGradient::color_step* step = gradient->ColorAtFast(i);
|
BGradient::ColorStop* step = gradient->ColorAtFast(i);
|
||||||
if (step->color.alpha < 255)
|
if (step->color.alpha < 255)
|
||||||
alpha = true;
|
alpha = true;
|
||||||
if (step->color.red != step->color.green
|
if (step->color.red != step->color.green
|
||||||
@@ -632,7 +632,7 @@ FlatIconExporter::_WriteGradient(LittleEndianBuffer& buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i < gradientStopCount; i++) {
|
for (int32 i = 0; i < gradientStopCount; i++) {
|
||||||
BGradient::color_step* step = gradient->ColorAtFast(i);
|
BGradient::ColorStop* step = gradient->ColorAtFast(i);
|
||||||
uint8 stopOffset = (uint8)(step->offset * 255.0);
|
uint8 stopOffset = (uint8)(step->offset * 255.0);
|
||||||
uint32 color = (uint32&)step->color;
|
uint32 color = (uint32&)step->color;
|
||||||
if (!buffer.Write(stopOffset))
|
if (!buffer.Write(stopOffset))
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ DocumentBuilder::_AddShape(path_attributes& attributes, bool outline,
|
|||||||
|
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
|
|
||||||
BGradient::color_step* step;
|
BGradient::ColorStop* step;
|
||||||
if (gradient && (step = gradient->ColorAt(0))) {
|
if (gradient && (step = gradient->ColorAt(0))) {
|
||||||
color.red = step->color.red;
|
color.red = step->color.red;
|
||||||
color.green = step->color.green;
|
color.green = step->color.green;
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ SVGExporter::_ExportGradient(const Gradient* gradient, BPositionIO* stream)
|
|||||||
|
|
||||||
// write stop tags
|
// write stop tags
|
||||||
char color[16];
|
char color[16];
|
||||||
for (int32 i = 0; BGradient::color_step* stop = gradient->ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::ColorStop* stop = gradient->ColorAt(i); i++) {
|
||||||
|
|
||||||
sprintf(color, "%.2x%.2x%.2x", stop->color.red,
|
sprintf(color, "%.2x%.2x%.2x", stop->color.red,
|
||||||
stop->color.green,
|
stop->color.green,
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ LinkReceiver::ReadRegion(BRegion* region)
|
|||||||
|
|
||||||
|
|
||||||
static BGradient*
|
static BGradient*
|
||||||
gradient_for_type(BGradient::gradient_type type)
|
gradient_for_type(BGradient::Type type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BGradient::TYPE_LINEAR:
|
case BGradient::TYPE_LINEAR:
|
||||||
@@ -495,10 +495,10 @@ status_t
|
|||||||
LinkReceiver::ReadGradient(BGradient** _gradient)
|
LinkReceiver::ReadGradient(BGradient** _gradient)
|
||||||
{
|
{
|
||||||
GTRACE(("LinkReceiver::ReadGradient\n"));
|
GTRACE(("LinkReceiver::ReadGradient\n"));
|
||||||
BGradient::gradient_type gradientType;
|
BGradient::Type gradientType;
|
||||||
int32 colorsCount;
|
int32 colorsCount;
|
||||||
status_t ret;
|
status_t ret;
|
||||||
if ((ret = Read(&gradientType, sizeof(BGradient::gradient_type))) != B_OK)
|
if ((ret = Read(&gradientType, sizeof(BGradient::Type))) != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
if ((ret = Read(&colorsCount, sizeof(int32))) != B_OK)
|
if ((ret = Read(&colorsCount, sizeof(int32))) != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -509,11 +509,11 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
*_gradient = gradient;
|
*_gradient = gradient;
|
||||||
|
|
||||||
if (colorsCount > 0) {
|
if (colorsCount > 0) {
|
||||||
BGradient::color_step step;
|
BGradient::ColorStop stop;
|
||||||
for (int i = 0; i < colorsCount; i++) {
|
for (int i = 0; i < colorsCount; i++) {
|
||||||
if ((ret = Read(&step, sizeof(BGradient::color_step))) != B_OK)
|
if ((ret = Read(&stop, sizeof(BGradient::ColorStop))) != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
if (!gradient->AddColor(step, i))
|
if (!gradient->AddColorStop(stop, i))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,15 +126,16 @@ status_t
|
|||||||
ServerLink::AttachGradient(const BGradient &gradient)
|
ServerLink::AttachGradient(const BGradient &gradient)
|
||||||
{
|
{
|
||||||
GTRACE(("ServerLink::AttachGradient\n"));
|
GTRACE(("ServerLink::AttachGradient\n"));
|
||||||
BGradient::gradient_type gradientType = gradient.Type();
|
BGradient::Type gradientType = gradient.GetType();
|
||||||
int32 colorsCount = gradient.CountColors();
|
int32 stopCount = gradient.CountColorStops();
|
||||||
GTRACE(("ServerLink::AttachGradient> colors count == %d\n", (int)colorsCount));
|
GTRACE(("ServerLink::AttachGradient> color stop count == %d\n",
|
||||||
fSender->Attach(&gradientType, sizeof(BGradient::gradient_type));
|
(int)stopCount));
|
||||||
fSender->Attach(&colorsCount, sizeof(int32));
|
fSender->Attach(&gradientType, sizeof(BGradient::Type));
|
||||||
if (colorsCount > 0) {
|
fSender->Attach(&stopCount, sizeof(int32));
|
||||||
for (int i = 0; i < colorsCount; i++) {
|
if (stopCount > 0) {
|
||||||
fSender->Attach(gradient.ColorAtFast(i),
|
for (int i = 0; i < stopCount; i++) {
|
||||||
sizeof(BGradient::color_step));
|
fSender->Attach(gradient.ColorStopAtFast(i),
|
||||||
|
sizeof(BGradient::ColorStop));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku.
|
* Copyright 2006-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
BGradient::color_step::color_step(const rgb_color c, float o)
|
BGradient::ColorStop::ColorStop(const rgb_color c, float o)
|
||||||
{
|
{
|
||||||
color.red = c.red;
|
color.red = c.red;
|
||||||
color.green = c.green;
|
color.green = c.green;
|
||||||
@@ -27,7 +27,7 @@ BGradient::color_step::color_step(const rgb_color c, float o)
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
BGradient::color_step::color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o)
|
BGradient::ColorStop::ColorStop(uint8 r, uint8 g, uint8 b, uint8 a, float o)
|
||||||
{
|
{
|
||||||
color.red = r;
|
color.red = r;
|
||||||
color.green = g;
|
color.green = g;
|
||||||
@@ -38,7 +38,7 @@ BGradient::color_step::color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o)
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
BGradient::color_step::color_step(const color_step& other)
|
BGradient::ColorStop::ColorStop(const ColorStop& other)
|
||||||
{
|
{
|
||||||
color.red = other.color.red;
|
color.red = other.color.red;
|
||||||
color.green = other.color.green;
|
color.green = other.color.green;
|
||||||
@@ -49,7 +49,7 @@ BGradient::color_step::color_step(const color_step& other)
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
BGradient::color_step::color_step()
|
BGradient::ColorStop::ColorStop()
|
||||||
{
|
{
|
||||||
color.red = 0;
|
color.red = 0;
|
||||||
color.green = 0;
|
color.green = 0;
|
||||||
@@ -61,7 +61,7 @@ BGradient::color_step::color_step()
|
|||||||
|
|
||||||
// operator!=
|
// operator!=
|
||||||
bool
|
bool
|
||||||
BGradient::color_step::operator!=(const color_step& other) const
|
BGradient::ColorStop::operator!=(const ColorStop& other) const
|
||||||
{
|
{
|
||||||
return color.red != other.color.red ||
|
return color.red != other.color.red ||
|
||||||
color.green != other.color.green ||
|
color.green != other.color.green ||
|
||||||
@@ -72,10 +72,10 @@ BGradient::color_step::operator!=(const color_step& other) const
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sort_color_steps_by_offset(const void* _left, const void* _right)
|
sort_color_stops_by_offset(const void* _left, const void* _right)
|
||||||
{
|
{
|
||||||
const BGradient::color_step** left = (const BGradient::color_step**)_left;
|
const BGradient::ColorStop** left = (const BGradient::ColorStop**)_left;
|
||||||
const BGradient::color_step** right = (const BGradient::color_step**)_right;
|
const BGradient::ColorStop** right = (const BGradient::ColorStop**)_right;
|
||||||
if ((*left)->offset > (*right)->offset)
|
if ((*left)->offset > (*right)->offset)
|
||||||
return 1;
|
return 1;
|
||||||
else if ((*left)->offset < (*right)->offset)
|
else if ((*left)->offset < (*right)->offset)
|
||||||
@@ -90,7 +90,7 @@ sort_color_steps_by_offset(const void* _left, const void* _right)
|
|||||||
// constructor
|
// constructor
|
||||||
BGradient::BGradient()
|
BGradient::BGradient()
|
||||||
: BArchivable(),
|
: BArchivable(),
|
||||||
fColors(4),
|
fColorStops(4),
|
||||||
fType(TYPE_NONE)
|
fType(TYPE_NONE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -99,17 +99,17 @@ BGradient::BGradient()
|
|||||||
// constructor
|
// constructor
|
||||||
BGradient::BGradient(BMessage* archive)
|
BGradient::BGradient(BMessage* archive)
|
||||||
: BArchivable(archive),
|
: BArchivable(archive),
|
||||||
fColors(4),
|
fColorStops(4),
|
||||||
fType(TYPE_NONE)
|
fType(TYPE_NONE)
|
||||||
{
|
{
|
||||||
if (!archive)
|
if (!archive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// color steps
|
// color stops
|
||||||
color_step step;
|
ColorStop stop;
|
||||||
for (int32 i = 0; archive->FindFloat("offset", i, &step.offset) >= B_OK; i++) {
|
for (int32 i = 0; archive->FindFloat("offset", i, &stop.offset) >= B_OK; i++) {
|
||||||
if (archive->FindInt32("color", i, (int32*)&step.color) >= B_OK)
|
if (archive->FindInt32("color", i, (int32*)&stop.color) >= B_OK)
|
||||||
AddColor(step, i);
|
AddColorStop(stop, i);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -177,11 +177,11 @@ BGradient::Archive(BMessage* into, bool deep) const
|
|||||||
|
|
||||||
// color steps
|
// color steps
|
||||||
if (ret >= B_OK) {
|
if (ret >= B_OK) {
|
||||||
for (int32 i = 0; color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; ColorStop* stop = ColorStopAt(i); i++) {
|
||||||
ret = into->AddInt32("color", (const uint32&)step->color);
|
ret = into->AddInt32("color", (const uint32&)stop->color);
|
||||||
if (ret < B_OK)
|
if (ret < B_OK)
|
||||||
break;
|
break;
|
||||||
ret = into->AddFloat("offset", step->offset);
|
ret = into->AddFloat("offset", stop->offset);
|
||||||
if (ret < B_OK)
|
if (ret < B_OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ BGradient::Archive(BMessage* into, bool deep) const
|
|||||||
BGradient&
|
BGradient&
|
||||||
BGradient::operator=(const BGradient& other)
|
BGradient::operator=(const BGradient& other)
|
||||||
{
|
{
|
||||||
SetColors(other);
|
SetColorStops(other);
|
||||||
fType = other.fType;
|
fType = other.fType;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ BGradient::operator=(const BGradient& other)
|
|||||||
bool
|
bool
|
||||||
BGradient::operator==(const BGradient& other) const
|
BGradient::operator==(const BGradient& other) const
|
||||||
{
|
{
|
||||||
return ((other.Type() == Type()) && ColorStepsAreEqual(other));
|
return ((other.GetType() == GetType()) && ColorStopsAreEqual(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -268,19 +268,19 @@ BGradient::operator!=(const BGradient& other) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ColorStepsAreEqual
|
// ColorStopsAreEqual
|
||||||
bool
|
bool
|
||||||
BGradient::ColorStepsAreEqual(const BGradient& other) const
|
BGradient::ColorStopsAreEqual(const BGradient& other) const
|
||||||
{
|
{
|
||||||
int32 count = CountColors();
|
int32 count = CountColorStops();
|
||||||
if (count == other.CountColors() &&
|
if (count == other.CountColorStops() &&
|
||||||
fType == other.fType) {
|
fType == other.fType) {
|
||||||
|
|
||||||
bool equal = true;
|
bool equal = true;
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
color_step* ourStep = ColorAtFast(i);
|
ColorStop* ourStop = ColorStopAtFast(i);
|
||||||
color_step* otherStep = other.ColorAtFast(i);
|
ColorStop* otherStop = other.ColorStopAtFast(i);
|
||||||
if (*ourStep != *otherStep) {
|
if (*ourStop != *otherStop) {
|
||||||
equal = false;
|
equal = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -291,13 +291,13 @@ BGradient::ColorStepsAreEqual(const BGradient& other) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SetColors
|
// SetColorStops
|
||||||
void
|
void
|
||||||
BGradient::SetColors(const BGradient& other)
|
BGradient::SetColorStops(const BGradient& other)
|
||||||
{
|
{
|
||||||
MakeEmpty();
|
MakeEmpty();
|
||||||
for (int32 i = 0; color_step* step = other.ColorAt(i); i++)
|
for (int32 i = 0; ColorStop* stop = other.ColorStopAt(i); i++)
|
||||||
AddColor(*step, i);
|
AddColorStop(*stop, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -306,29 +306,29 @@ int32
|
|||||||
BGradient::AddColor(const rgb_color& color, float offset)
|
BGradient::AddColor(const rgb_color& color, float offset)
|
||||||
{
|
{
|
||||||
// find the correct index (sorted by offset)
|
// find the correct index (sorted by offset)
|
||||||
color_step* step = new color_step(color, offset);
|
ColorStop* stop = new ColorStop(color, offset);
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
int32 count = CountColors();
|
int32 count = CountColorStops();
|
||||||
for (; index < count; index++) {
|
for (; index < count; index++) {
|
||||||
color_step* s = ColorAtFast(index);
|
ColorStop* s = ColorStopAtFast(index);
|
||||||
if (s->offset > step->offset)
|
if (s->offset > stop->offset)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!fColors.AddItem((void*)step, index)) {
|
if (!fColorStops.AddItem((void*)stop, index)) {
|
||||||
delete step;
|
delete stop;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// AddColor
|
// AddColorStop
|
||||||
bool
|
bool
|
||||||
BGradient::AddColor(const color_step& color, int32 index)
|
BGradient::AddColorStop(const ColorStop& colorStop, int32 index)
|
||||||
{
|
{
|
||||||
color_step* step = new color_step(color);
|
ColorStop* stop = new ColorStop(colorStop);
|
||||||
if (!fColors.AddItem((void*)step, index)) {
|
if (!fColorStops.AddItem((void*)stop, index)) {
|
||||||
delete step;
|
delete stop;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -339,23 +339,23 @@ BGradient::AddColor(const color_step& color, int32 index)
|
|||||||
bool
|
bool
|
||||||
BGradient::RemoveColor(int32 index)
|
BGradient::RemoveColor(int32 index)
|
||||||
{
|
{
|
||||||
color_step* step = (color_step*)fColors.RemoveItem(index);
|
ColorStop* stop = (ColorStop*)fColorStops.RemoveItem(index);
|
||||||
if (!step) {
|
if (!stop) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
delete step;
|
delete stop;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SetColor
|
// SetColorStop
|
||||||
bool
|
bool
|
||||||
BGradient::SetColor(int32 index, const color_step& color)
|
BGradient::SetColorStop(int32 index, const ColorStop& color)
|
||||||
{
|
{
|
||||||
if (color_step* step = ColorAt(index)) {
|
if (ColorStop* stop = ColorStopAt(index)) {
|
||||||
if (*step != color) {
|
if (*stop != color) {
|
||||||
step->color = color.color;
|
stop->color = color.color;
|
||||||
step->offset = color.offset;
|
stop->offset = color.offset;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -367,11 +367,10 @@ BGradient::SetColor(int32 index, const color_step& color)
|
|||||||
bool
|
bool
|
||||||
BGradient::SetColor(int32 index, const rgb_color& color)
|
BGradient::SetColor(int32 index, const rgb_color& color)
|
||||||
{
|
{
|
||||||
if (color_step* step = ColorAt(index)) {
|
ColorStop* stop = ColorStopAt(index);
|
||||||
if ((uint32&)step->color != (uint32&)color) {
|
if (stop && stop->color != color) {
|
||||||
step->color = color;
|
stop->color = color;
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -381,55 +380,55 @@ BGradient::SetColor(int32 index, const rgb_color& color)
|
|||||||
bool
|
bool
|
||||||
BGradient::SetOffset(int32 index, float offset)
|
BGradient::SetOffset(int32 index, float offset)
|
||||||
{
|
{
|
||||||
color_step* step = ColorAt(index);
|
ColorStop* stop = ColorStopAt(index);
|
||||||
if (step && step->offset != offset) {
|
if (stop && stop->offset != offset) {
|
||||||
step->offset = offset;
|
stop->offset = offset;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CountColors
|
// CountColorStops
|
||||||
int32
|
int32
|
||||||
BGradient::CountColors() const
|
BGradient::CountColorStops() const
|
||||||
{
|
{
|
||||||
return fColors.CountItems();
|
return fColorStops.CountItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ColorAt
|
// ColorStopAt
|
||||||
BGradient::color_step*
|
BGradient::ColorStop*
|
||||||
BGradient::ColorAt(int32 index) const
|
BGradient::ColorStopAt(int32 index) const
|
||||||
{
|
{
|
||||||
return (color_step*)fColors.ItemAt(index);
|
return (ColorStop*)fColorStops.ItemAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ColorAtFast
|
// ColorStopAtFast
|
||||||
BGradient::color_step*
|
BGradient::ColorStop*
|
||||||
BGradient::ColorAtFast(int32 index) const
|
BGradient::ColorStopAtFast(int32 index) const
|
||||||
{
|
{
|
||||||
return (color_step*)fColors.ItemAtFast(index);
|
return (ColorStop*)fColorStops.ItemAtFast(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Colors
|
// ColorStops
|
||||||
BGradient::color_step*
|
BGradient::ColorStop*
|
||||||
BGradient::Colors() const
|
BGradient::ColorStops() const
|
||||||
{
|
{
|
||||||
if (CountColors() > 0) {
|
if (CountColorStops() > 0) {
|
||||||
return (color_step*) fColors.Items();
|
return (ColorStop*) fColorStops.Items();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SortColorStepsByOffset
|
// SortColorStopsByOffset
|
||||||
void
|
void
|
||||||
BGradient::SortColorStepsByOffset()
|
BGradient::SortColorStopsByOffset()
|
||||||
{
|
{
|
||||||
fColors.SortItems(sort_color_steps_by_offset);
|
fColorStops.SortItems(sort_color_stops_by_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -437,8 +436,8 @@ BGradient::SortColorStepsByOffset()
|
|||||||
void
|
void
|
||||||
BGradient::MakeEmpty()
|
BGradient::MakeEmpty()
|
||||||
{
|
{
|
||||||
int32 count = CountColors();
|
int32 count = CountColorStops();
|
||||||
for (int32 i = 0; i < count; i++)
|
for (int32 i = 0; i < count; i++)
|
||||||
delete ColorAtFast(i);
|
delete ColorStopAtFast(i);
|
||||||
fColors.MakeEmpty();
|
fColorStops.MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ Gradient::Gradient(bool empty)
|
|||||||
fInheritTransformation(true)
|
fInheritTransformation(true)
|
||||||
{
|
{
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
AddColor(BGradient::color_step(0, 0, 0, 255, 0.0), 0);
|
AddColor(BGradient::ColorStop(0, 0, 0, 255, 0.0), 0);
|
||||||
AddColor(BGradient::color_step(255, 255, 255, 255, 1.0), 1);
|
AddColor(BGradient::ColorStop(255, 255, 255, 255, 1.0), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ Gradient::Gradient(BMessage* archive)
|
|||||||
LoadFrom((const double*)matrix);
|
LoadFrom((const double*)matrix);
|
||||||
|
|
||||||
// color steps
|
// color steps
|
||||||
BGradient::color_step step;
|
BGradient::ColorStop step;
|
||||||
for (int32 i = 0; archive->FindFloat("offset", i, &step.offset) >= B_OK; i++) {
|
for (int32 i = 0; archive->FindFloat("offset", i, &step.offset) >= B_OK; i++) {
|
||||||
if (archive->FindInt32("color", i, (int32*)&step.color) >= B_OK)
|
if (archive->FindInt32("color", i, (int32*)&step.color) >= B_OK)
|
||||||
AddColor(step, i);
|
AddColor(step, i);
|
||||||
@@ -97,7 +97,7 @@ Gradient::Gradient(const Gradient& other)
|
|||||||
fInterpolation(other.fInterpolation),
|
fInterpolation(other.fInterpolation),
|
||||||
fInheritTransformation(other.fInheritTransformation)
|
fInheritTransformation(other.fInheritTransformation)
|
||||||
{
|
{
|
||||||
for (int32 i = 0; BGradient::color_step* step = other.ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::ColorStop* step = other.ColorAt(i); i++) {
|
||||||
AddColor(*step, i);
|
AddColor(*step, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ Gradient::Archive(BMessage* into, bool deep) const
|
|||||||
|
|
||||||
// color steps
|
// color steps
|
||||||
if (ret >= B_OK) {
|
if (ret >= B_OK) {
|
||||||
for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::ColorStop* step = ColorAt(i); i++) {
|
||||||
ret = into->AddInt32("color", (const uint32&)step->color);
|
ret = into->AddInt32("color", (const uint32&)step->color);
|
||||||
if (ret < B_OK)
|
if (ret < B_OK)
|
||||||
break;
|
break;
|
||||||
@@ -198,8 +198,8 @@ Gradient::ColorStepsAreEqual(const Gradient& other) const
|
|||||||
|
|
||||||
bool equal = true;
|
bool equal = true;
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
BGradient::color_step* ourStep = ColorAtFast(i);
|
BGradient::ColorStop* ourStep = ColorAtFast(i);
|
||||||
BGradient::color_step* otherStep = other.ColorAtFast(i);
|
BGradient::ColorStop* otherStep = other.ColorAtFast(i);
|
||||||
if (*ourStep != *otherStep) {
|
if (*ourStep != *otherStep) {
|
||||||
equal = false;
|
equal = false;
|
||||||
break;
|
break;
|
||||||
@@ -219,7 +219,7 @@ Gradient::SetColors(const Gradient& other)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_MakeEmpty();
|
_MakeEmpty();
|
||||||
for (int32 i = 0; BGradient::color_step* step = other.ColorAt(i); i++)
|
for (int32 i = 0; BGradient::ColorStop* step = other.ColorAt(i); i++)
|
||||||
AddColor(*step, i);
|
AddColor(*step, i);
|
||||||
|
|
||||||
Notify();
|
Notify();
|
||||||
@@ -232,11 +232,11 @@ int32
|
|||||||
Gradient::AddColor(const rgb_color& color, float offset)
|
Gradient::AddColor(const rgb_color& color, float offset)
|
||||||
{
|
{
|
||||||
// find the correct index (sorted by offset)
|
// find the correct index (sorted by offset)
|
||||||
BGradient::color_step* step = new BGradient::color_step(color, offset);
|
BGradient::ColorStop* step = new BGradient::ColorStop(color, offset);
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
int32 count = CountColors();
|
int32 count = CountColors();
|
||||||
for (; index < count; index++) {
|
for (; index < count; index++) {
|
||||||
BGradient::color_step* s = ColorAtFast(index);
|
BGradient::ColorStop* s = ColorAtFast(index);
|
||||||
if (s->offset > step->offset)
|
if (s->offset > step->offset)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -250,9 +250,9 @@ Gradient::AddColor(const rgb_color& color, float offset)
|
|||||||
|
|
||||||
// AddColor
|
// AddColor
|
||||||
bool
|
bool
|
||||||
Gradient::AddColor(const BGradient::color_step& color, int32 index)
|
Gradient::AddColor(const BGradient::ColorStop& color, int32 index)
|
||||||
{
|
{
|
||||||
BGradient::color_step* step = new BGradient::color_step(color);
|
BGradient::ColorStop* step = new BGradient::ColorStop(color);
|
||||||
if (!fColors.AddItem((void*)step, index)) {
|
if (!fColors.AddItem((void*)step, index)) {
|
||||||
delete step;
|
delete step;
|
||||||
return false;
|
return false;
|
||||||
@@ -265,8 +265,8 @@ Gradient::AddColor(const BGradient::color_step& color, int32 index)
|
|||||||
bool
|
bool
|
||||||
Gradient::RemoveColor(int32 index)
|
Gradient::RemoveColor(int32 index)
|
||||||
{
|
{
|
||||||
BGradient::color_step* step
|
BGradient::ColorStop* step
|
||||||
= (BGradient::color_step*)fColors.RemoveItem(index);
|
= (BGradient::ColorStop*)fColors.RemoveItem(index);
|
||||||
if (!step) {
|
if (!step) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -279,9 +279,9 @@ Gradient::RemoveColor(int32 index)
|
|||||||
|
|
||||||
// SetColor
|
// SetColor
|
||||||
bool
|
bool
|
||||||
Gradient::SetColor(int32 index, const BGradient::color_step& color)
|
Gradient::SetColor(int32 index, const BGradient::ColorStop& color)
|
||||||
{
|
{
|
||||||
if (BGradient::color_step* step = ColorAt(index)) {
|
if (BGradient::ColorStop* step = ColorAt(index)) {
|
||||||
if (*step != color) {
|
if (*step != color) {
|
||||||
step->color = color.color;
|
step->color = color.color;
|
||||||
step->offset = color.offset;
|
step->offset = color.offset;
|
||||||
@@ -296,7 +296,7 @@ Gradient::SetColor(int32 index, const BGradient::color_step& color)
|
|||||||
bool
|
bool
|
||||||
Gradient::SetColor(int32 index, const rgb_color& color)
|
Gradient::SetColor(int32 index, const rgb_color& color)
|
||||||
{
|
{
|
||||||
if (BGradient::color_step* step = ColorAt(index)) {
|
if (BGradient::ColorStop* step = ColorAt(index)) {
|
||||||
if ((uint32&)step->color != (uint32&)color) {
|
if ((uint32&)step->color != (uint32&)color) {
|
||||||
step->color = color;
|
step->color = color;
|
||||||
Notify();
|
Notify();
|
||||||
@@ -310,7 +310,7 @@ Gradient::SetColor(int32 index, const rgb_color& color)
|
|||||||
bool
|
bool
|
||||||
Gradient::SetOffset(int32 index, float offset)
|
Gradient::SetOffset(int32 index, float offset)
|
||||||
{
|
{
|
||||||
BGradient::color_step* step = ColorAt(index);
|
BGradient::ColorStop* step = ColorAt(index);
|
||||||
if (step && step->offset != offset) {
|
if (step && step->offset != offset) {
|
||||||
step->offset = offset;
|
step->offset = offset;
|
||||||
Notify();
|
Notify();
|
||||||
@@ -329,17 +329,17 @@ Gradient::CountColors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ColorAt
|
// ColorAt
|
||||||
BGradient::color_step*
|
BGradient::ColorStop*
|
||||||
Gradient::ColorAt(int32 index) const
|
Gradient::ColorAt(int32 index) const
|
||||||
{
|
{
|
||||||
return (BGradient::color_step*)fColors.ItemAt(index);
|
return (BGradient::ColorStop*)fColors.ItemAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorAtFast
|
// ColorAtFast
|
||||||
BGradient::color_step*
|
BGradient::ColorStop*
|
||||||
Gradient::ColorAtFast(int32 index) const
|
Gradient::ColorAtFast(int32 index) const
|
||||||
{
|
{
|
||||||
return (BGradient::color_step*)fColors.ItemAtFast(index);
|
return (BGradient::ColorStop*)fColors.ItemAtFast(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -395,13 +395,13 @@ gauss(double f)
|
|||||||
void
|
void
|
||||||
Gradient::MakeGradient(uint32* colors, int32 count) const
|
Gradient::MakeGradient(uint32* colors, int32 count) const
|
||||||
{
|
{
|
||||||
BGradient::color_step* from = ColorAt(0);
|
BGradient::ColorStop* from = ColorAt(0);
|
||||||
|
|
||||||
if (!from)
|
if (!from)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// find the step with the lowest offset
|
// find the step with the lowest offset
|
||||||
for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::ColorStop* step = ColorAt(i); i++) {
|
||||||
if (step->offset < from->offset)
|
if (step->offset < from->offset)
|
||||||
from = step;
|
from = step;
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ Gradient::MakeGradient(uint32* colors, int32 count) const
|
|||||||
|
|
||||||
// put all steps that we need to interpolate to into a list
|
// put all steps that we need to interpolate to into a list
|
||||||
BList nextSteps(fColors.CountItems() - 1);
|
BList nextSteps(fColors.CountItems() - 1);
|
||||||
for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::ColorStop* step = ColorAt(i); i++) {
|
||||||
if (step != from)
|
if (step != from)
|
||||||
nextSteps.AddItem((void*)step);
|
nextSteps.AddItem((void*)step);
|
||||||
}
|
}
|
||||||
@@ -435,10 +435,10 @@ Gradient::MakeGradient(uint32* colors, int32 count) const
|
|||||||
while (!nextSteps.IsEmpty()) {
|
while (!nextSteps.IsEmpty()) {
|
||||||
|
|
||||||
// find the step with the next offset
|
// find the step with the next offset
|
||||||
BGradient::color_step* to = NULL;
|
BGradient::ColorStop* to = NULL;
|
||||||
float nextOffsetDist = 2.0;
|
float nextOffsetDist = 2.0;
|
||||||
for (int32 i = 0; BGradient::color_step* step
|
for (int32 i = 0; BGradient::ColorStop* step
|
||||||
= (BGradient::color_step*)nextSteps.ItemAt(i); i++) {
|
= (BGradient::ColorStop*)nextSteps.ItemAt(i); i++) {
|
||||||
float d = step->offset - from->offset;
|
float d = step->offset - from->offset;
|
||||||
if (d < nextOffsetDist && d >= 0) {
|
if (d < nextOffsetDist && d >= 0) {
|
||||||
to = step;
|
to = step;
|
||||||
@@ -588,7 +588,7 @@ Gradient::PrintToStream() const
|
|||||||
string_for_type(fType),
|
string_for_type(fType),
|
||||||
string_for_interpolation(fInterpolation),
|
string_for_interpolation(fInterpolation),
|
||||||
fInheritTransformation);
|
fInheritTransformation);
|
||||||
for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::ColorStop* step = ColorAt(i); i++) {
|
||||||
printf(" %ld: offset: %.1f -> color(%d, %d, %d, %d)\n",
|
printf(" %ld: offset: %.1f -> color(%d, %d, %d, %d)\n",
|
||||||
i, step->offset,
|
i, step->offset,
|
||||||
step->color.red,
|
step->color.red,
|
||||||
|
|||||||
@@ -73,19 +73,19 @@ class Gradient : public Transformable {
|
|||||||
|
|
||||||
|
|
||||||
int32 AddColor(const rgb_color& color, float offset);
|
int32 AddColor(const rgb_color& color, float offset);
|
||||||
bool AddColor(const BGradient::color_step& color,
|
bool AddColor(const BGradient::ColorStop& color,
|
||||||
int32 index);
|
int32 index);
|
||||||
|
|
||||||
bool RemoveColor(int32 index);
|
bool RemoveColor(int32 index);
|
||||||
|
|
||||||
bool SetColor(int32 index,
|
bool SetColor(int32 index,
|
||||||
const BGradient::color_step& step);
|
const BGradient::ColorStop& step);
|
||||||
bool SetColor(int32 index, const rgb_color& color);
|
bool SetColor(int32 index, const rgb_color& color);
|
||||||
bool SetOffset(int32 index, float offset);
|
bool SetOffset(int32 index, float offset);
|
||||||
|
|
||||||
int32 CountColors() const;
|
int32 CountColors() const;
|
||||||
BGradient::color_step* ColorAt(int32 index) const;
|
BGradient::ColorStop* ColorAt(int32 index) const;
|
||||||
BGradient::color_step* ColorAtFast(int32 index) const;
|
BGradient::ColorStop* ColorAtFast(int32 index) const;
|
||||||
|
|
||||||
void SetType(gradients_type type);
|
void SetType(gradients_type type);
|
||||||
gradients_type Type() const
|
gradients_type Type() const
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ Style::HasTransparency() const
|
|||||||
if (fGradient) {
|
if (fGradient) {
|
||||||
int32 count = fGradient->CountColors();
|
int32 count = fGradient->CountColors();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
BGradient::color_step* step = fGradient->ColorAtFast(i);
|
BGradient::ColorStop* step = fGradient->ColorAtFast(i);
|
||||||
if (step->color.alpha < 255)
|
if (step->color.alpha < 255)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -814,7 +814,7 @@ View::ConvertToScreenForDrawing(BRegion* region) const
|
|||||||
void
|
void
|
||||||
View::ConvertToScreenForDrawing(BGradient* gradient) const
|
View::ConvertToScreenForDrawing(BGradient* gradient) const
|
||||||
{
|
{
|
||||||
switch(gradient->Type()) {
|
switch(gradient->GetType()) {
|
||||||
case BGradient::TYPE_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
BGradientLinear* linear = (BGradientLinear*) gradient;
|
BGradientLinear* linear = (BGradientLinear*) gradient;
|
||||||
BPoint start = linear->Start();
|
BPoint start = linear->Start();
|
||||||
@@ -825,7 +825,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
ConvertToScreen(&end);
|
ConvertToScreen(&end);
|
||||||
linear->SetStart(start);
|
linear->SetStart(start);
|
||||||
linear->SetEnd(end);
|
linear->SetEnd(end);
|
||||||
linear->SortColorStepsByOffset();
|
linear->SortColorStopsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BGradient::TYPE_RADIAL: {
|
case BGradient::TYPE_RADIAL: {
|
||||||
@@ -834,7 +834,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
fDrawState->Transform(¢er);
|
fDrawState->Transform(¢er);
|
||||||
ConvertToScreen(¢er);
|
ConvertToScreen(¢er);
|
||||||
radial->SetCenter(center);
|
radial->SetCenter(center);
|
||||||
radial->SortColorStepsByOffset();
|
radial->SortColorStopsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BGradient::TYPE_RADIAL_FOCUS: {
|
case BGradient::TYPE_RADIAL_FOCUS: {
|
||||||
@@ -847,7 +847,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
ConvertToScreen(&focal);
|
ConvertToScreen(&focal);
|
||||||
radialFocus->SetCenter(center);
|
radialFocus->SetCenter(center);
|
||||||
radialFocus->SetFocal(focal);
|
radialFocus->SetFocal(focal);
|
||||||
radialFocus->SortColorStepsByOffset();
|
radialFocus->SortColorStopsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BGradient::TYPE_DIAMOND: {
|
case BGradient::TYPE_DIAMOND: {
|
||||||
@@ -856,7 +856,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
fDrawState->Transform(¢er);
|
fDrawState->Transform(¢er);
|
||||||
ConvertToScreen(¢er);
|
ConvertToScreen(¢er);
|
||||||
diamond->SetCenter(center);
|
diamond->SetCenter(center);
|
||||||
diamond->SortColorStepsByOffset();
|
diamond->SortColorStopsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BGradient::TYPE_CONIC: {
|
case BGradient::TYPE_CONIC: {
|
||||||
@@ -865,7 +865,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
fDrawState->Transform(¢er);
|
fDrawState->Transform(¢er);
|
||||||
ConvertToScreen(¢er);
|
ConvertToScreen(¢er);
|
||||||
conic->SetCenter(center);
|
conic->SetCenter(center);
|
||||||
conic->SortColorStepsByOffset();
|
conic->SortColorStopsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BGradient::TYPE_NONE: {
|
case BGradient::TYPE_NONE: {
|
||||||
|
|||||||
@@ -639,8 +639,7 @@ DrawingEngine::FillArc(BRect r, const float& angle, const float& span,
|
|||||||
BPoint center(r.left + xRadius,
|
BPoint center(r.left + xRadius,
|
||||||
r.top + yRadius);
|
r.top + yRadius);
|
||||||
|
|
||||||
fPainter->FillArcGradient(center, xRadius, yRadius, angle, span,
|
fPainter->FillArc(center, xRadius, yRadius, angle, span, gradient);
|
||||||
gradient);
|
|
||||||
|
|
||||||
_CopyToFront(clipped);
|
_CopyToFront(clipped);
|
||||||
}
|
}
|
||||||
@@ -669,7 +668,7 @@ DrawingEngine::FillBezier(BPoint* pts, const BGradient& gradient)
|
|||||||
// TODO: figure out bounds and hide cursor depending on that
|
// TODO: figure out bounds and hide cursor depending on that
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard);
|
AutoFloatingOverlaysHider _(fGraphicsCard);
|
||||||
|
|
||||||
BRect touched = fPainter->FillBezierGradient(pts, gradient);
|
BRect touched = fPainter->FillBezier(pts, gradient);
|
||||||
|
|
||||||
_CopyToFront(touched);
|
_CopyToFront(touched);
|
||||||
}
|
}
|
||||||
@@ -723,7 +722,7 @@ DrawingEngine::FillEllipse(BRect r, const BGradient& gradient)
|
|||||||
if (clipped.IsValid()) {
|
if (clipped.IsValid()) {
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
||||||
|
|
||||||
fPainter->FillEllipseGradient(r, gradient);
|
fPainter->FillEllipse(r, gradient);
|
||||||
|
|
||||||
_CopyToFront(clipped);
|
_CopyToFront(clipped);
|
||||||
}
|
}
|
||||||
@@ -761,7 +760,7 @@ DrawingEngine::FillPolygon(BPoint* ptlist, int32 numpts, BRect bounds,
|
|||||||
if (bounds.IsValid()) {
|
if (bounds.IsValid()) {
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard, bounds);
|
AutoFloatingOverlaysHider _(fGraphicsCard, bounds);
|
||||||
|
|
||||||
fPainter->FillPolygonGradient(ptlist, numpts, gradient, closed);
|
fPainter->FillPolygon(ptlist, numpts, gradient, closed);
|
||||||
|
|
||||||
_CopyToFront(bounds);
|
_CopyToFront(bounds);
|
||||||
}
|
}
|
||||||
@@ -979,7 +978,7 @@ DrawingEngine::FillRect(BRect r, const BGradient& gradient)
|
|||||||
|
|
||||||
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
|
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
|
||||||
|
|
||||||
fPainter->FillRectGradient(r, gradient);
|
fPainter->FillRect(r, gradient);
|
||||||
|
|
||||||
_CopyToFront(r);
|
_CopyToFront(r);
|
||||||
}
|
}
|
||||||
@@ -1049,11 +1048,11 @@ DrawingEngine::FillRegion(BRegion& r, const BGradient& gradient)
|
|||||||
|
|
||||||
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, clipped);
|
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, clipped);
|
||||||
|
|
||||||
BRect touched = fPainter->FillRectGradient(r.RectAt(0), gradient);
|
BRect touched = fPainter->FillRect(r.RectAt(0), gradient);
|
||||||
|
|
||||||
int32 count = r.CountRects();
|
int32 count = r.CountRects();
|
||||||
for (int32 i = 1; i < count; i++)
|
for (int32 i = 1; i < count; i++)
|
||||||
touched = touched | fPainter->FillRectGradient(r.RectAt(i), gradient);
|
touched = touched | fPainter->FillRect(r.RectAt(i), gradient);
|
||||||
|
|
||||||
_CopyToFront(r.Frame());
|
_CopyToFront(r.Frame());
|
||||||
}
|
}
|
||||||
@@ -1104,7 +1103,7 @@ DrawingEngine::FillRoundRect(BRect r, float xrad, float yrad,
|
|||||||
if (clipped.IsValid()) {
|
if (clipped.IsValid()) {
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
||||||
|
|
||||||
BRect touched = fPainter->FillRoundRectGradient(r, xrad, yrad, gradient);
|
BRect touched = fPainter->FillRoundRect(r, xrad, yrad, gradient);
|
||||||
|
|
||||||
_CopyToFront(touched);
|
_CopyToFront(touched);
|
||||||
}
|
}
|
||||||
@@ -1140,7 +1139,7 @@ DrawingEngine::FillShape(const BRect& bounds, int32 opCount,
|
|||||||
// shape is drawn on screen, TODO: optimize
|
// shape is drawn on screen, TODO: optimize
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard);
|
AutoFloatingOverlaysHider _(fGraphicsCard);
|
||||||
|
|
||||||
BRect touched = fPainter->FillShapeGradient(opCount, opList, ptCount,
|
BRect touched = fPainter->FillShape(opCount, opList, ptCount,
|
||||||
ptList, gradient);
|
ptList, gradient);
|
||||||
|
|
||||||
_CopyToFront(touched);
|
_CopyToFront(touched);
|
||||||
@@ -1179,7 +1178,7 @@ DrawingEngine::FillTriangle(BPoint* pts, const BRect& bounds,
|
|||||||
if (clipped.IsValid()) {
|
if (clipped.IsValid()) {
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
||||||
|
|
||||||
fPainter->FillTriangleGradient(pts[0], pts[1], pts[2], gradient);
|
fPainter->FillTriangle(pts[0], pts[1], pts[2], gradient);
|
||||||
|
|
||||||
_CopyToFront(clipped);
|
_CopyToFront(clipped);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -506,10 +506,10 @@ Painter::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3) const
|
|||||||
return _DrawTriangle(pt1, pt2, pt3, true);
|
return _DrawTriangle(pt1, pt2, pt3, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillTriangleGradient
|
// FillTriangle
|
||||||
BRect
|
BRect
|
||||||
Painter::FillTriangleGradient(BPoint pt1, BPoint pt2, BPoint pt3,
|
Painter::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
||||||
const BGradient& gradient) const
|
const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -525,7 +525,7 @@ Painter::FillTriangleGradient(BPoint pt1, BPoint pt2, BPoint pt3,
|
|||||||
|
|
||||||
fPath.close_polygon();
|
fPath.close_polygon();
|
||||||
|
|
||||||
return _FillPathGradient(fPath, gradient);
|
return _FillPath(fPath, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawPolygon
|
// DrawPolygon
|
||||||
@@ -559,9 +559,9 @@ Painter::DrawPolygon(BPoint* p, int32 numPts,
|
|||||||
return BRect(0.0, 0.0, -1.0, -1.0);
|
return BRect(0.0, 0.0, -1.0, -1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillPolygonGradient
|
// FillPolygon
|
||||||
BRect
|
BRect
|
||||||
Painter::FillPolygonGradient(BPoint* p, int32 numPts,
|
Painter::FillPolygon(BPoint* p, int32 numPts,
|
||||||
const BGradient& gradient, bool closed) const
|
const BGradient& gradient, bool closed) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
@@ -582,7 +582,7 @@ Painter::FillPolygonGradient(BPoint* p, int32 numPts,
|
|||||||
if (closed)
|
if (closed)
|
||||||
fPath.close_polygon();
|
fPath.close_polygon();
|
||||||
|
|
||||||
return _FillPathGradient(fPath, gradient);
|
return _FillPath(fPath, gradient);
|
||||||
}
|
}
|
||||||
return BRect(0.0, 0.0, -1.0, -1.0);
|
return BRect(0.0, 0.0, -1.0, -1.0);
|
||||||
}
|
}
|
||||||
@@ -614,9 +614,9 @@ Painter::DrawBezier(BPoint* p, bool filled) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillBezierGradient
|
// FillBezier
|
||||||
BRect
|
BRect
|
||||||
Painter::FillBezierGradient(BPoint* p, const BGradient& gradient) const
|
Painter::FillBezier(BPoint* p, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -634,15 +634,14 @@ Painter::FillBezierGradient(BPoint* p, const BGradient& gradient) const
|
|||||||
|
|
||||||
|
|
||||||
fPath.close_polygon();
|
fPath.close_polygon();
|
||||||
return _FillPathGradient(fCurve, gradient);
|
return _FillPath(fCurve, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// DrawShape
|
// DrawShape
|
||||||
BRect
|
BRect
|
||||||
Painter::DrawShape(const int32& opCount, const uint32* opList,
|
Painter::DrawShape(const int32& opCount, const uint32* opList,
|
||||||
const int32& ptCount, const BPoint* points,
|
const int32& ptCount, const BPoint* points, bool filled) const
|
||||||
bool filled) const
|
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -686,11 +685,11 @@ Painter::DrawShape(const int32& opCount, const uint32* opList,
|
|||||||
return _StrokePath(fCurve);
|
return _StrokePath(fCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillShapeGradient
|
// FillShape
|
||||||
BRect
|
BRect
|
||||||
Painter::FillShapeGradient(const int32& opCount, const uint32* opList,
|
Painter::FillShape(const int32& opCount, const uint32* opList,
|
||||||
const int32& ptCount, const BPoint* points,
|
const int32& ptCount, const BPoint* points,
|
||||||
const BGradient& gradient) const
|
const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -728,7 +727,7 @@ Painter::FillShapeGradient(const int32& opCount, const uint32* opList,
|
|||||||
fPath.close_polygon();
|
fPath.close_polygon();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _FillPathGradient(fCurve, gradient);
|
return _FillPath(fCurve, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// StrokeRect
|
// StrokeRect
|
||||||
@@ -854,9 +853,9 @@ Painter::FillRect(const BRect& r) const
|
|||||||
return _FillPath(fPath);
|
return _FillPath(fPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillRectGradient
|
// FillRect
|
||||||
BRect
|
BRect
|
||||||
Painter::FillRectGradient(const BRect& r, const BGradient& gradient) const
|
Painter::FillRect(const BRect& r, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -879,7 +878,7 @@ Painter::FillRectGradient(const BRect& r, const BGradient& gradient) const
|
|||||||
fPath.line_to(a.x, b.y);
|
fPath.line_to(a.x, b.y);
|
||||||
fPath.close_polygon();
|
fPath.close_polygon();
|
||||||
|
|
||||||
return _FillPathGradient(fPath, gradient);
|
return _FillPath(fPath, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillRect
|
// FillRect
|
||||||
@@ -921,6 +920,53 @@ gfxset32(offset + y1 * bpr, color.data32, (x2 - x1 + 1) * 4);
|
|||||||
} while (fBaseRenderer.next_clip_box());
|
} while (fBaseRenderer.next_clip_box());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// FillRectVerticalGradient
|
||||||
|
void
|
||||||
|
Painter::FillRectVerticalGradient(const BRect& r,
|
||||||
|
const BGradientLinear& gradient) const
|
||||||
|
{
|
||||||
|
if (!fValidClipping)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int32 gradientArraySize = r.IntegerHeight() + 1;
|
||||||
|
rgb_color gradientArray[gradientArraySize];
|
||||||
|
for (int32 i = 0; i < gradientArraySize; i++) {
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8* dst = fBuffer.row_ptr(0);
|
||||||
|
uint32 bpr = fBuffer.stride();
|
||||||
|
int32 left = (int32)r.left;
|
||||||
|
int32 top = (int32)r.top;
|
||||||
|
int32 right = (int32)r.right;
|
||||||
|
int32 bottom = (int32)r.bottom;
|
||||||
|
// get a 32 bit pixel ready with the color
|
||||||
|
pixel32 color;
|
||||||
|
color.data8[0] = c.blue;
|
||||||
|
color.data8[1] = c.green;
|
||||||
|
color.data8[2] = c.red;
|
||||||
|
color.data8[3] = c.alpha;
|
||||||
|
// fill rects, iterate over clipping boxes
|
||||||
|
fBaseRenderer.first_clip_box();
|
||||||
|
do {
|
||||||
|
int32 x1 = max_c(fBaseRenderer.xmin(), left);
|
||||||
|
int32 x2 = min_c(fBaseRenderer.xmax(), right);
|
||||||
|
if (x1 <= x2) {
|
||||||
|
int32 y1 = max_c(fBaseRenderer.ymin(), top);
|
||||||
|
int32 y2 = min_c(fBaseRenderer.ymax(), bottom);
|
||||||
|
uint8* offset = dst + x1 * 4;
|
||||||
|
for (; y1 <= y2; y1++) {
|
||||||
|
// uint32* handle = (uint32*)(offset + y1 * bpr);
|
||||||
|
// for (int32 x = x1; x <= x2; x++) {
|
||||||
|
// *handle++ = color.data32;
|
||||||
|
// }
|
||||||
|
gfxset32(offset + y1 * bpr, color.data32, (x2 - x1 + 1) * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (fBaseRenderer.next_clip_box());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// FillRectNoClipping
|
// FillRectNoClipping
|
||||||
void
|
void
|
||||||
Painter::FillRectNoClipping(const clipping_rect& r, const rgb_color& c) const
|
Painter::FillRectNoClipping(const clipping_rect& r, const rgb_color& c) const
|
||||||
@@ -970,10 +1016,11 @@ Painter::StrokeRoundRect(const BRect& r, float xRadius, float yRadius) const
|
|||||||
return _StrokePath(rect);
|
return _StrokePath(rect);
|
||||||
} else {
|
} else {
|
||||||
// NOTE: This implementation might seem a little strange, but it makes
|
// NOTE: This implementation might seem a little strange, but it makes
|
||||||
// stroked round rects look like on R5. A more correct way would be to use
|
// stroked round rects look like on R5. A more correct way would be to
|
||||||
// _StrokePath() as above (independent from fPenSize).
|
// use _StrokePath() as above (independent from fPenSize).
|
||||||
// The fact that the bounding box of the round rect is not enlarged
|
// The fact that the bounding box of the round rect is not enlarged
|
||||||
// by fPenSize/2 is actually on purpose, though one could argue it is unexpected.
|
// by fPenSize/2 is actually on purpose, though one could argue it is
|
||||||
|
// unexpected.
|
||||||
|
|
||||||
// enclose the right and bottom edge
|
// enclose the right and bottom edge
|
||||||
rb.x++;
|
rb.x++;
|
||||||
@@ -987,8 +1034,9 @@ Painter::StrokeRoundRect(const BRect& r, float xRadius, float yRadius) const
|
|||||||
fSubpixRasterizer.reset();
|
fSubpixRasterizer.reset();
|
||||||
fSubpixRasterizer.add_path(outer);
|
fSubpixRasterizer.add_path(outer);
|
||||||
|
|
||||||
// don't add an inner hole if the "size is negative", this avoids some
|
// don't add an inner hole if the "size is negative", this avoids
|
||||||
// defects that can be observed on R5 and could be regarded as a bug.
|
// some defects that can be observed on R5 and could be regarded
|
||||||
|
// as a bug.
|
||||||
if (2 * fPenSize < rb.x - lt.x && 2 * fPenSize < rb.y - lt.y) {
|
if (2 * fPenSize < rb.x - lt.x && 2 * fPenSize < rb.y - lt.y) {
|
||||||
agg::rounded_rect inner;
|
agg::rounded_rect inner;
|
||||||
inner.rect(lt.x + fPenSize, lt.y + fPenSize, rb.x - fPenSize,
|
inner.rect(lt.x + fPenSize, lt.y + fPenSize, rb.x - fPenSize,
|
||||||
@@ -1014,8 +1062,9 @@ Painter::StrokeRoundRect(const BRect& r, float xRadius, float yRadius) const
|
|||||||
fRasterizer.reset();
|
fRasterizer.reset();
|
||||||
fRasterizer.add_path(outer);
|
fRasterizer.add_path(outer);
|
||||||
|
|
||||||
// don't add an inner hole if the "size is negative", this avoids some
|
// don't add an inner hole if the "size is negative", this avoids
|
||||||
// defects that can be observed on R5 and could be regarded as a bug.
|
// some defects that can be observed on R5 and could be regarded as
|
||||||
|
// a bug.
|
||||||
if (2 * fPenSize < rb.x - lt.x && 2 * fPenSize < rb.y - lt.y) {
|
if (2 * fPenSize < rb.x - lt.x && 2 * fPenSize < rb.y - lt.y) {
|
||||||
agg::rounded_rect inner;
|
agg::rounded_rect inner;
|
||||||
inner.rect(lt.x + fPenSize, lt.y + fPenSize, rb.x - fPenSize,
|
inner.rect(lt.x + fPenSize, lt.y + fPenSize, rb.x - fPenSize,
|
||||||
@@ -1066,10 +1115,10 @@ Painter::FillRoundRect(const BRect& r, float xRadius, float yRadius) const
|
|||||||
return _FillPath(rect);
|
return _FillPath(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillRoundRectGradient
|
// FillRoundRect
|
||||||
BRect
|
BRect
|
||||||
Painter::FillRoundRectGradient(const BRect& r, float xRadius, float yRadius,
|
Painter::FillRoundRect(const BRect& r, float xRadius, float yRadius,
|
||||||
const BGradient& gradient) const
|
const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -1088,7 +1137,7 @@ Painter::FillRoundRectGradient(const BRect& r, float xRadius, float yRadius,
|
|||||||
rect.rect(lt.x, lt.y, rb.x, rb.y);
|
rect.rect(lt.x, lt.y, rb.x, rb.y);
|
||||||
rect.radius(xRadius, yRadius);
|
rect.radius(xRadius, yRadius);
|
||||||
|
|
||||||
return _FillPathGradient(rect, gradient);
|
return _FillPath(rect, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AlignEllipseRect
|
// AlignEllipseRect
|
||||||
@@ -1183,9 +1232,9 @@ Painter::DrawEllipse(BRect r, bool fill) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillEllipseGradient
|
// FillEllipse
|
||||||
BRect
|
BRect
|
||||||
Painter::FillEllipseGradient(BRect r, const BGradient& gradient) const
|
Painter::FillEllipse(BRect r, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -1203,7 +1252,7 @@ Painter::FillEllipseGradient(BRect r, const BGradient& gradient) const
|
|||||||
|
|
||||||
agg::ellipse path(center.x, center.y, xRadius, yRadius, divisions);
|
agg::ellipse path(center.x, center.y, xRadius, yRadius, divisions);
|
||||||
|
|
||||||
return _FillPathGradient(path, gradient);
|
return _FillPath(path, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// StrokeArc
|
// StrokeArc
|
||||||
@@ -1262,10 +1311,10 @@ Painter::FillArc(BPoint center, float xRadius, float yRadius, float angle,
|
|||||||
return _FillPath(fPath);
|
return _FillPath(fPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillArcGradient
|
// FillArc
|
||||||
BRect
|
BRect
|
||||||
Painter::FillArcGradient(BPoint center, float xRadius, float yRadius, float angle,
|
Painter::FillArc(BPoint center, float xRadius, float yRadius, float angle,
|
||||||
float span, const BGradient& gradient) const
|
float span, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
@@ -1295,7 +1344,7 @@ Painter::FillArcGradient(BPoint center, float xRadius, float yRadius, float angl
|
|||||||
|
|
||||||
fPath.close_polygon();
|
fPath.close_polygon();
|
||||||
|
|
||||||
return _FillPathGradient(fPath, gradient);
|
return _FillPath(fPath, gradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -1404,17 +1453,17 @@ Painter::FillRegion(const BRegion* region) const
|
|||||||
return touched;
|
return touched;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillRegionGradient
|
// FillRegion
|
||||||
BRect
|
BRect
|
||||||
Painter::FillRegionGradient(const BRegion* region, const BGradient& gradient) const
|
Painter::FillRegion(const BRegion* region, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
CHECK_CLIPPING
|
CHECK_CLIPPING
|
||||||
|
|
||||||
BRegion copy(*region);
|
BRegion copy(*region);
|
||||||
int32 count = copy.CountRects();
|
int32 count = copy.CountRects();
|
||||||
BRect touched = FillRectGradient(copy.RectAt(0), gradient);
|
BRect touched = FillRect(copy.RectAt(0), gradient);
|
||||||
for (int32 i = 1; i < count; i++) {
|
for (int32 i = 1; i < count; i++) {
|
||||||
touched = touched | FillRectGradient(copy.RectAt(i), gradient);
|
touched = touched | FillRect(copy.RectAt(i), gradient);
|
||||||
}
|
}
|
||||||
return touched;
|
return touched;
|
||||||
}
|
}
|
||||||
@@ -2513,16 +2562,16 @@ Painter::_FillPath(VertexSource& path) const
|
|||||||
return _Clipped(_BoundingBox(path));
|
return _Clipped(_BoundingBox(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// _FillPathGradient
|
// _FillPath
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
BRect
|
BRect
|
||||||
Painter::_FillPathGradient(VertexSource& path, const BGradient& gradient) const
|
Painter::_FillPath(VertexSource& path, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
GTRACE("Painter::_FillPathGradient\n");
|
GTRACE("Painter::_FillPath\n");
|
||||||
|
|
||||||
switch(gradient.Type()) {
|
switch(gradient.GetType()) {
|
||||||
case BGradient::TYPE_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == TYPE_LINEAR\n"));
|
GTRACE(("Painter::_FillPath> type == TYPE_LINEAR\n"));
|
||||||
_FillPathGradientLinear(path, *((const BGradientLinear*) &gradient));
|
_FillPathGradientLinear(path, *((const BGradientLinear*) &gradient));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2564,9 +2613,9 @@ template<class Array>
|
|||||||
void
|
void
|
||||||
Painter::_MakeGradient(Array& array, const BGradient& gradient) const
|
Painter::_MakeGradient(Array& array, const BGradient& gradient) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gradient.CountColors() - 1; i++) {
|
for (int i = 0; i < gradient.CountColorStops() - 1; i++) {
|
||||||
BGradient::color_step* from = gradient.ColorAtFast(i);
|
BGradient::ColorStop* from = gradient.ColorStopAtFast(i);
|
||||||
BGradient::color_step* to = gradient.ColorAtFast(i + 1);
|
BGradient::ColorStop* to = gradient.ColorStopAtFast(i + 1);
|
||||||
agg::rgba8 fromColor(from->color.red, from->color.green,
|
agg::rgba8 fromColor(from->color.red, from->color.green,
|
||||||
from->color.blue, from->color.alpha);
|
from->color.blue, from->color.alpha);
|
||||||
agg::rgba8 toColor(to->color.red, to->color.green,
|
agg::rgba8 toColor(to->color.red, to->color.green,
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class Painter {
|
|||||||
{ return fClippingRegion; }
|
{ return fClippingRegion; }
|
||||||
|
|
||||||
void SetDrawState(const DrawState* data,
|
void SetDrawState(const DrawState* data,
|
||||||
int32 xOffset = 0,
|
int32 xOffset = 0,
|
||||||
int32 yOffset = 0);
|
int32 yOffset = 0);
|
||||||
|
|
||||||
// object settings
|
// object settings
|
||||||
void SetHighColor(const rgb_color& color);
|
void SetHighColor(const rgb_color& color);
|
||||||
@@ -73,7 +73,7 @@ class Painter {
|
|||||||
void SetStrokeMode(cap_mode lineCap,
|
void SetStrokeMode(cap_mode lineCap,
|
||||||
join_mode joinMode, float miterLimit);
|
join_mode joinMode, float miterLimit);
|
||||||
void SetPattern(const pattern& p,
|
void SetPattern(const pattern& p,
|
||||||
bool drawingText = false);
|
bool drawingText = false);
|
||||||
inline pattern Pattern() const
|
inline pattern Pattern() const
|
||||||
{ return *fPatternHandler.GetR5Pattern(); }
|
{ return *fPatternHandler.GetR5Pattern(); }
|
||||||
void SetDrawingMode(drawing_mode mode);
|
void SetDrawingMode(drawing_mode mode);
|
||||||
@@ -90,155 +90,133 @@ class Painter {
|
|||||||
// painting functions
|
// painting functions
|
||||||
|
|
||||||
// lines
|
// lines
|
||||||
void StrokeLine( BPoint a,
|
void StrokeLine(BPoint a, BPoint b);
|
||||||
BPoint b);
|
|
||||||
|
|
||||||
// returns true if the line was either vertical or horizontal
|
// returns true if the line was either vertical or horizontal
|
||||||
// draws a solid one pixel wide line of color c, no blending
|
// draws a solid one pixel wide line of color c, no blending
|
||||||
bool StraightLine( BPoint a,
|
bool StraightLine(BPoint a, BPoint b,
|
||||||
BPoint b,
|
const rgb_color& c) const;
|
||||||
const rgb_color& c) const;
|
|
||||||
|
|
||||||
// triangles
|
// triangles
|
||||||
BRect StrokeTriangle( BPoint pt1,
|
BRect StrokeTriangle(BPoint pt1, BPoint pt2,
|
||||||
BPoint pt2,
|
BPoint pt3) const;
|
||||||
BPoint pt3) const;
|
|
||||||
|
|
||||||
BRect FillTriangle( BPoint pt1,
|
BRect FillTriangle(BPoint pt1, BPoint pt2,
|
||||||
BPoint pt2,
|
BPoint pt3) const;
|
||||||
BPoint pt3) const;
|
BRect FillTriangle(BPoint pt1, BPoint pt2,
|
||||||
BRect FillTriangleGradient(BPoint pt1, BPoint pt2,
|
BPoint pt3,
|
||||||
BPoint pt3,
|
const BGradient& gradient) const;
|
||||||
const BGradient& gradient) const;
|
|
||||||
|
|
||||||
// polygons
|
// polygons
|
||||||
BRect DrawPolygon( BPoint* ptArray,
|
BRect DrawPolygon(BPoint* ptArray, int32 numPts,
|
||||||
int32 numPts,
|
bool filled, bool closed) const;
|
||||||
bool filled,
|
BRect FillPolygon(BPoint* ptArray, int32 numPts,
|
||||||
bool closed) const;
|
const BGradient& gradient,
|
||||||
BRect FillPolygonGradient(BPoint* ptArray,
|
bool closed) const;
|
||||||
int32 numPts,
|
|
||||||
const BGradient& gradient,
|
|
||||||
bool closed) const;
|
|
||||||
|
|
||||||
// bezier curves
|
// bezier curves
|
||||||
BRect DrawBezier( BPoint* controlPoints,
|
BRect DrawBezier(BPoint* controlPoints,
|
||||||
bool filled) const;
|
bool filled) const;
|
||||||
BRect FillBezierGradient(BPoint* controlPoints,
|
BRect FillBezier(BPoint* controlPoints,
|
||||||
const BGradient& gradient) const;
|
const BGradient& gradient) const;
|
||||||
|
|
||||||
// shapes
|
// shapes
|
||||||
BRect DrawShape( const int32& opCount,
|
BRect DrawShape(const int32& opCount,
|
||||||
const uint32* opList,
|
const uint32* opList, const int32& ptCount,
|
||||||
const int32& ptCount,
|
const BPoint* ptList, bool filled) const;
|
||||||
const BPoint* ptList,
|
BRect FillShape(const int32& opCount,
|
||||||
bool filled) const;
|
|
||||||
BRect FillShapeGradient(const int32& opCount,
|
|
||||||
const uint32* opList,
|
const uint32* opList,
|
||||||
const int32& ptCount,
|
const int32& ptCount,
|
||||||
const BPoint* ptList,
|
const BPoint* ptList,
|
||||||
const BGradient& gradient) const;
|
const BGradient& gradient) const;
|
||||||
|
|
||||||
// rects
|
// rects
|
||||||
BRect StrokeRect( const BRect& r) const;
|
BRect StrokeRect(const BRect& r) const;
|
||||||
|
|
||||||
// strokes a one pixel wide solid rect, no blending
|
// strokes a one pixel wide solid rect, no blending
|
||||||
void StrokeRect( const BRect& r,
|
void StrokeRect(const BRect& r,
|
||||||
const rgb_color& c) const;
|
const rgb_color& c) const;
|
||||||
|
|
||||||
BRect FillRect( const BRect& r) const;
|
BRect FillRect(const BRect& r) const;
|
||||||
BRect FillRectGradient(const BRect& r,
|
BRect FillRect(const BRect& r,
|
||||||
const BGradient& gradient) const;
|
const BGradient& gradient) const;
|
||||||
|
|
||||||
// fills a solid rect with color c, no blending
|
// fills a solid rect with color c, no blending
|
||||||
void FillRect( const BRect& r,
|
void FillRect(const BRect& r,
|
||||||
const rgb_color& c) const;
|
const rgb_color& c) const;
|
||||||
// fills a solid rect with color c, no blending, no clipping
|
// fills a solid rect with color c, no blending, no clipping
|
||||||
void FillRectNoClipping(const clipping_rect& r,
|
void FillRectNoClipping(const clipping_rect& r,
|
||||||
const rgb_color& c) const;
|
const rgb_color& c) const;
|
||||||
|
|
||||||
// round rects
|
// round rects
|
||||||
BRect StrokeRoundRect(const BRect& r,
|
BRect StrokeRoundRect(const BRect& r, float xRadius,
|
||||||
float xRadius,
|
float yRadius) const;
|
||||||
float yRadius) const;
|
|
||||||
|
|
||||||
BRect FillRoundRect( const BRect& r,
|
BRect FillRoundRect(const BRect& r, float xRadius,
|
||||||
float xRadius,
|
float yRadius) const;
|
||||||
float yRadius) const;
|
BRect FillRoundRect(const BRect& r, float xRadius,
|
||||||
BRect FillRoundRectGradient(const BRect& r,
|
float yRadius,
|
||||||
float xRadius,
|
const BGradient& gradient) const;
|
||||||
float yRadius,
|
|
||||||
const BGradient& gradient) const;
|
|
||||||
|
|
||||||
// ellipses
|
// ellipses
|
||||||
void AlignEllipseRect(BRect* rect,
|
void AlignEllipseRect(BRect* rect,
|
||||||
bool filled) const;
|
bool filled) const;
|
||||||
|
|
||||||
BRect DrawEllipse( BRect r,
|
BRect DrawEllipse(BRect r, bool filled) const;
|
||||||
bool filled) const;
|
BRect FillEllipse(BRect r,
|
||||||
BRect FillEllipseGradient(BRect r,
|
const BGradient& gradient) const;
|
||||||
const BGradient& gradient) const;
|
|
||||||
|
|
||||||
// arcs
|
// arcs
|
||||||
BRect StrokeArc( BPoint center,
|
BRect StrokeArc(BPoint center, float xRadius,
|
||||||
float xRadius,
|
float yRadius, float angle,
|
||||||
float yRadius,
|
float span) const;
|
||||||
float angle,
|
|
||||||
float span) const;
|
|
||||||
|
|
||||||
BRect FillArc( BPoint center,
|
BRect FillArc(BPoint center, float xRadius,
|
||||||
float xRadius,
|
float yRadius, float angle,
|
||||||
float yRadius,
|
float span) const;
|
||||||
float angle,
|
BRect FillArc(BPoint center, float xRadius,
|
||||||
float span) const;
|
float yRadius, float angle, float span,
|
||||||
BRect FillArcGradient(BPoint center,
|
const BGradient& gradient) const;
|
||||||
float xRadius,
|
|
||||||
float yRadius,
|
|
||||||
float angle,
|
|
||||||
float span,
|
|
||||||
const BGradient& gradient) const;
|
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
BRect DrawString( const char* utf8String,
|
BRect DrawString(const char* utf8String,
|
||||||
uint32 length,
|
uint32 length, BPoint baseLine,
|
||||||
BPoint baseLine,
|
const escapement_delta* delta,
|
||||||
const escapement_delta* delta,
|
FontCacheReference* cacheReference = NULL);
|
||||||
FontCacheReference* cacheReference = NULL);
|
|
||||||
|
|
||||||
BRect BoundingBox( const char* utf8String,
|
BRect BoundingBox(const char* utf8String,
|
||||||
uint32 length,
|
uint32 length, BPoint baseLine,
|
||||||
BPoint baseLine,
|
BPoint* penLocation,
|
||||||
BPoint* penLocation,
|
const escapement_delta* delta,
|
||||||
const escapement_delta* delta,
|
FontCacheReference* cacheReference
|
||||||
FontCacheReference* cacheReference = NULL) const;
|
= NULL) const;
|
||||||
|
|
||||||
float StringWidth( const char* utf8String,
|
float StringWidth(const char* utf8String,
|
||||||
uint32 length,
|
uint32 length,
|
||||||
const escapement_delta* delta = NULL);
|
const escapement_delta* delta = NULL);
|
||||||
|
|
||||||
|
|
||||||
// bitmaps
|
// bitmaps
|
||||||
BRect DrawBitmap( const ServerBitmap* bitmap,
|
BRect DrawBitmap(const ServerBitmap* bitmap,
|
||||||
BRect bitmapRect,
|
BRect bitmapRect, BRect viewRect,
|
||||||
BRect viewRect,
|
uint32 options) const;
|
||||||
uint32 options) const;
|
|
||||||
|
|
||||||
// some convenience stuff
|
// some convenience stuff
|
||||||
BRect FillRegion( const BRegion* region) const;
|
BRect FillRegion(const BRegion* region) const;
|
||||||
BRect FillRegionGradient(const BRegion* region,
|
BRect FillRegion(const BRegion* region,
|
||||||
const BGradient& gradient) const;
|
const BGradient& gradient) const;
|
||||||
|
|
||||||
BRect InvertRect( const BRect& r) const;
|
BRect InvertRect(const BRect& r) const;
|
||||||
|
|
||||||
inline BRect ClipRect( BRect rect) const;
|
inline BRect ClipRect(BRect rect) const;
|
||||||
inline BRect AlignAndClipRect(BRect rect) const;
|
inline BRect AlignAndClipRect(BRect rect) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Transform(BPoint* point,
|
void _Transform(BPoint* point,
|
||||||
bool centerOffset = true) const;
|
bool centerOffset = true) const;
|
||||||
BPoint _Transform(const BPoint& point,
|
BPoint _Transform(const BPoint& point,
|
||||||
bool centerOffset = true) const;
|
bool centerOffset = true) const;
|
||||||
BRect _Clipped(const BRect& rect) const;
|
BRect _Clipped(const BRect& rect) const;
|
||||||
|
|
||||||
void _UpdateFont() const;
|
void _UpdateFont() const;
|
||||||
@@ -247,10 +225,8 @@ class Painter {
|
|||||||
void _SetRendererColor(const rgb_color& color) const;
|
void _SetRendererColor(const rgb_color& color) const;
|
||||||
|
|
||||||
// drawing functions stroke/fill
|
// drawing functions stroke/fill
|
||||||
BRect _DrawTriangle( BPoint pt1,
|
BRect _DrawTriangle(BPoint pt1, BPoint pt2,
|
||||||
BPoint pt2,
|
BPoint pt3, bool fill) const;
|
||||||
BPoint pt3,
|
|
||||||
bool fill) const;
|
|
||||||
|
|
||||||
template<typename sourcePixel>
|
template<typename sourcePixel>
|
||||||
void _TransparentMagicToAlpha(sourcePixel *buffer,
|
void _TransparentMagicToAlpha(sourcePixel *buffer,
|
||||||
@@ -259,39 +235,37 @@ class Painter {
|
|||||||
sourcePixel transparentMagic,
|
sourcePixel transparentMagic,
|
||||||
BBitmap *output) const;
|
BBitmap *output) const;
|
||||||
|
|
||||||
void _DrawBitmap( agg::rendering_buffer& srcBuffer,
|
void _DrawBitmap(agg::rendering_buffer& srcBuffer,
|
||||||
color_space format,
|
color_space format,
|
||||||
BRect actualBitmapRect,
|
BRect actualBitmapRect,
|
||||||
BRect bitmapRect,
|
BRect bitmapRect, BRect viewRect,
|
||||||
BRect viewRect,
|
uint32 bitmapFlags) const;
|
||||||
uint32 bitmapFlags) const;
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void _DrawBitmapNoScale32(
|
void _DrawBitmapNoScale32( F copyRowFunction,
|
||||||
F copyRowFunction,
|
uint32 bytesPerSourcePixel,
|
||||||
uint32 bytesPerSourcePixel,
|
agg::rendering_buffer& srcBuffer,
|
||||||
agg::rendering_buffer& srcBuffer,
|
int32 xOffset, int32 yOffset,
|
||||||
int32 xOffset, int32 yOffset,
|
BRect viewRect) const;
|
||||||
BRect viewRect) const;
|
|
||||||
void _DrawBitmapNearestNeighborCopy32(
|
void _DrawBitmapNearestNeighborCopy32(
|
||||||
agg::rendering_buffer& srcBuffer,
|
agg::rendering_buffer& srcBuffer,
|
||||||
double xOffset, double yOffset,
|
double xOffset, double yOffset,
|
||||||
double xScale, double yScale,
|
double xScale, double yScale,
|
||||||
BRect viewRect) const;
|
BRect viewRect) const;
|
||||||
void _DrawBitmapBilinearCopy32(
|
void _DrawBitmapBilinearCopy32(
|
||||||
agg::rendering_buffer& srcBuffer,
|
agg::rendering_buffer& srcBuffer,
|
||||||
double xOffset, double yOffset,
|
double xOffset, double yOffset,
|
||||||
double xScale, double yScale,
|
double xScale, double yScale,
|
||||||
BRect viewRect) const;
|
BRect viewRect) const;
|
||||||
void _DrawBitmapGeneric32(
|
void _DrawBitmapGeneric32(
|
||||||
agg::rendering_buffer& srcBuffer,
|
agg::rendering_buffer& srcBuffer,
|
||||||
double xOffset, double yOffset,
|
double xOffset, double yOffset,
|
||||||
double xScale, double yScale,
|
double xScale, double yScale,
|
||||||
BRect viewRect,
|
BRect viewRect,
|
||||||
uint32 bitmapFlags) const;
|
uint32 bitmapFlags) const;
|
||||||
|
|
||||||
void _InvertRect32( BRect r) const;
|
void _InvertRect32(BRect r) const;
|
||||||
void _BlendRect32( const BRect& r,
|
void _BlendRect32(const BRect& r,
|
||||||
const rgb_color& c) const;
|
const rgb_color& c) const;
|
||||||
|
|
||||||
|
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
@@ -308,23 +282,23 @@ class Painter {
|
|||||||
void _MakeGradient(Array& array,
|
void _MakeGradient(Array& array,
|
||||||
const BGradient& gradient) const;
|
const BGradient& gradient) const;
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
BRect _FillPathGradient(VertexSource& path,
|
BRect _FillPath(VertexSource& path,
|
||||||
const BGradient& gradient) const;
|
const BGradient& gradient) const;
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void _FillPathGradientLinear(VertexSource& path,
|
void _FillPathGradientLinear(VertexSource& path,
|
||||||
const BGradientLinear& linear) const;
|
const BGradientLinear& linear) const;
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void _FillPathGradientRadial(VertexSource& path,
|
void _FillPathGradientRadial(VertexSource& path,
|
||||||
const BGradientRadial& radial) const;
|
const BGradientRadial& radial) const;
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void _FillPathGradientRadialFocus(VertexSource& path,
|
void _FillPathGradientRadialFocus(VertexSource& path,
|
||||||
const BGradientRadialFocus& focus) const;
|
const BGradientRadialFocus& focus) const;
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void _FillPathGradientDiamond(VertexSource& path,
|
void _FillPathGradientDiamond(VertexSource& path,
|
||||||
const BGradientDiamond& diamond) const;
|
const BGradientDiamond& diamond) const;
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void _FillPathGradientConic(VertexSource& path,
|
void _FillPathGradientConic(VertexSource& path,
|
||||||
const BGradientConic& conic) const;
|
const BGradientConic& conic) const;
|
||||||
|
|
||||||
mutable agg::rendering_buffer fBuffer;
|
mutable agg::rendering_buffer fBuffer;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user