diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 17:43:19 +0000 |
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 17:43:19 +0000 |
| commit | 0292059f4a16434600564cfa3f0ad2309a508a54 (patch) | |
| tree | d95953cd53011917c4df679b96aedca39401b54f /doc/html/development-highlev.html | |
| download | libksquirrel-0292059f4a16434600564cfa3f0ad2309a508a54.tar.gz libksquirrel-0292059f4a16434600564cfa3f0ad2309a508a54.zip | |
Added libksquirrel for KDE3
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/libraries/libksquirrel@1095624 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'doc/html/development-highlev.html')
| -rw-r--r-- | doc/html/development-highlev.html | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/doc/html/development-highlev.html b/doc/html/development-highlev.html new file mode 100644 index 0000000..6174f5c --- /dev/null +++ b/doc/html/development-highlev.html @@ -0,0 +1,82 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <title>KSquirrel: development</title> + + <meta name='Author' content='Baryshev Dmitry/Krasu'> + <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'> + + <link rel='stylesheet' href='styles.css' type='text/css'> +</head> + +<body> + +When SQ_LibraryHandler loaded all found libraries, KSquirrel obtains the ability to decode any supported image format. +Here is a sample code to decode some image with library. Error handling is turned <b>off</b>. You can find real examples in +source distribution of ksquirrel-libs. + +<p><b><u>Sample</u></b> +<table cellpadding="2" cellspacing="2" width="70%" align="center"> +<tbody> +<tr> +<td valign="top" bgcolor="#CCCCCC"> +<pre> + int i, j, current = 0; + fmt_info finfo; + RGBA *image = NULL, *scan; + fmt_codec_base *codeK; + + QString file = "/home/krasu/animation1.gif"; + + <b>Determine the library and codec</b> + codeK = SQ_LibraryHandler::instance()->libraryForFile(file)->codec; + + <b>Init: open file, etc.</b> + codeK->read_init(file.ascii()); + + while(true) + { + i = codeK->read_next(); + + <b>Break, if we've decoded all available images in file</b> + if(i == SQE_NOTOK) + break; + + <b>Obtain the latest information (current image dimensions, etc.)</b> + finfo = codeK->information(); + + <b>realloc memory for new image</b> + image = (RGBA *)realloc(image, finfo.image[current].w * finfo.image[current].h * sizeof(RGBA)); + + <b>fill with white color (RGBA(255,255,255,255))</b> + memset(image, 255, finfo.image[current].w * finfo.image[current].h * sizeof(RGBA)); + + for(int pass = 0;pass < finfo.image[current].passes;pass++) + { + codeK->read_next_pass(); + + for(j = 0;j < finfo.image[current].h;j++) + { + scan = image + j * finfo.image[current].w; + codeK->read_scanline(scan); + } + } + + <b>Do something with decoded image here. + ...</b> + + current++; + } + + codeK->read_close(); + + free(image); + +</pre> +</td> +</tr> +</tbody> +</table> + +</body> +</html> |
