Moved the gradient_type and color_step structs into the BGradient
class/namespace. Renamed the B_GRADIENT_* types to TYPE_* as the context is already given. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28564 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,17 +19,18 @@ class BMessage;
|
|||||||
class BRect;
|
class BRect;
|
||||||
|
|
||||||
|
|
||||||
enum gradient_type {
|
class BGradient : public BArchivable {
|
||||||
B_GRADIENT_LINEAR = 0,
|
public:
|
||||||
B_GRADIENT_RADIAL,
|
enum gradient_type {
|
||||||
B_GRADIENT_RADIAL_FOCUS,
|
TYPE_LINEAR = 0,
|
||||||
B_GRADIENT_DIAMOND,
|
TYPE_RADIAL,
|
||||||
B_GRADIENT_CONIC,
|
TYPE_RADIAL_FOCUS,
|
||||||
B_GRADIENT_NONE
|
TYPE_DIAMOND,
|
||||||
};
|
TYPE_CONIC,
|
||||||
|
TYPE_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
struct color_step {
|
||||||
struct color_step {
|
|
||||||
color_step(const rgb_color c, float o);
|
color_step(const rgb_color c, float o);
|
||||||
color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o);
|
color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o);
|
||||||
color_step(const color_step& other);
|
color_step(const color_step& other);
|
||||||
@@ -39,10 +40,8 @@ struct color_step {
|
|||||||
|
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
float offset;
|
float offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BGradient : public BArchivable {
|
|
||||||
public:
|
public:
|
||||||
BGradient();
|
BGradient();
|
||||||
BGradient(BMessage* archive);
|
BGradient(BMessage* archive);
|
||||||
|
|||||||
@@ -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(gradient_type type);
|
void SetType(BGradient::gradient_type type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gradient_type fType;
|
BGradient::gradient_type fType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -134,19 +134,19 @@ GradientsWindow::MessageReceived(BMessage *msg)
|
|||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case MSG_LINEAR:
|
case MSG_LINEAR:
|
||||||
fGradientsView->SetType(B_GRADIENT_LINEAR);
|
fGradientsView->SetType(BGradient::TYPE_LINEAR);
|
||||||
break;
|
break;
|
||||||
case MSG_RADIAL:
|
case MSG_RADIAL:
|
||||||
fGradientsView->SetType(B_GRADIENT_RADIAL);
|
fGradientsView->SetType(BGradient::TYPE_RADIAL);
|
||||||
break;
|
break;
|
||||||
case MSG_RADIAL_FOCUS:
|
case MSG_RADIAL_FOCUS:
|
||||||
fGradientsView->SetType(B_GRADIENT_RADIAL_FOCUS);
|
fGradientsView->SetType(BGradient::TYPE_RADIAL_FOCUS);
|
||||||
break;
|
break;
|
||||||
case MSG_DIAMOND:
|
case MSG_DIAMOND:
|
||||||
fGradientsView->SetType(B_GRADIENT_DIAMOND);
|
fGradientsView->SetType(BGradient::TYPE_DIAMOND);
|
||||||
break;
|
break;
|
||||||
case MSG_CONIC:
|
case MSG_CONIC:
|
||||||
fGradientsView->SetType(B_GRADIENT_CONIC);
|
fGradientsView->SetType(BGradient::TYPE_CONIC);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(msg);
|
BWindow::MessageReceived(msg);
|
||||||
@@ -160,7 +160,7 @@ GradientsWindow::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
GradientsView::GradientsView(const BRect &rect)
|
GradientsView::GradientsView(const BRect &rect)
|
||||||
: BView(rect, "gradientsview", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
|
: BView(rect, "gradientsview", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
|
||||||
fType(B_GRADIENT_LINEAR)
|
fType(BGradient::TYPE_LINEAR)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,27 +174,27 @@ void
|
|||||||
GradientsView::Draw(BRect update)
|
GradientsView::Draw(BRect update)
|
||||||
{
|
{
|
||||||
switch (fType) {
|
switch (fType) {
|
||||||
case B_GRADIENT_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
DrawLinear(update);
|
DrawLinear(update);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL: {
|
case BGradient::TYPE_RADIAL: {
|
||||||
DrawRadial(update);
|
DrawRadial(update);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL_FOCUS: {
|
case BGradient::TYPE_RADIAL_FOCUS: {
|
||||||
DrawRadialFocus(update);
|
DrawRadialFocus(update);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_DIAMOND: {
|
case BGradient::TYPE_DIAMOND: {
|
||||||
DrawDiamond(update);
|
DrawDiamond(update);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_CONIC: {
|
case BGradient::TYPE_CONIC: {
|
||||||
DrawConic(update);
|
DrawConic(update);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_NONE:
|
case BGradient::TYPE_NONE:
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ GradientsView::DrawConic(BRect update)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GradientsView::SetType(gradient_type type)
|
GradientsView::SetType(BGradient::gradient_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) {
|
||||||
color_step* step = fGradient->ColorAt(fDraggingStepIndex);
|
BGradient::color_step* step = fGradient->ColorAt(fDraggingStepIndex);
|
||||||
if (step) {
|
if (step) {
|
||||||
if (fGradient->SetOffset(fDraggingStepIndex, offset)) {
|
if (fGradient->SetOffset(fDraggingStepIndex, offset)) {
|
||||||
_UpdateColors();
|
_UpdateColors();
|
||||||
@@ -201,7 +201,8 @@ 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 (color_step* step = fGradient->ColorAt(fDropIndex)) {
|
if (BGradient::color_step* step
|
||||||
|
= fGradient->ColorAt(fDropIndex)) {
|
||||||
color.alpha = step->color.alpha;
|
color.alpha = step->color.alpha;
|
||||||
}
|
}
|
||||||
fGradient->SetColor(fDropIndex, color);
|
fGradient->SetColor(fDropIndex, color);
|
||||||
@@ -209,7 +210,8 @@ GradientControl::MessageReceived(BMessage* message)
|
|||||||
fDropIndex = -1;
|
fDropIndex = -1;
|
||||||
update = true;
|
update = true;
|
||||||
} else if (fDropOffset >= 0.0) {
|
} else if (fDropOffset >= 0.0) {
|
||||||
fCurrentStepIndex = fGradient->AddColor(color, fDropOffset);
|
fCurrentStepIndex = fGradient->AddColor(color,
|
||||||
|
fDropOffset);
|
||||||
fDropOffset = -1.0;
|
fDropOffset = -1.0;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
@@ -253,7 +255,8 @@ 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 (color_step* step = fGradient->ColorAt(fCurrentStepIndex)) {
|
if (BGradient::color_step* step
|
||||||
|
= 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;
|
||||||
switch (bytes[0]) {
|
switch (bytes[0]) {
|
||||||
@@ -274,7 +277,8 @@ GradientControl::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
x = r.right;
|
x = r.right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
update = fGradient->SetOffset(fCurrentStepIndex, (x - r.left) / r.Width());
|
update = fGradient->SetOffset(fCurrentStepIndex,
|
||||||
|
(x - r.left) / r.Width());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -377,7 +381,8 @@ 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; color_step* step = fGradient->ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* step = fGradient->ColorAt(i);
|
||||||
|
i++) {
|
||||||
markerPos.x = b.left + (b.Width() * step->offset);
|
markerPos.x = b.left + (b.Width() * step->offset);
|
||||||
|
|
||||||
if (i == fCurrentStepIndex) {
|
if (i == fCurrentStepIndex) {
|
||||||
@@ -394,8 +399,7 @@ GradientControl::Draw(BRect updateRect)
|
|||||||
if (i == fDropIndex)
|
if (i == fDropIndex)
|
||||||
SetLowColor(255, 0, 0, 255);
|
SetLowColor(255, 0, 0, 255);
|
||||||
|
|
||||||
StrokeTriangle(markerPos,
|
StrokeTriangle(markerPos, markerPos + leftBottom,
|
||||||
markerPos + leftBottom,
|
|
||||||
markerPos + rightBottom, B_SOLID_LOW);
|
markerPos + rightBottom, B_SOLID_LOW);
|
||||||
if (fEnabled) {
|
if (fEnabled) {
|
||||||
SetHighColor(step->color);
|
SetHighColor(step->color);
|
||||||
@@ -459,7 +463,8 @@ GradientControl::SetCurrentStop(const rgb_color& color)
|
|||||||
bool
|
bool
|
||||||
GradientControl::GetCurrentStop(rgb_color* color) const
|
GradientControl::GetCurrentStop(rgb_color* color) const
|
||||||
{
|
{
|
||||||
color_step* stop = fGradient->ColorAt(fCurrentStepIndex);
|
BGradient::color_step* stop
|
||||||
|
= fGradient->ColorAt(fCurrentStepIndex);
|
||||||
if (stop && color) {
|
if (stop && color) {
|
||||||
*color = stop->color;
|
*color = stop->color;
|
||||||
return true;
|
return true;
|
||||||
@@ -612,8 +617,10 @@ 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; color_step* step = fGradient->ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* step
|
||||||
markerFrame.left = markerFrame.right = r.left + (r.Width() * step->offset);
|
= fGradient->ColorAt(i); i++) {
|
||||||
|
markerFrame.left = markerFrame.right = r.left
|
||||||
|
+ (r.Width() * step->offset);
|
||||||
markerFrame.InsetBy(-6.0, 0.0);
|
markerFrame.InsetBy(-6.0, 0.0);
|
||||||
if (markerFrame.Contains(where)) {
|
if (markerFrame.Contains(where)) {
|
||||||
index = i;
|
index = i;
|
||||||
@@ -641,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 (color_step* step = fGradient->ColorAt(fCurrentStepIndex)) {
|
if (BGradient::color_step* 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++) {
|
||||||
color_step* step = gradient->ColorAtFast(i);
|
BGradient::color_step* 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++) {
|
||||||
color_step* step = gradient->ColorAtFast(i);
|
BGradient::color_step* 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;
|
||||||
|
|
||||||
color_step* step;
|
BGradient::color_step* 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;
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ SVGExporter::_ExportGradient(const Gradient* gradient, BPositionIO* stream)
|
|||||||
|
|
||||||
// write stop tags
|
// write stop tags
|
||||||
char color[16];
|
char color[16];
|
||||||
for (int32 i = 0; color_step* stop = gradient->ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* 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,20 +471,20 @@ LinkReceiver::ReadRegion(BRegion* region)
|
|||||||
|
|
||||||
|
|
||||||
static BGradient*
|
static BGradient*
|
||||||
gradient_for_type(gradient_type type)
|
gradient_for_type(BGradient::gradient_type type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case B_GRADIENT_LINEAR:
|
case BGradient::TYPE_LINEAR:
|
||||||
return new (std::nothrow) BGradientLinear();
|
return new (std::nothrow) BGradientLinear();
|
||||||
case B_GRADIENT_RADIAL:
|
case BGradient::TYPE_RADIAL:
|
||||||
return new (std::nothrow) BGradientRadial();
|
return new (std::nothrow) BGradientRadial();
|
||||||
case B_GRADIENT_RADIAL_FOCUS:
|
case BGradient::TYPE_RADIAL_FOCUS:
|
||||||
return new (std::nothrow) BGradientRadialFocus();
|
return new (std::nothrow) BGradientRadialFocus();
|
||||||
case B_GRADIENT_DIAMOND:
|
case BGradient::TYPE_DIAMOND:
|
||||||
return new (std::nothrow) BGradientDiamond();
|
return new (std::nothrow) BGradientDiamond();
|
||||||
case B_GRADIENT_CONIC:
|
case BGradient::TYPE_CONIC:
|
||||||
return new (std::nothrow) BGradientConic();
|
return new (std::nothrow) BGradientConic();
|
||||||
case B_GRADIENT_NONE:
|
case BGradient::TYPE_NONE:
|
||||||
return new (std::nothrow) BGradient();
|
return new (std::nothrow) BGradient();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -495,10 +495,10 @@ status_t
|
|||||||
LinkReceiver::ReadGradient(BGradient** _gradient)
|
LinkReceiver::ReadGradient(BGradient** _gradient)
|
||||||
{
|
{
|
||||||
GTRACE(("LinkReceiver::ReadGradient\n"));
|
GTRACE(("LinkReceiver::ReadGradient\n"));
|
||||||
gradient_type gradientType;
|
BGradient::gradient_type gradientType;
|
||||||
int32 colorsCount;
|
int32 colorsCount;
|
||||||
status_t ret;
|
status_t ret;
|
||||||
if ((ret = Read(&gradientType, sizeof(gradient_type))) != B_OK)
|
if ((ret = Read(&gradientType, sizeof(BGradient::gradient_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,9 +509,9 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
*_gradient = gradient;
|
*_gradient = gradient;
|
||||||
|
|
||||||
if (colorsCount > 0) {
|
if (colorsCount > 0) {
|
||||||
color_step step;
|
BGradient::color_step step;
|
||||||
for (int i = 0; i < colorsCount; i++) {
|
for (int i = 0; i < colorsCount; i++) {
|
||||||
if ((ret = Read(&step, sizeof(color_step))) != B_OK)
|
if ((ret = Read(&step, sizeof(BGradient::color_step))) != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
if (!gradient->AddColor(step, i))
|
if (!gradient->AddColor(step, i))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -519,8 +519,8 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(gradientType) {
|
switch(gradientType) {
|
||||||
case B_GRADIENT_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_LINEAR\n"));
|
GTRACE(("LinkReceiver::ReadGradient> type == TYPE_LINEAR\n"));
|
||||||
BGradientLinear* linear = (BGradientLinear*)gradient;
|
BGradientLinear* linear = (BGradientLinear*)gradient;
|
||||||
BPoint start;
|
BPoint start;
|
||||||
BPoint end;
|
BPoint end;
|
||||||
@@ -532,8 +532,8 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
linear->SetEnd(end);
|
linear->SetEnd(end);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL: {
|
case BGradient::TYPE_RADIAL: {
|
||||||
GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_RADIAL\n"));
|
GTRACE(("LinkReceiver::ReadGradient> type == TYPE_RADIAL\n"));
|
||||||
BGradientRadial* radial = (BGradientRadial*)gradient;
|
BGradientRadial* radial = (BGradientRadial*)gradient;
|
||||||
BPoint center;
|
BPoint center;
|
||||||
float radius;
|
float radius;
|
||||||
@@ -545,8 +545,8 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
radial->SetRadius(radius);
|
radial->SetRadius(radius);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL_FOCUS: {
|
case BGradient::TYPE_RADIAL_FOCUS: {
|
||||||
GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_RADIAL_FOCUS\n"));
|
GTRACE(("LinkReceiver::ReadGradient> type == TYPE_RADIAL_FOCUS\n"));
|
||||||
BGradientRadialFocus* radialFocus =
|
BGradientRadialFocus* radialFocus =
|
||||||
(BGradientRadialFocus*)gradient;
|
(BGradientRadialFocus*)gradient;
|
||||||
BPoint center;
|
BPoint center;
|
||||||
@@ -563,8 +563,8 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
radialFocus->SetRadius(radius);
|
radialFocus->SetRadius(radius);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_DIAMOND: {
|
case BGradient::TYPE_DIAMOND: {
|
||||||
GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_DIAMOND\n"));
|
GTRACE(("LinkReceiver::ReadGradient> type == TYPE_DIAMOND\n"));
|
||||||
BGradientDiamond* diamond = (BGradientDiamond*)gradient;
|
BGradientDiamond* diamond = (BGradientDiamond*)gradient;
|
||||||
BPoint center;
|
BPoint center;
|
||||||
if ((ret = Read(¢er, sizeof(BPoint))) != B_OK)
|
if ((ret = Read(¢er, sizeof(BPoint))) != B_OK)
|
||||||
@@ -572,8 +572,8 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
diamond->SetCenter(center);
|
diamond->SetCenter(center);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_CONIC: {
|
case BGradient::TYPE_CONIC: {
|
||||||
GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_CONIC\n"));
|
GTRACE(("LinkReceiver::ReadGradient> type == TYPE_CONIC\n"));
|
||||||
BGradientConic* conic = (BGradientConic*)gradient;
|
BGradientConic* conic = (BGradientConic*)gradient;
|
||||||
BPoint center;
|
BPoint center;
|
||||||
float angle;
|
float angle;
|
||||||
@@ -585,8 +585,8 @@ LinkReceiver::ReadGradient(BGradient** _gradient)
|
|||||||
conic->SetAngle(angle);
|
conic->SetAngle(angle);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_NONE: {
|
case BGradient::TYPE_NONE: {
|
||||||
GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_NONE\n"));
|
GTRACE(("LinkReceiver::ReadGradient> type == TYPE_NONE\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-16
@@ -126,21 +126,21 @@ status_t
|
|||||||
ServerLink::AttachGradient(const BGradient &gradient)
|
ServerLink::AttachGradient(const BGradient &gradient)
|
||||||
{
|
{
|
||||||
GTRACE(("ServerLink::AttachGradient\n"));
|
GTRACE(("ServerLink::AttachGradient\n"));
|
||||||
gradient_type gradientType = gradient.Type();
|
BGradient::gradient_type gradientType = gradient.Type();
|
||||||
int32 colorsCount = gradient.CountColors();
|
int32 colorsCount = gradient.CountColors();
|
||||||
GTRACE(("ServerLink::AttachGradient> colors count == %d\n", (int)colorsCount));
|
GTRACE(("ServerLink::AttachGradient> colors count == %d\n", (int)colorsCount));
|
||||||
fSender->Attach(&gradientType, sizeof(gradient_type));
|
fSender->Attach(&gradientType, sizeof(BGradient::gradient_type));
|
||||||
fSender->Attach(&colorsCount, sizeof(int32));
|
fSender->Attach(&colorsCount, sizeof(int32));
|
||||||
if (colorsCount > 0) {
|
if (colorsCount > 0) {
|
||||||
for (int i = 0; i < colorsCount; i++) {
|
for (int i = 0; i < colorsCount; i++) {
|
||||||
fSender->Attach((color_step*) gradient.ColorAtFast(i),
|
fSender->Attach(gradient.ColorAtFast(i),
|
||||||
sizeof(color_step));
|
sizeof(BGradient::color_step));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(gradientType) {
|
switch(gradientType) {
|
||||||
case B_GRADIENT_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_LINEAR\n"));
|
GTRACE(("ServerLink::AttachGradient> type == TYPE_LINEAR\n"));
|
||||||
const BGradientLinear* linear = (BGradientLinear*) &gradient;
|
const BGradientLinear* linear = (BGradientLinear*) &gradient;
|
||||||
BPoint start = linear->Start();
|
BPoint start = linear->Start();
|
||||||
BPoint end = linear->End();
|
BPoint end = linear->End();
|
||||||
@@ -148,8 +148,8 @@ ServerLink::AttachGradient(const BGradient &gradient)
|
|||||||
fSender->Attach(&end, sizeof(BPoint));
|
fSender->Attach(&end, sizeof(BPoint));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL: {
|
case BGradient::TYPE_RADIAL: {
|
||||||
GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_RADIAL\n"));
|
GTRACE(("ServerLink::AttachGradient> type == TYPE_RADIAL\n"));
|
||||||
const BGradientRadial* radial = (BGradientRadial*) &gradient;
|
const BGradientRadial* radial = (BGradientRadial*) &gradient;
|
||||||
BPoint center = radial->Center();
|
BPoint center = radial->Center();
|
||||||
float radius = radial->Radius();
|
float radius = radial->Radius();
|
||||||
@@ -157,8 +157,8 @@ ServerLink::AttachGradient(const BGradient &gradient)
|
|||||||
fSender->Attach(&radius, sizeof(float));
|
fSender->Attach(&radius, sizeof(float));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL_FOCUS: {
|
case BGradient::TYPE_RADIAL_FOCUS: {
|
||||||
GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_RADIAL_FOCUS\n"));
|
GTRACE(("ServerLink::AttachGradient> type == TYPE_RADIAL_FOCUS\n"));
|
||||||
const BGradientRadialFocus* radialFocus =
|
const BGradientRadialFocus* radialFocus =
|
||||||
(BGradientRadialFocus*) &gradient;
|
(BGradientRadialFocus*) &gradient;
|
||||||
BPoint center = radialFocus->Center();
|
BPoint center = radialFocus->Center();
|
||||||
@@ -169,15 +169,15 @@ ServerLink::AttachGradient(const BGradient &gradient)
|
|||||||
fSender->Attach(&radius, sizeof(float));
|
fSender->Attach(&radius, sizeof(float));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_DIAMOND: {
|
case BGradient::TYPE_DIAMOND: {
|
||||||
GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_DIAMOND\n"));
|
GTRACE(("ServerLink::AttachGradient> type == TYPE_DIAMOND\n"));
|
||||||
const BGradientDiamond* diamond = (BGradientDiamond*) &gradient;
|
const BGradientDiamond* diamond = (BGradientDiamond*) &gradient;
|
||||||
BPoint center = diamond->Center();
|
BPoint center = diamond->Center();
|
||||||
fSender->Attach(¢er, sizeof(BPoint));
|
fSender->Attach(¢er, sizeof(BPoint));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_CONIC: {
|
case BGradient::TYPE_CONIC: {
|
||||||
GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_CONIC\n"));
|
GTRACE(("ServerLink::AttachGradient> type == TYPE_CONIC\n"));
|
||||||
const BGradientConic* conic = (BGradientConic*) &gradient;
|
const BGradientConic* conic = (BGradientConic*) &gradient;
|
||||||
BPoint center = conic->Center();
|
BPoint center = conic->Center();
|
||||||
float angle = conic->Angle();
|
float angle = conic->Angle();
|
||||||
@@ -185,8 +185,8 @@ ServerLink::AttachGradient(const BGradient &gradient)
|
|||||||
fSender->Attach(&angle, sizeof(float));
|
fSender->Attach(&angle, sizeof(float));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_NONE: {
|
case BGradient::TYPE_NONE: {
|
||||||
GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_NONE\n"));
|
GTRACE(("ServerLink::AttachGradient> type == TYPE_NONE\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
color_step::color_step(const rgb_color c, float o)
|
BGradient::color_step::color_step(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 @@ color_step::color_step(const rgb_color c, float o)
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
color_step::color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o)
|
BGradient::color_step::color_step(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 @@ color_step::color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o)
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
color_step::color_step(const color_step& other)
|
BGradient::color_step::color_step(const color_step& 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 @@ color_step::color_step(const color_step& other)
|
|||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
color_step::color_step()
|
BGradient::color_step::color_step()
|
||||||
{
|
{
|
||||||
color.red = 0;
|
color.red = 0;
|
||||||
color.green = 0;
|
color.green = 0;
|
||||||
@@ -61,7 +61,7 @@ color_step::color_step()
|
|||||||
|
|
||||||
// operator!=
|
// operator!=
|
||||||
bool
|
bool
|
||||||
color_step::operator!=(const color_step& other) const
|
BGradient::color_step::operator!=(const color_step& 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,19 +72,15 @@ 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_steps_by_offset(const void* _left, const void* _right)
|
||||||
{
|
{
|
||||||
const color_step **firstStep((const color_step**) left),
|
const BGradient::color_step** left = (const BGradient::color_step**)_left;
|
||||||
**secondStep((const color_step**) right);
|
const BGradient::color_step** right = (const BGradient::color_step**)_right;
|
||||||
int ret = 0;
|
if ((*left)->offset > (*right)->offset)
|
||||||
if ((*firstStep)->offset > (*secondStep)->offset) {
|
return 1;
|
||||||
ret = 1;
|
else if ((*left)->offset < (*right)->offset)
|
||||||
} if ((*firstStep)->offset < (*secondStep)->offset) {
|
return -1;
|
||||||
ret = -1;
|
return 0;
|
||||||
} if ((*firstStep)->offset == (*secondStep)->offset) {
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +91,7 @@ sort_color_steps_by_offset(const void* left, const void* right)
|
|||||||
BGradient::BGradient()
|
BGradient::BGradient()
|
||||||
: BArchivable(),
|
: BArchivable(),
|
||||||
fColors(4),
|
fColors(4),
|
||||||
fType(B_GRADIENT_NONE)
|
fType(TYPE_NONE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +100,7 @@ BGradient::BGradient()
|
|||||||
BGradient::BGradient(BMessage* archive)
|
BGradient::BGradient(BMessage* archive)
|
||||||
: BArchivable(archive),
|
: BArchivable(archive),
|
||||||
fColors(4),
|
fColors(4),
|
||||||
fType(B_GRADIENT_NONE)
|
fType(TYPE_NONE)
|
||||||
{
|
{
|
||||||
if (!archive)
|
if (!archive)
|
||||||
return;
|
return;
|
||||||
@@ -118,7 +114,7 @@ BGradient::BGradient(BMessage* archive)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (archive->FindInt32("type", (int32*)&fType) < B_OK)
|
if (archive->FindInt32("type", (int32*)&fType) < B_OK)
|
||||||
fType = B_GRADIENT_LINEAR;
|
fType = TYPE_LINEAR;
|
||||||
|
|
||||||
// linear
|
// linear
|
||||||
if (archive->FindFloat("linear_x1", (float*)&fData.linear.x1) < B_OK)
|
if (archive->FindFloat("linear_x1", (float*)&fData.linear.x1) < B_OK)
|
||||||
@@ -403,7 +399,7 @@ BGradient::CountColors() const
|
|||||||
|
|
||||||
|
|
||||||
// ColorAt
|
// ColorAt
|
||||||
color_step*
|
BGradient::color_step*
|
||||||
BGradient::ColorAt(int32 index) const
|
BGradient::ColorAt(int32 index) const
|
||||||
{
|
{
|
||||||
return (color_step*)fColors.ItemAt(index);
|
return (color_step*)fColors.ItemAt(index);
|
||||||
@@ -411,7 +407,7 @@ BGradient::ColorAt(int32 index) const
|
|||||||
|
|
||||||
|
|
||||||
// ColorAtFast
|
// ColorAtFast
|
||||||
color_step*
|
BGradient::color_step*
|
||||||
BGradient::ColorAtFast(int32 index) const
|
BGradient::ColorAtFast(int32 index) const
|
||||||
{
|
{
|
||||||
return (color_step*)fColors.ItemAtFast(index);
|
return (color_step*)fColors.ItemAtFast(index);
|
||||||
@@ -419,7 +415,7 @@ BGradient::ColorAtFast(int32 index) const
|
|||||||
|
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
color_step*
|
BGradient::color_step*
|
||||||
BGradient::Colors() const
|
BGradient::Colors() const
|
||||||
{
|
{
|
||||||
if (CountColors() > 0) {
|
if (CountColors() > 0) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ BGradientConic::BGradientConic()
|
|||||||
fData.conic.cx = 0.0f;
|
fData.conic.cx = 0.0f;
|
||||||
fData.conic.cy = 0.0f;
|
fData.conic.cy = 0.0f;
|
||||||
fData.conic.angle = 0.0f;
|
fData.conic.angle = 0.0f;
|
||||||
fType = B_GRADIENT_CONIC;
|
fType = TYPE_CONIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ BGradientConic::BGradientConic(const BPoint& center, float angle)
|
|||||||
fData.conic.cx = center.x;
|
fData.conic.cx = center.x;
|
||||||
fData.conic.cy = center.y;
|
fData.conic.cy = center.y;
|
||||||
fData.conic.angle = angle;
|
fData.conic.angle = angle;
|
||||||
fType = B_GRADIENT_CONIC;
|
fType = TYPE_CONIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ BGradientConic::BGradientConic(float cx, float cy, float angle)
|
|||||||
fData.conic.cx = cx;
|
fData.conic.cx = cx;
|
||||||
fData.conic.cy = cy;
|
fData.conic.cy = cy;
|
||||||
fData.conic.angle = angle;
|
fData.conic.angle = angle;
|
||||||
fType = B_GRADIENT_CONIC;
|
fType = TYPE_CONIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ BGradientDiamond::BGradientDiamond()
|
|||||||
{
|
{
|
||||||
fData.diamond.cx = 0.0f;
|
fData.diamond.cx = 0.0f;
|
||||||
fData.diamond.cy = 0.0f;
|
fData.diamond.cy = 0.0f;
|
||||||
fType = B_GRADIENT_DIAMOND;
|
fType = TYPE_DIAMOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ BGradientDiamond::BGradientDiamond(const BPoint& center)
|
|||||||
{
|
{
|
||||||
fData.diamond.cx = center.x;
|
fData.diamond.cx = center.x;
|
||||||
fData.diamond.cy = center.y;
|
fData.diamond.cy = center.y;
|
||||||
fType = B_GRADIENT_DIAMOND;
|
fType = TYPE_DIAMOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ BGradientDiamond::BGradientDiamond(float cx, float cy)
|
|||||||
{
|
{
|
||||||
fData.diamond.cx = cx;
|
fData.diamond.cx = cx;
|
||||||
fData.diamond.cy = cy;
|
fData.diamond.cy = cy;
|
||||||
fType = B_GRADIENT_DIAMOND;
|
fType = TYPE_DIAMOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ BGradientLinear::BGradientLinear()
|
|||||||
fData.linear.y1 = 0.0f;
|
fData.linear.y1 = 0.0f;
|
||||||
fData.linear.x2 = 0.0f;
|
fData.linear.x2 = 0.0f;
|
||||||
fData.linear.y2 = 0.0f;
|
fData.linear.y2 = 0.0f;
|
||||||
fType = B_GRADIENT_LINEAR;
|
fType = TYPE_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ BGradientLinear::BGradientLinear(const BPoint& start, const BPoint& end)
|
|||||||
fData.linear.y1 = start.y;
|
fData.linear.y1 = start.y;
|
||||||
fData.linear.x2 = end.x;
|
fData.linear.x2 = end.x;
|
||||||
fData.linear.y2 = end.y;
|
fData.linear.y2 = end.y;
|
||||||
fType = B_GRADIENT_LINEAR;
|
fType = TYPE_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ BGradientLinear::BGradientLinear(float x1, float y1, float x2, float y2)
|
|||||||
fData.linear.y1 = y1;
|
fData.linear.y1 = y1;
|
||||||
fData.linear.x2 = x2;
|
fData.linear.x2 = x2;
|
||||||
fData.linear.y2 = y2;
|
fData.linear.y2 = y2;
|
||||||
fType = B_GRADIENT_LINEAR;
|
fType = TYPE_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ BGradientRadial::BGradientRadial()
|
|||||||
fData.radial.cx = 0.0f;
|
fData.radial.cx = 0.0f;
|
||||||
fData.radial.cy = 0.0f;
|
fData.radial.cy = 0.0f;
|
||||||
fData.radial.radius = 0.0f;
|
fData.radial.radius = 0.0f;
|
||||||
fType = B_GRADIENT_RADIAL;
|
fType = TYPE_RADIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ BGradientRadial::BGradientRadial(const BPoint& center, float radius)
|
|||||||
fData.radial.cx = center.x;
|
fData.radial.cx = center.x;
|
||||||
fData.radial.cy = center.y;
|
fData.radial.cy = center.y;
|
||||||
fData.radial.radius = radius;
|
fData.radial.radius = radius;
|
||||||
fType = B_GRADIENT_RADIAL;
|
fType = TYPE_RADIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ BGradientRadial::BGradientRadial(float cx, float cy, float radius)
|
|||||||
fData.radial.cx = cx;
|
fData.radial.cx = cx;
|
||||||
fData.radial.cy = cy;
|
fData.radial.cy = cy;
|
||||||
fData.radial.radius = radius;
|
fData.radial.radius = radius;
|
||||||
fType = B_GRADIENT_RADIAL;
|
fType = TYPE_RADIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ BGradientRadialFocus::BGradientRadialFocus()
|
|||||||
fData.radial_focus.fx = 0.0f;
|
fData.radial_focus.fx = 0.0f;
|
||||||
fData.radial_focus.fy = 0.0f;
|
fData.radial_focus.fy = 0.0f;
|
||||||
fData.radial_focus.radius = 0.0f;
|
fData.radial_focus.radius = 0.0f;
|
||||||
fType = B_GRADIENT_RADIAL_FOCUS;
|
fType = TYPE_RADIAL_FOCUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ BGradientRadialFocus::BGradientRadialFocus(const BPoint& center, float radius,
|
|||||||
fData.radial_focus.fx = focal.x;
|
fData.radial_focus.fx = focal.x;
|
||||||
fData.radial_focus.fy = focal.y;
|
fData.radial_focus.fy = focal.y;
|
||||||
fData.radial_focus.radius = radius;
|
fData.radial_focus.radius = radius;
|
||||||
fType = B_GRADIENT_RADIAL_FOCUS;
|
fType = TYPE_RADIAL_FOCUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ BGradientRadialFocus::BGradientRadialFocus(float cx, float cy, float radius,
|
|||||||
fData.radial_focus.fx = fx;
|
fData.radial_focus.fx = fx;
|
||||||
fData.radial_focus.fy = fy;
|
fData.radial_focus.fy = fy;
|
||||||
fData.radial_focus.radius = radius;
|
fData.radial_focus.radius = radius;
|
||||||
fType = B_GRADIENT_RADIAL_FOCUS;
|
fType = TYPE_RADIAL_FOCUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ Gradient::Gradient(bool empty)
|
|||||||
fInheritTransformation(true)
|
fInheritTransformation(true)
|
||||||
{
|
{
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
AddColor(color_step(0, 0, 0, 255, 0.0), 0);
|
AddColor(BGradient::color_step(0, 0, 0, 255, 0.0), 0);
|
||||||
AddColor(color_step(255, 255, 255, 255, 1.0), 1);
|
AddColor(BGradient::color_step(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
|
||||||
color_step step;
|
BGradient::color_step 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; color_step* step = other.ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* 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; color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* 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++) {
|
||||||
color_step* ourStep = ColorAtFast(i);
|
BGradient::color_step* ourStep = ColorAtFast(i);
|
||||||
color_step* otherStep = other.ColorAtFast(i);
|
BGradient::color_step* 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; color_step* step = other.ColorAt(i); i++)
|
for (int32 i = 0; BGradient::color_step* 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)
|
||||||
color_step* step = new color_step(color, offset);
|
BGradient::color_step* step = new BGradient::color_step(color, offset);
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
int32 count = CountColors();
|
int32 count = CountColors();
|
||||||
for (; index < count; index++) {
|
for (; index < count; index++) {
|
||||||
color_step* s = ColorAtFast(index);
|
BGradient::color_step* 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 color_step& color, int32 index)
|
Gradient::AddColor(const BGradient::color_step& color, int32 index)
|
||||||
{
|
{
|
||||||
color_step* step = new color_step(color);
|
BGradient::color_step* step = new BGradient::color_step(color);
|
||||||
if (!fColors.AddItem((void*)step, index)) {
|
if (!fColors.AddItem((void*)step, index)) {
|
||||||
delete step;
|
delete step;
|
||||||
return false;
|
return false;
|
||||||
@@ -265,7 +265,8 @@ Gradient::AddColor(const color_step& color, int32 index)
|
|||||||
bool
|
bool
|
||||||
Gradient::RemoveColor(int32 index)
|
Gradient::RemoveColor(int32 index)
|
||||||
{
|
{
|
||||||
color_step* step = (color_step*)fColors.RemoveItem(index);
|
BGradient::color_step* step
|
||||||
|
= (BGradient::color_step*)fColors.RemoveItem(index);
|
||||||
if (!step) {
|
if (!step) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -278,9 +279,9 @@ Gradient::RemoveColor(int32 index)
|
|||||||
|
|
||||||
// SetColor
|
// SetColor
|
||||||
bool
|
bool
|
||||||
Gradient::SetColor(int32 index, const color_step& color)
|
Gradient::SetColor(int32 index, const BGradient::color_step& color)
|
||||||
{
|
{
|
||||||
if (color_step* step = ColorAt(index)) {
|
if (BGradient::color_step* 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;
|
||||||
@@ -295,7 +296,7 @@ Gradient::SetColor(int32 index, const color_step& color)
|
|||||||
bool
|
bool
|
||||||
Gradient::SetColor(int32 index, const rgb_color& color)
|
Gradient::SetColor(int32 index, const rgb_color& color)
|
||||||
{
|
{
|
||||||
if (color_step* step = ColorAt(index)) {
|
if (BGradient::color_step* step = ColorAt(index)) {
|
||||||
if ((uint32&)step->color != (uint32&)color) {
|
if ((uint32&)step->color != (uint32&)color) {
|
||||||
step->color = color;
|
step->color = color;
|
||||||
Notify();
|
Notify();
|
||||||
@@ -309,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)
|
||||||
{
|
{
|
||||||
color_step* step = ColorAt(index);
|
BGradient::color_step* step = ColorAt(index);
|
||||||
if (step && step->offset != offset) {
|
if (step && step->offset != offset) {
|
||||||
step->offset = offset;
|
step->offset = offset;
|
||||||
Notify();
|
Notify();
|
||||||
@@ -328,17 +329,17 @@ Gradient::CountColors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ColorAt
|
// ColorAt
|
||||||
color_step*
|
BGradient::color_step*
|
||||||
Gradient::ColorAt(int32 index) const
|
Gradient::ColorAt(int32 index) const
|
||||||
{
|
{
|
||||||
return (color_step*)fColors.ItemAt(index);
|
return (BGradient::color_step*)fColors.ItemAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorAtFast
|
// ColorAtFast
|
||||||
color_step*
|
BGradient::color_step*
|
||||||
Gradient::ColorAtFast(int32 index) const
|
Gradient::ColorAtFast(int32 index) const
|
||||||
{
|
{
|
||||||
return (color_step*)fColors.ItemAtFast(index);
|
return (BGradient::color_step*)fColors.ItemAtFast(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -394,13 +395,13 @@ gauss(double f)
|
|||||||
void
|
void
|
||||||
Gradient::MakeGradient(uint32* colors, int32 count) const
|
Gradient::MakeGradient(uint32* colors, int32 count) const
|
||||||
{
|
{
|
||||||
color_step* from = ColorAt(0);
|
BGradient::color_step* 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; color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) {
|
||||||
if (step->offset < from->offset)
|
if (step->offset < from->offset)
|
||||||
from = step;
|
from = step;
|
||||||
}
|
}
|
||||||
@@ -425,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; color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) {
|
||||||
if (step != from)
|
if (step != from)
|
||||||
nextSteps.AddItem((void*)step);
|
nextSteps.AddItem((void*)step);
|
||||||
}
|
}
|
||||||
@@ -434,9 +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
|
||||||
color_step* to = NULL;
|
BGradient::color_step* to = NULL;
|
||||||
float nextOffsetDist = 2.0;
|
float nextOffsetDist = 2.0;
|
||||||
for (int32 i = 0; color_step* step = (color_step*)nextSteps.ItemAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* step
|
||||||
|
= (BGradient::color_step*)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;
|
||||||
@@ -586,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; color_step* step = ColorAt(i); i++) {
|
for (int32 i = 0; BGradient::color_step* 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,17 +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 color_step& color, int32 index);
|
bool AddColor(const BGradient::color_step& color,
|
||||||
|
int32 index);
|
||||||
|
|
||||||
bool RemoveColor(int32 index);
|
bool RemoveColor(int32 index);
|
||||||
|
|
||||||
bool SetColor(int32 index, const color_step& step);
|
bool SetColor(int32 index,
|
||||||
|
const BGradient::color_step& 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;
|
||||||
color_step* ColorAt(int32 index) const;
|
BGradient::color_step* ColorAt(int32 index) const;
|
||||||
color_step* ColorAtFast(int32 index) const;
|
BGradient::color_step* 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++) {
|
||||||
color_step* step = fGradient->ColorAtFast(i);
|
BGradient::color_step* step = fGradient->ColorAtFast(i);
|
||||||
if (step->color.alpha < 255)
|
if (step->color.alpha < 255)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -815,7 +815,7 @@ void
|
|||||||
View::ConvertToScreenForDrawing(BGradient* gradient) const
|
View::ConvertToScreenForDrawing(BGradient* gradient) const
|
||||||
{
|
{
|
||||||
switch(gradient->Type()) {
|
switch(gradient->Type()) {
|
||||||
case B_GRADIENT_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
BGradientLinear* linear = (BGradientLinear*) gradient;
|
BGradientLinear* linear = (BGradientLinear*) gradient;
|
||||||
BPoint start = linear->Start();
|
BPoint start = linear->Start();
|
||||||
BPoint end = linear->End();
|
BPoint end = linear->End();
|
||||||
@@ -828,7 +828,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
linear->SortColorStepsByOffset();
|
linear->SortColorStepsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL: {
|
case BGradient::TYPE_RADIAL: {
|
||||||
BGradientRadial* radial = (BGradientRadial*) gradient;
|
BGradientRadial* radial = (BGradientRadial*) gradient;
|
||||||
BPoint center = radial->Center();
|
BPoint center = radial->Center();
|
||||||
fDrawState->Transform(¢er);
|
fDrawState->Transform(¢er);
|
||||||
@@ -837,7 +837,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
radial->SortColorStepsByOffset();
|
radial->SortColorStepsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL_FOCUS: {
|
case BGradient::TYPE_RADIAL_FOCUS: {
|
||||||
BGradientRadialFocus* radialFocus = (BGradientRadialFocus*) gradient;
|
BGradientRadialFocus* radialFocus = (BGradientRadialFocus*) gradient;
|
||||||
BPoint center = radialFocus->Center();
|
BPoint center = radialFocus->Center();
|
||||||
BPoint focal = radialFocus->Focal();
|
BPoint focal = radialFocus->Focal();
|
||||||
@@ -850,7 +850,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
radialFocus->SortColorStepsByOffset();
|
radialFocus->SortColorStepsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_DIAMOND: {
|
case BGradient::TYPE_DIAMOND: {
|
||||||
BGradientDiamond* diamond = (BGradientDiamond*) gradient;
|
BGradientDiamond* diamond = (BGradientDiamond*) gradient;
|
||||||
BPoint center = diamond->Center();
|
BPoint center = diamond->Center();
|
||||||
fDrawState->Transform(¢er);
|
fDrawState->Transform(¢er);
|
||||||
@@ -859,7 +859,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
diamond->SortColorStepsByOffset();
|
diamond->SortColorStepsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_CONIC: {
|
case BGradient::TYPE_CONIC: {
|
||||||
BGradientConic* conic = (BGradientConic*) gradient;
|
BGradientConic* conic = (BGradientConic*) gradient;
|
||||||
BPoint center = conic->Center();
|
BPoint center = conic->Center();
|
||||||
fDrawState->Transform(¢er);
|
fDrawState->Transform(¢er);
|
||||||
@@ -868,7 +868,7 @@ View::ConvertToScreenForDrawing(BGradient* gradient) const
|
|||||||
conic->SortColorStepsByOffset();
|
conic->SortColorStepsByOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_NONE: {
|
case BGradient::TYPE_NONE: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2521,37 +2521,37 @@ Painter::_FillPathGradient(VertexSource& path, const BGradient& gradient) const
|
|||||||
GTRACE("Painter::_FillPathGradient\n");
|
GTRACE("Painter::_FillPathGradient\n");
|
||||||
|
|
||||||
switch(gradient.Type()) {
|
switch(gradient.Type()) {
|
||||||
case B_GRADIENT_LINEAR: {
|
case BGradient::TYPE_LINEAR: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == B_GRADIENT_LINEAR\n"));
|
GTRACE(("Painter::_FillPathGradient> type == TYPE_LINEAR\n"));
|
||||||
_FillPathGradientLinear(path, *((const BGradientLinear*) &gradient));
|
_FillPathGradientLinear(path, *((const BGradientLinear*) &gradient));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL: {
|
case BGradient::TYPE_RADIAL: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == B_GRADIENT_RADIAL\n"));
|
GTRACE(("Painter::_FillPathGradient> type == TYPE_RADIAL\n"));
|
||||||
_FillPathGradientRadial(path,
|
_FillPathGradientRadial(path,
|
||||||
*((const BGradientRadial*) &gradient));
|
*((const BGradientRadial*) &gradient));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_RADIAL_FOCUS: {
|
case BGradient::TYPE_RADIAL_FOCUS: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == B_GRADIENT_RADIAL_FOCUS\n"));
|
GTRACE(("Painter::_FillPathGradient> type == TYPE_RADIAL_FOCUS\n"));
|
||||||
_FillPathGradientRadialFocus(path,
|
_FillPathGradientRadialFocus(path,
|
||||||
*((const BGradientRadialFocus*) &gradient));
|
*((const BGradientRadialFocus*) &gradient));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_DIAMOND: {
|
case BGradient::TYPE_DIAMOND: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == B_GRADIENT_DIAMOND\n"));
|
GTRACE(("Painter::_FillPathGradient> type == TYPE_DIAMOND\n"));
|
||||||
_FillPathGradientDiamond(path,
|
_FillPathGradientDiamond(path,
|
||||||
*((const BGradientDiamond*) &gradient));
|
*((const BGradientDiamond*) &gradient));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_CONIC: {
|
case BGradient::TYPE_CONIC: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == B_GRADIENT_CONIC\n"));
|
GTRACE(("Painter::_FillPathGradient> type == TYPE_CONIC\n"));
|
||||||
_FillPathGradientConic(path,
|
_FillPathGradientConic(path,
|
||||||
*((const BGradientConic*) &gradient));
|
*((const BGradientConic*) &gradient));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_GRADIENT_NONE: {
|
case BGradient::TYPE_NONE: {
|
||||||
GTRACE(("Painter::_FillPathGradient> type == B_GRADIENT_NONE\n"));
|
GTRACE(("Painter::_FillPathGradient> type == TYPE_NONE\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2565,8 +2565,8 @@ 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.CountColors() - 1; i++) {
|
||||||
color_step* from = gradient.ColorAtFast(i);
|
BGradient::color_step* from = gradient.ColorAtFast(i);
|
||||||
color_step* to = gradient.ColorAtFast(i + 1);
|
BGradient::color_step* to = gradient.ColorAtFast(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,
|
||||||
@@ -2577,8 +2577,9 @@ Painter::_MakeGradient(Array& array, const BGradient& gradient) const
|
|||||||
toColor.r, toColor.g, toColor.b, to->offset);
|
toColor.r, toColor.g, toColor.b, to->offset);
|
||||||
float dist = to->offset - from->offset;
|
float dist = to->offset - from->offset;
|
||||||
GTRACE("Painter::_MakeGradient> dist = %f\n", dist);
|
GTRACE("Painter::_MakeGradient> dist = %f\n", dist);
|
||||||
|
// TODO: Review this... offset should better be on [0..1]
|
||||||
if (dist > 0) {
|
if (dist > 0) {
|
||||||
for (int j = from->offset; j <= to->offset; j++) {
|
for (int j = (int)from->offset; j <= (int)to->offset; j++) {
|
||||||
float f = (float)(to->offset - j) / (float)(dist + 1);
|
float f = (float)(to->offset - j) / (float)(dist + 1);
|
||||||
array[j] = toColor.gradient(fromColor, f);
|
array[j] = toColor.gradient(fromColor, f);
|
||||||
GTRACE("Painter::_MakeGradient> array[%d](%d, %d, %d)\n",
|
GTRACE("Painter::_MakeGradient> array[%d](%d, %d, %d)\n",
|
||||||
@@ -2652,7 +2653,8 @@ Painter::_FillPathGradientRadial(VertexSource& path,
|
|||||||
GTRACE("Painter::_FillPathGradientRadial\n");
|
GTRACE("Painter::_FillPathGradientRadial\n");
|
||||||
|
|
||||||
BPoint center = radial.Center();
|
BPoint center = radial.Center();
|
||||||
float radius = radial.Radius();
|
// TODO: finish this
|
||||||
|
// float radius = radial.Radius();
|
||||||
|
|
||||||
typedef agg::span_interpolator_linear<> interpolator_type;
|
typedef agg::span_interpolator_linear<> interpolator_type;
|
||||||
typedef agg::pod_auto_array<agg::rgba8, 256> color_array_type;
|
typedef agg::pod_auto_array<agg::rgba8, 256> color_array_type;
|
||||||
@@ -2697,8 +2699,9 @@ Painter::_FillPathGradientRadialFocus(VertexSource& path,
|
|||||||
GTRACE("Painter::_FillPathGradientRadialFocus\n");
|
GTRACE("Painter::_FillPathGradientRadialFocus\n");
|
||||||
|
|
||||||
BPoint center = focus.Center();
|
BPoint center = focus.Center();
|
||||||
BPoint focal = focus.Focal();
|
// TODO: finish this.
|
||||||
float radius = focus.Radius();
|
// BPoint focal = focus.Focal();
|
||||||
|
// float radius = focus.Radius();
|
||||||
|
|
||||||
typedef agg::span_interpolator_linear<> interpolator_type;
|
typedef agg::span_interpolator_linear<> interpolator_type;
|
||||||
typedef agg::pod_auto_array<agg::rgba8, 256> color_array_type;
|
typedef agg::pod_auto_array<agg::rgba8, 256> color_array_type;
|
||||||
|
|||||||
Reference in New Issue
Block a user