Jump to content

[REL] Texturizer Module


jyrno42

Recommended Posts

Texturizer

Version: 0.91

Texturizer is a module which provides TXD libary writing and GD functions to MTASA server. It's available Windows only, however since the build system is CMake it should be pretty simple to use it on another platforms. I also added a small resource to clean up after lazy scripters. The resource also provides a testing base for future updates.

Download:

Installation:

See wikipedia (https://wiki.multitheftauto.com/wiki/Modules/Texturizer).

Functions:

  
bool/int createTxdContainer( void ); 
bool txdContainerAddImage( int container, string name, string filePath[, bool compress, string alphaname] ); 
bool saveTxdContainer( int container, string fName ); 
  
table gd_info( ); 
  
bool/userdata imageCreate( int w, int h ); 
bool/userdata imageCreateTrueColor( int w, int h ); 
bool/userdata imageCreateFromPng( string File ); 
bool/userdata imageCreateFromGif( string File ); 
bool/userdata imageCreateFromJpeg( string File ); 
  
bool/int imageSX( userdata im ); 
bool/int imageSY( userdata im ); 
bool imageIsTrueColor( userdata im ); 
  
bool imagePng( userdata im, string fPath[, int level = 0, int delete = false] ); 
bool imageGif( userdata im, string fPath[, bool delete = false] ); 
bool imageJpeg( userdata im, string fPath[, float quality = 1, bool delete = false] ); 
  
bool imageGetAlphaBlending( userdata im ); 
bool imageSetAlphaBlending( userdata im, bool blendmode ); 
bool imageGetAntiAlias( userdata im ); 
bool imageSetAntiAlias( userdata im, bool enabled ); 
bool imageGetInterlace( userdata im ); 
bool imageSetInterlace( userdata im, bool interlace ); 
bool imageGetSaveAlpha( userdata im ); 
bool imageSetSaveAlpha( userdata im, bool savealpha ); 
  
bool/int imageColorAllocate( userdata im, int red, int green, int blue); 
bool/int imageColorAllocateAlpha( userdata im, int red, int green, int blue, int alpha); 
bool/int imageColorClosest( userdata im, int red, int green, int blue); 
bool/int imageColorClosestAlpha( userdata im, int red, int green, int blue, int alpha); 
bool/int imageColorExact( userdata im, int red, int green, int blue); 
bool/int imageColorExactAlpha( userdata im, int red, int green, int blue, int alpha); 
bool/int imageColorResolve( userdata im, int red, int green, int blue); 
bool/int imageColorResolveAlpha( userdata im, int red, int green, int blue, int alpha); 
bool/int imageGetColorAt( userdata im, int x, int y); 
bool imageSetColorAt( userdata im, int x, int y, int color); 
bool imageColorDeallocate( userdata im, int color ); 
bool/int imageColorsTotal( userdata im ); 
bool/int imageColorSpecial( string name ); -- name can be: styled, brushed, styledbrushed, tiled, transparent, antialiased 
  
bool/int imageFontHeight( int font ); -- font : 1 - 5 
bool/int imageFontWidth( int font ); -- font : 1 - 5 
bool imageChar( userdata im, int font, int x, int y, string char, int color); 
bool imageCharUp( userdata im, int font, int x, int y, string char, int color); 
bool imageString( userdata im, int font, int x, int y, string char, int color); 
bool imageStringUp( userdata im, int font, int x, int y, string char, int color); 
bool/int imageTtfText( userdata im, int size, int angle, int x, int y, int color, string fontFile, string text); 
bool/table imageTtfBBox( int size, int angle, string fontFile, string text); 
  
bool/table imageGetStyle( userdata im ); 
bool imageSetStyle( userdata im, table style ); 
bool/int imageGetThickness( userdata im ); 
bool imageSetThickness( userdata im, int thickness ); 
bool/userdata imageGetBrush( userdata im ); 
bool imageSetBrush( userdata im, userdata brush ); 
bool/userdata imageGetTile( userdata im ); 
bool imageSetTile( userdata im, userdata tile ); 
  
bool/int imageLine( userdata im, int x1, int y1, int x2, int y2, int color ); 
bool/int imageArc( userdata im, int cx, int cy, int w, int h, int start, int end, int color ); 
bool/int imageRectangle( userdata im, int x1, int y1, int x2, int y2, int color ); 
bool/int imageEllipse( userdata im, int cx, int cy, int w, int h, int color ); 
  
bool/int imageFill( userdata im, int x, int y, int color ); 
bool/int imageFillToBorder( userdata im, int x, int y, int border, int color ); 
  
bool/int imageFilledArc( userdata im, int cx, int cy, int w, int h, int start, int end, int color[, table style] ); 
bool/int imageFilledRectangle( userdata im, int x1, int y1, int x2, int y2, int color ); 
bool/int imageFilledEllipse( userdata im, int cx, int cy, int w, int h, int color ); 
  
bool imageDestroy( userdata im ); 
bool imageCleanup( userdata resource ); 
  

More info: https://wiki.multitheftauto.com/wiki/Modules/Texturizer

Changelog:

Version 0.9.1 - 30.12.2010

  • Initial Release

Bugs and Requests:

Even though i created a lot of tests into a resource some bugs may still need squashing, hence the version number. Due to my work and school i wont be extra active on developing this, but i'll try to update the module as often as i can.

PS: I will add the function documentation to wiki soon, but since i mostly added GD functions that exist in php-gd you can use its documentation for more in-depth info. The function names should be same but capitalization is not.

PS2: I shall tidy up and add instructions for build to the source tomorrow or the day after that, too sleepy at the moment. Anyways, the link to current source is here: http://www.mediafire.com/?i4uxsv2fctox6wz.

NOTICE:

The txdContainerAddImage currently only supports png images... Will add gdImagePtr versions later.

Edited by Guest
Link to comment
what does this exactly do? I dont get it!

The smaller example of the possibilities can be seen in the following video:

It basically allows scripters to create modules which update the textures of objects in their server. The video showed an early version of my module which only had a couple of functions. Now, on to the GD part.

What is the GD library?

GD is an open source code library for the dynamic creation of images by programmers. GD creates PNG, JPEG and GIF images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve web site development.

GD is written in C and various binding are available.

The library was originally developped by Thomas Boutell and is now maintained by Pierre-A. Joye under the umbrella of PHP.net.

http://www.libgd.org/Main_Page

The GD adds more on-the-fly possibilities to the texture updating part. For example i could make this:

I have a custom model of an statue in my RP server. The statue base contains a list of names who have donated to my server. The texture of my statue has an automatic update functionality which loads the list of donators from my database and then updates the texture based on the new list.

Talk about turning OOC into IC info.

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...