1 /*
2  * DSFML - The Simple and Fast Multimedia Library for D
3  *
4  * Copyright (c) 2013 - 2017 Jeremy DeHaan (dehaan.jeremiah@gmail.com)
5  *
6  * This software is provided 'as-is', without any express or implied warranty.
7  * In no event will the authors be held liable for any damages arising from the
8  * use of this software.
9  *
10  * Permission is granted to anyone to use this software for any purpose,
11  * including commercial applications, and to alter it and redistribute it
12  * freely, subject to the following restrictions:
13  *
14  * 1. The origin of this software must not be misrepresented; you must not claim
15  * that you wrote the original software. If you use this software in a product,
16  * an acknowledgment in the product documentation would be appreciated but is
17  * not required.
18  *
19  * 2. Altered source versions must be plainly marked as such, and must not be
20  * misrepresented as being the original software.
21  *
22  * 3. This notice may not be removed or altered from any source distribution
23  */
24 
25 /**
26  * $(U Texture) stores pixels that can be drawn, with a sprite for example. A
27  * texture lives in the graphics card memory, therefore it is very fast to draw
28  * a texture to a render target, or copy a render target to a texture (the
29  * graphics card can access both directly).
30  *
31  * Being stored in the graphics card memory has some drawbacks. A texture cannot
32  * be manipulated as freely as a $(IMAGE_LINK), you need to prepare the pixels
33  * first and then upload them to the texture in a single operation (see
34  * `Texture.update`).
35  *
36  * $(U Texture) makes it easy to convert from/to Image, but keep in mind that
37  * these calls require transfers between the graphics card and the central
38  * memory, therefore they are slow operations.
39  *
40  * A texture can be loaded from an image, but also directly from a
41  * file/memory/stream. The necessary shortcuts are defined so that you don't
42  * need an image first for the most common cases. However, if you want to
43  * perform some modifications on the pixels before creating the final texture,
44  * you can load your file to a $(IMAGE_LINK), do whatever you need with the
45  * pixels, and then call `Texture.loadFromImage`.
46  *
47  * Since they live in the graphics card memory, the pixels of a texture cannot
48  * be accessed without a slow copy first. And they cannot be accessed
49  * individually. Therefore, if you need to read the texture's pixels (like for
50  * pixel-perfect collisions), it is recommended to store the collision
51  * information separately, for example in an array of booleans.
52  *
53  * Like $(IMAGE_LINK), $(U Texture) can handle a unique internal representation
54  * of pixels, which is RGBA 32 bits. This means that a pixel must be composed of
55  * 8 bits red, green, blue and alpha channels – just like a $(COLOR_LINK).
56  *
57  * Example:
58  * ---
59  * // This example shows the most common use of Texture:
60  * // drawing a sprite
61  *
62  * // Load a texture from a file
63  * auto texture = new Texture();
64  * if (!texture.loadFromFile("texture.png"))
65  *     return -1;
66  *
67  * // Assign it to a sprite
68  * auto sprite = new Sprite();
69  * sprite.setTexture(texture);
70  *
71  * // Draw the textured sprite
72  * window.draw(sprite);
73  * ---
74  *
75  * ---
76  * // This example shows another common use of Texture:
77  * // streaming real-time data, like video frames
78  *
79  * // Create an empty texture
80  * auto texture = new Texture();
81  * if (!texture.create(640, 480))
82  *     return -1;
83  *
84  * // Create a sprite that will display the texture
85  * auto sprite = new Sprite(texture);
86  *
87  * while (...) // the main loop
88  * {
89  *     ...
90  *
91  *     // update the texture
92  *
93  *     // get a fresh chunk of pixels (the next frame of a movie, for example)
94  *     ubyte[] pixels = ...;
95  *     texture.update(pixels);
96  *
97  *     // draw it
98  *     window.draw(sprite);
99  *
100  *     ...
101  * }
102  *
103  * ---
104  *
105  * $(PARA Like $(SHADER_LINK) that can be used as a raw OpenGL shader,
106  * $(U Texture) can also be used directly as a raw texture for custom OpenGL
107  * geometry.)
108  * ---
109  * Texture.bind(texture);
110  * ... render OpenGL geometry ...
111  * Texture.bind(null);
112  * ---
113  *
114  * See_Also:
115  * $(SPRITE_LINK), $(IMAGE_LINK), $(RENDERTEXTURE_LINK)
116  */
117 module dsfml.graphics.texture;
118 
119 
120 import dsfml.graphics.rect;
121 import dsfml.graphics.image;
122 import dsfml.graphics.renderwindow;
123 
124 import dsfml.window.window;
125 
126 import dsfml.system.inputstream;
127 import dsfml.system.vector2;
128 import dsfml.system.err;
129 
130 /**
131  * Image living on the graphics card that can be used for drawing.
132  */
133 class Texture
134 {
135     package sfTexture* sfPtr;
136 
137     /**
138      * Default constructor
139      *
140      * Creates an empty texture.
141      */
142     this()
143     {
144         sfPtr = sfTexture_construct();
145     }
146 
147     package this(sfTexture* texturePointer)
148     {
149         sfPtr = texturePointer;
150     }
151 
152     /// Destructor.
153     ~this()
154     {
155         import dsfml.system.config;
156         mixin(destructorOutput);
157         sfTexture_destroy( sfPtr);
158     }
159 
160     /**
161      * Load the texture from a file on disk.
162      *
163      * The area argument can be used to load only a sub-rectangle of the whole
164      * image. If you want the entire image then leave the default value (which
165      * is an empty IntRect). If the area rectangle crosses the bounds of the
166      * image, it is adjusted to fit the image size.
167      *
168      * The maximum size for a texture depends on the graphics driver and can be
169      * retrieved with the getMaximumSize function.
170      *
171      * If this function fails, the texture is left unchanged.
172      *
173      * Params:
174      * 		filename	= Path of the image file to load
175      * 		area		= Area of the image to load
176      *
177      * Returns: true if loading was successful, false otherwise.
178      */
179     bool loadFromFile(const(char)[] filename, IntRect area = IntRect() )
180     {
181         import dsfml.system..string;
182 
183         bool ret = sfTexture_loadFromFile(sfPtr, filename.ptr, filename.length,area.left, area.top,area.width, area.height);
184         if(!ret)
185         {
186             err.write(dsfml.system..string.toString(sfErr_getOutput()));
187         }
188 
189         return ret;
190     }
191 
192     /**
193      * Load the texture from a file in memory.
194      *
195      * The area argument can be used to load only a sub-rectangle of the whole
196      * image. If you want the entire image then leave the default value (which
197      * is an empty IntRect). If the area rectangle crosses the bounds of the
198      * image, it is adjusted to fit the image size.
199      *
200      * The maximum size for a texture depends on the graphics driver and can be
201      * retrieved with the getMaximumSize function.
202      *
203      * If this function fails, the texture is left unchanged.
204      *
205      * Params:
206      * 		data	= Image in memory
207      * 		size	= Size of the data to load, in bytes.
208      * 		area	= Area of the image to load
209      *
210      * Returns: true if loading was successful, false otherwise.
211      */
212     bool loadFromMemory(const(void)[] data, IntRect area = IntRect())
213     {
214         import dsfml.system..string;
215 
216 
217         bool ret = sfTexture_loadFromMemory(sfPtr, data.ptr, data.length,area.left, area.top,area.width, area.height);
218         if(!ret)
219         {
220             err.write(dsfml.system..string.toString(sfErr_getOutput()));
221         }
222 
223         return ret;
224     }
225 
226     /**
227      * Load the texture from a custom stream.
228      *
229      * The area argument can be used to load only a sub-rectangle of the whole
230      * image. If you want the entire image then leave the default value (which
231      * is an empty IntRect). If the area rectangle crosses the bounds of the
232      * image, it is adjusted to fit the image size.
233      *
234      * The maximum size for a texture depends on the graphics driver and can be
235      * retrieved with the getMaximumSize function.
236      *
237      * If this function fails, the texture is left unchanged.
238      *
239      * Params:
240      * 		stream	= Source stream to read from
241      * 		area	= Area of the image to load
242      *
243      * Returns: true if loading was successful, false otherwise.
244      */
245     bool loadFromStream(InputStream stream, IntRect area = IntRect())
246     {
247         import dsfml.system..string;
248 
249         bool ret = sfTexture_loadFromStream(sfPtr, new textureStream(stream), area.left, area.top,area.width, area.height);
250         if(!ret)
251         {
252             err.write(dsfml.system..string.toString(sfErr_getOutput()));
253         }
254 
255         return ret;
256     }
257 
258     /**
259      * Load the texture from an image.
260      *
261      * The area argument can be used to load only a sub-rectangle of the whole
262      * image. If you want the entire image then leave the default value (which
263      * is an empty IntRect). If the area rectangle crosses the bounds of the
264      * image, it is adjusted to fit the image size.
265      *
266      * The maximum size for a texture depends on the graphics driver and can be
267      * retrieved with the getMaximumSize function.
268      *
269      * If this function fails, the texture is left unchanged.
270      *
271      * Params:
272      * 		image	= Image to load into the texture
273      * 		area	= Area of the image to load
274      *
275      * Returns: true if loading was successful, false otherwise.
276      */
277     bool loadFromImage(Image image, IntRect area = IntRect())
278     {
279         import dsfml.system..string;
280 
281         bool ret = sfTexture_loadFromImage(sfPtr, image.sfPtr, area.left, area.top,area.width, area.height);
282         if(!ret)
283         {
284             err.write(dsfml.system..string.toString(sfErr_getOutput()));
285         }
286 
287         return ret;
288     }
289 
290     /**
291      * Get the maximum texture size allowed.
292      *
293      * This Maximum size is defined by the graphics driver. You can expect a
294      * value of 512 pixels for low-end graphics card, and up to 8192 pixels or
295      * more for newer hardware.
296      *
297      * Returns: Maximum size allowed for textures, in pixels.
298      */
299     static uint getMaximumSize()
300     {
301         return sfTexture_getMaximumSize();
302     }
303 
304     /**
305      * Return the size of the texture.
306      *
307      * Returns: Size in pixels.
308      */
309     Vector2u getSize() const
310     {
311         Vector2u temp;
312         sfTexture_getSize(sfPtr, &temp.x, &temp.y);
313         return temp;
314     }
315 
316     /**
317      * Enable or disable the smooth filter.
318      *
319      * When the filter is activated, the texture appears smoother so that pixels
320      * are less noticeable. However if you want the texture to look exactly the
321      * same as its source file, you should leave it disabled. The smooth filter
322      * is disabled by default.
323      *
324      * Params:
325      * 		smooth	= true to enable smoothing, false to disable it
326      */
327     void setSmooth(bool smooth)
328     {
329         sfTexture_setSmooth(sfPtr, smooth);
330     }
331 
332     /**
333      * Enable or disable repeating.
334      *
335      * Repeating is involved when using texture coordinates outside the texture
336      * rectangle [0, 0, width, height]. In this case, if repeat mode is enabled,
337      * the whole texture will be repeated as many times as needed to reach the
338      * coordinate (for example, if the X texture coordinate is 3 * width, the
339      * texture will be repeated 3 times).
340      *
341      * If repeat mode is disabled, the "extra space" will instead be filled with
342      * border pixels. Warning: on very old graphics cards, white pixels may
343      * appear when the texture is repeated. With such cards, repeat mode can be
344      * used reliably only if the texture has power-of-two dimensions
345      * (such as 256x128). Repeating is disabled by default.
346      *
347      * Params:
348      * 		repeated	= true to repeat the texture, false to disable repeating
349      */
350     void setRepeated(bool repeated)
351     {
352         sfTexture_setRepeated(sfPtr, repeated);
353     }
354 
355     /**
356      * Bind a texture for rendering.
357      *
358      * This function is not part of the graphics API, it mustn't be used when
359      * drawing DSFML entities. It must be used only if you mix Texture with
360      * OpenGL code.
361      *
362      * Params:
363      * 		texture	= The texture to bind. Can be null to use no texture
364      */
365     static void bind(Texture texture)
366     {
367         (texture is null)?sfTexture_bind(null):sfTexture_bind(texture.sfPtr);
368     }
369 
370     /**
371      * Create the texture.
372      *
373      * If this function fails, the texture is left unchanged.
374      *
375      * Params:
376      * 		width	= Width of the texture
377      * 		height	= Height of the texture
378      *
379      * Returns: true if creation was successful, false otherwise.
380      */
381     bool create(uint width, uint height)
382     {
383         import dsfml.system..string;
384 
385         bool ret = sfTexture_create(sfPtr, width, height);
386         if(!ret)
387         {
388             err.write(dsfml.system..string.toString(sfErr_getOutput()));
389         }
390 
391         return ret;
392     }
393 
394     /**
395      * Copy the texture pixels to an image.
396      *
397      * This function performs a slow operation that downloads the texture's
398      * pixels from the graphics card and copies them to a new image, potentially
399      * applying transformations to pixels if necessary (texture may be padded or
400      * flipped).
401      *
402      * Returns: Image containing the texture's pixels.
403      */
404     Image copyToImage() const
405     {
406         return new Image(sfTexture_copyToImage(sfPtr));
407     }
408 
409     /**
410      * Creates a new texture from the same data (this means copying the entire
411      * set of pixels).
412      */
413     @property Texture dup() const
414     {
415         return new Texture(sfTexture_copy(sfPtr));
416     }
417 
418     /**
419      * Tell whether the texture is repeated or not.
420      *
421      * Returns: true if repeat mode is enabled, false if it is disabled.
422      */
423     bool isRepeated() const
424     {
425         return (sfTexture_isRepeated(sfPtr));
426     }
427 
428     /**
429      * Tell whether the smooth filter is enabled or not.
430      *
431      * Returns: true if something is enabled, false if it is disabled.
432      */
433     bool isSmooth() const
434     {
435         return (sfTexture_isSmooth(sfPtr));
436     }
437 
438 
439     /**
440      * Update the whole texture from an array of pixels.
441      *
442      * The pixel array is assumed to have the same size as
443      * the area rectangle, and to contain 32-bits RGBA pixels.
444      *
445      * No additional check is performed on the size of the pixel
446      * array, passing invalid arguments will lead to an undefined
447      * behavior.
448      *
449      * This function does nothing if pixels is empty or if the
450      * texture was not previously created.
451      *
452      * Params:
453      * 		pixels	= Array of pixels to copy to the texture.
454      */
455     void update(const(ubyte)[] pixels)
456     {
457         Vector2u size = getSize();
458 
459         sfTexture_updateFromPixels(sfPtr,pixels.ptr,size.x, size.y, 0,0);
460     }
461 
462     /**
463      * Update part of the texture from an array of pixels.
464      *
465      * The size of the pixel array must match the width and height arguments,
466      * and it must contain 32-bits RGBA pixels.
467      *
468      * No additional check is performed on the size of the pixel array or the
469      * bounds of the area to update, passing invalid arguments will lead to an
470      * undefined behaviour.
471      *
472      * This function does nothing if pixels is empty or if the texture was not
473      * previously created.
474      *
475      * Params:
476      * 		pixels	= Array of pixels to copy to the texture.
477      * 		width	= Width of the pixel region contained in pixels
478      * 		height	= Height of the pixel region contained in pixels
479      * 		x		= X offset in the texture where to copy the source pixels
480      * 		y		= Y offset in the texture where to copy the source pixels
481      */
482     void update(const(ubyte)[] pixels, uint width, uint height, uint x, uint y)
483     {
484         sfTexture_updateFromPixels(sfPtr,pixels.ptr,width, height, x,y);
485     }
486 
487     /**
488      * Update the texture from an image.
489      *
490      * Although the source image can be smaller than the texture, this function
491      * is usually used for updating the whole texture. The other overload, which
492      * has (x, y) additional arguments, is more convenient for updating a
493      * sub-area of the texture.
494      *
495      * No additional check is performed on the size of the image, passing an
496      * image bigger than the texture will lead to an undefined behaviour.
497      *
498      * This function does nothing if the texture was not previously created.
499      *
500      * Params:
501      * 		image	= Image to copy to the texture.
502      */
503     void update(const(Image) image)
504     {
505         sfTexture_updateFromImage(sfPtr, image.sfPtr, 0, 0);
506     }
507 
508     /**
509      * Update the texture from an image.
510      *
511      * No additional check is performed on the size of the image, passing an
512      * invalid combination of image size and offset will lead to an undefined
513      * behavior.
514      *
515      * This function does nothing if the texture was not previously created.
516      *
517      * Params:
518      * 		image = Image to copy to the texture.
519      *		y     = Y offset in the texture where to copy the source image.
520      *		x     = X offset in the texture where to copy the source image.
521      */
522     void update(const(Image) image, uint x, uint y)
523     {
524         sfTexture_updateFromImage(sfPtr, image.sfPtr, x, y);
525     }
526 
527     /**
528      * Update the texture from the contents of a window
529      *
530      * Although the source window can be smaller than the texture, this function
531      * is usually used for updating the whole texture. The other overload, which
532      * has (x, y) additional arguments, is more convenient for updating a
533      * sub-area of the texture.
534      *
535      * No additional check is performed on the size of the window, passing a
536      * window bigger than the texture will lead to an undefined behavior.
537      *
538      * This function does nothing if either the texture or the window
539      * was not previously created.
540      *
541      * Params:
542      *		window = Window to copy to the texture
543      */
544     void update(T)(const(T) window)
545         if(is(T == Window) || is(T == RenderWindow))
546     {
547         update(window, 0, 0);
548     }
549 
550     /**
551      * Update a part of the texture from the contents of a window.
552      *
553      * No additional check is performed on the size of the window, passing an
554      * invalid combination of window size and offset will lead to an undefined
555      * behavior.
556      *
557      * This function does nothing if either the texture or the window was not
558      * previously created.
559      *
560      * Params:
561      *		window = Window to copy to the texture
562      *		x      = X offset in the texture where to copy the source window
563      *		y      = Y offset in the texture where to copy the source window
564      *
565      */
566     void update(T)(const(T) window, uint x, uint y)
567         if(is(T == Window) || is(T == RenderWindow))
568     {
569         static if(is(T == RenderWindow))
570         {
571             sfTexture_updateFromRenderWindow(sfPtr, T.sfPtr, x, y);
572         }
573         else
574         {
575             sfTexture_updateFromWindow(sfPtr, RenderWindow.windowPointer(T),
576                                         x, y);
577         }
578 
579     }
580 
581     /**
582      * Update the texture from an image.
583      *
584      * Although the source image can be smaller than the texture, this function
585      * is usually used for updating the whole texture. The other overload, which
586      * has (x, y) additional arguments, is more convenient for updating a
587      * sub-area of the texture.
588      *
589      * No additional check is performed on the size of the image, passing an
590      * image bigger than the texture will lead to an undefined behaviour.
591      *
592      * This function does nothing if the texture was not previously created.
593      *
594      * Params:
595      * 		image	= Image to copy to the texture.
596      */
597     deprecated("Use update function.")
598     void updateFromImage(Image image, uint x, uint y)
599     {
600         sfTexture_updateFromImage(sfPtr, image.sfPtr, x, y);
601     }
602 
603     /**
604      * Update part of the texture from an array of pixels.
605      *
606      * The size of the pixel array must match the width and height arguments,
607      * and it must contain 32-bits RGBA pixels.
608      *
609      * No additional check is performed on the size of the pixel array or the
610      * bounds of the area to update, passing invalid arguments will lead to an
611      * undefined behaviour.
612      *
613      * This function does nothing if pixels is null or if the texture was not
614      * previously created.
615      *
616      * Params:
617      * 		pixels	= Array of pixels to copy to the texture.
618      * 		width	= Width of the pixel region contained in pixels
619      * 		height	= Height of the pixel region contained in pixels
620      * 		x		= X offset in the texture where to copy the source pixels
621      * 		y		= Y offset in the texture where to copy the source pixels
622      */
623     deprecated("Use update function.")
624     void updateFromPixels(const(ubyte)[] pixels, uint width, uint height, uint x, uint y)
625     {
626         sfTexture_updateFromPixels(sfPtr,pixels.ptr,width, height, x,y);
627     }
628 
629     //TODO: Get this working via inheritance?(so custom window classes can do it too)
630     /**
631      * Update a part of the texture from the contents of a window.
632      *
633      * No additional check is performed on the size of the window, passing an
634      * invalid combination of window size and offset will lead to an undefined
635      * behaviour.
636      *
637      * This function does nothing if either the texture or the window was not
638      * previously created.
639      *
640      * Params:
641      * 		window	= Window to copy to the texture
642      * 		x		= X offset in the texture where to copy the source window
643      * 		y		= Y offset in the texture where to copy the source window
644      */
645     deprecated("Use update function.")
646     void updateFromWindow(Window window, uint x, uint y)
647     {
648         sfTexture_updateFromWindow(sfPtr, RenderWindow.windowPointer(window), x, y);
649     }
650 
651     //Is this even safe? RenderWindow inherits from Window, so what happens? Is this bottom used or the top?
652     /**
653      * Update a part of the texture from the contents of a window.
654      *
655      * No additional check is performed on the size of the window, passing an
656      * invalid combination of window size and offset will lead to an undefined
657      * behaviour.
658      *
659      * This function does nothing if either the texture or the window was not
660      * previously created.
661      *
662      * Params:
663      * 		window	= Window to copy to the texture
664      * 		x		= X offset in the texture where to copy the source window
665      * 		y		= Y offset in the texture where to copy the source window
666      */
667     deprecated("Use update function.")
668     void updateFromWindow(RenderWindow window, uint x, uint y)
669     {
670         sfTexture_updateFromRenderWindow(sfPtr, window.sfPtr, x, y);
671     }
672 
673 }
674 
675 unittest
676 {
677     version(DSFML_Unittest_Graphics)
678     {
679         import std.stdio;
680 
681         writeln("Unit test for Texture");
682 
683         auto texture = new Texture();
684 
685         assert(texture.loadFromFile("res/TestImage.png"));
686 
687         //do things with the texture
688 
689         writeln();
690     }
691 }
692 
693 private extern(C++) interface textureInputStream
694 {
695     long read(void* data, long size);
696 
697     long seek(long position);
698 
699     long tell();
700 
701     long getSize();
702 }
703 
704 
705 private class textureStream:textureInputStream
706 {
707     private InputStream myStream;
708 
709     this(InputStream stream)
710     {
711         myStream = stream;
712     }
713 
714     extern(C++)long read(void* data, long size)
715     {
716         return myStream.read(data[0..cast(size_t)size]);
717     }
718 
719     extern(C++)long seek(long position)
720     {
721         return myStream.seek(position);
722     }
723 
724     extern(C++)long tell()
725     {
726         return myStream.tell();
727     }
728 
729     extern(C++)long getSize()
730     {
731         return myStream.getSize();
732     }
733 }
734 
735 
736 
737 package extern(C) struct sfTexture;
738 
739 private extern(C):
740 
741 //Construct a new texture
742 sfTexture* sfTexture_construct();
743 
744 //Create a new texture
745 bool sfTexture_create(sfTexture* texture, uint width, uint height);
746 
747 //Create a new texture from a file
748 bool sfTexture_loadFromFile(sfTexture* texture, const(char)* filename, size_t length, int left, int top, int width, int height);
749 
750 //Create a new texture from a file in memory
751 bool sfTexture_loadFromMemory(sfTexture* texture, const(void)* data, size_t sizeInBytes, int left, int top, int width, int height);
752 
753 //Create a new texture from a custom stream
754 bool sfTexture_loadFromStream(sfTexture* texture, textureInputStream stream, int left, int top, int width, int height);
755 
756 //Create a new texture from an image
757 bool sfTexture_loadFromImage(sfTexture* texture, const(sfImage)* image, int left, int top, int width, int height);
758 
759 //Copy an existing texture
760 sfTexture* sfTexture_copy(const(sfTexture)* texture);
761 
762 //Destroy an existing texture
763 void sfTexture_destroy(sfTexture* texture);
764 
765 //Return the size of the texture
766 void sfTexture_getSize(const(sfTexture)* texture, uint* x, uint* y);
767 
768 //Copy a texture's pixels to an image
769 sfImage* sfTexture_copyToImage(const sfTexture* texture);
770 
771 //Update a texture from an array of pixels
772 void sfTexture_updateFromPixels(sfTexture* texture, const ubyte* pixels, uint width, uint height, uint x, uint y);
773 
774 //Update a texture from an image
775 void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, uint x, uint y);
776 
777 //Update a texture from the contents of a window
778 void sfTexture_updateFromWindow(sfTexture* texture, const(void)* window, uint x, uint y);
779 
780 //Update a texture from the contents of a render-window
781 void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, uint x, uint y);
782 
783 //Enable or disable the smooth filter on a texture
784 void sfTexture_setSmooth(sfTexture* texture, bool smooth);
785 
786 //Tell whether the smooth filter is enabled or not for a texture
787 bool sfTexture_isSmooth(const sfTexture* texture);
788 
789 //Enable or disable repeating for a texture
790 void sfTexture_setRepeated(sfTexture* texture, bool repeated);
791 
792 //Tell whether a texture is repeated or not
793 bool sfTexture_isRepeated(const sfTexture* texture);
794 
795 //Bind a texture for rendering
796 void sfTexture_bind(const sfTexture* texture);
797 
798 //Get the maximum texture size allowed
799 uint sfTexture_getMaximumSize();
800 
801 //Flush the OpenGL command buffer.
802 //void  sfTexture_flush();
803 
804 const(char)* sfErr_getOutput();