* Updated indentation style
* Added warning about this being experimental API. +alphabranch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,15 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2009, Haiku.
|
* Copyright 2006-2009, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
* Artur Wyszynski <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GRADIENT_H
|
#ifndef _GRADIENT_H
|
||||||
#define _GRADIENT_H
|
#define _GRADIENT_H
|
||||||
|
|
||||||
|
|
||||||
#include <Archivable.h>
|
#include <Archivable.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
@@ -19,6 +15,14 @@ class BMessage;
|
|||||||
class BRect;
|
class BRect;
|
||||||
|
|
||||||
|
|
||||||
|
// WARNING! This is experimental API and may change! Be prepared to
|
||||||
|
// recompile your software in a next version of haiku. In particular,
|
||||||
|
// the offsets are currently specified on [0..255], but may be changed
|
||||||
|
// to the interval [0..1]. This class also does not have any FBC padding,
|
||||||
|
// So your software will definitely break when this class gets new
|
||||||
|
// virtuals. And the object size may change too...
|
||||||
|
|
||||||
|
|
||||||
class BGradient : public BArchivable {
|
class BGradient : public BArchivable {
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
@@ -43,39 +47,44 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BGradient();
|
BGradient();
|
||||||
BGradient(BMessage* archive);
|
BGradient(BMessage* archive);
|
||||||
virtual ~BGradient();
|
virtual ~BGradient();
|
||||||
|
|
||||||
status_t Archive(BMessage* into, bool deep = true) const;
|
status_t Archive(BMessage* into,
|
||||||
|
bool deep = true) const;
|
||||||
|
|
||||||
BGradient& operator=(const BGradient& other);
|
BGradient& operator=(const BGradient& other);
|
||||||
|
|
||||||
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 ColorStopsAreEqual(const BGradient& other) const;
|
bool ColorStopsAreEqual(
|
||||||
|
const BGradient& other) const;
|
||||||
|
|
||||||
void SetColorStops(const BGradient& other);
|
void SetColorStops(const BGradient& other);
|
||||||
|
|
||||||
int32 AddColor(const rgb_color& color, float offset);
|
int32 AddColor(const rgb_color& color,
|
||||||
bool AddColorStop(const ColorStop& colorStop, int32 index);
|
float offset);
|
||||||
|
bool AddColorStop(const ColorStop& colorStop,
|
||||||
|
int32 index);
|
||||||
|
|
||||||
bool RemoveColor(int32 index);
|
bool RemoveColor(int32 index);
|
||||||
|
|
||||||
bool SetColorStop(int32 index, const ColorStop& colorStop);
|
bool SetColorStop(int32 index,
|
||||||
bool SetColor(int32 index, const rgb_color& color);
|
const ColorStop& colorStop);
|
||||||
bool SetOffset(int32 index, float offset);
|
bool SetColor(int32 index, const rgb_color& color);
|
||||||
|
bool SetOffset(int32 index, float offset);
|
||||||
|
|
||||||
int32 CountColorStops() const;
|
int32 CountColorStops() const;
|
||||||
ColorStop* ColorStopAt(int32 index) const;
|
ColorStop* ColorStopAt(int32 index) const;
|
||||||
ColorStop* ColorStopAtFast(int32 index) const;
|
ColorStop* ColorStopAtFast(int32 index) const;
|
||||||
ColorStop* ColorStops() const;
|
ColorStop* ColorStops() const;
|
||||||
void SortColorStopsByOffset();
|
void SortColorStopsByOffset();
|
||||||
|
|
||||||
Type GetType() const
|
Type GetType() const
|
||||||
{ return fType; }
|
{ return fType; }
|
||||||
|
|
||||||
void MakeEmpty();
|
void MakeEmpty();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class BGradientLinear;
|
friend class BGradientLinear;
|
||||||
@@ -84,26 +93,26 @@ private:
|
|||||||
friend class BGradientDiamond;
|
friend class BGradientDiamond;
|
||||||
friend class BGradientConic;
|
friend class BGradientConic;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
float x1, y1, x2, y2;
|
float x1, y1, x2, y2;
|
||||||
} linear;
|
} linear;
|
||||||
struct {
|
struct {
|
||||||
float cx, cy, radius;
|
float cx, cy, radius;
|
||||||
} radial;
|
} radial;
|
||||||
struct {
|
struct {
|
||||||
float cx, cy, fx, fy, radius;
|
float cx, cy, fx, fy, radius;
|
||||||
} radial_focus;
|
} radial_focus;
|
||||||
struct {
|
struct {
|
||||||
float cx, cy;
|
float cx, cy;
|
||||||
} diamond;
|
} diamond;
|
||||||
struct {
|
struct {
|
||||||
float cx, cy, angle;
|
float cx, cy, angle;
|
||||||
} conic;
|
} conic;
|
||||||
} fData;
|
} fData;
|
||||||
|
|
||||||
BList fColorStops;
|
BList fColorStops;
|
||||||
Type fType;
|
Type fType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GRADIENT_H
|
#endif // _GRADIENT_H
|
||||||
|
|||||||
Reference in New Issue
Block a user