13 attr_filename( &this->cm,
"/ivorium_graphics/empty.png" ),
20 this->
cm.
owns( this->texture.
cm, this->shader.cm, this->square.cm );
27 auto row = view->
Table( DebugTable ).
Row(
this );
64 if( this->texture.
get() )
66 int2 prefsize = this->texture->metadata().size;
67 float density = this->texture->metadata().density;
79 GLuint shader_id = this->shader.
get() ? this->shader->program_id() : 0;
80 GLuint texture_id = this->texture.
get() ? this->texture->gl_texture()->texture_id() : 0;
82 if( shader_id && texture_id )
116 this->shader->Render(
125 this->attr_preblend.Get(),
126 this->attr_translucent.Get(),
128 this->square->gl_mesh(),
132 this->texture->gl_texture(),
133 this->texture->metadata().density,
134 this->texture->metadata().msdf_pixelRange,
140 float Image::texcoord_frame_transform_px(
float coord_image_px,
float tex_size,
float image_size )
143 if( coord_image_px < image_size * 0.5 )
145 if( coord_image_px < tex_size / 2.0f )
146 coord_tex_px = coord_image_px;
148 coord_tex_px = tex_size / 2.0f;
152 if( image_size - coord_image_px < tex_size / 2.0f )
153 coord_tex_px = tex_size - ( image_size - coord_image_px );
155 coord_tex_px = tex_size / 2.0f;
163 if( !this->texture.
get() )
166 if( !this->texture->metadata().hitmap )
170 float2 texsize( this->texture->metadata().size );
171 float dpi = this->texture->metadata().density;
176 texpos = local_pos /
size * texsize;
182 texpos.x =
sig_mod( texpos.x, texsize.x / dpi ) * dpi;
183 texpos.y =
sig_mod( texpos.y, texsize.y / dpi ) * dpi;
187 texpos =
int2( Image::texcoord_frame_transform_px( local_pos.x, texsize.x / dpi,
size.x ) * dpi, Image::texcoord_frame_transform_px( local_pos.y, texsize.y / dpi,
size.y ) * dpi );
199 " texpos=", texpos );
201 return this->texture->hittest( texpos.x, texsize.y - texpos.y - 1 );