29 MakeEnumName(GL_CONSTANT_ALPHA),
30 MakeEnumName(GL_CONSTANT_COLOR),
31 MakeEnumName(GL_DST_ALPHA),
32 MakeEnumName(GL_DST_COLOR),
34 MakeEnumName(GL_ONE_MINUS_DST_ALPHA),
35 MakeEnumName(GL_ONE_MINUS_DST_COLOR),
36 MakeEnumName(GL_ONE_MINUS_SRC_ALPHA),
37 MakeEnumName(GL_ONE_MINUS_SRC_COLOR),
38 MakeEnumName(GL_SRC_ALPHA),
39 MakeEnumName(GL_SRC_COLOR),
43#define _Class _ImageView
57 glDeleteTextures(1, &this->texture);
81 $(self,
bind, inlets, dictionary);
100 if (this->texture == 0) {
102 this->texture = $(renderer,
createTexture, this->image->surface);
103 assert(this->texture);
126 glDeleteTextures(1, &this->texture);
134#pragma mark - ImageView
145 self->
blend.
dst = GL_ONE_MINUS_SRC_ALPHA;
173 release(self->
image);
176 self->
image = retain(image);
210 Resource *resource = $$(Resource, resourceWithName, name);
235#pragma mark - Class lifecycle
242 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
245 ((ViewInterface *) clazz->interface)->init =
init;
249 ((ImageViewInterface *) clazz->interface)->initWithFrame =
initWithFrame;
250 ((ImageViewInterface *) clazz->interface)->initWithImage =
initWithImage;
251 ((ImageViewInterface *) clazz->interface)->setImage =
setImage;
266 clazz = _initialize(&(
const ClassDef) {
268 .superclass =
_View(),
270 .interfaceOffset = offsetof(
ImageView, interface),
271 .interfaceSize =
sizeof(ImageViewInterface),
const EnumName GLBlendNames[]
static void dealloc(Object *self)
static void initialize(Class *clazz)
ImageViews render an Image in the context of a View hierarchy.
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
SDL_Size size(const Image *self)
Image * initWithSurface(Image *self, SDL_Surface *surface)
Initializes this Image with the given surface.
Image * imageWithResource(const Resource *resource)
Instantiates an Image with the specified Resource.
ImageViews render an Image in the context of a View hierarchy.
void setImageWithResource(ImageView *self, const Resource *resource)
Sets the Image for this ImageView with the given Resource.
void setImage(ImageView *self, Image *image)
Sets the Image for this ImageView.
void setImageWithSurface(ImageView *self, SDL_Surface *surface)
A convenience method to set this view's Image with a surface.
GLuint texture
The texture.
void setImageWithResourceName(ImageView *self, const char *name)
Sets the Image for this ImageView with the Resource by the given name.
SDL_Color color
The drawing color.
struct ImageView::@0 blend
The blend function.
Inlets enable inbound data binding of View attributes through JSON.
The Renderer is responsible for rasterizing the View hierarchy of a WindowController.
GLuint createTexture(const Renderer *self, const SDL_Surface *surface)
Generates and binds to an OpenGL texture object, uploading the given surface.
void renderDeviceWillReset(Renderer *self)
This method is invoked when the render device will become reset.
void drawTexture(const Renderer *self, GLuint texture, const SDL_Rect *dest)
Draws a textured GL_QUAD in the given rectangle.
void setDrawColor(Renderer *self, const SDL_Color *color)
Sets the primary color for drawing operations.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
_Bool bind(View *self, const Inlet *inlets, const Dictionary *dictionary)
Performs data binding for the Inlets described in dictionary.
Class * _View(void)
The View archetype.
void resize(View *self, const SDL_Size *size)
Resizes this View to the specified size.
void awakeWithDictionary(View *self, const Dictionary *dictionary)
Wakes this View with the specified Dictionary.
SDL_Rect renderFrame(const View *self)
void render(View *self, Renderer *renderer)
Renders this View using the given renderer.