Sha256: 04f0ea4e6a2709fe64a9556ca081269b51c4009c5373cce41980fda5484d8ce9

Contents?: true

Size: 883 Bytes

Versions: 37

Compression:

Stored size: 883 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

37 entries across 37 versions & 1 rubygems

Version Path
reflexion-0.3 src/image_view.cpp
reflexion-0.2.1 src/image_view.cpp
reflexion-0.2 src/image_view.cpp
reflexion-0.1.57 src/image_view.cpp
reflexion-0.1.56 src/image_view.cpp
reflexion-0.1.55 src/image_view.cpp
reflexion-0.1.54 src/image_view.cpp
reflexion-0.1.53 src/image_view.cpp
reflexion-0.1.52 src/image_view.cpp
reflexion-0.1.51 src/image_view.cpp
reflexion-0.1.50 src/image_view.cpp
reflexion-0.1.49 src/image_view.cpp
reflexion-0.1.48 src/image_view.cpp
reflexion-0.1.47 src/image_view.cpp
reflexion-0.1.46 src/image_view.cpp
reflexion-0.1.45 src/image_view.cpp
reflexion-0.1.44 src/image_view.cpp
reflexion-0.1.43 src/image_view.cpp
reflexion-0.1.42 src/image_view.cpp
reflexion-0.1.41 src/image_view.cpp