Sha256: b44a2fcf2cd1b62df8d824c949f3332ec07841017cbbfa8f1f47a325ce1b8e80

Contents?: true

Size: 879 Bytes

Versions: 10

Compression:

Stored size: 879 Bytes

Contents

#include "reflex/image_view.h"


#include <assert.h>
#include "reflex/exception.h"


namespace Reflex
{


	struct ImageView::Data
	{

		Image image;

	};// ImageView::Data


	ImageView::ImageView (const char* name)
	:	Super(name)
	{
	}

	ImageView::~ImageView ()
	{
	}

	void
	ImageView::set_image (Image image)
	{
		self->image = image;
		redraw();
	}

	Image
	ImageView::get_image () const
	{
		return self->image;
	}

	Bounds
	ImageView::content_bounds () const
	{
		if (self->image)
			return Bounds(self->image.width(), self->image.height());
		else
			return Super::content_bounds();
	}

	void
	ImageView::on_draw (DrawEvent* e)
	{
		if (!self->image) return;

		assert(e && e->painter);
		Painter* p = e->painter;

		Color f = p->fill(), s = p->stroke();
		p->set_fill(1);
		p->no_stroke();

		p->image(self->image);

		p->set_fill(f);
		p->set_stroke(s);
	}


}// Reflex

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
reflexion-0.1.23 src/image_view.cpp
reflexion-0.1.22 src/image_view.cpp
reflexion-0.1.21 src/image_view.cpp
reflexion-0.1.20 src/image_view.cpp
reflexion-0.1.19 src/image_view.cpp
reflexion-0.1.17 src/image_view.cpp
reflexion-0.1.16 src/image_view.cpp
reflexion-0.1.15 src/image_view.cpp
reflexion-0.1.14 src/image_view.cpp
reflexion-0.1.13 src/image_view.cpp