Patch by Artur Wyszynski:
* Implemented BGradient, BGradientLinear, BGradientRadial, BGradientDiamond, BGradientConic and BGradientRadialFocus new Interface Kit classes. * Implemented all the (AGG-based) backend necessary in the app_server to render gradients (Painter, DrawingEngine) * app_server/View can convert a BGradient layout to screen coordinates. * Added BGradient methods of the Fill* methods in BView. * Implemented a test app and added it to the image as a demo. * Adopted Icon-O-Matic and libs/icon in order to avoid clashing with the new BGradient class. Re-use some parts where possible. Awesome work, Artur! Thanks a lot. Now a more modern looking GUI has just become much easier to implement! :-) TODO: * Remove the need to have gradient type twice in the app_server protocol. * Refactor some parts of the patch to remove duplicated code (Painter, DrawingEngine). * Adopt the BPicture protocol to know about BGradients. * Review some parts of the BArchivable implementation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28109 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright 2006-2008, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include <Point.h>
|
||||
#include <Gradient.h>
|
||||
#include <GradientLinear.h>
|
||||
|
||||
|
||||
// constructor
|
||||
BGradientLinear::BGradientLinear()
|
||||
{
|
||||
fData.linear.x1 = 0.0f;
|
||||
fData.linear.y1 = 0.0f;
|
||||
fData.linear.x2 = 0.0f;
|
||||
fData.linear.y2 = 0.0f;
|
||||
fType = B_GRADIENT_LINEAR;
|
||||
}
|
||||
|
||||
|
||||
// constructor
|
||||
BGradientLinear::BGradientLinear(const BPoint& start, const BPoint& end)
|
||||
{
|
||||
fData.linear.x1 = start.x;
|
||||
fData.linear.y1 = start.y;
|
||||
fData.linear.x2 = end.x;
|
||||
fData.linear.y2 = end.y;
|
||||
fType = B_GRADIENT_LINEAR;
|
||||
}
|
||||
|
||||
|
||||
// constructor
|
||||
BGradientLinear::BGradientLinear(float x1, float y1, float x2, float y2)
|
||||
{
|
||||
fData.linear.x1 = x1;
|
||||
fData.linear.y1 = y1;
|
||||
fData.linear.x2 = x2;
|
||||
fData.linear.y2 = y2;
|
||||
fType = B_GRADIENT_LINEAR;
|
||||
}
|
||||
|
||||
|
||||
// Start
|
||||
BPoint
|
||||
BGradientLinear::Start() const
|
||||
{
|
||||
return BPoint(fData.linear.x1, fData.linear.y1);
|
||||
}
|
||||
|
||||
|
||||
// SetStart
|
||||
void
|
||||
BGradientLinear::SetStart(const BPoint& start)
|
||||
{
|
||||
fData.linear.x1 = start.x;
|
||||
fData.linear.y1 = start.y;
|
||||
}
|
||||
|
||||
|
||||
// SetStart
|
||||
void
|
||||
BGradientLinear::SetStart(float x, float y)
|
||||
{
|
||||
fData.linear.x1 = x;
|
||||
fData.linear.y1 = y;
|
||||
}
|
||||
|
||||
|
||||
// End
|
||||
BPoint
|
||||
BGradientLinear::End() const
|
||||
{
|
||||
return BPoint(fData.linear.x2, fData.linear.y2);
|
||||
}
|
||||
|
||||
|
||||
// SetEnd
|
||||
void
|
||||
BGradientLinear::SetEnd(const BPoint& end)
|
||||
{
|
||||
fData.linear.x2 = end.x;
|
||||
fData.linear.y2 = end.y;
|
||||
}
|
||||
|
||||
|
||||
// SetEnd
|
||||
void
|
||||
BGradientLinear::SetEnd(float x, float y)
|
||||
{
|
||||
fData.linear.x2 = x;
|
||||
fData.linear.y2 = y;
|
||||
}
|
||||
Reference in New Issue
Block a user