using System;
using System.Runtime.InteropServices;
namespace SFML
{
namespace Graphics
{
////////////////////////////////////////////////////////////
///
/// Enumerate the blending modes available for drawable objects
///
////////////////////////////////////////////////////////////
public enum BlendMode
{
/// Pixel = Src * a + Dest * (1 - a)
Alpha,
/// Pixel = Src + Dest
Add,
/// Pixel = Src * Dest
Multiply,
/// No blending
None
}
////////////////////////////////////////////////////////////
///
/// Abstract base class for every object that can be drawn
/// into a render window
///
////////////////////////////////////////////////////////////
public abstract class Drawable : ObjectBase
{
////////////////////////////////////////////////////////////
///
/// Position of the object on screen
///
////////////////////////////////////////////////////////////
public abstract Vector2 Position {get; set;}
////////////////////////////////////////////////////////////
///
/// Rotation of the object, defined in degrees
///
////////////////////////////////////////////////////////////
public abstract float Rotation {get; set;}
////////////////////////////////////////////////////////////
///
/// Vertical and horizontal scale of the object
///
////////////////////////////////////////////////////////////
public abstract Vector2 Scale {get; set;}
////////////////////////////////////////////////////////////
///
/// Origin of the transformation of the object
/// (center of translation, rotation and scale)
///
////////////////////////////////////////////////////////////
public abstract Vector2 Origin {get; set;}
////////////////////////////////////////////////////////////
///
/// Global color of the object
///
////////////////////////////////////////////////////////////
public abstract Color Color {get; set;}
////////////////////////////////////////////////////////////
///
/// Blending mode of the object
///
////////////////////////////////////////////////////////////
public abstract BlendMode BlendMode {get; set;}
////////////////////////////////////////////////////////////
///
/// Transform a point from global coordinates into local coordinates
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
///
/// Point to transform
/// Transformed point
////////////////////////////////////////////////////////////
public abstract Vector2 TransformToLocal(Vector2 point);
////////////////////////////////////////////////////////////
///
/// Transform a point from local coordinates into global coordinates
/// (ie it applies the object's origin, translation, rotation and scale to the point)
///
/// Point to transform
/// Transformed point
////////////////////////////////////////////////////////////
public abstract Vector2 TransformToGlobal(Vector2 point);
////////////////////////////////////////////////////////////
///
/// Render the object into the given render window
///
/// Target render window
////////////////////////////////////////////////////////////
internal abstract void Render(RenderWindow target);
////////////////////////////////////////////////////////////
///
/// Render the object into the given render image
///
/// Target render image
////////////////////////////////////////////////////////////
internal abstract void Render(RenderImage target);
////////////////////////////////////////////////////////////
///
/// Internal constructor, for derived classes
///
/// Pointer to the object in C library
////////////////////////////////////////////////////////////
protected Drawable(IntPtr thisPtr) :
base(thisPtr)
{
}
}
}
}