pax_global_header00006660000000000000000000000064122652130340014510gustar00rootroot0000000000000052 comment=bf43a53cb6011cbb138166da476b785075cdbae3 libsdl2-gfx-1.0.0/000077500000000000000000000000001226521303400136235ustar00rootroot00000000000000libsdl2-gfx-1.0.0/AUTHORS000066400000000000000000000000371226521303400146730ustar00rootroot00000000000000aschiffler at ferzkopp dot net libsdl2-gfx-1.0.0/COPYING000066400000000000000000000001451226521303400146560ustar00rootroot00000000000000SDL2_gfx COPYING Library is governed under the ZLib license. http://www.zlib.net/zlib_license.html libsdl2-gfx-1.0.0/ChangeLog000066400000000000000000000004621226521303400153770ustar00rootroot00000000000000SDL2_gfx ChangeLog Mon, Oct 28, 2013 8:00:05 AM - bugfix to _aaline special cases - added image filter functions - added to documentation - updated readme and changelog - updated solutions for VS2010 and VS2012 Tue, Sep 04, 2012 8:27:44 AM - initial release of development version (partially finished) libsdl2-gfx-1.0.0/Docs/000077500000000000000000000000001226521303400145135ustar00rootroot00000000000000libsdl2-gfx-1.0.0/Docs/html.doxyfile000066400000000000000000002316471226521303400172410ustar00rootroot00000000000000# Doxyfile 1.8.0 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = SDL2_gfx # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 1.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = Graphics primitives and surface functions for SDL2 # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = . # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. The create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = .. # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.d \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.mm \ *.dox \ *.py \ *.f90 \ *.f \ *.vhd \ *.vhdl \ README # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = .. # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://www.mathjax.org/mathjax # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES libsdl2-gfx-1.0.0/Docs/html/000077500000000000000000000000001226521303400154575ustar00rootroot00000000000000libsdl2-gfx-1.0.0/Docs/html/_r_e_a_d_m_e.html000077500000000000000000000036351226521303400207060ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/README File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/README File Reference
libsdl2-gfx-1.0.0/Docs/html/_r_e_a_d_m_e_source.html000077500000000000000000000037211226521303400222620ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/README Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/README
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__framerate_8c.html000077500000000000000000000312011226521303400224250ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_framerate.c File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_framerate.c File Reference
#include "SDL2_framerate.h"

Go to the source code of this file.

Functions

Uint32 _getTicks ()
 Internal wrapper to SDL_GetTicks that ensures a non-zero return value.
void SDL_initFramerate (FPSmanager *manager)
 Initialize the framerate manager.
int SDL_setFramerate (FPSmanager *manager, Uint32 rate)
 Set the framerate in Hz.
int SDL_getFramerate (FPSmanager *manager)
 Return the current target framerate in Hz.
int SDL_getFramecount (FPSmanager *manager)
 Return the current framecount.
Uint32 SDL_framerateDelay (FPSmanager *manager)
 Delay execution to maintain a constant framerate and calculate fps.

Function Documentation

Uint32 _getTicks ( )

Internal wrapper to SDL_GetTicks that ensures a non-zero return value.

Returns:
The tick count.

Definition at line 37 of file SDL2_framerate.c.

Uint32 SDL_framerateDelay ( FPSmanager manager)

Delay execution to maintain a constant framerate and calculate fps.

Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.

Parameters:
managerPointer to the framerate manager.
Returns:
The time that passed since the last call to the function in ms. May return 0.

Definition at line 146 of file SDL2_framerate.c.

int SDL_getFramecount ( FPSmanager manager)

Return the current framecount.

Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.

Parameters:
managerPointer to the framerate manager.
Returns:
Current frame count or -1 for error.

Definition at line 126 of file SDL2_framerate.c.

int SDL_getFramerate ( FPSmanager manager)

Return the current target framerate in Hz.

Get the currently set framerate of the manager.

Parameters:
managerPointer to the framerate manager.
Returns:
Current framerate in Hz or -1 for error.

Definition at line 107 of file SDL2_framerate.c.

void SDL_initFramerate ( FPSmanager manager)

Initialize the framerate manager.

Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.

Parameters:
managerPointer to the framerate manager.

Definition at line 62 of file SDL2_framerate.c.

int SDL_setFramerate ( FPSmanager manager,
Uint32  rate 
)

Set the framerate in Hz.

Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.

Parameters:
managerPointer to the framerate manager.
rateThe new framerate in Hz (frames per second).
Returns:
0 for sucess and -1 for error.

Definition at line 86 of file SDL2_framerate.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__framerate_8c_source.html000077500000000000000000000407061226521303400240170ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_framerate.c Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_framerate.c
Go to the documentation of this file.
00001 /*
00002 
00003 SDL_framerate.c: framerate manager
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #include "SDL2_framerate.h"
00031 
00037 Uint32 _getTicks()
00038 {
00039         Uint32 ticks = SDL_GetTicks();
00040 
00041         /* 
00042         * Since baseticks!=0 is used to track initialization
00043         * we need to ensure that the tick count is always >0 
00044         * since SDL_GetTicks may not have incremented yet and
00045         * return 0 depending on the timing of the calls.
00046         */
00047         if (ticks == 0) {
00048                 return 1;
00049         } else {
00050                 return ticks;
00051         }
00052 }
00053 
00062 void SDL_initFramerate(FPSmanager * manager)
00063 {
00064         /*
00065         * Store some sane values 
00066         */
00067         manager->framecount = 0;
00068         manager->rate = FPS_DEFAULT;
00069         manager->rateticks = (1000.0f / (float) FPS_DEFAULT);
00070         manager->baseticks = _getTicks();
00071         manager->lastticks = manager->baseticks;
00072 
00073 }
00074 
00086 int SDL_setFramerate(FPSmanager * manager, Uint32 rate)
00087 {
00088         if ((rate >= FPS_LOWER_LIMIT) && (rate <= FPS_UPPER_LIMIT)) {
00089                 manager->framecount = 0;
00090                 manager->rate = rate;
00091                 manager->rateticks = (1000.0f / (float) rate);
00092                 return (0);
00093         } else {
00094                 return (-1);
00095         }
00096 }
00097 
00107 int SDL_getFramerate(FPSmanager * manager)
00108 {
00109         if (manager == NULL) {
00110                 return (-1);
00111         } else {
00112                 return ((int)manager->rate);
00113         }
00114 }
00115 
00126 int SDL_getFramecount(FPSmanager * manager)
00127 {
00128         if (manager == NULL) {
00129                 return (-1);
00130         } else {
00131                 return ((int)manager->framecount);
00132         }
00133 }
00134 
00146 Uint32 SDL_framerateDelay(FPSmanager * manager)
00147 {
00148         Uint32 current_ticks;
00149         Uint32 target_ticks;
00150         Uint32 the_delay;
00151         Uint32 time_passed = 0;
00152 
00153         /*
00154         * No manager, no delay
00155         */
00156         if (manager == NULL) {
00157                 return 0;
00158         }
00159 
00160         /*
00161         * Initialize uninitialized manager 
00162         */
00163         if (manager->baseticks == 0) {
00164                 SDL_initFramerate(manager);
00165         }
00166 
00167         /*
00168         * Next frame 
00169         */
00170         manager->framecount++;
00171 
00172         /*
00173         * Get/calc ticks 
00174         */
00175         current_ticks = _getTicks();
00176         time_passed = current_ticks - manager->lastticks;
00177         manager->lastticks = current_ticks;
00178         target_ticks = manager->baseticks + (Uint32) ((float) manager->framecount * manager->rateticks);
00179 
00180         if (current_ticks <= target_ticks) {
00181                 the_delay = target_ticks - current_ticks;
00182                 SDL_Delay(the_delay);
00183         } else {
00184                 manager->framecount = 0;
00185                 manager->baseticks = _getTicks();
00186         }
00187 
00188         return time_passed;
00189 }
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__framerate_8h.html000077500000000000000000000425201226521303400224400ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_framerate.h File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_framerate.h File Reference
#include "SDL.h"

Go to the source code of this file.

Data Structures

struct  FPSmanager
 Structure holding the state and timing information of the framerate controller. More...

Defines

#define FPS_UPPER_LIMIT   200
 Highest possible rate supported by framerate controller in Hz (1/s).
#define FPS_LOWER_LIMIT   1
 Lowest possible rate supported by framerate controller in Hz (1/s).
#define FPS_DEFAULT   30
 Default rate of framerate controller in Hz (1/s).
#define SDL2_FRAMERATE_SCOPE   extern

Functions

SDL2_FRAMERATE_SCOPE void SDL_initFramerate (FPSmanager *manager)
 Initialize the framerate manager.
SDL2_FRAMERATE_SCOPE int SDL_setFramerate (FPSmanager *manager, Uint32 rate)
 Set the framerate in Hz.
SDL2_FRAMERATE_SCOPE int SDL_getFramerate (FPSmanager *manager)
 Return the current target framerate in Hz.
SDL2_FRAMERATE_SCOPE int SDL_getFramecount (FPSmanager *manager)
 Return the current framecount.
SDL2_FRAMERATE_SCOPE Uint32 SDL_framerateDelay (FPSmanager *manager)
 Delay execution to maintain a constant framerate and calculate fps.

Define Documentation

#define FPS_DEFAULT   30

Default rate of framerate controller in Hz (1/s).

Definition at line 57 of file SDL2_framerate.h.

#define FPS_LOWER_LIMIT   1

Lowest possible rate supported by framerate controller in Hz (1/s).

Definition at line 52 of file SDL2_framerate.h.

#define FPS_UPPER_LIMIT   200

Highest possible rate supported by framerate controller in Hz (1/s).

Definition at line 47 of file SDL2_framerate.h.

#define SDL2_FRAMERATE_SCOPE   extern

Definition at line 82 of file SDL2_framerate.h.


Function Documentation

Delay execution to maintain a constant framerate and calculate fps.

Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.

Parameters:
managerPointer to the framerate manager.
Returns:
The time that passed since the last call to the function in ms. May return 0.

Definition at line 146 of file SDL2_framerate.c.

Return the current framecount.

Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.

Parameters:
managerPointer to the framerate manager.
Returns:
Current frame count or -1 for error.

Definition at line 126 of file SDL2_framerate.c.

Return the current target framerate in Hz.

Get the currently set framerate of the manager.

Parameters:
managerPointer to the framerate manager.
Returns:
Current framerate in Hz or -1 for error.

Definition at line 107 of file SDL2_framerate.c.

Initialize the framerate manager.

Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.

Parameters:
managerPointer to the framerate manager.

Definition at line 62 of file SDL2_framerate.c.

SDL2_FRAMERATE_SCOPE int SDL_setFramerate ( FPSmanager manager,
Uint32  rate 
)

Set the framerate in Hz.

Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.

Parameters:
managerPointer to the framerate manager.
rateThe new framerate in Hz (frames per second).
Returns:
0 for sucess and -1 for error.

Definition at line 86 of file SDL2_framerate.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__framerate_8h_source.html000077500000000000000000000312321226521303400240160ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_framerate.h Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_framerate.h
Go to the documentation of this file.
00001 /*
00002 
00003 SDL2_framerate.h: framerate manager
00004 
00005 Copyright (C) 2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL2_framerate_h
00031 #define _SDL2_framerate_h
00032 
00033 /* Set up for C function definitions, even when using C++ */
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038         /* --- */
00039 
00040 #include "SDL.h"
00041 
00042         /* --------- Definitions */
00043 
00047 #define FPS_UPPER_LIMIT         200
00048 
00052 #define FPS_LOWER_LIMIT         1
00053 
00057 #define FPS_DEFAULT             30
00058 
00062         typedef struct {
00063                 Uint32 framecount;
00064                 float rateticks;
00065                 Uint32 baseticks;
00066                 Uint32 lastticks;
00067                 Uint32 rate;
00068         } FPSmanager;
00069 
00070         /* ---- Function Prototypes */
00071 
00072 #ifdef _MSC_VER
00073 #  if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)
00074 #    define SDL2_FRAMERATE_SCOPE __declspec(dllexport)
00075 #  else
00076 #    ifdef LIBSDL2_GFX_DLL_IMPORT
00077 #      define SDL2_FRAMERATE_SCOPE __declspec(dllimport)
00078 #    endif
00079 #  endif
00080 #endif
00081 #ifndef SDL2_FRAMERATE_SCOPE
00082 #  define SDL2_FRAMERATE_SCOPE extern
00083 #endif
00084 
00085         /* Functions return 0 or value for sucess and -1 for error */
00086 
00087         SDL2_FRAMERATE_SCOPE void SDL_initFramerate(FPSmanager * manager);
00088         SDL2_FRAMERATE_SCOPE int SDL_setFramerate(FPSmanager * manager, Uint32 rate);
00089         SDL2_FRAMERATE_SCOPE int SDL_getFramerate(FPSmanager * manager);
00090         SDL2_FRAMERATE_SCOPE int SDL_getFramecount(FPSmanager * manager);
00091         SDL2_FRAMERATE_SCOPE Uint32 SDL_framerateDelay(FPSmanager * manager);
00092 
00093         /* --- */
00094 
00095         /* Ends C function definitions when using C++ */
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 
00100 #endif                          /* _SDL2_framerate_h */
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__gfx_primitives_8c.html000077500000000000000000010225411226521303400235260ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives.c File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_gfxPrimitives.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SDL2_gfxPrimitives.h"
#include "SDL2_rotozoom.h"
#include "SDL2_gfxPrimitives_font.h"

Go to the source code of this file.

Data Structures

struct  SDL2_gfxBresenhamIterator
 The structure passed to the internal Bresenham iterator. More...
struct  SDL2_gfxMurphyIterator
 The structure passed to the internal Murphy iterator. More...

Defines

#define AAlevels   256
#define AAbits   8
#define HYPOT(x, y)   sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))

Functions

int pixel (SDL_Renderer *renderer, Sint16 x, Sint16 y)
 Draw pixel in currently set color.
int pixelColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint32 color)
 Draw pixel with blending enabled if a<255.
int pixelRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pixel with blending enabled if a<255.
int pixelRGBAWeight (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint32 weight)
 Draw pixel with blending enabled and using alpha weight on color.
int hline (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y)
 Draw horizontal line in currently set color.
int hlineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line with blending.
int hlineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line with blending.
int vlineColor (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Draw vertical line with blending.
int vlineRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw vertical line with blending.
int rectangleColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw rectangle with blending.
int rectangleRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rectangle with blending.
int roundedRectangleColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner rectangle with blending.
int roundedRectangleRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner rectangle with blending.
int roundedBoxColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner box (filled rectangle) with blending.
int roundedBoxRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner box (filled rectangle) with blending.
int boxColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw box (filled rectangle) with blending.
int boxRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw box (filled rectangle) with blending.
int line (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
 Draw line with alpha blending using the currently set color.
int lineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw line with alpha blending.
int lineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw line with alpha blending.
int _aalineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int draw_endpoint)
 Internal function to draw anti-aliased line with alpha blending and endpoint control.
int aalineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw anti-aliased line with alpha blending.
int aalineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased line with alpha blending.
int circleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw circle with blending.
int circleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw circle with blending.
int arcColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Arc with blending.
int arcRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Arc with blending.
int aacircleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw anti-aliased circle with blending.
int aacircleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased circle with blending.
int filledCircleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw filled circle with blending.
int filledCircleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled circle with blending.
int ellipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw ellipse with blending.
int ellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw ellipse with blending.
int aaellipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw anti-aliased ellipse with blending.
int aaellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased ellipse with blending.
int filledEllipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw filled ellipse with blending.
int filledEllipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled ellipse with blending.
int _pieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 filled)
 Internal float (low-speed) pie-calc implementation by drawing polygons.
int pieColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw pie (outline) with alpha blending.
int pieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pie (outline) with alpha blending.
int filledPieColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw filled pie with alpha blending.
int filledPieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled pie with alpha blending.
int trigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw trigon (triangle outline) with alpha blending.
int trigonRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw trigon (triangle outline) with alpha blending.
int aatrigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
int aatrigonRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
int filledTrigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw filled trigon (triangle) with alpha blending.
int filledTrigonRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled trigon (triangle) with alpha blending.
int polygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw polygon with alpha blending.
int polygon (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n)
 Draw polygon with the currently set color and blend mode.
int polygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw polygon with alpha blending.
int aapolygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw anti-aliased polygon with alpha blending.
int aapolygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased polygon with alpha blending.
int _gfxPrimitivesCompareInt (const void *a, const void *b)
 Internal helper qsort callback functions used in filled polygon drawing.
int filledPolygonRGBAMT (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
int filledPolygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw filled polygon with alpha blending.
int filledPolygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled polygon with alpha blending.
int _HLineTextured (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, SDL_Texture *texture, int texture_w, int texture_h, int texture_dx, int texture_dy)
 Internal function to draw a textured horizontal line.
int texturedPolygonMT (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)
 Draws a polygon filled with the given texture (Multi-Threading Capable).
int texturedPolygon (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
 Draws a polygon filled with the given texture.
void gfxPrimitivesSetFont (const void *fontdata, Uint32 cw, Uint32 ch)
 Sets or resets the current global font data.
void gfxPrimitivesSetFontRotation (Uint32 rotation)
 Sets current global font character rotation steps.
int characterRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a character of the currently set font.
int characterColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint32 color)
 Draw a character of the currently set font.
int stringColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint32 color)
 Draw a string in the currently set font.
int stringRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a string in the currently set font.
double _evaluateBezier (double *data, int ndata, double t)
 Internal function to calculate bezier interpolator of data array with ndata values at position 't'.
int bezierColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
 Draw a bezier curve with alpha blending.
int bezierRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a bezier curve with alpha blending.
int _bresenhamInitialize (SDL2_gfxBresenhamIterator *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
 Internal function to initialize the Bresenham line iterator.
int _bresenhamIterate (SDL2_gfxBresenhamIterator *b)
 Internal function to move Bresenham line iterator to the next position.
void _murphyParaline (SDL2_gfxMurphyIterator *m, Sint16 x, Sint16 y, int d1)
 Internal function to to draw parallel lines with Murphy algorithm.
void _murphyIteration (SDL2_gfxMurphyIterator *m, Uint8 miter, Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)
 Internal function to to draw one iteration of the Murphy algorithm.
void _murphyWideline (SDL2_gfxMurphyIterator *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)
 Internal function to to draw wide lines with Murphy algorithm.
int thickLineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
 Draw a thick line with alpha blending.
int thickLineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a thick line with alpha blending.

Define Documentation

#define AAbits   8

Definition at line 791 of file SDL2_gfxPrimitives.c.

#define AAlevels   256

Definition at line 790 of file SDL2_gfxPrimitives.c.

#define HYPOT (   x,
 
)    sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))

Definition at line 4037 of file SDL2_gfxPrimitives.c.


Function Documentation

int _aalineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
int  draw_endpoint 
)

Internal function to draw anti-aliased line with alpha blending and endpoint control.

This implementation of the Wu antialiasing code is based on Mike Abrash's DDJ article which was reprinted as Chapter 42 of his Graphics Programming Black Book, but has been optimized to work with SDL and utilizes 32-bit fixed-point arithmetic by A. Schiffler. The endpoint control allows the supression to draw the last pixel useful for rendering continous aa-lines with alpha<255.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
rThe red value of the aa-line to draw.
gThe green value of the aa-line to draw.
bThe blue value of the aa-line to draw.
aThe alpha value of the aa-line to draw.
draw_endpointFlag indicating if the endpoint should be drawn; draw if non-zero.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 816 of file SDL2_gfxPrimitives.c.

int _bresenhamInitialize ( SDL2_gfxBresenhamIterator b,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2 
)

Internal function to initialize the Bresenham line iterator.

Example of use: SDL2_gfxBresenhamIterator b; _bresenhamInitialize (&b, x1, y1, x2, y2); do { plot(b.x, b.y); } while (_bresenhamIterate(&b)==0);

Parameters:
bPointer to struct for bresenham line drawing state.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3775 of file SDL2_gfxPrimitives.c.

Internal function to move Bresenham line iterator to the next position.

Maybe updates the x and y coordinates of the iterator struct.

Parameters:
bPointer to struct for bresenham line drawing state.
Returns:
Returns 0 on success, 1 if last point was reached, 2 if moving past end-of-line, -1 on failure.

Definition at line 3837 of file SDL2_gfxPrimitives.c.

double _evaluateBezier ( double *  data,
int  ndata,
double  t 
)

Internal function to calculate bezier interpolator of data array with ndata values at position 't'.

Parameters:
dataArray of values.
ndataSize of array.
tPosition for which to calculate interpolated value. t should be between [0, ndata].
Returns:
Interpolated value at position t, value[0] when t<0, value[n-1] when t>n.

Definition at line 3608 of file SDL2_gfxPrimitives.c.

int _gfxPrimitivesCompareInt ( const void *  a,
const void *  b 
)

Internal helper qsort callback functions used in filled polygon drawing.

Parameters:
aThe surface to draw on.
bVertex array containing X coordinates of the points of the polygon.
Returns:
Returns 0 if a==b, a negative number if a<b or a positive number if a>b.

Definition at line 2741 of file SDL2_gfxPrimitives.c.

int _HLineTextured ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  x2,
Sint16  y,
SDL_Texture *  texture,
int  texture_w,
int  texture_h,
int  texture_dx,
int  texture_dy 
)

Internal function to draw a textured horizontal line.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
textureThe texture to retrieve color information from.
texture_wThe width of the texture.
texture_hThe height of the texture.
texture_dxThe X offset for the texture lookup.
texture_dyThe Y offset for the textured lookup.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2988 of file SDL2_gfxPrimitives.c.

void _murphyIteration ( SDL2_gfxMurphyIterator m,
Uint8  miter,
Uint16  ml1bx,
Uint16  ml1by,
Uint16  ml2bx,
Uint16  ml2by,
Uint16  ml1x,
Uint16  ml1y,
Uint16  ml2x,
Uint16  ml2y 
)

Internal function to to draw one iteration of the Murphy algorithm.

Parameters:
mPointer to struct for murphy iterator.
miterIteration count.
ml1bxX coordinate of a point.
ml1byY coordinate of a point.
ml2bxX coordinate of a point.
ml2byY coordinate of a point.
ml1xX coordinate of a point.
ml1yY coordinate of a point.
ml2xX coordinate of a point.
ml2yY coordinate of a point.

Definition at line 3930 of file SDL2_gfxPrimitives.c.

void _murphyParaline ( SDL2_gfxMurphyIterator m,
Sint16  x,
Sint16  y,
int  d1 
)

Internal function to to draw parallel lines with Murphy algorithm.

Parameters:
mPointer to struct for murphy iterator.
xX coordinate of point.
yY coordinate of point.
d1Direction square/diagonal.

Definition at line 3880 of file SDL2_gfxPrimitives.c.

void _murphyWideline ( SDL2_gfxMurphyIterator m,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  miter 
)

Internal function to to draw wide lines with Murphy algorithm.

Draws lines parallel to ideal line.

Parameters:
mPointer to struct for murphy iterator.
x1X coordinate of first point.
y1Y coordinate of first point.
x2X coordinate of second point.
y2Y coordinate of second point.
widthWidth of line.
miterIteration count.

Definition at line 4053 of file SDL2_gfxPrimitives.c.

int _pieRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
Uint8  filled 
)

Internal float (low-speed) pie-calc implementation by drawing polygons.

Note: Determines vertex array and uses polygon or filledPolygon drawing routines to render.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
rThe red value of the pie to draw.
gThe green value of the pie to draw.
bThe blue value of the pie to draw.
aThe alpha value of the pie to draw.
filledFlag indicating if the pie should be filled (=1) or not (=0).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2122 of file SDL2_gfxPrimitives.c.

int aacircleColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw anti-aliased circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
colorThe color value of the aa-circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1364 of file SDL2_gfxPrimitives.c.

int aacircleRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
rThe red value of the aa-circle to draw.
gThe green value of the aa-circle to draw.
bThe blue value of the aa-circle to draw.
aThe alpha value of the aa-circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1384 of file SDL2_gfxPrimitives.c.

int aaellipseColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw anti-aliased ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
colorThe color value of the aa-ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1741 of file SDL2_gfxPrimitives.c.

int aaellipseRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
rThe red value of the aa-ellipse to draw.
gThe green value of the aa-ellipse to draw.
bThe blue value of the aa-ellipse to draw.
aThe alpha value of the aa-ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1762 of file SDL2_gfxPrimitives.c.

int aalineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw anti-aliased line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1030 of file SDL2_gfxPrimitives.c.

int aalineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
rThe red value of the aa-line to draw.
gThe green value of the aa-line to draw.
bThe blue value of the aa-line to draw.
aThe alpha value of the aa-line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1051 of file SDL2_gfxPrimitives.c.

int aapolygonColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the aa-polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2663 of file SDL2_gfxPrimitives.c.

int aapolygonRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the aa-polygon to draw.
gThe green value of the aa-polygon to draw.
bThe blue value of the aa-polygon to draw.
aThe alpha value of the aa-polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2683 of file SDL2_gfxPrimitives.c.

int aatrigonColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
colorThe color value of the aa-trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2391 of file SDL2_gfxPrimitives.c.

int aatrigonRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
rThe red value of the aa-trigon to draw.
gThe green value of the aa-trigon to draw.
bThe blue value of the aa-trigon to draw.
aThe alpha value of the aa-trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2423 of file SDL2_gfxPrimitives.c.

int arcColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Arc with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
colorThe color value of the arc to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1109 of file SDL2_gfxPrimitives.c.

int arcRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Arc with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
rThe red value of the arc to draw.
gThe green value of the arc to draw.
bThe blue value of the arc to draw.
aThe alpha value of the arc to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1131 of file SDL2_gfxPrimitives.c.

int bezierColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint32  color 
)

Draw a bezier curve with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
colorThe color value of the bezier curve to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3667 of file SDL2_gfxPrimitives.c.

int bezierRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a bezier curve with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
rThe red value of the bezier curve to draw.
gThe green value of the bezier curve to draw.
bThe blue value of the bezier curve to draw.
aThe alpha value of the bezier curve to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3688 of file SDL2_gfxPrimitives.c.

int boxColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 644 of file SDL2_gfxPrimitives.c.

int boxRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 665 of file SDL2_gfxPrimitives.c.

int characterColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
char  c,
Uint32  color 
)

Draw a character of the currently set font.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
colorThe color value of the character to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3526 of file SDL2_gfxPrimitives.c.

int characterRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
char  c,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a character of the currently set font.

Parameters:
rendererThe Renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3404 of file SDL2_gfxPrimitives.c.

int circleColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
colorThe color value of the circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1069 of file SDL2_gfxPrimitives.c.

int circleRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
rThe red value of the circle to draw.
gThe green value of the circle to draw.
bThe blue value of the circle to draw.
aThe alpha value of the circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1089 of file SDL2_gfxPrimitives.c.

int ellipseColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
colorThe color value of the ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1525 of file SDL2_gfxPrimitives.c.

int ellipseRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
rThe red value of the ellipse to draw.
gThe green value of the ellipse to draw.
bThe blue value of the ellipse to draw.
aThe alpha value of the ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1546 of file SDL2_gfxPrimitives.c.

int filledCircleColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw filled circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
colorThe color value of the filled circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1405 of file SDL2_gfxPrimitives.c.

int filledCircleRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
rThe red value of the filled circle to draw.
gThe green value of the filled circle to draw.
bThe blue value of the filled circle to draw.
aThe alpha value of the filled circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1425 of file SDL2_gfxPrimitives.c.

int filledEllipseColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw filled ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
colorThe color value of the filled ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1955 of file SDL2_gfxPrimitives.c.

int filledEllipseRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
rThe red value of the filled ellipse to draw.
gThe green value of the filled ellipse to draw.
bThe blue value of the filled ellipse to draw.
aThe alpha value of the filled ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1976 of file SDL2_gfxPrimitives.c.

int filledPieColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw filled pie with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
colorThe color value of the filled pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2279 of file SDL2_gfxPrimitives.c.

int filledPieRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled pie with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
rThe red value of the filled pie to draw.
gThe green value of the filled pie to draw.
bThe blue value of the filled pie to draw.
aThe alpha value of the filled pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2301 of file SDL2_gfxPrimitives.c.

int filledPolygonColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw filled polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2946 of file SDL2_gfxPrimitives.c.

int filledPolygonRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2966 of file SDL2_gfxPrimitives.c.

int filledPolygonRGBAMT ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filled polygon to draw.
aThe alpha value of the filled polygon to draw.
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2778 of file SDL2_gfxPrimitives.c.

int filledTrigonColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
colorThe color value of the filled trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2457 of file SDL2_gfxPrimitives.c.

int filledTrigonRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
rThe red value of the filled trigon to draw.
gThe green value of the filled trigon to draw.
bThe blue value of the filled trigon to draw.
aThe alpha value of the filled trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2491 of file SDL2_gfxPrimitives.c.

void gfxPrimitivesSetFont ( const void *  fontdata,
Uint32  cw,
Uint32  ch 
)

Sets or resets the current global font data.

The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]

Parameters:
fontdataPointer to array of font data. Set to NULL, to reset global font to the default 8x8 font.
cwWidth of character in bytes. Ignored if fontdata==NULL.
chHeight of character in bytes. Ignored if fontdata==NULL.

Definition at line 3312 of file SDL2_gfxPrimitives.c.

void gfxPrimitivesSetFontRotation ( Uint32  rotation)

Sets current global font character rotation steps.

Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.

Parameters:
rotationNumber of 90deg clockwise steps to rotate

Definition at line 3358 of file SDL2_gfxPrimitives.c.

int hline ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  x2,
Sint16  y 
)

Draw horizontal line in currently set color.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 158 of file SDL2_gfxPrimitives.c.

int hlineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 175 of file SDL2_gfxPrimitives.c.

int hlineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 195 of file SDL2_gfxPrimitives.c.

int line ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2 
)

Draw line with alpha blending using the currently set color.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 735 of file SDL2_gfxPrimitives.c.

int lineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the seond point of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 755 of file SDL2_gfxPrimitives.c.

int lineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 776 of file SDL2_gfxPrimitives.c.

int pieColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw pie (outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2237 of file SDL2_gfxPrimitives.c.

int pieRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pie (outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
rThe red value of the pie to draw.
gThe green value of the pie to draw.
bThe blue value of the pie to draw.
aThe alpha value of the pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2260 of file SDL2_gfxPrimitives.c.

int pixel ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y 
)

Draw pixel in currently set color.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 73 of file SDL2_gfxPrimitives.c.

int pixelColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Uint32  color 
)

Draw pixel with blending enabled if a<255.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 88 of file SDL2_gfxPrimitives.c.

int pixelRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pixel with blending enabled if a<255.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
rThe red color value of the pixel to draw.
gThe green color value of the pixel to draw.
bThe blue color value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 107 of file SDL2_gfxPrimitives.c.

int pixelRGBAWeight ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
Uint32  weight 
)

Draw pixel with blending enabled and using alpha weight on color.

Parameters:
rendererThe renderer to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
rThe red color value of the pixel to draw.
gThe green color value of the pixel to draw.
bThe blue color value of the pixel to draw.
aThe alpha value of the pixel to draw.
weightThe weight multiplied into the alpha value of the pixel.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 130 of file SDL2_gfxPrimitives.c.

int polygon ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n 
)

Draw polygon with the currently set color and blend mode.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2536 of file SDL2_gfxPrimitives.c.

int polygonColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2520 of file SDL2_gfxPrimitives.c.

int polygonRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the polygon to draw.
gThe green value of the polygon to draw.
bThe blue value of the polygon to draw.
aThe alpha value of the polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2602 of file SDL2_gfxPrimitives.c.

int rectangleColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 260 of file SDL2_gfxPrimitives.c.

int rectangleRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 281 of file SDL2_gfxPrimitives.c.

int roundedBoxColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 498 of file SDL2_gfxPrimitives.c.

int roundedBoxRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 520 of file SDL2_gfxPrimitives.c.

int roundedRectangleColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 353 of file SDL2_gfxPrimitives.c.

int roundedRectangleRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 375 of file SDL2_gfxPrimitives.c.

int stringColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
const char *  s,
Uint32  color 
)

Draw a string in the currently set font.

The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
colorThe color value of the string to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3547 of file SDL2_gfxPrimitives.c.

int stringRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
const char *  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a string in the currently set font.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
rThe red value of the string to draw.
gThe green value of the string to draw.
bThe blue value of the string to draw.
aThe alpha value of the string to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3567 of file SDL2_gfxPrimitives.c.

int texturedPolygon ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Draws a polygon filled with the given texture.

This standard version is calling multithreaded versions with NULL cache parameters.

Parameters:
rendererThe renderer to draw on.
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3244 of file SDL2_gfxPrimitives.c.

int texturedPolygonMT ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy,
int **  polyInts,
int *  polyAllocated 
)

Draws a polygon filled with the given texture (Multi-Threading Capable).

Parameters:
rendererThe renderer to draw on.
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. If you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
polyIntsPreallocated temp array storage for vertex sorting (used for multi-threaded operation)
polyAllocatedFlag indicating oif the temp array was allocated (used for multi-threaded operation)
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3082 of file SDL2_gfxPrimitives.c.

int thickLineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint32  color 
)

Draw a thick line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4239 of file SDL2_gfxPrimitives.c.

int thickLineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a thick line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4261 of file SDL2_gfxPrimitives.c.

int trigonColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses polygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
colorThe color value of the trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2325 of file SDL2_gfxPrimitives.c.

int trigonRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw trigon (triangle outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
rThe red value of the trigon to draw.
gThe green value of the trigon to draw.
bThe blue value of the trigon to draw.
aThe alpha value of the trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2357 of file SDL2_gfxPrimitives.c.

int vlineColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Draw vertical line with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 217 of file SDL2_gfxPrimitives.c.

int vlineRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw vertical line with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 237 of file SDL2_gfxPrimitives.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__gfx_primitives_8c_source.html000077500000000000000000011355061226521303400251140ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives.c Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_gfxPrimitives.c
Go to the documentation of this file.
00001 /* 
00002 
00003 SDL2_gfxPrimitives.c: graphics primitives for SDL2 renderers
00004 
00005 Copyright (C) 2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <math.h>
00033 #include <string.h>
00034 
00035 #include "SDL2_gfxPrimitives.h"
00036 #include "SDL2_rotozoom.h"
00037 #include "SDL2_gfxPrimitives_font.h"
00038 
00039 /* ---- Structures */
00040 
00044 typedef struct {
00045         Sint16 x, y;
00046         int dx, dy, s1, s2, swapdir, error;
00047         Uint32 count;
00048 } SDL2_gfxBresenhamIterator;
00049 
00053 typedef struct {
00054         SDL_Renderer *renderer;
00055         int u, v;               /* delta x , delta y */
00056         int ku, kt, kv, kd;     /* loop constants */
00057         int oct2;
00058         int quad4;
00059         Sint16 last1x, last1y, last2x, last2y, first1x, first1y, first2x, first2y, tempx, tempy;
00060 } SDL2_gfxMurphyIterator;
00061 
00062 /* ---- Pixel */
00063 
00073 int pixel(SDL_Renderer *renderer, Sint16 x, Sint16 y)
00074 {
00075         return SDL_RenderDrawPoint(renderer, x, y);
00076 }
00077 
00088 int pixelColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint32 color)
00089 {
00090         Uint8 *c = (Uint8 *)&color; 
00091         return pixelRGBA(renderer, x, y, c[0], c[1], c[2], c[3]);
00092 }
00093 
00107 int pixelRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00108 {
00109         int result = 0;
00110         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
00111         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
00112         result |= SDL_RenderDrawPoint(renderer, x, y);
00113         return result;
00114 }
00115 
00130 int pixelRGBAWeight(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint32 weight)
00131 {
00132         /*
00133         * Modify Alpha by weight 
00134         */
00135         Uint32 ax = a;
00136         ax = ((ax * weight) >> 8);
00137         if (ax > 255) {
00138                 a = 255;
00139         } else {
00140                 a = (Uint8)(ax & 0x000000ff);
00141         }
00142 
00143         return pixelRGBA(renderer, x, y, r, g, b, a);
00144 }
00145 
00146 /* ---- Hline */
00147 
00158 int hline(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y)
00159 {
00160         return SDL_RenderDrawLine(renderer, x1, y, x2, y);;
00161 }
00162 
00163 
00175 int hlineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
00176 {
00177         Uint8 *c = (Uint8 *)&color; 
00178         return hlineRGBA(renderer, x1, x2, y, c[0], c[1], c[2], c[3]);
00179 }
00180 
00195 int hlineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00196 {
00197         int result = 0;
00198         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
00199         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
00200         result |= SDL_RenderDrawLine(renderer, x1, y, x2, y);
00201         return result;
00202 }
00203 
00204 /* ---- Vline */
00205 
00217 int vlineColor(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
00218 {
00219         Uint8 *c = (Uint8 *)&color; 
00220         return vlineRGBA(renderer, x, y1, y2, c[0], c[1], c[2], c[3]);
00221 }
00222 
00237 int vlineRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00238 {
00239         int result = 0;
00240         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
00241         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
00242         result |= SDL_RenderDrawLine(renderer, x, y1, x, y2);
00243         return result;
00244 }
00245 
00246 /* ---- Rectangle */
00247 
00260 int rectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
00261 {
00262         Uint8 *c = (Uint8 *)&color; 
00263         return rectangleRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
00264 }
00265 
00281 int rectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00282 {
00283         int result;
00284         Sint16 tmp;
00285         SDL_Rect rect;
00286 
00287         /*
00288         * Test for special cases of straight lines or single point 
00289         */
00290         if (x1 == x2) {
00291                 if (y1 == y2) {
00292                         return (pixelRGBA(renderer, x1, y1, r, g, b, a));
00293                 } else {
00294                         return (vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
00295                 }
00296         } else {
00297                 if (y1 == y2) {
00298                         return (hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
00299                 }
00300         }
00301 
00302         /*
00303         * Swap x1, x2 if required 
00304         */
00305         if (x1 > x2) {
00306                 tmp = x1;
00307                 x1 = x2;
00308                 x2 = tmp;
00309         }
00310 
00311         /*
00312         * Swap y1, y2 if required 
00313         */
00314         if (y1 > y2) {
00315                 tmp = y1;
00316                 y1 = y2;
00317                 y2 = tmp;
00318         }
00319 
00320         /* 
00321         * Create destination rect
00322         */      
00323         rect.x = x1;
00324         rect.y = y1;
00325         rect.w = x2 - x1;
00326         rect.h = y2 - y1;
00327         
00328         /*
00329         * Draw
00330         */
00331         result = 0;
00332         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
00333         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a); 
00334         result |= SDL_RenderDrawRect(renderer, &rect);
00335         return result;
00336 }
00337 
00338 /* ---- Rounded Rectangle */
00339 
00353 int roundedRectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
00354 {
00355         Uint8 *c = (Uint8 *)&color; 
00356         return roundedRectangleRGBA(renderer, x1, y1, x2, y2, rad, c[0], c[1], c[2], c[3]);
00357 }
00358 
00375 int roundedRectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00376 {
00377         int result = 0;
00378         Sint16 tmp;
00379         Sint16 w, h;
00380         Sint16 xx1, xx2;
00381         Sint16 yy1, yy2;
00382         
00383         /*
00384         * Check renderer
00385         */
00386         if (renderer == NULL)
00387         {
00388                 return -1;
00389         }
00390 
00391         /*
00392         * Check radius vor valid range
00393         */
00394         if (rad < 0) {
00395                 return -1;
00396         }
00397 
00398         /*
00399         * Special case - no rounding
00400         */
00401         if (rad == 0) {
00402                 return rectangleRGBA(renderer, x1, y1, x2, y2, r, g, b, a);
00403         }
00404 
00405         /*
00406         * Test for special cases of straight lines or single point 
00407         */
00408         if (x1 == x2) {
00409                 if (y1 == y2) {
00410                         return (pixelRGBA(renderer, x1, y1, r, g, b, a));
00411                 } else {
00412                         return (vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
00413                 }
00414         } else {
00415                 if (y1 == y2) {
00416                         return (hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
00417                 }
00418         }
00419 
00420         /*
00421         * Swap x1, x2 if required 
00422         */
00423         if (x1 > x2) {
00424                 tmp = x1;
00425                 x1 = x2;
00426                 x2 = tmp;
00427         }
00428 
00429         /*
00430         * Swap y1, y2 if required 
00431         */
00432         if (y1 > y2) {
00433                 tmp = y1;
00434                 y1 = y2;
00435                 y2 = tmp;
00436         }
00437 
00438         /*
00439         * Calculate width&height 
00440         */
00441         w = x2 - x1;
00442         h = y2 - y1;
00443 
00444         /*
00445         * Maybe adjust radius
00446         */
00447         if ((rad * 2) > w)  
00448         {
00449                 rad = w / 2;
00450         }
00451         if ((rad * 2) > h)
00452         {
00453                 rad = h / 2;
00454         }
00455 
00456         /*
00457         * Draw corners
00458         */
00459         xx1 = x1 + rad;
00460         xx2 = x2 - rad;
00461         yy1 = y1 + rad;
00462         yy2 = y2 - rad;
00463         result |= arcRGBA(renderer, xx1, yy1, rad, 180, 270, r, g, b, a);
00464         result |= arcRGBA(renderer, xx2, yy1, rad, 270, 360, r, g, b, a);
00465         result |= arcRGBA(renderer, xx1, yy2, rad,  90, 180, r, g, b, a);
00466         result |= arcRGBA(renderer, xx2, yy2, rad,   0,  90, r, g, b, a);
00467 
00468         /*
00469         * Draw lines
00470         */
00471         if (xx1 <= xx2) {
00472                 result |= hlineRGBA(renderer, xx1, xx2, y1, r, g, b, a);
00473                 result |= hlineRGBA(renderer, xx1, xx2, y2, r, g, b, a);
00474         }
00475         if (yy1 <= yy2) {
00476                 result |= vlineRGBA(renderer, x1, yy1, yy2, r, g, b, a);
00477                 result |= vlineRGBA(renderer, x2, yy1, yy2, r, g, b, a);
00478         }
00479 
00480         return result;
00481 }
00482 
00483 /* ---- Rounded Box */
00484 
00498 int roundedBoxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
00499 {
00500         Uint8 *c = (Uint8 *)&color; 
00501         return roundedBoxRGBA(renderer, x1, y1, x2, y2, rad, c[0], c[1], c[2], c[3]);
00502 }
00503 
00520 int roundedBoxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2,
00521         Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00522 {
00523         int result = 0;
00524         Sint16 w, h, tmp;
00525         Sint16 xx1, xx2, yy1, yy2;
00526 
00527         /* 
00528         * Check destination renderer 
00529         */
00530         if (renderer == NULL)
00531         {
00532                 return -1;
00533         }
00534 
00535         /*
00536         * Check radius vor valid range
00537         */
00538         if (rad < 0) {
00539                 return -1;
00540         }
00541 
00542         /*
00543         * Special case - no rounding
00544         */
00545         if (rad == 0) {
00546                 return rectangleRGBA(renderer, x1, y1, x2, y2, r, g, b, a);
00547         }
00548 
00549         /*
00550         * Test for special cases of straight lines or single point 
00551         */
00552         if (x1 == x2) {
00553                 if (y1 == y2) {
00554                         return (pixelRGBA(renderer, x1, y1, r, g, b, a));
00555                 } else {
00556                         return (vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
00557                 }
00558         } else {
00559                 if (y1 == y2) {
00560                         return (hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
00561                 }
00562         }
00563 
00564         /*
00565         * Swap x1, x2 if required 
00566         */
00567         if (x1 > x2) {
00568                 tmp = x1;
00569                 x1 = x2;
00570                 x2 = tmp;
00571         }
00572 
00573         /*
00574         * Swap y1, y2 if required 
00575         */
00576         if (y1 > y2) {
00577                 tmp = y1;
00578                 y1 = y2;
00579                 y2 = tmp;
00580         }
00581 
00582         /*
00583         * Calculate width&height 
00584         */
00585         w = x2 - x1;
00586         h = y2 - y1;
00587 
00588         /*
00589         * Maybe adjust radius
00590         */
00591         if ((rad * 2) > w)  
00592         {
00593                 rad = w / 2;
00594         }
00595         if ((rad * 2) > h)
00596         {
00597                 rad = h / 2;
00598         }
00599 
00600         /*
00601         * Draw corners
00602         */
00603         xx1 = x1 + rad;
00604         xx2 = x2 - rad;
00605         yy1 = y1 + rad;
00606         yy2 = y2 - rad;
00607         result |= filledPieRGBA(renderer, xx1, yy1, rad, 180, 270, r, g, b, a);
00608         result |= filledPieRGBA(renderer, xx2, yy1, rad, 270, 360, r, g, b, a);
00609         result |= filledPieRGBA(renderer, xx1, yy2, rad,  90, 180, r, g, b, a);
00610         result |= filledPieRGBA(renderer, xx2, yy2, rad,   0,  90, r, g, b, a);
00611 
00612         /*
00613         * Draw body
00614         */
00615         xx1++;
00616         xx2--;
00617         yy1++;
00618         yy2--;
00619         if (xx1 <= xx2) {
00620                 result |= boxRGBA(renderer, xx1, y1, xx2, y2, r, g, b, a);
00621         }
00622         if (yy1 <= yy2) {
00623                 result |= boxRGBA(renderer, x1, yy1, xx1-1, yy2, r, g, b, a);
00624                 result |= boxRGBA(renderer, xx2+1, yy1, x2, yy2, r, g, b, a);
00625         }
00626 
00627         return result;
00628 }
00629 
00630 /* ---- Box */
00631 
00644 int boxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
00645 {
00646         Uint8 *c = (Uint8 *)&color; 
00647         return boxRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
00648 }
00649 
00665 int boxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00666 {
00667         int result;
00668         Sint16 tmp;
00669         SDL_Rect rect;
00670 
00671         /*
00672         * Test for special cases of straight lines or single point 
00673         */
00674         if (x1 == x2) {
00675                 if (y1 == y2) {
00676                         return (pixelRGBA(renderer, x1, y1, r, g, b, a));
00677                 } else {
00678                         return (vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
00679                 }
00680         } else {
00681                 if (y1 == y2) {
00682                         return (hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
00683                 }
00684         }
00685 
00686         /*
00687         * Swap x1, x2 if required 
00688         */
00689         if (x1 > x2) {
00690                 tmp = x1;
00691                 x1 = x2;
00692                 x2 = tmp;
00693         }
00694 
00695         /*
00696         * Swap y1, y2 if required 
00697         */
00698         if (y1 > y2) {
00699                 tmp = y1;
00700                 y1 = y2;
00701                 y2 = tmp;
00702         }
00703 
00704         /* 
00705         * Create destination rect
00706         */      
00707         rect.x = x1;
00708         rect.y = y1;
00709         rect.w = x2 - x1;
00710         rect.h = y2 - y1;
00711         
00712         /*
00713         * Draw
00714         */
00715         result = 0;
00716         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
00717         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a); 
00718         result |= SDL_RenderFillRect(renderer, &rect);
00719         return result;
00720 }
00721 
00722 /* ----- Line */
00723 
00735 int line(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
00736 {
00737         /*
00738         * Draw
00739         */
00740         return SDL_RenderDrawLine(renderer, x1, y1, x2, y2);
00741 }
00742 
00755 int lineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
00756 {
00757         Uint8 *c = (Uint8 *)&color; 
00758         return lineRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
00759 }
00760 
00776 int lineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00777 {
00778         /*
00779         * Draw
00780         */
00781         int result = 0;
00782         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
00783         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a); 
00784         result |= SDL_RenderDrawLine(renderer, x1, y1, x2, y2);
00785         return result;
00786 }
00787 
00788 /* ---- AA Line */
00789 
00790 #define AAlevels 256
00791 #define AAbits 8
00792 
00816 int _aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int draw_endpoint)
00817 {
00818         Sint32 xx0, yy0, xx1, yy1;
00819         int result;
00820         Uint32 intshift, erracc, erradj;
00821         Uint32 erracctmp, wgt, wgtcompmask;
00822         int dx, dy, tmp, xdir, y0p1, x0pxdir;
00823 
00824         /*
00825         * Keep on working with 32bit numbers 
00826         */
00827         xx0 = x1;
00828         yy0 = y1;
00829         xx1 = x2;
00830         yy1 = y2;
00831 
00832         /*
00833         * Reorder points to make dy positive 
00834         */
00835         if (yy0 > yy1) {
00836                 tmp = yy0;
00837                 yy0 = yy1;
00838                 yy1 = tmp;
00839                 tmp = xx0;
00840                 xx0 = xx1;
00841                 xx1 = tmp;
00842         }
00843 
00844         /*
00845         * Calculate distance 
00846         */
00847         dx = xx1 - xx0;
00848         dy = yy1 - yy0;
00849 
00850         /*
00851         * Adjust for negative dx and set xdir 
00852         */
00853         if (dx >= 0) {
00854                 xdir = 1;
00855         } else {
00856                 xdir = -1;
00857                 dx = (-dx);
00858         }
00859         
00860         /*
00861         * Check for special cases 
00862         */
00863         if (dx == 0) {
00864                 /*
00865                 * Vertical line 
00866                 */
00867                 if (draw_endpoint)
00868                 {
00869                         return (vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
00870                 } else {
00871                         if (dy > 0) {
00872                                 return (vlineRGBA(renderer, x1, yy0, yy0+dy, r, g, b, a));
00873                         } else {
00874                                 return (pixelRGBA(renderer, x1, y1, r, g, b, a));
00875                         }
00876                 }
00877         } else if (dy == 0) {
00878                 /*
00879                 * Horizontal line 
00880                 */
00881                 if (draw_endpoint)
00882                 {
00883                         return (hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
00884                 } else {
00885                         if (dx > 0) {
00886                                 return (hlineRGBA(renderer, xx0, xx0+dx, y1, r, g, b, a));
00887                         } else {
00888                                 return (pixelRGBA(renderer, x1, y1, r, g, b, a));
00889                         }
00890                 }
00891         } else if ((dx == dy) && (draw_endpoint)) {
00892                 /*
00893                 * Diagonal line (with endpoint)
00894                 */
00895                 return (lineRGBA(renderer, x1, y1, x2, y2,  r, g, b, a));
00896         }
00897 
00898 
00899         /*
00900         * Line is not horizontal, vertical or diagonal (with endpoint)
00901         */
00902         result = 0;
00903 
00904         /*
00905         * Zero accumulator 
00906         */
00907         erracc = 0;
00908 
00909         /*
00910         * # of bits by which to shift erracc to get intensity level 
00911         */
00912         intshift = 32 - AAbits;
00913 
00914         /*
00915         * Mask used to flip all bits in an intensity weighting 
00916         */
00917         wgtcompmask = AAlevels - 1;
00918 
00919         /*
00920         * Draw the initial pixel in the foreground color 
00921         */
00922         result |= pixelRGBA(renderer, x1, y1, r, g, b, a);
00923 
00924         /*
00925         * x-major or y-major? 
00926         */
00927         if (dy > dx) {
00928 
00929                 /*
00930                 * y-major.  Calculate 16-bit fixed point fractional part of a pixel that
00931                 * X advances every time Y advances 1 pixel, truncating the result so that
00932                 * we won't overrun the endpoint along the X axis 
00933                 */
00934                 /*
00935                 * Not-so-portable version: erradj = ((Uint64)dx << 32) / (Uint64)dy; 
00936                 */
00937                 erradj = ((dx << 16) / dy) << 16;
00938 
00939                 /*
00940                 * draw all pixels other than the first and last 
00941                 */
00942                 x0pxdir = xx0 + xdir;
00943                 while (--dy) {
00944                         erracctmp = erracc;
00945                         erracc += erradj;
00946                         if (erracc <= erracctmp) {
00947                                 /*
00948                                 * rollover in error accumulator, x coord advances 
00949                                 */
00950                                 xx0 = x0pxdir;
00951                                 x0pxdir += xdir;
00952                         }
00953                         yy0++;          /* y-major so always advance Y */
00954 
00955                         /*
00956                         * the AAbits most significant bits of erracc give us the intensity
00957                         * weighting for this pixel, and the complement of the weighting for
00958                         * the paired pixel. 
00959                         */
00960                         wgt = (erracc >> intshift) & 255;
00961                         result |= pixelRGBAWeight (renderer, xx0, yy0, r, g, b, a, 255 - wgt);
00962                         result |= pixelRGBAWeight (renderer, x0pxdir, yy0, r, g, b, a, wgt);
00963                 }
00964 
00965         } else {
00966 
00967                 /*
00968                 * x-major line.  Calculate 16-bit fixed-point fractional part of a pixel
00969                 * that Y advances each time X advances 1 pixel, truncating the result so
00970                 * that we won't overrun the endpoint along the X axis. 
00971                 */
00972                 /*
00973                 * Not-so-portable version: erradj = ((Uint64)dy << 32) / (Uint64)dx; 
00974                 */
00975                 erradj = ((dy << 16) / dx) << 16;
00976 
00977                 /*
00978                 * draw all pixels other than the first and last 
00979                 */
00980                 y0p1 = yy0 + 1;
00981                 while (--dx) {
00982 
00983                         erracctmp = erracc;
00984                         erracc += erradj;
00985                         if (erracc <= erracctmp) {
00986                                 /*
00987                                 * Accumulator turned over, advance y 
00988                                 */
00989                                 yy0 = y0p1;
00990                                 y0p1++;
00991                         }
00992                         xx0 += xdir;    /* x-major so always advance X */
00993                         /*
00994                         * the AAbits most significant bits of erracc give us the intensity
00995                         * weighting for this pixel, and the complement of the weighting for
00996                         * the paired pixel. 
00997                         */
00998                         wgt = (erracc >> intshift) & 255;
00999                         result |= pixelRGBAWeight (renderer, xx0, yy0, r, g, b, a, 255 - wgt);
01000                         result |= pixelRGBAWeight (renderer, xx0, y0p1, r, g, b, a, wgt);
01001                 }
01002         }
01003 
01004         /*
01005         * Do we have to draw the endpoint 
01006         */
01007         if (draw_endpoint) {
01008                 /*
01009                 * Draw final pixel, always exactly intersected by the line and doesn't
01010                 * need to be weighted. 
01011                 */
01012                 result |= pixelRGBA (renderer, x2, y2, r, g, b, a);
01013         }
01014 
01015         return (result);
01016 }
01017 
01030 int aalineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
01031 {
01032         Uint8 *c = (Uint8 *)&color; 
01033         return _aalineRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3], 1);
01034 }
01035 
01051 int aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01052 {
01053         return _aalineRGBA(renderer, x1, y1, x2, y2, r, g, b, a, 1);
01054 }
01055 
01056 /* ----- Circle */
01057 
01069 int circleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
01070 {
01071         Uint8 *c = (Uint8 *)&color; 
01072         return ellipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
01073 }
01074 
01089 int circleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01090 {
01091         return ellipseRGBA(renderer, x, y, rad, rad, r, g, b, a);
01092 }
01093 
01094 /* ----- Arc */
01095 
01109 int arcColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
01110 {
01111         Uint8 *c = (Uint8 *)&color; 
01112         return arcRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3]);
01113 }
01114 
01131 int arcRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01132 {
01133         int result;
01134         Sint16 cx = 0;
01135         Sint16 cy = rad;
01136         Sint16 df = 1 - rad;
01137         Sint16 d_e = 3;
01138         Sint16 d_se = -2 * rad + 5;
01139         Sint16 xpcx, xmcx, xpcy, xmcy;
01140         Sint16 ypcy, ymcy, ypcx, ymcx;
01141         Uint8 drawoct;
01142         int startoct, endoct, oct, stopval_start = 0, stopval_end = 0;
01143         double dstart, dend, temp = 0.;
01144 
01145         /*
01146         * Sanity check radius 
01147         */
01148         if (rad < 0) {
01149                 return (-1);
01150         }
01151 
01152         /*
01153         * Special case for rad=0 - draw a point 
01154         */
01155         if (rad == 0) {
01156                 return (pixelRGBA(renderer, x, y, r, g, b, a));
01157         }
01158 
01159         // Octant labelling
01160         //      
01161         //  \ 5 | 6 /
01162         //   \  |  /
01163         //  4 \ | / 7
01164         //     \|/
01165         //------+------ +x
01166         //     /|\
01167         //  3 / | \ 0
01168         //   /  |  \
01169         //  / 2 | 1 \
01170         //      +y
01171 
01172         // Initially reset bitmask to 0x00000000
01173         // the set whether or not to keep drawing a given octant.
01174         // For example: 0x00111100 means we're drawing in octants 2-5
01175         drawoct = 0; 
01176 
01177         /*
01178         * Fixup angles
01179         */
01180         start %= 360;
01181         end %= 360;
01182         // 0 <= start & end < 360; note that sometimes start > end - if so, arc goes back through 0.
01183         while (start < 0) start += 360;
01184         while (end < 0) end += 360;
01185         start %= 360;
01186         end %= 360;
01187 
01188         // now, we find which octants we're drawing in.
01189         startoct = start / 45;
01190         endoct = end / 45;
01191         oct = startoct - 1; // we increment as first step in loop
01192 
01193         // stopval_start, stopval_end; 
01194         // what values of cx to stop at.
01195         do {
01196                 oct = (oct + 1) % 8;
01197 
01198                 if (oct == startoct) {
01199                         // need to compute stopval_start for this octant.  Look at picture above if this is unclear
01200                         dstart = (double)start;
01201                         switch (oct) 
01202                         {
01203                         case 0:
01204                         case 3:
01205                                 temp = sin(dstart * M_PI / 180.);
01206                                 break;
01207                         case 1:
01208                         case 6:
01209                                 temp = cos(dstart * M_PI / 180.);
01210                                 break;
01211                         case 2:
01212                         case 5:
01213                                 temp = -cos(dstart * M_PI / 180.);
01214                                 break;
01215                         case 4:
01216                         case 7:
01217                                 temp = -sin(dstart * M_PI / 180.);
01218                                 break;
01219                         }
01220                         temp *= rad;
01221                         stopval_start = (int)temp; // always round down.
01222 
01223                         // This isn't arbitrary, but requires graph paper to explain well.
01224                         // The basic idea is that we're always changing drawoct after we draw, so we
01225                         // stop immediately after we render the last sensible pixel at x = ((int)temp).
01226 
01227                         // and whether to draw in this octant initially
01228                         if (oct % 2) drawoct |= (1 << oct); // this is basically like saying drawoct[oct] = true, if drawoct were a bool array
01229                         else             drawoct &= 255 - (1 << oct); // this is basically like saying drawoct[oct] = false
01230                 }
01231                 if (oct == endoct) {
01232                         // need to compute stopval_end for this octant
01233                         dend = (double)end;
01234                         switch (oct)
01235                         {
01236                         case 0:
01237                         case 3:
01238                                 temp = sin(dend * M_PI / 180);
01239                                 break;
01240                         case 1:
01241                         case 6:
01242                                 temp = cos(dend * M_PI / 180);
01243                                 break;
01244                         case 2:
01245                         case 5:
01246                                 temp = -cos(dend * M_PI / 180);
01247                                 break;
01248                         case 4:
01249                         case 7:
01250                                 temp = -sin(dend * M_PI / 180);
01251                                 break;
01252                         }
01253                         temp *= rad;
01254                         stopval_end = (int)temp;
01255 
01256                         // and whether to draw in this octant initially
01257                         if (startoct == endoct) {
01258                                 // note:      we start drawing, stop, then start again in this case
01259                                 // otherwise: we only draw in this octant, so initialize it to false, it will get set back to true
01260                                 if (start > end) {
01261                                         // unfortunately, if we're in the same octant and need to draw over the whole circle, 
01262                                         // we need to set the rest to true, because the while loop will end at the bottom.
01263                                         drawoct = 255;
01264                                 } else {
01265                                         drawoct &= 255 - (1 << oct);
01266                                 }
01267                         } 
01268                         else if (oct % 2) drawoct &= 255 - (1 << oct);
01269                         else                      drawoct |= (1 << oct);
01270                 } else if (oct != startoct) { // already verified that it's != endoct
01271                         drawoct |= (1 << oct); // draw this entire segment
01272                 }
01273         } while (oct != endoct);
01274 
01275         // so now we have what octants to draw and when to draw them. all that's left is the actual raster code.
01276 
01277         /*
01278         * Set color 
01279         */
01280         result = 0;
01281         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
01282         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
01283 
01284         /*
01285         * Draw arc 
01286         */
01287         do {
01288                 ypcy = y + cy;
01289                 ymcy = y - cy;
01290                 if (cx > 0) {
01291                         xpcx = x + cx;
01292                         xmcx = x - cx;
01293 
01294                         // always check if we're drawing a certain octant before adding a pixel to that octant.
01295                         if (drawoct & 4)  result |= pixel(renderer, xmcx, ypcy);
01296                         if (drawoct & 2)  result |= pixel(renderer, xpcx, ypcy);
01297                         if (drawoct & 32) result |= pixel(renderer, xmcx, ymcy);
01298                         if (drawoct & 64) result |= pixel(renderer, xpcx, ymcy);
01299                 } else {
01300                         if (drawoct & 96) result |= pixel(renderer, x, ymcy);
01301                         if (drawoct & 6)  result |= pixel(renderer, x, ypcy);
01302                 }
01303 
01304                 xpcy = x + cy;
01305                 xmcy = x - cy;
01306                 if (cx > 0 && cx != cy) {
01307                         ypcx = y + cx;
01308                         ymcx = y - cx;
01309                         if (drawoct & 8)   result |= pixel(renderer, xmcy, ypcx);
01310                         if (drawoct & 1)   result |= pixel(renderer, xpcy, ypcx);
01311                         if (drawoct & 16)  result |= pixel(renderer, xmcy, ymcx);
01312                         if (drawoct & 128) result |= pixel(renderer, xpcy, ymcx);
01313                 } else if (cx == 0) {
01314                         if (drawoct & 24)  result |= pixel(renderer, xmcy, y);
01315                         if (drawoct & 129) result |= pixel(renderer, xpcy, y);
01316                 }
01317 
01318                 /*
01319                 * Update whether we're drawing an octant
01320                 */
01321                 if (stopval_start == cx) {
01322                         // works like an on-off switch.  
01323                         // This is just in case start & end are in the same octant.
01324                         if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);                
01325                         else                                               drawoct |= (1 << startoct);
01326                 }
01327                 if (stopval_end == cx) {
01328                         if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
01329                         else                                             drawoct |= (1 << endoct);
01330                 }
01331 
01332                 /*
01333                 * Update pixels
01334                 */
01335                 if (df < 0) {
01336                         df += d_e;
01337                         d_e += 2;
01338                         d_se += 2;
01339                 } else {
01340                         df += d_se;
01341                         d_e += 2;
01342                         d_se += 4;
01343                         cy--;
01344                 }
01345                 cx++;
01346         } while (cx <= cy);
01347 
01348         return (result);
01349 }
01350 
01351 /* ----- AA Circle */
01352 
01364 int aacircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
01365 {
01366         Uint8 *c = (Uint8 *)&color; 
01367         return aaellipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
01368 }
01369 
01384 int aacircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01385 {
01386         /*
01387         * Draw 
01388         */
01389         return aaellipseRGBA(renderer, x, y, rad, rad, r, g, b, a);
01390 }
01391 
01392 /* ----- Filled Circle */
01393 
01405 int filledCircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
01406 {
01407         Uint8 *c = (Uint8 *)&color; 
01408         return filledEllipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
01409 }
01410 
01425 int filledCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01426 {
01427         int result;
01428         Sint16 cx = 0;
01429         Sint16 cy = rad;
01430         Sint16 ocx = (Sint16) 0xffff;
01431         Sint16 ocy = (Sint16) 0xffff;
01432         Sint16 df = 1 - rad;
01433         Sint16 d_e = 3;
01434         Sint16 d_se = -2 * rad + 5;
01435         Sint16 xpcx, xmcx, xpcy, xmcy;
01436         Sint16 ypcy, ymcy, ypcx, ymcx;
01437 
01438         /*
01439         * Sanity check radius 
01440         */
01441         if (rad < 0) {
01442                 return (-1);
01443         }
01444 
01445         /*
01446         * Special case for rad=0 - draw a point 
01447         */
01448         if (rad == 0) {
01449                 return (pixelRGBA(renderer, x, y, r, g, b, a));
01450         }
01451 
01452         /*
01453         * Set color
01454         */
01455         result = 0;
01456         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
01457         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
01458 
01459         /*
01460         * Draw 
01461         */
01462         do {
01463                 xpcx = x + cx;
01464                 xmcx = x - cx;
01465                 xpcy = x + cy;
01466                 xmcy = x - cy;
01467                 if (ocy != cy) {
01468                         if (cy > 0) {
01469                                 ypcy = y + cy;
01470                                 ymcy = y - cy;
01471                                 result |= hline(renderer, xmcx, xpcx, ypcy);
01472                                 result |= hline(renderer, xmcx, xpcx, ymcy);
01473                         } else {
01474                                 result |= hline(renderer, xmcx, xpcx, y);
01475                         }
01476                         ocy = cy;
01477                 }
01478                 if (ocx != cx) {
01479                         if (cx != cy) {
01480                                 if (cx > 0) {
01481                                         ypcx = y + cx;
01482                                         ymcx = y - cx;
01483                                         result |= hline(renderer, xmcy, xpcy, ymcx);
01484                                         result |= hline(renderer, xmcy, xpcy, ypcx);
01485                                 } else {
01486                                         result |= hline(renderer, xmcy, xpcy, y);
01487                                 }
01488                         }
01489                         ocx = cx;
01490                 }
01491 
01492                 /*
01493                 * Update 
01494                 */
01495                 if (df < 0) {
01496                         df += d_e;
01497                         d_e += 2;
01498                         d_se += 2;
01499                 } else {
01500                         df += d_se;
01501                         d_e += 2;
01502                         d_se += 4;
01503                         cy--;
01504                 }
01505                 cx++;
01506         } while (cx <= cy);
01507 
01508         return (result);
01509 }
01510 
01511 /* ----- Ellipse */
01512 
01525 int ellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
01526 {
01527         Uint8 *c = (Uint8 *)&color; 
01528         return ellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3]);
01529 }
01530 
01546 int ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01547 {
01548         int result;
01549         int ix, iy;
01550         int h, i, j, k;
01551         int oh, oi, oj, ok;
01552         int xmh, xph, ypk, ymk;
01553         int xmi, xpi, ymj, ypj;
01554         int xmj, xpj, ymi, ypi;
01555         int xmk, xpk, ymh, yph;
01556 
01557         /*
01558         * Sanity check radii 
01559         */
01560         if ((rx < 0) || (ry < 0)) {
01561                 return (-1);
01562         }
01563 
01564         /*
01565         * Special case for rx=0 - draw a vline 
01566         */
01567         if (rx == 0) {
01568                 return (vlineRGBA(renderer, x, y - ry, y + ry, r, g, b, a));
01569         }
01570         /*
01571         * Special case for ry=0 - draw a hline 
01572         */
01573         if (ry == 0) {
01574                 return (hlineRGBA(renderer, x - rx, x + rx, y, r, g, b, a));
01575         }
01576 
01577         /*
01578         * Set color
01579         */
01580         result = 0;
01581         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
01582         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
01583 
01584         /*
01585         * Init vars 
01586         */
01587         oh = oi = oj = ok = 0xFFFF;
01588 
01589         /*
01590         * Draw 
01591         */
01592         if (rx > ry) {
01593                 ix = 0;
01594                 iy = rx * 64;
01595 
01596                 do {
01597                         h = (ix + 32) >> 6;
01598                         i = (iy + 32) >> 6;
01599                         j = (h * ry) / rx;
01600                         k = (i * ry) / rx;
01601 
01602                         if (((ok != k) && (oj != k)) || ((oj != j) && (ok != j)) || (k != j)) {
01603                                 xph = x + h;
01604                                 xmh = x - h;
01605                                 if (k > 0) {
01606                                         ypk = y + k;
01607                                         ymk = y - k;
01608                                         result |= pixel(renderer, xmh, ypk);
01609                                         result |= pixel(renderer, xph, ypk);
01610                                         result |= pixel(renderer, xmh, ymk);
01611                                         result |= pixel(renderer, xph, ymk);
01612                                 } else {
01613                                         result |= pixel(renderer, xmh, y);
01614                                         result |= pixel(renderer, xph, y);
01615                                 }
01616                                 ok = k;
01617                                 xpi = x + i;
01618                                 xmi = x - i;
01619                                 if (j > 0) {
01620                                         ypj = y + j;
01621                                         ymj = y - j;
01622                                         result |= pixel(renderer, xmi, ypj);
01623                                         result |= pixel(renderer, xpi, ypj);
01624                                         result |= pixel(renderer, xmi, ymj);
01625                                         result |= pixel(renderer, xpi, ymj);
01626                                 } else {
01627                                         result |= pixel(renderer, xmi, y);
01628                                         result |= pixel(renderer, xpi, y);
01629                                 }
01630                                 oj = j;
01631                         }
01632 
01633                         ix = ix + iy / rx;
01634                         iy = iy - ix / rx;
01635 
01636                 } while (i > h);
01637         } else {
01638                 ix = 0;
01639                 iy = ry * 64;
01640 
01641                 do {
01642                         h = (ix + 32) >> 6;
01643                         i = (iy + 32) >> 6;
01644                         j = (h * rx) / ry;
01645                         k = (i * rx) / ry;
01646 
01647                         if (((oi != i) && (oh != i)) || ((oh != h) && (oi != h) && (i != h))) {
01648                                 xmj = x - j;
01649                                 xpj = x + j;
01650                                 if (i > 0) {
01651                                         ypi = y + i;
01652                                         ymi = y - i;
01653                                         result |= pixel(renderer, xmj, ypi);
01654                                         result |= pixel(renderer, xpj, ypi);
01655                                         result |= pixel(renderer, xmj, ymi);
01656                                         result |= pixel(renderer, xpj, ymi);
01657                                 } else {
01658                                         result |= pixel(renderer, xmj, y);
01659                                         result |= pixel(renderer, xpj, y);
01660                                 }
01661                                 oi = i;
01662                                 xmk = x - k;
01663                                 xpk = x + k;
01664                                 if (h > 0) {
01665                                         yph = y + h;
01666                                         ymh = y - h;
01667                                         result |= pixel(renderer, xmk, yph);
01668                                         result |= pixel(renderer, xpk, yph);
01669                                         result |= pixel(renderer, xmk, ymh);
01670                                         result |= pixel(renderer, xpk, ymh);
01671                                 } else {
01672                                         result |= pixel(renderer, xmk, y);
01673                                         result |= pixel(renderer, xpk, y);
01674                                 }
01675                                 oh = h;
01676                         }
01677 
01678                         ix = ix + iy / ry;
01679                         iy = iy - ix / ry;
01680 
01681                 } while (i > h);
01682         }
01683 
01684         return (result);
01685 }
01686 
01687 /* ----- AA Ellipse */
01688 
01689 /* Windows targets do not have lrint, so provide a local inline version */
01690 #if defined(_MSC_VER)
01691 /* Detect 64bit and use intrinsic version */
01692 #ifdef _M_X64
01693 #include <emmintrin.h>
01694 static __inline long 
01695         lrint(float f) 
01696 {
01697         return _mm_cvtss_si32(_mm_load_ss(&f));
01698 }
01699 #elif defined(_M_IX86)
01700 __inline long int
01701         lrint (double flt)
01702 {       
01703         int intgr;
01704         _asm
01705         {
01706                 fld flt
01707                         fistp intgr
01708         };
01709         return intgr;
01710 }
01711 #elif defined(_M_ARM)
01712 #include <armintr.h>
01713 #pragma warning(push)
01714 #pragma warning(disable: 4716)
01715 __declspec(naked) long int
01716         lrint (double flt)
01717 {
01718         __emit(0xEC410B10); // fmdrr  d0, r0, r1
01719         __emit(0xEEBD0B40); // ftosid s0, d0
01720         __emit(0xEE100A10); // fmrs   r0, s0
01721         __emit(0xE12FFF1E); // bx     lr
01722 }
01723 #pragma warning(pop)
01724 #else
01725 #error lrint needed for MSVC on non X86/AMD64/ARM targets.
01726 #endif
01727 #endif
01728 
01741 int aaellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
01742 {
01743         Uint8 *c = (Uint8 *)&color; 
01744         return aaellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3]);
01745 }
01746 
01762 int aaellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01763 {
01764         int result;
01765         int i;
01766         int a2, b2, ds, dt, dxt, t, s, d;
01767         Sint16 xp, yp, xs, ys, dyt, od, xx, yy, xc2, yc2;
01768         float cp;
01769         double sab;
01770         Uint8 weight, iweight;
01771 
01772         /*
01773         * Sanity check radii 
01774         */
01775         if ((rx < 0) || (ry < 0)) {
01776                 return (-1);
01777         }
01778 
01779         /*
01780         * Special case for rx=0 - draw a vline 
01781         */
01782         if (rx == 0) {
01783                 return (vlineRGBA(renderer, x, y - ry, y + ry, r, g, b, a));
01784         }
01785         /*
01786         * Special case for ry=0 - draw an hline 
01787         */
01788         if (ry == 0) {
01789                 return (hlineRGBA(renderer, x - rx, x + rx, y, r, g, b, a));
01790         }
01791 
01792         /* Variable setup */
01793         a2 = rx * rx;
01794         b2 = ry * ry;
01795 
01796         ds = 2 * a2;
01797         dt = 2 * b2;
01798 
01799         xc2 = 2 * x;
01800         yc2 = 2 * y;
01801 
01802         sab = sqrt((double)(a2 + b2));
01803         od = (Sint16)lrint(sab*0.01) + 1; /* introduce some overdraw */
01804         dxt = (Sint16)lrint((double)a2 / sab) + od;
01805 
01806         t = 0;
01807         s = -2 * a2 * ry;
01808         d = 0;
01809 
01810         xp = x;
01811         yp = y - ry;
01812 
01813         /* Draw */
01814         result = 0;
01815         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
01816 
01817         /* "End points" */
01818         result |= pixelRGBA(renderer, xp, yp, r, g, b, a);
01819         result |= pixelRGBA(renderer, xc2 - xp, yp, r, g, b, a);
01820         result |= pixelRGBA(renderer, xp, yc2 - yp, r, g, b, a);
01821         result |= pixelRGBA(renderer, xc2 - xp, yc2 - yp, r, g, b, a);
01822 
01823         for (i = 1; i <= dxt; i++) {
01824                 xp--;
01825                 d += t - b2;
01826 
01827                 if (d >= 0)
01828                         ys = yp - 1;
01829                 else if ((d - s - a2) > 0) {
01830                         if ((2 * d - s - a2) >= 0)
01831                                 ys = yp + 1;
01832                         else {
01833                                 ys = yp;
01834                                 yp++;
01835                                 d -= s + a2;
01836                                 s += ds;
01837                         }
01838                 } else {
01839                         yp++;
01840                         ys = yp + 1;
01841                         d -= s + a2;
01842                         s += ds;
01843                 }
01844 
01845                 t -= dt;
01846 
01847                 /* Calculate alpha */
01848                 if (s != 0) {
01849                         cp = (float) abs(d) / (float) abs(s);
01850                         if (cp > 1.0) {
01851                                 cp = 1.0;
01852                         }
01853                 } else {
01854                         cp = 1.0;
01855                 }
01856 
01857                 /* Calculate weights */
01858                 weight = (Uint8) (cp * 255);
01859                 iweight = 255 - weight;
01860 
01861                 /* Upper half */
01862                 xx = xc2 - xp;
01863                 result |= pixelRGBAWeight(renderer, xp, yp, r, g, b, a, iweight);
01864                 result |= pixelRGBAWeight(renderer, xx, yp, r, g, b, a, iweight);
01865 
01866                 result |= pixelRGBAWeight(renderer, xp, ys, r, g, b, a, weight);
01867                 result |= pixelRGBAWeight(renderer, xx, ys, r, g, b, a, weight);
01868 
01869                 /* Lower half */
01870                 yy = yc2 - yp;
01871                 result |= pixelRGBAWeight(renderer, xp, yy, r, g, b, a, iweight);
01872                 result |= pixelRGBAWeight(renderer, xx, yy, r, g, b, a, iweight);
01873 
01874                 yy = yc2 - ys;
01875                 result |= pixelRGBAWeight(renderer, xp, yy, r, g, b, a, weight);
01876                 result |= pixelRGBAWeight(renderer, xx, yy, r, g, b, a, weight);
01877         }
01878 
01879         /* Replaces original approximation code dyt = abs(yp - yc); */
01880         dyt = (Sint16)lrint((double)b2 / sab ) + od;    
01881 
01882         for (i = 1; i <= dyt; i++) {
01883                 yp++;
01884                 d -= s + a2;
01885 
01886                 if (d <= 0)
01887                         xs = xp + 1;
01888                 else if ((d + t - b2) < 0) {
01889                         if ((2 * d + t - b2) <= 0)
01890                                 xs = xp - 1;
01891                         else {
01892                                 xs = xp;
01893                                 xp--;
01894                                 d += t - b2;
01895                                 t -= dt;
01896                         }
01897                 } else {
01898                         xp--;
01899                         xs = xp - 1;
01900                         d += t - b2;
01901                         t -= dt;
01902                 }
01903 
01904                 s += ds;
01905 
01906                 /* Calculate alpha */
01907                 if (t != 0) {
01908                         cp = (float) abs(d) / (float) abs(t);
01909                         if (cp > 1.0) {
01910                                 cp = 1.0;
01911                         }
01912                 } else {
01913                         cp = 1.0;
01914                 }
01915 
01916                 /* Calculate weight */
01917                 weight = (Uint8) (cp * 255);
01918                 iweight = 255 - weight;
01919 
01920                 /* Left half */
01921                 xx = xc2 - xp;
01922                 yy = yc2 - yp;
01923                 result |= pixelRGBAWeight(renderer, xp, yp, r, g, b, a, iweight);
01924                 result |= pixelRGBAWeight(renderer, xx, yp, r, g, b, a, iweight);
01925 
01926                 result |= pixelRGBAWeight(renderer, xp, yy, r, g, b, a, iweight);
01927                 result |= pixelRGBAWeight(renderer, xx, yy, r, g, b, a, iweight);
01928 
01929                 /* Right half */
01930                 xx = xc2 - xs;
01931                 result |= pixelRGBAWeight(renderer, xs, yp, r, g, b, a, weight);
01932                 result |= pixelRGBAWeight(renderer, xx, yp, r, g, b, a, weight);
01933 
01934                 result |= pixelRGBAWeight(renderer, xs, yy, r, g, b, a, weight);
01935                 result |= pixelRGBAWeight(renderer, xx, yy, r, g, b, a, weight);                
01936         }
01937 
01938         return (result);
01939 }
01940 
01941 /* ---- Filled Ellipse */
01942 
01955 int filledEllipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
01956 {
01957         Uint8 *c = (Uint8 *)&color; 
01958         return filledEllipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3]);
01959 }
01960 
01976 int filledEllipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01977 {
01978         int result;
01979         int ix, iy;
01980         int h, i, j, k;
01981         int oh, oi, oj, ok;
01982         int xmh, xph;
01983         int xmi, xpi;
01984         int xmj, xpj;
01985         int xmk, xpk;
01986 
01987         /*
01988         * Sanity check radii 
01989         */
01990         if ((rx < 0) || (ry < 0)) {
01991                 return (-1);
01992         }
01993 
01994         /*
01995         * Special case for rx=0 - draw a vline 
01996         */
01997         if (rx == 0) {
01998                 return (vlineRGBA(renderer, x, y - ry, y + ry, r, g, b, a));
01999         }
02000         /*
02001         * Special case for ry=0 - draw a hline 
02002         */
02003         if (ry == 0) {
02004                 return (hlineRGBA(renderer, x - rx, x + rx, y, r, g, b, a));
02005         }
02006 
02007         /*
02008         * Set color
02009         */
02010         result = 0;
02011         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
02012         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
02013 
02014         /*
02015         * Init vars 
02016         */
02017         oh = oi = oj = ok = 0xFFFF;
02018 
02019         /*
02020         * Draw 
02021         */
02022         if (rx > ry) {
02023                 ix = 0;
02024                 iy = rx * 64;
02025 
02026                 do {
02027                         h = (ix + 32) >> 6;
02028                         i = (iy + 32) >> 6;
02029                         j = (h * ry) / rx;
02030                         k = (i * ry) / rx;
02031 
02032                         if ((ok != k) && (oj != k)) {
02033                                 xph = x + h;
02034                                 xmh = x - h;
02035                                 if (k > 0) {
02036                                         result |= hline(renderer, xmh, xph, y + k);
02037                                         result |= hline(renderer, xmh, xph, y - k);
02038                                 } else {
02039                                         result |= hline(renderer, xmh, xph, y);
02040                                 }
02041                                 ok = k;
02042                         }
02043                         if ((oj != j) && (ok != j) && (k != j)) {
02044                                 xmi = x - i;
02045                                 xpi = x + i;
02046                                 if (j > 0) {
02047                                         result |= hline(renderer, xmi, xpi, y + j);
02048                                         result |= hline(renderer, xmi, xpi, y - j);
02049                                 } else {
02050                                         result |= hline(renderer, xmi, xpi, y);
02051                                 }
02052                                 oj = j;
02053                         }
02054 
02055                         ix = ix + iy / rx;
02056                         iy = iy - ix / rx;
02057 
02058                 } while (i > h);
02059         } else {
02060                 ix = 0;
02061                 iy = ry * 64;
02062 
02063                 do {
02064                         h = (ix + 32) >> 6;
02065                         i = (iy + 32) >> 6;
02066                         j = (h * rx) / ry;
02067                         k = (i * rx) / ry;
02068 
02069                         if ((oi != i) && (oh != i)) {
02070                                 xmj = x - j;
02071                                 xpj = x + j;
02072                                 if (i > 0) {
02073                                         result |= hline(renderer, xmj, xpj, y + i);
02074                                         result |= hline(renderer, xmj, xpj, y - i);
02075                                 } else {
02076                                         result |= hline(renderer, xmj, xpj, y);
02077                                 }
02078                                 oi = i;
02079                         }
02080                         if ((oh != h) && (oi != h) && (i != h)) {
02081                                 xmk = x - k;
02082                                 xpk = x + k;
02083                                 if (h > 0) {
02084                                         result |= hline(renderer, xmk, xpk, y + h);
02085                                         result |= hline(renderer, xmk, xpk, y - h);
02086                                 } else {
02087                                         result |= hline(renderer, xmk, xpk, y);
02088                                 }
02089                                 oh = h;
02090                         }
02091 
02092                         ix = ix + iy / ry;
02093                         iy = iy - ix / ry;
02094 
02095                 } while (i > h);
02096         }
02097 
02098         return (result);
02099 }
02100 
02101 /* ----- Pie */
02102 
02122 int _pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end,  Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 filled)
02123 {
02124         int result;
02125         double angle, start_angle, end_angle;
02126         double deltaAngle;
02127         double dr;
02128         int numpoints, i;
02129         Sint16 *vx, *vy;
02130 
02131         /*
02132         * Sanity check radii 
02133         */
02134         if (rad < 0) {
02135                 return (-1);
02136         }
02137 
02138         /*
02139         * Fixup angles
02140         */
02141         start = start % 360;
02142         end = end % 360;
02143 
02144         /*
02145         * Special case for rad=0 - draw a point 
02146         */
02147         if (rad == 0) {
02148                 return (pixelRGBA(renderer, x, y, r, g, b, a));
02149         }
02150 
02151         /*
02152         * Variable setup 
02153         */
02154         dr = (double) rad;
02155         deltaAngle = 3.0 / dr;
02156         start_angle = (double) start *(2.0 * M_PI / 360.0);
02157         end_angle = (double) end *(2.0 * M_PI / 360.0);
02158         if (start > end) {
02159                 end_angle += (2.0 * M_PI);
02160         }
02161 
02162         /* We will always have at least 2 points */
02163         numpoints = 2;
02164 
02165         /* Count points (rather than calculating it) */
02166         angle = start_angle;
02167         while (angle < end_angle) {
02168                 angle += deltaAngle;
02169                 numpoints++;
02170         }
02171 
02172         /* Allocate combined vertex array */
02173         vx = vy = (Sint16 *) malloc(2 * sizeof(Uint16) * numpoints);
02174         if (vx == NULL) {
02175                 return (-1);
02176         }
02177 
02178         /* Update point to start of vy */
02179         vy += numpoints;
02180 
02181         /* Center */
02182         vx[0] = x;
02183         vy[0] = y;
02184 
02185         /* First vertex */
02186         angle = start_angle;
02187         vx[1] = x + (int) (dr * cos(angle));
02188         vy[1] = y + (int) (dr * sin(angle));
02189 
02190         if (numpoints<3)
02191         {
02192                 result = lineRGBA(renderer, vx[0], vy[0], vx[1], vy[1], r, g, b, a);
02193         }
02194         else
02195         {
02196                 /* Calculate other vertices */
02197                 i = 2;
02198                 angle = start_angle;
02199                 while (angle < end_angle) {
02200                         angle += deltaAngle;
02201                         if (angle>end_angle)
02202                         {
02203                                 angle = end_angle;
02204                         }
02205                         vx[i] = x + (int) (dr * cos(angle));
02206                         vy[i] = y + (int) (dr * sin(angle));
02207                         i++;
02208                 }
02209 
02210                 /* Draw */
02211                 if (filled) {
02212                         result = filledPolygonRGBA(renderer, vx, vy, numpoints, r, g, b, a);
02213                 } else {
02214                         result = polygonRGBA(renderer, vx, vy, numpoints, r, g, b, a);
02215                 }
02216         }
02217 
02218         /* Free combined vertex array */
02219         free(vx);
02220 
02221         return (result);
02222 }
02223 
02237 int pieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, 
02238         Sint16 start, Sint16 end, Uint32 color) 
02239 {
02240         Uint8 *c = (Uint8 *)&color; 
02241         return _pieRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3], 0);
02242 }
02243 
02260 int pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
02261         Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02262 {
02263         return _pieRGBA(renderer, x, y, rad, start, end, r, g, b, a, 0);
02264 }
02265 
02279 int filledPieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
02280 {
02281         Uint8 *c = (Uint8 *)&color; 
02282         return _pieRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3], 1);
02283 }
02284 
02301 int filledPieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
02302         Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02303 {
02304         return _pieRGBA(renderer, x, y, rad, start, end, r, g, b, a, 1);
02305 }
02306 
02307 /* ------ Trigon */
02308 
02325 int trigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
02326 {
02327         Sint16 vx[3]; 
02328         Sint16 vy[3];
02329 
02330         vx[0]=x1;
02331         vx[1]=x2;
02332         vx[2]=x3;
02333         vy[0]=y1;
02334         vy[1]=y2;
02335         vy[2]=y3;
02336 
02337         return(polygonColor(renderer,vx,vy,3,color));
02338 }
02339 
02357 int trigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
02358         Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02359 {
02360         Sint16 vx[3]; 
02361         Sint16 vy[3];
02362 
02363         vx[0]=x1;
02364         vx[1]=x2;
02365         vx[2]=x3;
02366         vy[0]=y1;
02367         vy[1]=y2;
02368         vy[2]=y3;
02369 
02370         return(polygonRGBA(renderer,vx,vy,3,r,g,b,a));
02371 }                                
02372 
02373 /* ------ AA-Trigon */
02374 
02391 int aatrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
02392 {
02393         Sint16 vx[3]; 
02394         Sint16 vy[3];
02395 
02396         vx[0]=x1;
02397         vx[1]=x2;
02398         vx[2]=x3;
02399         vy[0]=y1;
02400         vy[1]=y2;
02401         vy[2]=y3;
02402 
02403         return(aapolygonColor(renderer,vx,vy,3,color));
02404 }
02405 
02423 int aatrigonRGBA(SDL_Renderer * renderer,  Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
02424         Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02425 {
02426         Sint16 vx[3]; 
02427         Sint16 vy[3];
02428 
02429         vx[0]=x1;
02430         vx[1]=x2;
02431         vx[2]=x3;
02432         vy[0]=y1;
02433         vy[1]=y2;
02434         vy[2]=y3;
02435 
02436         return(aapolygonRGBA(renderer,vx,vy,3,r,g,b,a));
02437 }                                  
02438 
02439 /* ------ Filled Trigon */
02440 
02457 int filledTrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
02458 {
02459         Sint16 vx[3]; 
02460         Sint16 vy[3];
02461 
02462         vx[0]=x1;
02463         vx[1]=x2;
02464         vx[2]=x3;
02465         vy[0]=y1;
02466         vy[1]=y2;
02467         vy[2]=y3;
02468 
02469         return(filledPolygonColor(renderer,vx,vy,3,color));
02470 }
02471 
02491 int filledTrigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
02492         Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02493 {
02494         Sint16 vx[3]; 
02495         Sint16 vy[3];
02496 
02497         vx[0]=x1;
02498         vx[1]=x2;
02499         vx[2]=x3;
02500         vy[0]=y1;
02501         vy[1]=y2;
02502         vy[2]=y3;
02503 
02504         return(filledPolygonRGBA(renderer,vx,vy,3,r,g,b,a));
02505 }
02506 
02507 /* ---- Polygon */
02508 
02520 int polygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
02521 {
02522         Uint8 *c = (Uint8 *)&color; 
02523         return polygonRGBA(renderer, vx, vy, n, c[0], c[1], c[2], c[3]);
02524 }
02525 
02536 int polygon(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n)
02537 {
02538         /*
02539         * Draw 
02540         */
02541         int result;
02542         int i, nn;
02543         SDL_Point* points;
02544 
02545         /*
02546         * Vertex array NULL check 
02547         */
02548         if (vx == NULL) {
02549                 return (-1);
02550         }
02551         if (vy == NULL) {
02552                 return (-1);
02553         }
02554 
02555         /*
02556         * Sanity check 
02557         */
02558         if (n < 3) {
02559                 return (-1);
02560         }
02561 
02562         /*
02563         * Create array of points
02564         */
02565         nn = n + 1;
02566         points = (SDL_Point*)malloc(sizeof(SDL_Point) * nn);
02567         if (points == NULL)
02568         {
02569                 return -1;
02570         }
02571         for (i=0; i<n; i++)
02572         {
02573                 points[i].x = vx[i];
02574                 points[i].y = vy[i];
02575         }
02576         points[n].x = vx[0];
02577         points[n].y = vy[0];
02578 
02579         /*
02580         * Draw 
02581         */
02582         result |= SDL_RenderDrawLines(renderer, points, nn);
02583         free(points);
02584 
02585         return (result);
02586 }
02587 
02602 int polygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02603 {
02604         /*
02605         * Draw 
02606         */
02607         int result;
02608         const Sint16 *x1, *y1, *x2, *y2;
02609 
02610         /*
02611         * Vertex array NULL check 
02612         */
02613         if (vx == NULL) {
02614                 return (-1);
02615         }
02616         if (vy == NULL) {
02617                 return (-1);
02618         }
02619 
02620         /*
02621         * Sanity check 
02622         */
02623         if (n < 3) {
02624                 return (-1);
02625         }
02626 
02627         /*
02628         * Pointer setup 
02629         */
02630         x1 = x2 = vx;
02631         y1 = y2 = vy;
02632         x2++;
02633         y2++;
02634 
02635         /*
02636         * Set color 
02637         */
02638         result = 0;
02639         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
02640         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a); 
02641 
02642         /*
02643         * Draw 
02644         */
02645         result |= polygon(renderer, vx, vy, n);
02646 
02647         return (result);
02648 }
02649 
02650 /* ---- AA-Polygon */
02651 
02663 int aapolygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
02664 {
02665         Uint8 *c = (Uint8 *)&color; 
02666         return aapolygonRGBA(renderer, vx, vy, n, c[0], c[1], c[2], c[3]);
02667 }
02668 
02683 int aapolygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02684 {
02685         int result;
02686         int i;
02687         const Sint16 *x1, *y1, *x2, *y2;
02688 
02689         /*
02690         * Vertex array NULL check 
02691         */
02692         if (vx == NULL) {
02693                 return (-1);
02694         }
02695         if (vy == NULL) {
02696                 return (-1);
02697         }
02698 
02699         /*
02700         * Sanity check 
02701         */
02702         if (n < 3) {
02703                 return (-1);
02704         }
02705 
02706         /*
02707         * Pointer setup 
02708         */
02709         x1 = x2 = vx;
02710         y1 = y2 = vy;
02711         x2++;
02712         y2++;
02713 
02714         /*
02715         * Draw 
02716         */
02717         result = 0;
02718         for (i = 1; i < n; i++) {
02719                 result |= _aalineRGBA(renderer, *x1, *y1, *x2, *y2, r, g, b, a, 0);
02720                 x1 = x2;
02721                 y1 = y2;
02722                 x2++;
02723                 y2++;
02724         }
02725 
02726         result |= _aalineRGBA(renderer, *x1, *y1, *vx, *vy, r, g, b, a, 0);
02727 
02728         return (result);
02729 }
02730 
02731 /* ---- Filled Polygon */
02732 
02741 int _gfxPrimitivesCompareInt(const void *a, const void *b)
02742 {
02743         return (*(const int *) a) - (*(const int *) b);
02744 }
02745 
02751 static int *gfxPrimitivesPolyIntsGlobal = NULL;
02752 
02758 static int gfxPrimitivesPolyAllocatedGlobal = 0;
02759 
02778 int filledPolygonRGBAMT(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
02779 {
02780         int result;
02781         int i;
02782         int y, xa, xb;
02783         int miny, maxy;
02784         int x1, y1;
02785         int x2, y2;
02786         int ind1, ind2;
02787         int ints;
02788         int *gfxPrimitivesPolyInts = NULL;
02789         int *gfxPrimitivesPolyIntsNew = NULL;
02790         int gfxPrimitivesPolyAllocated = 0;
02791 
02792         /*
02793         * Vertex array NULL check 
02794         */
02795         if (vx == NULL) {
02796                 return (-1);
02797         }
02798         if (vy == NULL) {
02799                 return (-1);
02800         }
02801 
02802         /*
02803         * Sanity check number of edges
02804         */
02805         if (n < 3) {
02806                 return -1;
02807         }
02808 
02809         /*
02810         * Map polygon cache  
02811         */
02812         if ((polyInts==NULL) || (polyAllocated==NULL)) {
02813                 /* Use global cache */
02814                 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
02815                 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
02816         } else {
02817                 /* Use local cache */
02818                 gfxPrimitivesPolyInts = *polyInts;
02819                 gfxPrimitivesPolyAllocated = *polyAllocated;
02820         }
02821 
02822         /*
02823         * Allocate temp array, only grow array 
02824         */
02825         if (!gfxPrimitivesPolyAllocated) {
02826                 gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
02827                 gfxPrimitivesPolyAllocated = n;
02828         } else {
02829                 if (gfxPrimitivesPolyAllocated < n) {
02830                         gfxPrimitivesPolyIntsNew = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
02831                         if (!gfxPrimitivesPolyIntsNew) {
02832                                 if (!gfxPrimitivesPolyInts) {
02833                                         free(gfxPrimitivesPolyInts);
02834                                         gfxPrimitivesPolyInts = NULL;
02835                                 }
02836                                 gfxPrimitivesPolyAllocated = 0;
02837                         } else {
02838                                 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsNew;
02839                                 gfxPrimitivesPolyAllocated = n;
02840                         }
02841                 }
02842         }
02843 
02844         /*
02845         * Check temp array
02846         */
02847         if (gfxPrimitivesPolyInts==NULL) {        
02848                 gfxPrimitivesPolyAllocated = 0;
02849         }
02850 
02851         /*
02852         * Update cache variables
02853         */
02854         if ((polyInts==NULL) || (polyAllocated==NULL)) { 
02855                 gfxPrimitivesPolyIntsGlobal =  gfxPrimitivesPolyInts;
02856                 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
02857         } else {
02858                 *polyInts = gfxPrimitivesPolyInts;
02859                 *polyAllocated = gfxPrimitivesPolyAllocated;
02860         }
02861 
02862         /*
02863         * Check temp array again
02864         */
02865         if (gfxPrimitivesPolyInts==NULL) {        
02866                 return(-1);
02867         }
02868 
02869         /*
02870         * Determine Y maxima 
02871         */
02872         miny = vy[0];
02873         maxy = vy[0];
02874         for (i = 1; (i < n); i++) {
02875                 if (vy[i] < miny) {
02876                         miny = vy[i];
02877                 } else if (vy[i] > maxy) {
02878                         maxy = vy[i];
02879                 }
02880         }
02881 
02882         /*
02883         * Draw, scanning y 
02884         */
02885         result = 0;
02886         for (y = miny; (y <= maxy); y++) {
02887                 ints = 0;
02888                 for (i = 0; (i < n); i++) {
02889                         if (!i) {
02890                                 ind1 = n - 1;
02891                                 ind2 = 0;
02892                         } else {
02893                                 ind1 = i - 1;
02894                                 ind2 = i;
02895                         }
02896                         y1 = vy[ind1];
02897                         y2 = vy[ind2];
02898                         if (y1 < y2) {
02899                                 x1 = vx[ind1];
02900                                 x2 = vx[ind2];
02901                         } else if (y1 > y2) {
02902                                 y2 = vy[ind1];
02903                                 y1 = vy[ind2];
02904                                 x2 = vx[ind1];
02905                                 x1 = vx[ind2];
02906                         } else {
02907                                 continue;
02908                         }
02909                         if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
02910                                 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
02911                         }           
02912                 }
02913 
02914                 qsort(gfxPrimitivesPolyInts, ints, sizeof(int), _gfxPrimitivesCompareInt);
02915 
02916                 /*
02917                 * Set color 
02918                 */
02919                 result = 0;
02920             result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
02921                 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a); 
02922 
02923                 for (i = 0; (i < ints); i += 2) {
02924                         xa = gfxPrimitivesPolyInts[i] + 1;
02925                         xa = (xa >> 16) + ((xa & 32768) >> 15);
02926                         xb = gfxPrimitivesPolyInts[i+1] - 1;
02927                         xb = (xb >> 16) + ((xb & 32768) >> 15);
02928                         result |= hline(renderer, xa, xb, y);
02929                 }
02930         }
02931 
02932         return (result);
02933 }
02934 
02946 int filledPolygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
02947 {
02948         Uint8 *c = (Uint8 *)&color; 
02949         return filledPolygonRGBAMT(renderer, vx, vy, n, c[0], c[1], c[2], c[3], NULL, NULL);
02950 }
02951 
02966 int filledPolygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02967 {
02968         return filledPolygonRGBAMT(renderer, vx, vy, n, r, g, b, a, NULL, NULL);
02969 }
02970 
02971 /* ---- Textured Polygon */
02972 
02988 int _HLineTextured(SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, SDL_Texture *texture, int texture_w, int texture_h, int texture_dx, int texture_dy)
02989 {
02990         Sint16 w;
02991         Sint16 xtmp;
02992         int result = 0;
02993         int texture_x_walker;    
02994         int texture_y_start;    
02995         SDL_Rect source_rect,dst_rect;
02996         int pixels_written,write_width;
02997 
02998         /*
02999         * Swap x1, x2 if required to ensure x1<=x2
03000         */
03001         if (x1 > x2) {
03002                 xtmp = x1;
03003                 x1 = x2;
03004                 x2 = xtmp;
03005         }
03006 
03007         /*
03008         * Calculate width to draw
03009         */
03010         w = x2 - x1 + 1;
03011 
03012         /*
03013         * Determine where in the texture we start drawing
03014         */
03015         texture_x_walker =   (x1 - texture_dx)  % texture_w;
03016         if (texture_x_walker < 0){
03017                 texture_x_walker = texture_w + texture_x_walker ;
03018         }
03019 
03020         texture_y_start = (y + texture_dy) % texture_h;
03021         if (texture_y_start < 0){
03022                 texture_y_start = texture_h + texture_y_start;
03023         }
03024 
03025         // setup the source rectangle; we are only drawing one horizontal line
03026         source_rect.y = texture_y_start;
03027         source_rect.x = texture_x_walker;
03028         source_rect.h = 1;
03029 
03030         // we will draw to the current y
03031         dst_rect.y = y;
03032 
03033         // if there are enough pixels left in the current row of the texture
03034         // draw it all at once
03035         if (w <= texture_w -texture_x_walker){
03036                 source_rect.w = w;
03037                 source_rect.x = texture_x_walker;
03038                 dst_rect.x= x1;
03039                 result = (SDL_RenderCopy(renderer, texture, &source_rect ,&dst_rect) == 0);
03040         } else { // we need to draw multiple times
03041                 // draw the first segment
03042                 pixels_written = texture_w  - texture_x_walker;
03043                 source_rect.w = pixels_written;
03044                 source_rect.x = texture_x_walker;
03045                 dst_rect.x= x1;
03046                 result |= (SDL_RenderCopy(renderer, texture, &source_rect , &dst_rect) == 0);
03047                 write_width = texture_w;
03048 
03049                 // now draw the rest
03050                 // set the source x to 0
03051                 source_rect.x = 0;
03052                 while (pixels_written < w){
03053                         if (write_width >= w - pixels_written) {
03054                                 write_width =  w - pixels_written;
03055                         }
03056                         source_rect.w = write_width;
03057                         dst_rect.x = x1 + pixels_written;
03058                         result  |= (SDL_RenderCopy(renderer,texture,&source_rect , &dst_rect) == 0);
03059                         pixels_written += write_width;
03060                 }
03061         }
03062 
03063         return result;
03064 }
03065 
03082 int texturedPolygonMT(SDL_Renderer *renderer, const Sint16 * vx, const Sint16 * vy, int n, 
03083         SDL_Surface * texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)
03084 {
03085         int result;
03086         int i;
03087         int y, xa, xb;
03088         int minx,maxx,miny, maxy;
03089         int x1, y1;
03090         int x2, y2;
03091         int ind1, ind2;
03092         int ints;
03093         int *gfxPrimitivesPolyInts = NULL;
03094         int gfxPrimitivesPolyAllocated = 0;
03095         SDL_Texture *textureAsTexture;
03096 
03097         /*
03098         * Sanity check number of edges
03099         */
03100         if (n < 3) {
03101                 return -1;
03102         }
03103 
03104         /*
03105         * Map polygon cache  
03106         */
03107         if ((polyInts==NULL) || (polyAllocated==NULL)) {
03108                 /* Use global cache */
03109                 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
03110                 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
03111         } else {
03112                 /* Use local cache */
03113                 gfxPrimitivesPolyInts = *polyInts;
03114                 gfxPrimitivesPolyAllocated = *polyAllocated;
03115         }
03116 
03117         /*
03118         * Allocate temp array, only grow array 
03119         */
03120         if (!gfxPrimitivesPolyAllocated) {
03121                 gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
03122                 gfxPrimitivesPolyAllocated = n;
03123         } else {
03124                 if (gfxPrimitivesPolyAllocated < n) {
03125                         gfxPrimitivesPolyInts = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
03126                         gfxPrimitivesPolyAllocated = n;
03127                 }
03128         }
03129 
03130         /*
03131         * Check temp array
03132         */
03133         if (gfxPrimitivesPolyInts==NULL) {        
03134                 gfxPrimitivesPolyAllocated = 0;
03135         }
03136 
03137         /*
03138         * Update cache variables
03139         */
03140         if ((polyInts==NULL) || (polyAllocated==NULL)) { 
03141                 gfxPrimitivesPolyIntsGlobal =  gfxPrimitivesPolyInts;
03142                 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
03143         } else {
03144                 *polyInts = gfxPrimitivesPolyInts;
03145                 *polyAllocated = gfxPrimitivesPolyAllocated;
03146         }
03147 
03148         /*
03149         * Check temp array again
03150         */
03151         if (gfxPrimitivesPolyInts==NULL) {        
03152                 return(-1);
03153         }
03154 
03155         /*
03156         * Determine X,Y minima,maxima 
03157         */
03158         miny = vy[0];
03159         maxy = vy[0];
03160         minx = vx[0];
03161         maxx = vx[0];
03162         for (i = 1; (i < n); i++) {
03163                 if (vy[i] < miny) {
03164                         miny = vy[i];
03165                 } else if (vy[i] > maxy) {
03166                         maxy = vy[i];
03167                 }
03168                 if (vx[i] < minx) {
03169                         minx = vx[i];
03170                 } else if (vx[i] > maxx) {
03171                         maxx = vx[i];
03172                 }
03173         }
03174 
03175         /*
03176         * Draw, scanning y 
03177         */
03178         result = 0;
03179         for (y = miny; (y <= maxy); y++) {
03180                 ints = 0;
03181                 for (i = 0; (i < n); i++) {
03182                         if (!i) {
03183                                 ind1 = n - 1;
03184                                 ind2 = 0;
03185                         } else {
03186                                 ind1 = i - 1;
03187                                 ind2 = i;
03188                         }
03189                         y1 = vy[ind1];
03190                         y2 = vy[ind2];
03191                         if (y1 < y2) {
03192                                 x1 = vx[ind1];
03193                                 x2 = vx[ind2];
03194                         } else if (y1 > y2) {
03195                                 y2 = vy[ind1];
03196                                 y1 = vy[ind2];
03197                                 x2 = vx[ind1];
03198                                 x1 = vx[ind2];
03199                         } else {
03200                                 continue;
03201                         }
03202                         if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
03203                                 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
03204                         } 
03205                 }
03206 
03207                 qsort(gfxPrimitivesPolyInts, ints, sizeof(int), _gfxPrimitivesCompareInt);
03208 
03209                 textureAsTexture = SDL_CreateTextureFromSurface(renderer, texture);
03210                 if (textureAsTexture == NULL)
03211                 {
03212                         return (-1);
03213                 }
03214 
03215                 for (i = 0; (i < ints); i += 2) {
03216                         xa = gfxPrimitivesPolyInts[i] + 1;
03217                         xa = (xa >> 16) + ((xa & 32768) >> 15);
03218                         xb = gfxPrimitivesPolyInts[i+1] - 1;
03219                         xb = (xb >> 16) + ((xb & 32768) >> 15);
03220                         result |= _HLineTextured(renderer, xa, xb, y, textureAsTexture, texture->w, texture->h, texture_dx, texture_dy);
03221                 }
03222                 SDL_DestroyTexture(textureAsTexture);
03223         }
03224 
03225         return (result);
03226 }
03227 
03244 int texturedPolygon(SDL_Renderer *renderer, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
03245 {
03246         /*
03247         * Draw
03248         */
03249         return (texturedPolygonMT(renderer, vx, vy, n, texture, texture_dx, texture_dy, NULL, NULL));
03250 }
03251 
03252 /* ---- Character */
03253 
03257 static SDL_Texture *gfxPrimitivesFont[256];
03258 
03262 static const unsigned char *currentFontdata = gfxPrimitivesFontdata;
03263 
03267 static Uint32 charWidth = 8;
03268 
03272 static Uint32 charHeight = 8;
03273 
03277 static Uint32 charWidthLocal = 8;
03278 
03282 static Uint32 charHeightLocal = 8;
03283 
03287 static Uint32 charPitch = 1;
03288 
03292 static Uint32 charRotation = 0;
03293 
03297 static Uint32 charSize = 8;
03298 
03312 void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch)
03313 {
03314         int i;
03315 
03316         if ((fontdata) && (cw) && (ch)) {
03317                 currentFontdata = (unsigned char *)fontdata;
03318                 charWidth = cw;
03319                 charHeight = ch;
03320         } else {
03321                 currentFontdata = gfxPrimitivesFontdata;
03322                 charWidth = 8;
03323                 charHeight = 8;
03324         }
03325 
03326         charPitch = (charWidth+7)/8;
03327         charSize = charPitch * charHeight;
03328 
03329         /* Maybe flip width/height for rendering */
03330         if ((charRotation==1) || (charRotation==3))
03331         {
03332                 charWidthLocal = charHeight;
03333                 charHeightLocal = charWidth;
03334         }
03335         else
03336         {
03337                 charWidthLocal = charWidth;
03338                 charHeightLocal = charHeight;
03339         }
03340 
03341         /* Clear character cache */
03342         for (i = 0; i < 256; i++) {
03343                 if (gfxPrimitivesFont[i]) {
03344                         SDL_DestroyTexture(gfxPrimitivesFont[i]);
03345                         gfxPrimitivesFont[i] = NULL;
03346                 }
03347         }
03348 }
03349 
03358 void gfxPrimitivesSetFontRotation(Uint32 rotation)
03359 {
03360         int i;
03361 
03362         rotation = rotation & 3;
03363         if (charRotation != rotation)
03364         {
03365                 /* Store rotation */
03366                 charRotation = rotation;
03367 
03368                 /* Maybe flip width/height for rendering */
03369                 if ((charRotation==1) || (charRotation==3))
03370                 {
03371                         charWidthLocal = charHeight;
03372                         charHeightLocal = charWidth;
03373                 }
03374                 else
03375                 {
03376                         charWidthLocal = charWidth;
03377                         charHeightLocal = charHeight;
03378                 }
03379 
03380                 /* Clear character cache */
03381                 for (i = 0; i < 256; i++) {
03382                         if (gfxPrimitivesFont[i]) {
03383                                 SDL_DestroyTexture(gfxPrimitivesFont[i]);
03384                                 gfxPrimitivesFont[i] = NULL;
03385                         }
03386                 }
03387         }
03388 }
03389 
03404 int characterRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03405 {
03406         SDL_Rect srect;
03407         SDL_Rect drect;
03408         int result;
03409         Uint32 ix, iy;
03410         const unsigned char *charpos;
03411         Uint8 *curpos;
03412         Uint8 patt, mask;
03413         Uint8 *linepos;
03414         Uint32 pitch;
03415         SDL_Surface *character;
03416         SDL_Surface *rotatedCharacter;
03417         Uint32 ci;
03418 
03419         /*
03420         * Setup source rectangle
03421         */
03422         srect.x = 0;
03423         srect.y = 0;
03424         srect.w = charWidthLocal;
03425         srect.h = charHeightLocal;
03426 
03427         /*
03428         * Setup destination rectangle
03429         */
03430         drect.x = x;
03431         drect.y = y;
03432         drect.w = charWidthLocal;
03433         drect.h = charHeightLocal;
03434 
03435         /* Character index in cache */
03436         ci = (unsigned char) c;
03437 
03438         /*
03439         * Create new charWidth x charHeight bitmap surface if not already present.
03440         * Might get rotated later.
03441         */
03442         if (gfxPrimitivesFont[ci] == NULL) {
03443                 /*
03444                 * Redraw character into surface
03445                 */
03446                 character =     SDL_CreateRGBSurface(SDL_SWSURFACE,
03447                         charWidth, charHeight, 32,
03448                         0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
03449                 if (character == NULL) {
03450                         return (-1);
03451                 }
03452 
03453                 charpos = currentFontdata + ci * charSize;
03454                                 linepos = (Uint8 *)character->pixels;
03455                 pitch = character->pitch;
03456 
03457                 /*
03458                 * Drawing loop 
03459                 */
03460                 patt = 0;
03461                 for (iy = 0; iy < charHeight; iy++) {
03462                         mask = 0x00;
03463                         curpos = linepos;
03464                         for (ix = 0; ix < charWidth; ix++) {
03465                                 if (!(mask >>= 1)) {
03466                                         patt = *charpos++;
03467                                         mask = 0x80;
03468                                 }
03469                                 if (patt & mask) {
03470                                         *(Uint32 *)curpos = 0xffffffff;
03471                                 } else {
03472                                         *(Uint32 *)curpos = 0;
03473                                 }
03474                                 curpos += 4;
03475                         }
03476                         linepos += pitch;
03477                 }
03478 
03479                 /* Maybe rotate and replace cached image */
03480                 if (charRotation>0)
03481                 {
03482                         rotatedCharacter = rotateSurface90Degrees(character, charRotation);
03483                         SDL_FreeSurface(character);
03484                         character = rotatedCharacter;
03485                 }
03486 
03487                 /* Convert temp surface into texture */
03488                 gfxPrimitivesFont[ci] = SDL_CreateTextureFromSurface(renderer, character);
03489                 SDL_FreeSurface(character);
03490 
03491                 /*
03492                 * Check pointer 
03493                 */
03494                 if (gfxPrimitivesFont[ci] == NULL) {
03495                         return (-1);
03496                 }
03497         }
03498 
03499         /*
03500         * Set color 
03501         */
03502         result = 0;
03503         result |= SDL_SetTextureColorMod(gfxPrimitivesFont[ci], r, g, b);
03504         result |= SDL_SetTextureAlphaMod(gfxPrimitivesFont[ci], a);
03505 
03506         /*
03507         * Draw texture onto destination 
03508         */
03509         result |= SDL_RenderCopy(renderer, gfxPrimitivesFont[ci], &srect, &drect);
03510 
03511         return (result);
03512 }
03513 
03514 
03526 int characterColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, char c, Uint32 color)
03527 {
03528         Uint8 *co = (Uint8 *)&color; 
03529         return characterRGBA(renderer, x, y, c, co[0], co[1], co[2], co[3]);
03530 }
03531 
03532 
03547 int stringColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, const char *s, Uint32 color)
03548 {
03549         Uint8 *c = (Uint8 *)&color; 
03550         return stringRGBA(renderer, x, y, s, c[0], c[1], c[2], c[3]);
03551 }
03552 
03567 int stringRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03568 {
03569         int result = 0;
03570         Sint16 curx = x;
03571         Sint16 cury = y;
03572         const char *curchar = s;
03573 
03574         while (*curchar && !result) {
03575                 result |= characterRGBA(renderer, curx, cury, *curchar, r, g, b, a);
03576                 switch (charRotation)
03577                 {
03578                 case 0:
03579                         curx += charWidthLocal;
03580                         break;
03581                 case 2:
03582                         curx -= charWidthLocal;
03583                         break;
03584                 case 1:
03585                         cury += charHeightLocal;
03586                         break;
03587                 case 3:
03588                         cury -= charHeightLocal;
03589                         break;
03590                 }
03591                 curchar++;
03592         }
03593 
03594         return (result);
03595 }
03596 
03597 /* ---- Bezier curve */
03598 
03608 double _evaluateBezier (double *data, int ndata, double t) 
03609 {
03610         double mu, result;
03611         int n,k,kn,nn,nkn;
03612         double blend,muk,munk;
03613 
03614         /* Sanity check bounds */
03615         if (t<0.0) {
03616                 return(data[0]);
03617         }
03618         if (t>=(double)ndata) {
03619                 return(data[ndata-1]);
03620         }
03621 
03622         /* Adjust t to the range 0.0 to 1.0 */ 
03623         mu=t/(double)ndata;
03624 
03625         /* Calculate interpolate */
03626         n=ndata-1;
03627         result=0.0;
03628         muk = 1;
03629         munk = pow(1-mu,(double)n);
03630         for (k=0;k<=n;k++) {
03631                 nn = n;
03632                 kn = k;
03633                 nkn = n - k;
03634                 blend = muk * munk;
03635                 muk *= mu;
03636                 munk /= (1-mu);
03637                 while (nn >= 1) {
03638                         blend *= nn;
03639                         nn--;
03640                         if (kn > 1) {
03641                                 blend /= (double)kn;
03642                                 kn--;
03643                         }
03644                         if (nkn > 1) {
03645                                 blend /= (double)nkn;
03646                                 nkn--;
03647                         }
03648                 }
03649                 result += data[k] * blend;
03650         }
03651 
03652         return (result);
03653 }
03654 
03667 int bezierColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color)
03668 {
03669         Uint8 *c = (Uint8 *)&color; 
03670         return bezierRGBA(renderer, vx, vy, n, s, c[0], c[1], c[2], c[3]);
03671 }
03672 
03688 int bezierRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03689 {
03690         int result;
03691         int i;
03692         double *x, *y, t, stepsize;
03693         Sint16 x1, y1, x2, y2;
03694 
03695         /*
03696         * Sanity check 
03697         */
03698         if (n < 3) {
03699                 return (-1);
03700         }
03701         if (s < 2) {
03702                 return (-1);
03703         }
03704 
03705         /*
03706         * Variable setup 
03707         */
03708         stepsize=(double)1.0/(double)s;
03709 
03710         /* Transfer vertices into float arrays */
03711         if ((x=(double *)malloc(sizeof(double)*(n+1)))==NULL) {
03712                 return(-1);
03713         }
03714         if ((y=(double *)malloc(sizeof(double)*(n+1)))==NULL) {
03715                 free(x);
03716                 return(-1);
03717         }    
03718         for (i=0; i<n; i++) {
03719                 x[i]=(double)vx[i];
03720                 y[i]=(double)vy[i];
03721         }      
03722         x[n]=(double)vx[0];
03723         y[n]=(double)vy[0];
03724 
03725         /*
03726         * Set color 
03727         */
03728         result = 0;
03729         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
03730         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
03731 
03732         /*
03733         * Draw 
03734         */
03735         t=0.0;
03736         x1=(Sint16)lrint(_evaluateBezier(x,n+1,t));
03737         y1=(Sint16)lrint(_evaluateBezier(y,n+1,t));
03738         for (i = 0; i <= (n*s); i++) {
03739                 t += stepsize;
03740                 x2=(Sint16)_evaluateBezier(x,n,t);
03741                 y2=(Sint16)_evaluateBezier(y,n,t);
03742                 result |= line(renderer, x1, y1, x2, y2);
03743                 x1 = x2;
03744                 y1 = y2;
03745         }
03746 
03747         /* Clean up temporary array */
03748         free(x);
03749         free(y);
03750 
03751         return (result);
03752 }
03753 
03754 
03755 /* ---- Thick Line */
03756 
03775 int _bresenhamInitialize(SDL2_gfxBresenhamIterator *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
03776 {
03777         int temp;
03778 
03779         if (b==NULL) {
03780                 return(-1);
03781         }
03782 
03783         b->x = x1;
03784         b->y = y1;
03785 
03786         /* dx = abs(x2-x1), s1 = sign(x2-x1) */
03787         if ((b->dx = x2 - x1) != 0) {
03788                 if (b->dx < 0) {
03789                         b->dx = -b->dx;
03790                         b->s1 = -1;
03791                 } else {
03792                         b->s1 = 1;
03793                 }
03794         } else {
03795                 b->s1 = 0;      
03796         }
03797 
03798         /* dy = abs(y2-y1), s2 = sign(y2-y1)    */
03799         if ((b->dy = y2 - y1) != 0) {
03800                 if (b->dy < 0) {
03801                         b->dy = -b->dy;
03802                         b->s2 = -1;
03803                 } else {
03804                         b->s2 = 1;
03805                 }
03806         } else {
03807                 b->s2 = 0;      
03808         }
03809 
03810         if (b->dy > b->dx) {
03811                 temp = b->dx;
03812                 b->dx = b->dy;
03813                 b->dy = temp;
03814                 b->swapdir = 1;
03815         } else {
03816                 b->swapdir = 0;
03817         }
03818 
03819         b->count = (b->dx<0) ? 0 : (unsigned int)b->dx;
03820         b->dy <<= 1;
03821         b->error = b->dy - b->dx;
03822         b->dx <<= 1;    
03823 
03824         return(0);
03825 }
03826 
03827 
03837 int _bresenhamIterate(SDL2_gfxBresenhamIterator *b)
03838 {       
03839         if (b==NULL) {
03840                 return (-1);
03841         }
03842 
03843         /* last point check */
03844         if (b->count==0) {
03845                 return (2);
03846         }
03847 
03848         while (b->error >= 0) {
03849                 if (b->swapdir) {
03850                         b->x += b->s1;
03851                 } else  {
03852                         b->y += b->s2;
03853                 }
03854 
03855                 b->error -= b->dx;
03856         }
03857 
03858         if (b->swapdir) {
03859                 b->y += b->s2;
03860         } else {
03861                 b->x += b->s1;
03862         }
03863 
03864         b->error += b->dy;      
03865         b->count--;             
03866 
03867         /* count==0 indicates "end-of-line" */
03868         return ((b->count) ? 0 : 1);
03869 }
03870 
03871 
03880 void _murphyParaline(SDL2_gfxMurphyIterator *m, Sint16 x, Sint16 y, int d1)
03881 {
03882         int p;
03883         d1 = -d1;
03884 
03885         for (p = 0; p <= m->u; p++) {
03886 
03887                 pixel(m->renderer, x, y);
03888 
03889                 if (d1 <= m->kt) {
03890                         if (m->oct2 == 0) {
03891                                 x++;
03892                         } else {
03893                                 if (m->quad4 == 0) {
03894                                         y++;
03895                                 } else {
03896                                         y--;
03897                                 }
03898                         }
03899                         d1 += m->kv;
03900                 } else {        
03901                         x++;
03902                         if (m->quad4 == 0) {
03903                                 y++;
03904                         } else {
03905                                 y--;
03906                         }
03907                         d1 += m->kd;
03908                 }
03909         }
03910 
03911         m->tempx = x;
03912         m->tempy = y;
03913 }
03914 
03930 void _murphyIteration(SDL2_gfxMurphyIterator *m, Uint8 miter, 
03931         Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, 
03932         Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)
03933 {
03934         int atemp1, atemp2;
03935         int ftmp1, ftmp2;
03936         Uint16 m1x, m1y, m2x, m2y;      
03937         Uint16 fix, fiy, lax, lay, curx, cury;
03938         Sint16 px[4], py[4];
03939         SDL2_gfxBresenhamIterator b;
03940 
03941         if (miter > 1) {
03942                 if (m->first1x != -32768) {
03943                         fix = (m->first1x + m->first2x) / 2;
03944                         fiy = (m->first1y + m->first2y) / 2;
03945                         lax = (m->last1x + m->last2x) / 2;
03946                         lay = (m->last1y + m->last2y) / 2;
03947                         curx = (ml1x + ml2x) / 2;
03948                         cury = (ml1y + ml2y) / 2;
03949 
03950                         atemp1 = (fix - curx);
03951                         atemp2 = (fiy - cury);
03952                         ftmp1 = atemp1 * atemp1 + atemp2 * atemp2;
03953                         atemp1 = (lax - curx);
03954                         atemp2 = (lay - cury);
03955                         ftmp2 = atemp1 * atemp1 + atemp2 * atemp2;
03956 
03957                         if (ftmp1 <= ftmp2) {
03958                                 m1x = m->first1x;
03959                                 m1y = m->first1y;
03960                                 m2x = m->first2x;
03961                                 m2y = m->first2y;
03962                         } else {
03963                                 m1x = m->last1x;
03964                                 m1y = m->last1y;
03965                                 m2x = m->last2x;
03966                                 m2y = m->last2y;
03967                         }
03968 
03969                         atemp1 = (m2x - ml2x);
03970                         atemp2 = (m2y - ml2y);
03971                         ftmp1 = atemp1 * atemp1 + atemp2 * atemp2;
03972                         atemp1 = (m2x - ml2bx);
03973                         atemp2 = (m2y - ml2by);
03974                         ftmp2 = atemp1 * atemp1 + atemp2 * atemp2;
03975 
03976                         if (ftmp2 >= ftmp1) {
03977                                 ftmp1 = ml2bx;
03978                                 ftmp2 = ml2by;
03979                                 ml2bx = ml2x;
03980                                 ml2by = ml2y;
03981                                 ml2x = ftmp1;
03982                                 ml2y = ftmp2;
03983                                 ftmp1 = ml1bx;
03984                                 ftmp2 = ml1by;
03985                                 ml1bx = ml1x;
03986                                 ml1by = ml1y;
03987                                 ml1x = ftmp1;
03988                                 ml1y = ftmp2;
03989                         }
03990 
03991                         /*
03992                         * Lock the surface 
03993                         */
03994                         _bresenhamInitialize(&b, m2x, m2y, m1x, m1y);
03995                         do {
03996                                 pixel(m->renderer, b.x, b.y);
03997                         } while (_bresenhamIterate(&b)==0);
03998 
03999                         _bresenhamInitialize(&b, m1x, m1y, ml1bx, ml1by);
04000                         do {
04001                                 pixel(m->renderer, b.x, b.y);
04002                         } while (_bresenhamIterate(&b)==0);
04003 
04004                         _bresenhamInitialize(&b, ml1bx, ml1by, ml2bx, ml2by);
04005                         do {
04006                                 pixel(m->renderer, b.x, b.y);
04007                         } while (_bresenhamIterate(&b)==0);
04008 
04009                         _bresenhamInitialize(&b, ml2bx, ml2by, m2x, m2y);
04010                         do {
04011                                 pixel(m->renderer, b.x, b.y);
04012                         } while (_bresenhamIterate(&b)==0);
04013 
04014                         px[0] = m1x;
04015                         px[1] = m2x;
04016                         px[2] = ml1bx;
04017                         px[3] = ml2bx;
04018                         py[0] = m1y;
04019                         py[1] = m2y;
04020                         py[2] = ml1by;
04021                         py[3] = ml2by;                  
04022                         polygon(m->renderer, px, py, 4);                                                
04023                 }
04024         }
04025 
04026         m->last1x = ml1x;
04027         m->last1y = ml1y;
04028         m->last2x = ml2x;
04029         m->last2y = ml2y;
04030         m->first1x = ml1bx;
04031         m->first1y = ml1by;
04032         m->first2x = ml2bx;
04033         m->first2y = ml2by;
04034 }
04035 
04036 
04037 #define HYPOT(x,y) sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y)) 
04038 
04053 void _murphyWideline(SDL2_gfxMurphyIterator *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)
04054 {       
04055         float offset = (float)width / 2.f;
04056 
04057         Sint16 temp;
04058         Sint16 ptx, pty, ptxx, ptxy, ml1x, ml1y, ml2x, ml2y, ml1bx, ml1by, ml2bx, ml2by;
04059 
04060         int d0, d1;             /* difference terms d0=perpendicular to line, d1=along line */
04061 
04062         int q;                  /* pel counter,q=perpendicular to line */
04063         int tmp;
04064 
04065         int dd;                 /* distance along line */
04066         int tk;                 /* thickness threshold */
04067         double ang;             /* angle for initial point calculation */
04068         double sang, cang;
04069 
04070         /* Initialisation */
04071         m->u = x2 - x1; /* delta x */
04072         m->v = y2 - y1; /* delta y */
04073 
04074         if (m->u < 0) { /* swap to make sure we are in quadrants 1 or 4 */
04075                 temp = x1;
04076                 x1 = x2;
04077                 x2 = temp;
04078                 temp = y1;
04079                 y1 = y2;
04080                 y2 = temp;              
04081                 m->u *= -1;
04082                 m->v *= -1;
04083         }
04084 
04085         if (m->v < 0) { /* swap to 1st quadrant and flag */
04086                 m->v *= -1;
04087                 m->quad4 = 1;
04088         } else {
04089                 m->quad4 = 0;
04090         }
04091 
04092         if (m->v > m->u) {      /* swap things if in 2 octant */
04093                 tmp = m->u;
04094                 m->u = m->v;
04095                 m->v = tmp;
04096                 m->oct2 = 1;
04097         } else {
04098                 m->oct2 = 0;
04099         }
04100 
04101         m->ku = m->u + m->u;    /* change in l for square shift */
04102         m->kv = m->v + m->v;    /* change in d for square shift */
04103         m->kd = m->kv - m->ku;  /* change in d for diagonal shift */
04104         m->kt = m->u - m->kv;   /* diag/square decision threshold */
04105 
04106         d0 = 0;
04107         d1 = 0;
04108         dd = 0;
04109 
04110         ang = atan((double) m->v / (double) m->u);      /* calc new initial point - offset both sides of ideal */       
04111         sang = sin(ang);
04112         cang = cos(ang);
04113 
04114         if (m->oct2 == 0) {
04115                 ptx = x1 + (Sint16)lrint(offset * sang);
04116                 if (m->quad4 == 0) {
04117                         pty = y1 - (Sint16)lrint(offset * cang);
04118                 } else {
04119                         pty = y1 + (Sint16)lrint(offset * cang);
04120                 }
04121         } else {
04122                 ptx = x1 - (Sint16)lrint(offset * cang);
04123                 if (m->quad4 == 0) {
04124                         pty = y1 + (Sint16)lrint(offset * sang);
04125                 } else {
04126                         pty = y1 - (Sint16)lrint(offset * sang);
04127                 }
04128         }
04129 
04130         /* used here for constant thickness line */
04131         tk = (int) (4. * HYPOT(ptx - x1, pty - y1) * HYPOT(m->u, m->v));
04132 
04133         if (miter == 0) {
04134                 m->first1x = -32768;
04135                 m->first1y = -32768;
04136                 m->first2x = -32768;
04137                 m->first2y = -32768;
04138                 m->last1x = -32768;
04139                 m->last1y = -32768;
04140                 m->last2x = -32768;
04141                 m->last2y = -32768;
04142         }
04143         ptxx = ptx;
04144         ptxy = pty;
04145 
04146         for (q = 0; dd <= tk; q++) {    /* outer loop, stepping perpendicular to line */
04147 
04148                 _murphyParaline(m, ptx, pty, d1);       /* call to inner loop - right edge */
04149                 if (q == 0) {
04150                         ml1x = ptx;
04151                         ml1y = pty;
04152                         ml1bx = m->tempx;
04153                         ml1by = m->tempy;
04154                 } else {
04155                         ml2x = ptx;
04156                         ml2y = pty;
04157                         ml2bx = m->tempx;
04158                         ml2by = m->tempy;
04159                 }
04160                 if (d0 < m->kt) {       /* square move */
04161                         if (m->oct2 == 0) {
04162                                 if (m->quad4 == 0) {
04163                                         pty++;
04164                                 } else {
04165                                         pty--;
04166                                 }
04167                         } else {
04168                                 ptx++;
04169                         }
04170                 } else {        /* diagonal move */
04171                         dd += m->kv;
04172                         d0 -= m->ku;
04173                         if (d1 < m->kt) {       /* normal diagonal */
04174                                 if (m->oct2 == 0) {
04175                                         ptx--;
04176                                         if (m->quad4 == 0) {
04177                                                 pty++;
04178                                         } else {
04179                                                 pty--;
04180                                         }
04181                                 } else {
04182                                         ptx++;
04183                                         if (m->quad4 == 0) {
04184                                                 pty--;
04185                                         } else {
04186                                                 pty++;
04187                                         }
04188                                 }
04189                                 d1 += m->kv;
04190                         } else {        /* double square move, extra parallel line */
04191                                 if (m->oct2 == 0) {
04192                                         ptx--;
04193                                 } else {
04194                                         if (m->quad4 == 0) {
04195                                                 pty--;
04196                                         } else {
04197                                                 pty++;
04198                                         }
04199                                 }
04200                                 d1 += m->kd;
04201                                 if (dd > tk) {
04202                                         _murphyIteration(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y);
04203                                         return; /* breakout on the extra line */
04204                                 }
04205                                 _murphyParaline(m, ptx, pty, d1);
04206                                 if (m->oct2 == 0) {
04207                                         if (m->quad4 == 0) {
04208                                                 pty++;
04209                                         } else {
04210 
04211                                                 pty--;
04212                                         }
04213                                 } else {
04214                                         ptx++;
04215                                 }
04216                         }
04217                 }
04218                 dd += m->ku;
04219                 d0 += m->kv;
04220         }
04221 
04222         _murphyIteration(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y);
04223 }
04224 
04225 
04239 int thickLineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
04240 {       
04241         Uint8 *c = (Uint8 *)&color; 
04242         return thickLineRGBA(renderer, x1, y1, x2, y2, width, c[0], c[1], c[2], c[3]);
04243 }
04244 
04261 int thickLineRGBA(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04262 {
04263         int result;
04264         int wh;
04265         SDL2_gfxMurphyIterator m;
04266 
04267         if (renderer == NULL) {
04268                 return -1;
04269         }
04270         if (width < 1) {
04271                 return -1;
04272         }
04273 
04274         /* Special case: thick "point" */
04275         if ((x1 == x2) && (y1 == y2)) {
04276                 wh = width / 2;
04277                 return boxRGBA(renderer, x1 - wh, y1 - wh, x2 + width, y2 + width, r, g, b, a);         
04278         }
04279 
04280         /*
04281         * Set color
04282         */
04283         result = 0;
04284         result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
04285         result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
04286 
04287         /* 
04288         * Draw
04289         */
04290         m.renderer = renderer;
04291         _murphyWideline(&m, x1, y1, x2, y2, width, 0);
04292         _murphyWideline(&m, x1, y1, x2, y2, width, 1);
04293 
04294         return(0);
04295 }
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__gfx_primitives_8h.html000077500000000000000000006767461226521303400235600ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h File Reference
#include <math.h>
#include "SDL.h"

Go to the source code of this file.

Defines

#define M_PI   3.1415926535897932384626433832795
#define SDL2_GFXPRIMITIVES_MAJOR   1
#define SDL2_GFXPRIMITIVES_MINOR   0
#define SDL2_GFXPRIMITIVES_MICRO   0
#define SDL2_GFXPRIMITIVES_SCOPE   extern

Functions

SDL2_GFXPRIMITIVES_SCOPE int pixelColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint32 color)
 Draw pixel with blending enabled if a<255.
SDL2_GFXPRIMITIVES_SCOPE int pixelRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pixel with blending enabled if a<255.
SDL2_GFXPRIMITIVES_SCOPE int hlineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line with blending.
SDL2_GFXPRIMITIVES_SCOPE int hlineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line with blending.
SDL2_GFXPRIMITIVES_SCOPE int vlineColor (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Draw vertical line with blending.
SDL2_GFXPRIMITIVES_SCOPE int vlineRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw vertical line with blending.
SDL2_GFXPRIMITIVES_SCOPE int rectangleColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw rectangle with blending.
SDL2_GFXPRIMITIVES_SCOPE int rectangleRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rectangle with blending.
SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner rectangle with blending.
SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner rectangle with blending.
SDL2_GFXPRIMITIVES_SCOPE int boxColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw box (filled rectangle) with blending.
SDL2_GFXPRIMITIVES_SCOPE int boxRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw box (filled rectangle) with blending.
SDL2_GFXPRIMITIVES_SCOPE int roundedBoxColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner box (filled rectangle) with blending.
SDL2_GFXPRIMITIVES_SCOPE int roundedBoxRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner box (filled rectangle) with blending.
SDL2_GFXPRIMITIVES_SCOPE int lineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw line with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int lineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw line with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int aalineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw anti-aliased line with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int aalineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased line with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int thickLineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
 Draw a thick line with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int thickLineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a thick line with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int circleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw circle with blending.
SDL2_GFXPRIMITIVES_SCOPE int circleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw circle with blending.
SDL2_GFXPRIMITIVES_SCOPE int arcColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Arc with blending.
SDL2_GFXPRIMITIVES_SCOPE int arcRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Arc with blending.
SDL2_GFXPRIMITIVES_SCOPE int aacircleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw anti-aliased circle with blending.
SDL2_GFXPRIMITIVES_SCOPE int aacircleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased circle with blending.
SDL2_GFXPRIMITIVES_SCOPE int filledCircleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 r, Uint32 color)
 Draw filled circle with blending.
SDL2_GFXPRIMITIVES_SCOPE int filledCircleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled circle with blending.
SDL2_GFXPRIMITIVES_SCOPE int ellipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw ellipse with blending.
SDL2_GFXPRIMITIVES_SCOPE int ellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw ellipse with blending.
SDL2_GFXPRIMITIVES_SCOPE int aaellipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw anti-aliased ellipse with blending.
SDL2_GFXPRIMITIVES_SCOPE int aaellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased ellipse with blending.
SDL2_GFXPRIMITIVES_SCOPE int filledEllipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw filled ellipse with blending.
SDL2_GFXPRIMITIVES_SCOPE int filledEllipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled ellipse with blending.
SDL2_GFXPRIMITIVES_SCOPE int pieColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw pie (outline) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int pieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pie (outline) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int filledPieColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw filled pie with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int filledPieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled pie with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int trigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw trigon (triangle outline) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int trigonRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw trigon (triangle outline) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int aatrigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int aatrigonRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int filledTrigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw filled trigon (triangle) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int filledTrigonRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled trigon (triangle) with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int polygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw polygon with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int polygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw polygon with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int aapolygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw anti-aliased polygon with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int aapolygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased polygon with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int filledPolygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw filled polygon with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int filledPolygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled polygon with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int texturedPolygon (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
 Draws a polygon filled with the given texture.
SDL2_GFXPRIMITIVES_SCOPE int bezierColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
 Draw a bezier curve with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE int bezierRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a bezier curve with alpha blending.
SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont (const void *fontdata, Uint32 cw, Uint32 ch)
 Sets or resets the current global font data.
SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation (Uint32 rotation)
 Sets current global font character rotation steps.
SDL2_GFXPRIMITIVES_SCOPE int characterColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint32 color)
 Draw a character of the currently set font.
SDL2_GFXPRIMITIVES_SCOPE int characterRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a character of the currently set font.
SDL2_GFXPRIMITIVES_SCOPE int stringColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint32 color)
 Draw a string in the currently set font.
SDL2_GFXPRIMITIVES_SCOPE int stringRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a string in the currently set font.

Define Documentation

#define M_PI   3.1415926535897932384626433832795

Definition at line 35 of file SDL2_gfxPrimitives.h.

#define SDL2_GFXPRIMITIVES_MAJOR   1

Definition at line 47 of file SDL2_gfxPrimitives.h.

#define SDL2_GFXPRIMITIVES_MICRO   0

Definition at line 49 of file SDL2_gfxPrimitives.h.

#define SDL2_GFXPRIMITIVES_MINOR   0

Definition at line 48 of file SDL2_gfxPrimitives.h.

#define SDL2_GFXPRIMITIVES_SCOPE   extern

Definition at line 64 of file SDL2_gfxPrimitives.h.


Function Documentation

SDL2_GFXPRIMITIVES_SCOPE int aacircleColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw anti-aliased circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
colorThe color value of the aa-circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1364 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aacircleRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
rThe red value of the aa-circle to draw.
gThe green value of the aa-circle to draw.
bThe blue value of the aa-circle to draw.
aThe alpha value of the aa-circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1384 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aaellipseColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw anti-aliased ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
colorThe color value of the aa-ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1741 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aaellipseRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
rThe red value of the aa-ellipse to draw.
gThe green value of the aa-ellipse to draw.
bThe blue value of the aa-ellipse to draw.
aThe alpha value of the aa-ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1762 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aalineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw anti-aliased line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1030 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aalineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
rThe red value of the aa-line to draw.
gThe green value of the aa-line to draw.
bThe blue value of the aa-line to draw.
aThe alpha value of the aa-line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1051 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aapolygonColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the aa-polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2663 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aapolygonRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the aa-polygon to draw.
gThe green value of the aa-polygon to draw.
bThe blue value of the aa-polygon to draw.
aThe alpha value of the aa-polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2683 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aatrigonColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
colorThe color value of the aa-trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2391 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int aatrigonRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
rThe red value of the aa-trigon to draw.
gThe green value of the aa-trigon to draw.
bThe blue value of the aa-trigon to draw.
aThe alpha value of the aa-trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2423 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int arcColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Arc with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
colorThe color value of the arc to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1109 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int arcRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Arc with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
rThe red value of the arc to draw.
gThe green value of the arc to draw.
bThe blue value of the arc to draw.
aThe alpha value of the arc to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1131 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int bezierColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint32  color 
)

Draw a bezier curve with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
colorThe color value of the bezier curve to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3667 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int bezierRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a bezier curve with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
rThe red value of the bezier curve to draw.
gThe green value of the bezier curve to draw.
bThe blue value of the bezier curve to draw.
aThe alpha value of the bezier curve to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3688 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int boxColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 644 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int boxRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 665 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int characterColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
char  c,
Uint32  color 
)

Draw a character of the currently set font.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
colorThe color value of the character to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3526 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int characterRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
char  c,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a character of the currently set font.

Parameters:
rendererThe Renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3404 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int circleColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
colorThe color value of the circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1069 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int circleRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
rThe red value of the circle to draw.
gThe green value of the circle to draw.
bThe blue value of the circle to draw.
aThe alpha value of the circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1089 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int ellipseColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
colorThe color value of the ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1525 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int ellipseRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
rThe red value of the ellipse to draw.
gThe green value of the ellipse to draw.
bThe blue value of the ellipse to draw.
aThe alpha value of the ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1546 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledCircleColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw filled circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
colorThe color value of the filled circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1405 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledCircleRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled circle with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
rThe red value of the filled circle to draw.
gThe green value of the filled circle to draw.
bThe blue value of the filled circle to draw.
aThe alpha value of the filled circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1425 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledEllipseColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw filled ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
colorThe color value of the filled ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1955 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledEllipseRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled ellipse with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
rThe red value of the filled ellipse to draw.
gThe green value of the filled ellipse to draw.
bThe blue value of the filled ellipse to draw.
aThe alpha value of the filled ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1976 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledPieColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw filled pie with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
colorThe color value of the filled pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2279 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledPieRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled pie with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
rThe red value of the filled pie to draw.
gThe green value of the filled pie to draw.
bThe blue value of the filled pie to draw.
aThe alpha value of the filled pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2301 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledPolygonColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw filled polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2946 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledPolygonRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2966 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledTrigonColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
colorThe color value of the filled trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2457 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int filledTrigonRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
rThe red value of the filled trigon to draw.
gThe green value of the filled trigon to draw.
bThe blue value of the filled trigon to draw.
aThe alpha value of the filled trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2491 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont ( const void *  fontdata,
Uint32  cw,
Uint32  ch 
)

Sets or resets the current global font data.

The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]

Parameters:
fontdataPointer to array of font data. Set to NULL, to reset global font to the default 8x8 font.
cwWidth of character in bytes. Ignored if fontdata==NULL.
chHeight of character in bytes. Ignored if fontdata==NULL.

Definition at line 3312 of file SDL2_gfxPrimitives.c.

Sets current global font character rotation steps.

Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.

Parameters:
rotationNumber of 90deg clockwise steps to rotate

Definition at line 3358 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int hlineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 175 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int hlineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 195 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int lineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the seond point of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 755 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int lineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 776 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int pieColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw pie (outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2237 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int pieRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pie (outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
rThe red value of the pie to draw.
gThe green value of the pie to draw.
bThe blue value of the pie to draw.
aThe alpha value of the pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2260 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int pixelColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Uint32  color 
)

Draw pixel with blending enabled if a<255.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 88 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int pixelRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pixel with blending enabled if a<255.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
rThe red color value of the pixel to draw.
gThe green color value of the pixel to draw.
bThe blue color value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 107 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int polygonColor ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2520 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int polygonRGBA ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw polygon with alpha blending.

Parameters:
rendererThe renderer to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the polygon to draw.
gThe green value of the polygon to draw.
bThe blue value of the polygon to draw.
aThe alpha value of the polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2602 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int rectangleColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 260 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int rectangleRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 281 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int roundedBoxColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 498 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int roundedBoxRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 520 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 353 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner rectangle with blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 375 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int stringColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
const char *  s,
Uint32  color 
)

Draw a string in the currently set font.

The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
colorThe color value of the string to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3547 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int stringRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y,
const char *  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a string in the currently set font.

Parameters:
rendererThe renderer to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
rThe red value of the string to draw.
gThe green value of the string to draw.
bThe blue value of the string to draw.
aThe alpha value of the string to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3567 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int texturedPolygon ( SDL_Renderer *  renderer,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Draws a polygon filled with the given texture.

This standard version is calling multithreaded versions with NULL cache parameters.

Parameters:
rendererThe renderer to draw on.
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3244 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int thickLineColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint32  color 
)

Draw a thick line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4239 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int thickLineRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a thick line with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4261 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int trigonColor ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses polygon routine to render.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
colorThe color value of the trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2325 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int trigonRGBA ( SDL_Renderer *  renderer,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw trigon (triangle outline) with alpha blending.

Parameters:
rendererThe renderer to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
rThe red value of the trigon to draw.
gThe green value of the trigon to draw.
bThe blue value of the trigon to draw.
aThe alpha value of the trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2357 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int vlineColor ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Draw vertical line with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 217 of file SDL2_gfxPrimitives.c.

SDL2_GFXPRIMITIVES_SCOPE int vlineRGBA ( SDL_Renderer *  renderer,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw vertical line with blending.

Parameters:
rendererThe renderer to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 237 of file SDL2_gfxPrimitives.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__gfx_primitives_8h_source.html000077500000000000000000001206741226521303400251200ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h
Go to the documentation of this file.
00001 /* 
00002 
00003 SDL2_gfxPrimitives.h: graphics primitives for SDL
00004 
00005 Copyright (C) 2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL2_gfxPrimitives_h
00031 #define _SDL2_gfxPrimitives_h
00032 
00033 #include <math.h>
00034 #ifndef M_PI
00035 #define M_PI    3.1415926535897932384626433832795
00036 #endif
00037 
00038 #include "SDL.h"
00039 
00040 /* Set up for C function definitions, even when using C++ */
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045         /* ----- Versioning */
00046 
00047 #define SDL2_GFXPRIMITIVES_MAJOR        1
00048 #define SDL2_GFXPRIMITIVES_MINOR        0
00049 #define SDL2_GFXPRIMITIVES_MICRO        0
00050 
00051 
00052         /* ---- Function Prototypes */
00053 
00054 #ifdef _MSC_VER
00055 #  if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)
00056 #    define SDL2_GFXPRIMITIVES_SCOPE __declspec(dllexport)
00057 #  else
00058 #    ifdef LIBSDL2_GFX_DLL_IMPORT
00059 #      define SDL2_GFXPRIMITIVES_SCOPE __declspec(dllimport)
00060 #    endif
00061 #  endif
00062 #endif
00063 #ifndef SDL2_GFXPRIMITIVES_SCOPE
00064 #  define SDL2_GFXPRIMITIVES_SCOPE extern
00065 #endif
00066 
00067         /* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */
00068 
00069         /* Pixel */
00070 
00071         SDL2_GFXPRIMITIVES_SCOPE int pixelColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint32 color);
00072         SDL2_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00073 
00074         /* Horizontal line */
00075 
00076         SDL2_GFXPRIMITIVES_SCOPE int hlineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color);
00077         SDL2_GFXPRIMITIVES_SCOPE int hlineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00078 
00079         /* Vertical line */
00080 
00081         SDL2_GFXPRIMITIVES_SCOPE int vlineColor(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color);
00082         SDL2_GFXPRIMITIVES_SCOPE int vlineRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00083 
00084         /* Rectangle */
00085 
00086         SDL2_GFXPRIMITIVES_SCOPE int rectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00087         SDL2_GFXPRIMITIVES_SCOPE int rectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
00088                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00089 
00090         /* Rounded-Corner Rectangle */
00091 
00092         SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
00093         SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
00094                 Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00095 
00096         /* Filled rectangle (Box) */
00097 
00098         SDL2_GFXPRIMITIVES_SCOPE int boxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00099         SDL2_GFXPRIMITIVES_SCOPE int boxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2,
00100                 Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00101 
00102         /* Rounded-Corner Filled rectangle (Box) */
00103 
00104         SDL2_GFXPRIMITIVES_SCOPE int roundedBoxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
00105         SDL2_GFXPRIMITIVES_SCOPE int roundedBoxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2,
00106                 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00107 
00108         /* Line */
00109 
00110         SDL2_GFXPRIMITIVES_SCOPE int lineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00111         SDL2_GFXPRIMITIVES_SCOPE int lineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
00112                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00113 
00114         /* AA Line */
00115 
00116         SDL2_GFXPRIMITIVES_SCOPE int aalineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00117         SDL2_GFXPRIMITIVES_SCOPE int aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
00118                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00119 
00120         /* Thick Line */
00121         SDL2_GFXPRIMITIVES_SCOPE int thickLineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, 
00122                 Uint8 width, Uint32 color);
00123         SDL2_GFXPRIMITIVES_SCOPE int thickLineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, 
00124                 Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00125 
00126         /* Circle */
00127 
00128         SDL2_GFXPRIMITIVES_SCOPE int circleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
00129         SDL2_GFXPRIMITIVES_SCOPE int circleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00130 
00131         /* Arc */
00132 
00133         SDL2_GFXPRIMITIVES_SCOPE int arcColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color);
00134         SDL2_GFXPRIMITIVES_SCOPE int arcRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, 
00135                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00136 
00137         /* AA Circle */
00138 
00139         SDL2_GFXPRIMITIVES_SCOPE int aacircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
00140         SDL2_GFXPRIMITIVES_SCOPE int aacircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
00141                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00142 
00143         /* Filled Circle */
00144 
00145         SDL2_GFXPRIMITIVES_SCOPE int filledCircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 r, Uint32 color);
00146         SDL2_GFXPRIMITIVES_SCOPE int filledCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
00147                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00148 
00149         /* Ellipse */
00150 
00151         SDL2_GFXPRIMITIVES_SCOPE int ellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
00152         SDL2_GFXPRIMITIVES_SCOPE int ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
00153                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00154 
00155         /* AA Ellipse */
00156 
00157         SDL2_GFXPRIMITIVES_SCOPE int aaellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
00158         SDL2_GFXPRIMITIVES_SCOPE int aaellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
00159                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00160 
00161         /* Filled Ellipse */
00162 
00163         SDL2_GFXPRIMITIVES_SCOPE int filledEllipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
00164         SDL2_GFXPRIMITIVES_SCOPE int filledEllipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
00165                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00166 
00167         /* Pie */
00168 
00169         SDL2_GFXPRIMITIVES_SCOPE int pieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
00170                 Sint16 start, Sint16 end, Uint32 color);
00171         SDL2_GFXPRIMITIVES_SCOPE int pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
00172                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00173 
00174         /* Filled Pie */
00175 
00176         SDL2_GFXPRIMITIVES_SCOPE int filledPieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
00177                 Sint16 start, Sint16 end, Uint32 color);
00178         SDL2_GFXPRIMITIVES_SCOPE int filledPieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
00179                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00180 
00181         /* Trigon */
00182 
00183         SDL2_GFXPRIMITIVES_SCOPE int trigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
00184         SDL2_GFXPRIMITIVES_SCOPE int trigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
00185                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00186 
00187         /* AA-Trigon */
00188 
00189         SDL2_GFXPRIMITIVES_SCOPE int aatrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
00190         SDL2_GFXPRIMITIVES_SCOPE int aatrigonRGBA(SDL_Renderer * renderer,  Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
00191                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00192 
00193         /* Filled Trigon */
00194 
00195         SDL2_GFXPRIMITIVES_SCOPE int filledTrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
00196         SDL2_GFXPRIMITIVES_SCOPE int filledTrigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
00197                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00198 
00199         /* Polygon */
00200 
00201         SDL2_GFXPRIMITIVES_SCOPE int polygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
00202         SDL2_GFXPRIMITIVES_SCOPE int polygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy,
00203                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00204 
00205         /* AA-Polygon */
00206 
00207         SDL2_GFXPRIMITIVES_SCOPE int aapolygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
00208         SDL2_GFXPRIMITIVES_SCOPE int aapolygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy,
00209                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00210 
00211         /* Filled Polygon */
00212 
00213         SDL2_GFXPRIMITIVES_SCOPE int filledPolygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
00214         SDL2_GFXPRIMITIVES_SCOPE int filledPolygonRGBA(SDL_Renderer * renderer, const Sint16 * vx,
00215                 const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00216 
00217         /* Textured Polygon */
00218 
00219         SDL2_GFXPRIMITIVES_SCOPE int texturedPolygon(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy);
00220 
00221         /* Bezier */
00222 
00223         SDL2_GFXPRIMITIVES_SCOPE int bezierColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color);
00224         SDL2_GFXPRIMITIVES_SCOPE int bezierRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy,
00225                 int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00226 
00227         /* Characters/Strings */
00228 
00229         SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch);
00230         SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation(Uint32 rotation);
00231         SDL2_GFXPRIMITIVES_SCOPE int characterColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, char c, Uint32 color);
00232         SDL2_GFXPRIMITIVES_SCOPE int characterRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00233         SDL2_GFXPRIMITIVES_SCOPE int stringColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, const char *s, Uint32 color);
00234         SDL2_GFXPRIMITIVES_SCOPE int stringRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00235 
00236         /* Ends C function definitions when using C++ */
00237 #ifdef __cplusplus
00238 }
00239 #endif
00240 
00241 #endif                          /* _SDL2_gfxPrimitives_h */
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__gfx_primitives__font_8h.html000077500000000000000000000061201226521303400247120ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives_font.h File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_gfxPrimitives_font.h File Reference

Go to the source code of this file.

Defines

#define GFX_FONTDATAMAX   (8*256)

Define Documentation

#define GFX_FONTDATAMAX   (8*256)

Definition at line 6 of file SDL2_gfxPrimitives_font.h.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__gfx_primitives__font_8h_source.html000077500000000000000000010364231226521303400263040ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives_font.h Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_gfxPrimitives_font.h
Go to the documentation of this file.
00001 
00002 /* ---- 8x8 font definition ---- */
00003 
00004 /*  ZLIB (c) A. Schiffler 2012 */
00005 
00006 #define GFX_FONTDATAMAX (8*256)
00007 
00008 static unsigned char gfxPrimitivesFontdata[GFX_FONTDATAMAX] = {
00009 
00010         /*
00011         * 0 0x00 '^@' 
00012         */
00013         0x00,                   /* 00000000 */
00014         0x00,                   /* 00000000 */
00015         0x00,                   /* 00000000 */
00016         0x00,                   /* 00000000 */
00017         0x00,                   /* 00000000 */
00018         0x00,                   /* 00000000 */
00019         0x00,                   /* 00000000 */
00020         0x00,                   /* 00000000 */
00021 
00022         /*
00023         * 1 0x01 '^A' 
00024         */
00025         0x7e,                   /* 01111110 */
00026         0x81,                   /* 10000001 */
00027         0xa5,                   /* 10100101 */
00028         0x81,                   /* 10000001 */
00029         0xbd,                   /* 10111101 */
00030         0x99,                   /* 10011001 */
00031         0x81,                   /* 10000001 */
00032         0x7e,                   /* 01111110 */
00033 
00034         /*
00035         * 2 0x02 '^B' 
00036         */
00037         0x7e,                   /* 01111110 */
00038         0xff,                   /* 11111111 */
00039         0xdb,                   /* 11011011 */
00040         0xff,                   /* 11111111 */
00041         0xc3,                   /* 11000011 */
00042         0xe7,                   /* 11100111 */
00043         0xff,                   /* 11111111 */
00044         0x7e,                   /* 01111110 */
00045 
00046         /*
00047         * 3 0x03 '^C' 
00048         */
00049         0x6c,                   /* 01101100 */
00050         0xfe,                   /* 11111110 */
00051         0xfe,                   /* 11111110 */
00052         0xfe,                   /* 11111110 */
00053         0x7c,                   /* 01111100 */
00054         0x38,                   /* 00111000 */
00055         0x10,                   /* 00010000 */
00056         0x00,                   /* 00000000 */
00057 
00058         /*
00059         * 4 0x04 '^D' 
00060         */
00061         0x10,                   /* 00010000 */
00062         0x38,                   /* 00111000 */
00063         0x7c,                   /* 01111100 */
00064         0xfe,                   /* 11111110 */
00065         0x7c,                   /* 01111100 */
00066         0x38,                   /* 00111000 */
00067         0x10,                   /* 00010000 */
00068         0x00,                   /* 00000000 */
00069 
00070         /*
00071         * 5 0x05 '^E' 
00072         */
00073         0x38,                   /* 00111000 */
00074         0x7c,                   /* 01111100 */
00075         0x38,                   /* 00111000 */
00076         0xfe,                   /* 11111110 */
00077         0xfe,                   /* 11111110 */
00078         0xd6,                   /* 11010110 */
00079         0x10,                   /* 00010000 */
00080         0x38,                   /* 00111000 */
00081 
00082         /*
00083         * 6 0x06 '^F' 
00084         */
00085         0x10,                   /* 00010000 */
00086         0x38,                   /* 00111000 */
00087         0x7c,                   /* 01111100 */
00088         0xfe,                   /* 11111110 */
00089         0xfe,                   /* 11111110 */
00090         0x7c,                   /* 01111100 */
00091         0x10,                   /* 00010000 */
00092         0x38,                   /* 00111000 */
00093 
00094         /*
00095         * 7 0x07 '^G' 
00096         */
00097         0x00,                   /* 00000000 */
00098         0x00,                   /* 00000000 */
00099         0x18,                   /* 00011000 */
00100         0x3c,                   /* 00111100 */
00101         0x3c,                   /* 00111100 */
00102         0x18,                   /* 00011000 */
00103         0x00,                   /* 00000000 */
00104         0x00,                   /* 00000000 */
00105 
00106         /*
00107         * 8 0x08 '^H' 
00108         */
00109         0xff,                   /* 11111111 */
00110         0xff,                   /* 11111111 */
00111         0xe7,                   /* 11100111 */
00112         0xc3,                   /* 11000011 */
00113         0xc3,                   /* 11000011 */
00114         0xe7,                   /* 11100111 */
00115         0xff,                   /* 11111111 */
00116         0xff,                   /* 11111111 */
00117 
00118         /*
00119         * 9 0x09 '^I' 
00120         */
00121         0x00,                   /* 00000000 */
00122         0x3c,                   /* 00111100 */
00123         0x66,                   /* 01100110 */
00124         0x42,                   /* 01000010 */
00125         0x42,                   /* 01000010 */
00126         0x66,                   /* 01100110 */
00127         0x3c,                   /* 00111100 */
00128         0x00,                   /* 00000000 */
00129 
00130         /*
00131         * 10 0x0a '^J' 
00132         */
00133         0xff,                   /* 11111111 */
00134         0xc3,                   /* 11000011 */
00135         0x99,                   /* 10011001 */
00136         0xbd,                   /* 10111101 */
00137         0xbd,                   /* 10111101 */
00138         0x99,                   /* 10011001 */
00139         0xc3,                   /* 11000011 */
00140         0xff,                   /* 11111111 */
00141 
00142         /*
00143         * 11 0x0b '^K' 
00144         */
00145         0x0f,                   /* 00001111 */
00146         0x07,                   /* 00000111 */
00147         0x0f,                   /* 00001111 */
00148         0x7d,                   /* 01111101 */
00149         0xcc,                   /* 11001100 */
00150         0xcc,                   /* 11001100 */
00151         0xcc,                   /* 11001100 */
00152         0x78,                   /* 01111000 */
00153 
00154         /*
00155         * 12 0x0c '^L' 
00156         */
00157         0x3c,                   /* 00111100 */
00158         0x66,                   /* 01100110 */
00159         0x66,                   /* 01100110 */
00160         0x66,                   /* 01100110 */
00161         0x3c,                   /* 00111100 */
00162         0x18,                   /* 00011000 */
00163         0x7e,                   /* 01111110 */
00164         0x18,                   /* 00011000 */
00165 
00166         /*
00167         * 13 0x0d '^M' 
00168         */
00169         0x3f,                   /* 00111111 */
00170         0x33,                   /* 00110011 */
00171         0x3f,                   /* 00111111 */
00172         0x30,                   /* 00110000 */
00173         0x30,                   /* 00110000 */
00174         0x70,                   /* 01110000 */
00175         0xf0,                   /* 11110000 */
00176         0xe0,                   /* 11100000 */
00177 
00178         /*
00179         * 14 0x0e '^N' 
00180         */
00181         0x7f,                   /* 01111111 */
00182         0x63,                   /* 01100011 */
00183         0x7f,                   /* 01111111 */
00184         0x63,                   /* 01100011 */
00185         0x63,                   /* 01100011 */
00186         0x67,                   /* 01100111 */
00187         0xe6,                   /* 11100110 */
00188         0xc0,                   /* 11000000 */
00189 
00190         /*
00191         * 15 0x0f '^O' 
00192         */
00193         0x18,                   /* 00011000 */
00194         0xdb,                   /* 11011011 */
00195         0x3c,                   /* 00111100 */
00196         0xe7,                   /* 11100111 */
00197         0xe7,                   /* 11100111 */
00198         0x3c,                   /* 00111100 */
00199         0xdb,                   /* 11011011 */
00200         0x18,                   /* 00011000 */
00201 
00202         /*
00203         * 16 0x10 '^P' 
00204         */
00205         0x80,                   /* 10000000 */
00206         0xe0,                   /* 11100000 */
00207         0xf8,                   /* 11111000 */
00208         0xfe,                   /* 11111110 */
00209         0xf8,                   /* 11111000 */
00210         0xe0,                   /* 11100000 */
00211         0x80,                   /* 10000000 */
00212         0x00,                   /* 00000000 */
00213 
00214         /*
00215         * 17 0x11 '^Q' 
00216         */
00217         0x02,                   /* 00000010 */
00218         0x0e,                   /* 00001110 */
00219         0x3e,                   /* 00111110 */
00220         0xfe,                   /* 11111110 */
00221         0x3e,                   /* 00111110 */
00222         0x0e,                   /* 00001110 */
00223         0x02,                   /* 00000010 */
00224         0x00,                   /* 00000000 */
00225 
00226         /*
00227         * 18 0x12 '^R' 
00228         */
00229         0x18,                   /* 00011000 */
00230         0x3c,                   /* 00111100 */
00231         0x7e,                   /* 01111110 */
00232         0x18,                   /* 00011000 */
00233         0x18,                   /* 00011000 */
00234         0x7e,                   /* 01111110 */
00235         0x3c,                   /* 00111100 */
00236         0x18,                   /* 00011000 */
00237 
00238         /*
00239         * 19 0x13 '^S' 
00240         */
00241         0x66,                   /* 01100110 */
00242         0x66,                   /* 01100110 */
00243         0x66,                   /* 01100110 */
00244         0x66,                   /* 01100110 */
00245         0x66,                   /* 01100110 */
00246         0x00,                   /* 00000000 */
00247         0x66,                   /* 01100110 */
00248         0x00,                   /* 00000000 */
00249 
00250         /*
00251         * 20 0x14 '^T' 
00252         */
00253         0x7f,                   /* 01111111 */
00254         0xdb,                   /* 11011011 */
00255         0xdb,                   /* 11011011 */
00256         0x7b,                   /* 01111011 */
00257         0x1b,                   /* 00011011 */
00258         0x1b,                   /* 00011011 */
00259         0x1b,                   /* 00011011 */
00260         0x00,                   /* 00000000 */
00261 
00262         /*
00263         * 21 0x15 '^U' 
00264         */
00265         0x3e,                   /* 00111110 */
00266         0x61,                   /* 01100001 */
00267         0x3c,                   /* 00111100 */
00268         0x66,                   /* 01100110 */
00269         0x66,                   /* 01100110 */
00270         0x3c,                   /* 00111100 */
00271         0x86,                   /* 10000110 */
00272         0x7c,                   /* 01111100 */
00273 
00274         /*
00275         * 22 0x16 '^V' 
00276         */
00277         0x00,                   /* 00000000 */
00278         0x00,                   /* 00000000 */
00279         0x00,                   /* 00000000 */
00280         0x00,                   /* 00000000 */
00281         0x7e,                   /* 01111110 */
00282         0x7e,                   /* 01111110 */
00283         0x7e,                   /* 01111110 */
00284         0x00,                   /* 00000000 */
00285 
00286         /*
00287         * 23 0x17 '^W' 
00288         */
00289         0x18,                   /* 00011000 */
00290         0x3c,                   /* 00111100 */
00291         0x7e,                   /* 01111110 */
00292         0x18,                   /* 00011000 */
00293         0x7e,                   /* 01111110 */
00294         0x3c,                   /* 00111100 */
00295         0x18,                   /* 00011000 */
00296         0xff,                   /* 11111111 */
00297 
00298         /*
00299         * 24 0x18 '^X' 
00300         */
00301         0x18,                   /* 00011000 */
00302         0x3c,                   /* 00111100 */
00303         0x7e,                   /* 01111110 */
00304         0x18,                   /* 00011000 */
00305         0x18,                   /* 00011000 */
00306         0x18,                   /* 00011000 */
00307         0x18,                   /* 00011000 */
00308         0x00,                   /* 00000000 */
00309 
00310         /*
00311         * 25 0x19 '^Y' 
00312         */
00313         0x18,                   /* 00011000 */
00314         0x18,                   /* 00011000 */
00315         0x18,                   /* 00011000 */
00316         0x18,                   /* 00011000 */
00317         0x7e,                   /* 01111110 */
00318         0x3c,                   /* 00111100 */
00319         0x18,                   /* 00011000 */
00320         0x00,                   /* 00000000 */
00321 
00322         /*
00323         * 26 0x1a '^Z' 
00324         */
00325         0x00,                   /* 00000000 */
00326         0x18,                   /* 00011000 */
00327         0x0c,                   /* 00001100 */
00328         0xfe,                   /* 11111110 */
00329         0x0c,                   /* 00001100 */
00330         0x18,                   /* 00011000 */
00331         0x00,                   /* 00000000 */
00332         0x00,                   /* 00000000 */
00333 
00334         /*
00335         * 27 0x1b '^[' 
00336         */
00337         0x00,                   /* 00000000 */
00338         0x30,                   /* 00110000 */
00339         0x60,                   /* 01100000 */
00340         0xfe,                   /* 11111110 */
00341         0x60,                   /* 01100000 */
00342         0x30,                   /* 00110000 */
00343         0x00,                   /* 00000000 */
00344         0x00,                   /* 00000000 */
00345 
00346         /*
00347         * 28 0x1c '^\' 
00348         */
00349         0x00,                   /* 00000000 */
00350         0x00,                   /* 00000000 */
00351         0xc0,                   /* 11000000 */
00352         0xc0,                   /* 11000000 */
00353         0xc0,                   /* 11000000 */
00354         0xfe,                   /* 11111110 */
00355         0x00,                   /* 00000000 */
00356         0x00,                   /* 00000000 */
00357 
00358         /*
00359         * 29 0x1d '^]' 
00360         */
00361         0x00,                   /* 00000000 */
00362         0x24,                   /* 00100100 */
00363         0x66,                   /* 01100110 */
00364         0xff,                   /* 11111111 */
00365         0x66,                   /* 01100110 */
00366         0x24,                   /* 00100100 */
00367         0x00,                   /* 00000000 */
00368         0x00,                   /* 00000000 */
00369 
00370         /*
00371         * 30 0x1e '^^' 
00372         */
00373         0x00,                   /* 00000000 */
00374         0x18,                   /* 00011000 */
00375         0x3c,                   /* 00111100 */
00376         0x7e,                   /* 01111110 */
00377         0xff,                   /* 11111111 */
00378         0xff,                   /* 11111111 */
00379         0x00,                   /* 00000000 */
00380         0x00,                   /* 00000000 */
00381 
00382         /*
00383         * 31 0x1f '^_' 
00384         */
00385         0x00,                   /* 00000000 */
00386         0xff,                   /* 11111111 */
00387         0xff,                   /* 11111111 */
00388         0x7e,                   /* 01111110 */
00389         0x3c,                   /* 00111100 */
00390         0x18,                   /* 00011000 */
00391         0x00,                   /* 00000000 */
00392         0x00,                   /* 00000000 */
00393 
00394         /*
00395         * 32 0x20 ' ' 
00396         */
00397         0x00,                   /* 00000000 */
00398         0x00,                   /* 00000000 */
00399         0x00,                   /* 00000000 */
00400         0x00,                   /* 00000000 */
00401         0x00,                   /* 00000000 */
00402         0x00,                   /* 00000000 */
00403         0x00,                   /* 00000000 */
00404         0x00,                   /* 00000000 */
00405 
00406         /*
00407         * 33 0x21 '!' 
00408         */
00409         0x18,                   /* 00011000 */
00410         0x3c,                   /* 00111100 */
00411         0x3c,                   /* 00111100 */
00412         0x18,                   /* 00011000 */
00413         0x18,                   /* 00011000 */
00414         0x00,                   /* 00000000 */
00415         0x18,                   /* 00011000 */
00416         0x00,                   /* 00000000 */
00417 
00418         /*
00419         * 34 0x22 '"' 
00420         */
00421         0x66,                   /* 01100110 */
00422         0x66,                   /* 01100110 */
00423         0x24,                   /* 00100100 */
00424         0x00,                   /* 00000000 */
00425         0x00,                   /* 00000000 */
00426         0x00,                   /* 00000000 */
00427         0x00,                   /* 00000000 */
00428         0x00,                   /* 00000000 */
00429 
00430         /*
00431         * 35 0x23 '#' 
00432         */
00433         0x6c,                   /* 01101100 */
00434         0x6c,                   /* 01101100 */
00435         0xfe,                   /* 11111110 */
00436         0x6c,                   /* 01101100 */
00437         0xfe,                   /* 11111110 */
00438         0x6c,                   /* 01101100 */
00439         0x6c,                   /* 01101100 */
00440         0x00,                   /* 00000000 */
00441 
00442         /*
00443         * 36 0x24 '$' 
00444         */
00445         0x18,                   /* 00011000 */
00446         0x3e,                   /* 00111110 */
00447         0x60,                   /* 01100000 */
00448         0x3c,                   /* 00111100 */
00449         0x06,                   /* 00000110 */
00450         0x7c,                   /* 01111100 */
00451         0x18,                   /* 00011000 */
00452         0x00,                   /* 00000000 */
00453 
00454         /*
00455         * 37 0x25 '%' 
00456         */
00457         0x00,                   /* 00000000 */
00458         0xc6,                   /* 11000110 */
00459         0xcc,                   /* 11001100 */
00460         0x18,                   /* 00011000 */
00461         0x30,                   /* 00110000 */
00462         0x66,                   /* 01100110 */
00463         0xc6,                   /* 11000110 */
00464         0x00,                   /* 00000000 */
00465 
00466         /*
00467         * 38 0x26 '&' 
00468         */
00469         0x38,                   /* 00111000 */
00470         0x6c,                   /* 01101100 */
00471         0x38,                   /* 00111000 */
00472         0x76,                   /* 01110110 */
00473         0xdc,                   /* 11011100 */
00474         0xcc,                   /* 11001100 */
00475         0x76,                   /* 01110110 */
00476         0x00,                   /* 00000000 */
00477 
00478         /*
00479         * 39 0x27 ''' 
00480         */
00481         0x18,                   /* 00011000 */
00482         0x18,                   /* 00011000 */
00483         0x30,                   /* 00110000 */
00484         0x00,                   /* 00000000 */
00485         0x00,                   /* 00000000 */
00486         0x00,                   /* 00000000 */
00487         0x00,                   /* 00000000 */
00488         0x00,                   /* 00000000 */
00489 
00490         /*
00491         * 40 0x28 '(' 
00492         */
00493         0x0c,                   /* 00001100 */
00494         0x18,                   /* 00011000 */
00495         0x30,                   /* 00110000 */
00496         0x30,                   /* 00110000 */
00497         0x30,                   /* 00110000 */
00498         0x18,                   /* 00011000 */
00499         0x0c,                   /* 00001100 */
00500         0x00,                   /* 00000000 */
00501 
00502         /*
00503         * 41 0x29 ')' 
00504         */
00505         0x30,                   /* 00110000 */
00506         0x18,                   /* 00011000 */
00507         0x0c,                   /* 00001100 */
00508         0x0c,                   /* 00001100 */
00509         0x0c,                   /* 00001100 */
00510         0x18,                   /* 00011000 */
00511         0x30,                   /* 00110000 */
00512         0x00,                   /* 00000000 */
00513 
00514         /*
00515         * 42 0x2a '*' 
00516         */
00517         0x00,                   /* 00000000 */
00518         0x66,                   /* 01100110 */
00519         0x3c,                   /* 00111100 */
00520         0xff,                   /* 11111111 */
00521         0x3c,                   /* 00111100 */
00522         0x66,                   /* 01100110 */
00523         0x00,                   /* 00000000 */
00524         0x00,                   /* 00000000 */
00525 
00526         /*
00527         * 43 0x2b '+' 
00528         */
00529         0x00,                   /* 00000000 */
00530         0x18,                   /* 00011000 */
00531         0x18,                   /* 00011000 */
00532         0x7e,                   /* 01111110 */
00533         0x18,                   /* 00011000 */
00534         0x18,                   /* 00011000 */
00535         0x00,                   /* 00000000 */
00536         0x00,                   /* 00000000 */
00537 
00538         /*
00539         * 44 0x2c ',' 
00540         */
00541         0x00,                   /* 00000000 */
00542         0x00,                   /* 00000000 */
00543         0x00,                   /* 00000000 */
00544         0x00,                   /* 00000000 */
00545         0x00,                   /* 00000000 */
00546         0x18,                   /* 00011000 */
00547         0x18,                   /* 00011000 */
00548         0x30,                   /* 00110000 */
00549 
00550         /*
00551         * 45 0x2d '-' 
00552         */
00553         0x00,                   /* 00000000 */
00554         0x00,                   /* 00000000 */
00555         0x00,                   /* 00000000 */
00556         0x7e,                   /* 01111110 */
00557         0x00,                   /* 00000000 */
00558         0x00,                   /* 00000000 */
00559         0x00,                   /* 00000000 */
00560         0x00,                   /* 00000000 */
00561 
00562         /*
00563         * 46 0x2e '.' 
00564         */
00565         0x00,                   /* 00000000 */
00566         0x00,                   /* 00000000 */
00567         0x00,                   /* 00000000 */
00568         0x00,                   /* 00000000 */
00569         0x00,                   /* 00000000 */
00570         0x18,                   /* 00011000 */
00571         0x18,                   /* 00011000 */
00572         0x00,                   /* 00000000 */
00573 
00574         /*
00575         * 47 0x2f '/' 
00576         */
00577         0x06,                   /* 00000110 */
00578         0x0c,                   /* 00001100 */
00579         0x18,                   /* 00011000 */
00580         0x30,                   /* 00110000 */
00581         0x60,                   /* 01100000 */
00582         0xc0,                   /* 11000000 */
00583         0x80,                   /* 10000000 */
00584         0x00,                   /* 00000000 */
00585 
00586         /*
00587         * 48 0x30 '0' 
00588         */
00589         0x38,                   /* 00111000 */
00590         0x6c,                   /* 01101100 */
00591         0xc6,                   /* 11000110 */
00592         0xd6,                   /* 11010110 */
00593         0xc6,                   /* 11000110 */
00594         0x6c,                   /* 01101100 */
00595         0x38,                   /* 00111000 */
00596         0x00,                   /* 00000000 */
00597 
00598         /*
00599         * 49 0x31 '1' 
00600         */
00601         0x18,                   /* 00011000 */
00602         0x38,                   /* 00111000 */
00603         0x18,                   /* 00011000 */
00604         0x18,                   /* 00011000 */
00605         0x18,                   /* 00011000 */
00606         0x18,                   /* 00011000 */
00607         0x7e,                   /* 01111110 */
00608         0x00,                   /* 00000000 */
00609 
00610         /*
00611         * 50 0x32 '2' 
00612         */
00613         0x7c,                   /* 01111100 */
00614         0xc6,                   /* 11000110 */
00615         0x06,                   /* 00000110 */
00616         0x1c,                   /* 00011100 */
00617         0x30,                   /* 00110000 */
00618         0x66,                   /* 01100110 */
00619         0xfe,                   /* 11111110 */
00620         0x00,                   /* 00000000 */
00621 
00622         /*
00623         * 51 0x33 '3' 
00624         */
00625         0x7c,                   /* 01111100 */
00626         0xc6,                   /* 11000110 */
00627         0x06,                   /* 00000110 */
00628         0x3c,                   /* 00111100 */
00629         0x06,                   /* 00000110 */
00630         0xc6,                   /* 11000110 */
00631         0x7c,                   /* 01111100 */
00632         0x00,                   /* 00000000 */
00633 
00634         /*
00635         * 52 0x34 '4' 
00636         */
00637         0x1c,                   /* 00011100 */
00638         0x3c,                   /* 00111100 */
00639         0x6c,                   /* 01101100 */
00640         0xcc,                   /* 11001100 */
00641         0xfe,                   /* 11111110 */
00642         0x0c,                   /* 00001100 */
00643         0x1e,                   /* 00011110 */
00644         0x00,                   /* 00000000 */
00645 
00646         /*
00647         * 53 0x35 '5' 
00648         */
00649         0xfe,                   /* 11111110 */
00650         0xc0,                   /* 11000000 */
00651         0xc0,                   /* 11000000 */
00652         0xfc,                   /* 11111100 */
00653         0x06,                   /* 00000110 */
00654         0xc6,                   /* 11000110 */
00655         0x7c,                   /* 01111100 */
00656         0x00,                   /* 00000000 */
00657 
00658         /*
00659         * 54 0x36 '6' 
00660         */
00661         0x38,                   /* 00111000 */
00662         0x60,                   /* 01100000 */
00663         0xc0,                   /* 11000000 */
00664         0xfc,                   /* 11111100 */
00665         0xc6,                   /* 11000110 */
00666         0xc6,                   /* 11000110 */
00667         0x7c,                   /* 01111100 */
00668         0x00,                   /* 00000000 */
00669 
00670         /*
00671         * 55 0x37 '7' 
00672         */
00673         0xfe,                   /* 11111110 */
00674         0xc6,                   /* 11000110 */
00675         0x0c,                   /* 00001100 */
00676         0x18,                   /* 00011000 */
00677         0x30,                   /* 00110000 */
00678         0x30,                   /* 00110000 */
00679         0x30,                   /* 00110000 */
00680         0x00,                   /* 00000000 */
00681 
00682         /*
00683         * 56 0x38 '8' 
00684         */
00685         0x7c,                   /* 01111100 */
00686         0xc6,                   /* 11000110 */
00687         0xc6,                   /* 11000110 */
00688         0x7c,                   /* 01111100 */
00689         0xc6,                   /* 11000110 */
00690         0xc6,                   /* 11000110 */
00691         0x7c,                   /* 01111100 */
00692         0x00,                   /* 00000000 */
00693 
00694         /*
00695         * 57 0x39 '9' 
00696         */
00697         0x7c,                   /* 01111100 */
00698         0xc6,                   /* 11000110 */
00699         0xc6,                   /* 11000110 */
00700         0x7e,                   /* 01111110 */
00701         0x06,                   /* 00000110 */
00702         0x0c,                   /* 00001100 */
00703         0x78,                   /* 01111000 */
00704         0x00,                   /* 00000000 */
00705 
00706         /*
00707         * 58 0x3a ':' 
00708         */
00709         0x00,                   /* 00000000 */
00710         0x18,                   /* 00011000 */
00711         0x18,                   /* 00011000 */
00712         0x00,                   /* 00000000 */
00713         0x00,                   /* 00000000 */
00714         0x18,                   /* 00011000 */
00715         0x18,                   /* 00011000 */
00716         0x00,                   /* 00000000 */
00717 
00718         /*
00719         * 59 0x3b ';' 
00720         */
00721         0x00,                   /* 00000000 */
00722         0x18,                   /* 00011000 */
00723         0x18,                   /* 00011000 */
00724         0x00,                   /* 00000000 */
00725         0x00,                   /* 00000000 */
00726         0x18,                   /* 00011000 */
00727         0x18,                   /* 00011000 */
00728         0x30,                   /* 00110000 */
00729 
00730         /*
00731         * 60 0x3c '<' 
00732         */
00733         0x06,                   /* 00000110 */
00734         0x0c,                   /* 00001100 */
00735         0x18,                   /* 00011000 */
00736         0x30,                   /* 00110000 */
00737         0x18,                   /* 00011000 */
00738         0x0c,                   /* 00001100 */
00739         0x06,                   /* 00000110 */
00740         0x00,                   /* 00000000 */
00741 
00742         /*
00743         * 61 0x3d '=' 
00744         */
00745         0x00,                   /* 00000000 */
00746         0x00,                   /* 00000000 */
00747         0x7e,                   /* 01111110 */
00748         0x00,                   /* 00000000 */
00749         0x00,                   /* 00000000 */
00750         0x7e,                   /* 01111110 */
00751         0x00,                   /* 00000000 */
00752         0x00,                   /* 00000000 */
00753 
00754         /*
00755         * 62 0x3e '>' 
00756         */
00757         0x60,                   /* 01100000 */
00758         0x30,                   /* 00110000 */
00759         0x18,                   /* 00011000 */
00760         0x0c,                   /* 00001100 */
00761         0x18,                   /* 00011000 */
00762         0x30,                   /* 00110000 */
00763         0x60,                   /* 01100000 */
00764         0x00,                   /* 00000000 */
00765 
00766         /*
00767         * 63 0x3f '?' 
00768         */
00769         0x7c,                   /* 01111100 */
00770         0xc6,                   /* 11000110 */
00771         0x0c,                   /* 00001100 */
00772         0x18,                   /* 00011000 */
00773         0x18,                   /* 00011000 */
00774         0x00,                   /* 00000000 */
00775         0x18,                   /* 00011000 */
00776         0x00,                   /* 00000000 */
00777 
00778         /*
00779         * 64 0x40 '@' 
00780         */
00781         0x7c,                   /* 01111100 */
00782         0xc6,                   /* 11000110 */
00783         0xde,                   /* 11011110 */
00784         0xde,                   /* 11011110 */
00785         0xde,                   /* 11011110 */
00786         0xc0,                   /* 11000000 */
00787         0x78,                   /* 01111000 */
00788         0x00,                   /* 00000000 */
00789 
00790         /*
00791         * 65 0x41 'A' 
00792         */
00793         0x38,                   /* 00111000 */
00794         0x6c,                   /* 01101100 */
00795         0xc6,                   /* 11000110 */
00796         0xfe,                   /* 11111110 */
00797         0xc6,                   /* 11000110 */
00798         0xc6,                   /* 11000110 */
00799         0xc6,                   /* 11000110 */
00800         0x00,                   /* 00000000 */
00801 
00802         /*
00803         * 66 0x42 'B' 
00804         */
00805         0xfc,                   /* 11111100 */
00806         0x66,                   /* 01100110 */
00807         0x66,                   /* 01100110 */
00808         0x7c,                   /* 01111100 */
00809         0x66,                   /* 01100110 */
00810         0x66,                   /* 01100110 */
00811         0xfc,                   /* 11111100 */
00812         0x00,                   /* 00000000 */
00813 
00814         /*
00815         * 67 0x43 'C' 
00816         */
00817         0x3c,                   /* 00111100 */
00818         0x66,                   /* 01100110 */
00819         0xc0,                   /* 11000000 */
00820         0xc0,                   /* 11000000 */
00821         0xc0,                   /* 11000000 */
00822         0x66,                   /* 01100110 */
00823         0x3c,                   /* 00111100 */
00824         0x00,                   /* 00000000 */
00825 
00826         /*
00827         * 68 0x44 'D' 
00828         */
00829         0xf8,                   /* 11111000 */
00830         0x6c,                   /* 01101100 */
00831         0x66,                   /* 01100110 */
00832         0x66,                   /* 01100110 */
00833         0x66,                   /* 01100110 */
00834         0x6c,                   /* 01101100 */
00835         0xf8,                   /* 11111000 */
00836         0x00,                   /* 00000000 */
00837 
00838         /*
00839         * 69 0x45 'E' 
00840         */
00841         0xfe,                   /* 11111110 */
00842         0x62,                   /* 01100010 */
00843         0x68,                   /* 01101000 */
00844         0x78,                   /* 01111000 */
00845         0x68,                   /* 01101000 */
00846         0x62,                   /* 01100010 */
00847         0xfe,                   /* 11111110 */
00848         0x00,                   /* 00000000 */
00849 
00850         /*
00851         * 70 0x46 'F' 
00852         */
00853         0xfe,                   /* 11111110 */
00854         0x62,                   /* 01100010 */
00855         0x68,                   /* 01101000 */
00856         0x78,                   /* 01111000 */
00857         0x68,                   /* 01101000 */
00858         0x60,                   /* 01100000 */
00859         0xf0,                   /* 11110000 */
00860         0x00,                   /* 00000000 */
00861 
00862         /*
00863         * 71 0x47 'G' 
00864         */
00865         0x3c,                   /* 00111100 */
00866         0x66,                   /* 01100110 */
00867         0xc0,                   /* 11000000 */
00868         0xc0,                   /* 11000000 */
00869         0xce,                   /* 11001110 */
00870         0x66,                   /* 01100110 */
00871         0x3a,                   /* 00111010 */
00872         0x00,                   /* 00000000 */
00873 
00874         /*
00875         * 72 0x48 'H' 
00876         */
00877         0xc6,                   /* 11000110 */
00878         0xc6,                   /* 11000110 */
00879         0xc6,                   /* 11000110 */
00880         0xfe,                   /* 11111110 */
00881         0xc6,                   /* 11000110 */
00882         0xc6,                   /* 11000110 */
00883         0xc6,                   /* 11000110 */
00884         0x00,                   /* 00000000 */
00885 
00886         /*
00887         * 73 0x49 'I' 
00888         */
00889         0x3c,                   /* 00111100 */
00890         0x18,                   /* 00011000 */
00891         0x18,                   /* 00011000 */
00892         0x18,                   /* 00011000 */
00893         0x18,                   /* 00011000 */
00894         0x18,                   /* 00011000 */
00895         0x3c,                   /* 00111100 */
00896         0x00,                   /* 00000000 */
00897 
00898         /*
00899         * 74 0x4a 'J' 
00900         */
00901         0x1e,                   /* 00011110 */
00902         0x0c,                   /* 00001100 */
00903         0x0c,                   /* 00001100 */
00904         0x0c,                   /* 00001100 */
00905         0xcc,                   /* 11001100 */
00906         0xcc,                   /* 11001100 */
00907         0x78,                   /* 01111000 */
00908         0x00,                   /* 00000000 */
00909 
00910         /*
00911         * 75 0x4b 'K' 
00912         */
00913         0xe6,                   /* 11100110 */
00914         0x66,                   /* 01100110 */
00915         0x6c,                   /* 01101100 */
00916         0x78,                   /* 01111000 */
00917         0x6c,                   /* 01101100 */
00918         0x66,                   /* 01100110 */
00919         0xe6,                   /* 11100110 */
00920         0x00,                   /* 00000000 */
00921 
00922         /*
00923         * 76 0x4c 'L' 
00924         */
00925         0xf0,                   /* 11110000 */
00926         0x60,                   /* 01100000 */
00927         0x60,                   /* 01100000 */
00928         0x60,                   /* 01100000 */
00929         0x62,                   /* 01100010 */
00930         0x66,                   /* 01100110 */
00931         0xfe,                   /* 11111110 */
00932         0x00,                   /* 00000000 */
00933 
00934         /*
00935         * 77 0x4d 'M' 
00936         */
00937         0xc6,                   /* 11000110 */
00938         0xee,                   /* 11101110 */
00939         0xfe,                   /* 11111110 */
00940         0xfe,                   /* 11111110 */
00941         0xd6,                   /* 11010110 */
00942         0xc6,                   /* 11000110 */
00943         0xc6,                   /* 11000110 */
00944         0x00,                   /* 00000000 */
00945 
00946         /*
00947         * 78 0x4e 'N' 
00948         */
00949         0xc6,                   /* 11000110 */
00950         0xe6,                   /* 11100110 */
00951         0xf6,                   /* 11110110 */
00952         0xde,                   /* 11011110 */
00953         0xce,                   /* 11001110 */
00954         0xc6,                   /* 11000110 */
00955         0xc6,                   /* 11000110 */
00956         0x00,                   /* 00000000 */
00957 
00958         /*
00959         * 79 0x4f 'O' 
00960         */
00961         0x7c,                   /* 01111100 */
00962         0xc6,                   /* 11000110 */
00963         0xc6,                   /* 11000110 */
00964         0xc6,                   /* 11000110 */
00965         0xc6,                   /* 11000110 */
00966         0xc6,                   /* 11000110 */
00967         0x7c,                   /* 01111100 */
00968         0x00,                   /* 00000000 */
00969 
00970         /*
00971         * 80 0x50 'P' 
00972         */
00973         0xfc,                   /* 11111100 */
00974         0x66,                   /* 01100110 */
00975         0x66,                   /* 01100110 */
00976         0x7c,                   /* 01111100 */
00977         0x60,                   /* 01100000 */
00978         0x60,                   /* 01100000 */
00979         0xf0,                   /* 11110000 */
00980         0x00,                   /* 00000000 */
00981 
00982         /*
00983         * 81 0x51 'Q' 
00984         */
00985         0x7c,                   /* 01111100 */
00986         0xc6,                   /* 11000110 */
00987         0xc6,                   /* 11000110 */
00988         0xc6,                   /* 11000110 */
00989         0xc6,                   /* 11000110 */
00990         0xce,                   /* 11001110 */
00991         0x7c,                   /* 01111100 */
00992         0x0e,                   /* 00001110 */
00993 
00994         /*
00995         * 82 0x52 'R' 
00996         */
00997         0xfc,                   /* 11111100 */
00998         0x66,                   /* 01100110 */
00999         0x66,                   /* 01100110 */
01000         0x7c,                   /* 01111100 */
01001         0x6c,                   /* 01101100 */
01002         0x66,                   /* 01100110 */
01003         0xe6,                   /* 11100110 */
01004         0x00,                   /* 00000000 */
01005 
01006         /*
01007         * 83 0x53 'S' 
01008         */
01009         0x3c,                   /* 00111100 */
01010         0x66,                   /* 01100110 */
01011         0x30,                   /* 00110000 */
01012         0x18,                   /* 00011000 */
01013         0x0c,                   /* 00001100 */
01014         0x66,                   /* 01100110 */
01015         0x3c,                   /* 00111100 */
01016         0x00,                   /* 00000000 */
01017 
01018         /*
01019         * 84 0x54 'T' 
01020         */
01021         0x7e,                   /* 01111110 */
01022         0x7e,                   /* 01111110 */
01023         0x5a,                   /* 01011010 */
01024         0x18,                   /* 00011000 */
01025         0x18,                   /* 00011000 */
01026         0x18,                   /* 00011000 */
01027         0x3c,                   /* 00111100 */
01028         0x00,                   /* 00000000 */
01029 
01030         /*
01031         * 85 0x55 'U' 
01032         */
01033         0xc6,                   /* 11000110 */
01034         0xc6,                   /* 11000110 */
01035         0xc6,                   /* 11000110 */
01036         0xc6,                   /* 11000110 */
01037         0xc6,                   /* 11000110 */
01038         0xc6,                   /* 11000110 */
01039         0x7c,                   /* 01111100 */
01040         0x00,                   /* 00000000 */
01041 
01042         /*
01043         * 86 0x56 'V' 
01044         */
01045         0xc6,                   /* 11000110 */
01046         0xc6,                   /* 11000110 */
01047         0xc6,                   /* 11000110 */
01048         0xc6,                   /* 11000110 */
01049         0xc6,                   /* 11000110 */
01050         0x6c,                   /* 01101100 */
01051         0x38,                   /* 00111000 */
01052         0x00,                   /* 00000000 */
01053 
01054         /*
01055         * 87 0x57 'W' 
01056         */
01057         0xc6,                   /* 11000110 */
01058         0xc6,                   /* 11000110 */
01059         0xc6,                   /* 11000110 */
01060         0xd6,                   /* 11010110 */
01061         0xd6,                   /* 11010110 */
01062         0xfe,                   /* 11111110 */
01063         0x6c,                   /* 01101100 */
01064         0x00,                   /* 00000000 */
01065 
01066         /*
01067         * 88 0x58 'X' 
01068         */
01069         0xc6,                   /* 11000110 */
01070         0xc6,                   /* 11000110 */
01071         0x6c,                   /* 01101100 */
01072         0x38,                   /* 00111000 */
01073         0x6c,                   /* 01101100 */
01074         0xc6,                   /* 11000110 */
01075         0xc6,                   /* 11000110 */
01076         0x00,                   /* 00000000 */
01077 
01078         /*
01079         * 89 0x59 'Y' 
01080         */
01081         0x66,                   /* 01100110 */
01082         0x66,                   /* 01100110 */
01083         0x66,                   /* 01100110 */
01084         0x3c,                   /* 00111100 */
01085         0x18,                   /* 00011000 */
01086         0x18,                   /* 00011000 */
01087         0x3c,                   /* 00111100 */
01088         0x00,                   /* 00000000 */
01089 
01090         /*
01091         * 90 0x5a 'Z' 
01092         */
01093         0xfe,                   /* 11111110 */
01094         0xc6,                   /* 11000110 */
01095         0x8c,                   /* 10001100 */
01096         0x18,                   /* 00011000 */
01097         0x32,                   /* 00110010 */
01098         0x66,                   /* 01100110 */
01099         0xfe,                   /* 11111110 */
01100         0x00,                   /* 00000000 */
01101 
01102         /*
01103         * 91 0x5b '[' 
01104         */
01105         0x3c,                   /* 00111100 */
01106         0x30,                   /* 00110000 */
01107         0x30,                   /* 00110000 */
01108         0x30,                   /* 00110000 */
01109         0x30,                   /* 00110000 */
01110         0x30,                   /* 00110000 */
01111         0x3c,                   /* 00111100 */
01112         0x00,                   /* 00000000 */
01113 
01114         /*
01115         * 92 0x5c '\' 
01116         */
01117         0xc0,                   /* 11000000 */
01118         0x60,                   /* 01100000 */
01119         0x30,                   /* 00110000 */
01120         0x18,                   /* 00011000 */
01121         0x0c,                   /* 00001100 */
01122         0x06,                   /* 00000110 */
01123         0x02,                   /* 00000010 */
01124         0x00,                   /* 00000000 */
01125 
01126         /*
01127         * 93 0x5d ']' 
01128         */
01129         0x3c,                   /* 00111100 */
01130         0x0c,                   /* 00001100 */
01131         0x0c,                   /* 00001100 */
01132         0x0c,                   /* 00001100 */
01133         0x0c,                   /* 00001100 */
01134         0x0c,                   /* 00001100 */
01135         0x3c,                   /* 00111100 */
01136         0x00,                   /* 00000000 */
01137 
01138         /*
01139         * 94 0x5e '^' 
01140         */
01141         0x10,                   /* 00010000 */
01142         0x38,                   /* 00111000 */
01143         0x6c,                   /* 01101100 */
01144         0xc6,                   /* 11000110 */
01145         0x00,                   /* 00000000 */
01146         0x00,                   /* 00000000 */
01147         0x00,                   /* 00000000 */
01148         0x00,                   /* 00000000 */
01149 
01150         /*
01151         * 95 0x5f '_' 
01152         */
01153         0x00,                   /* 00000000 */
01154         0x00,                   /* 00000000 */
01155         0x00,                   /* 00000000 */
01156         0x00,                   /* 00000000 */
01157         0x00,                   /* 00000000 */
01158         0x00,                   /* 00000000 */
01159         0x00,                   /* 00000000 */
01160         0xff,                   /* 11111111 */
01161 
01162         /*
01163         * 96 0x60 '`' 
01164         */
01165         0x30,                   /* 00110000 */
01166         0x18,                   /* 00011000 */
01167         0x0c,                   /* 00001100 */
01168         0x00,                   /* 00000000 */
01169         0x00,                   /* 00000000 */
01170         0x00,                   /* 00000000 */
01171         0x00,                   /* 00000000 */
01172         0x00,                   /* 00000000 */
01173 
01174         /*
01175         * 97 0x61 'a' 
01176         */
01177         0x00,                   /* 00000000 */
01178         0x00,                   /* 00000000 */
01179         0x78,                   /* 01111000 */
01180         0x0c,                   /* 00001100 */
01181         0x7c,                   /* 01111100 */
01182         0xcc,                   /* 11001100 */
01183         0x76,                   /* 01110110 */
01184         0x00,                   /* 00000000 */
01185 
01186         /*
01187         * 98 0x62 'b' 
01188         */
01189         0xe0,                   /* 11100000 */
01190         0x60,                   /* 01100000 */
01191         0x7c,                   /* 01111100 */
01192         0x66,                   /* 01100110 */
01193         0x66,                   /* 01100110 */
01194         0x66,                   /* 01100110 */
01195         0xdc,                   /* 11011100 */
01196         0x00,                   /* 00000000 */
01197 
01198         /*
01199         * 99 0x63 'c' 
01200         */
01201         0x00,                   /* 00000000 */
01202         0x00,                   /* 00000000 */
01203         0x7c,                   /* 01111100 */
01204         0xc6,                   /* 11000110 */
01205         0xc0,                   /* 11000000 */
01206         0xc6,                   /* 11000110 */
01207         0x7c,                   /* 01111100 */
01208         0x00,                   /* 00000000 */
01209 
01210         /*
01211         * 100 0x64 'd' 
01212         */
01213         0x1c,                   /* 00011100 */
01214         0x0c,                   /* 00001100 */
01215         0x7c,                   /* 01111100 */
01216         0xcc,                   /* 11001100 */
01217         0xcc,                   /* 11001100 */
01218         0xcc,                   /* 11001100 */
01219         0x76,                   /* 01110110 */
01220         0x00,                   /* 00000000 */
01221 
01222         /*
01223         * 101 0x65 'e' 
01224         */
01225         0x00,                   /* 00000000 */
01226         0x00,                   /* 00000000 */
01227         0x7c,                   /* 01111100 */
01228         0xc6,                   /* 11000110 */
01229         0xfe,                   /* 11111110 */
01230         0xc0,                   /* 11000000 */
01231         0x7c,                   /* 01111100 */
01232         0x00,                   /* 00000000 */
01233 
01234         /*
01235         * 102 0x66 'f' 
01236         */
01237         0x3c,                   /* 00111100 */
01238         0x66,                   /* 01100110 */
01239         0x60,                   /* 01100000 */
01240         0xf8,                   /* 11111000 */
01241         0x60,                   /* 01100000 */
01242         0x60,                   /* 01100000 */
01243         0xf0,                   /* 11110000 */
01244         0x00,                   /* 00000000 */
01245 
01246         /*
01247         * 103 0x67 'g' 
01248         */
01249         0x00,                   /* 00000000 */
01250         0x00,                   /* 00000000 */
01251         0x76,                   /* 01110110 */
01252         0xcc,                   /* 11001100 */
01253         0xcc,                   /* 11001100 */
01254         0x7c,                   /* 01111100 */
01255         0x0c,                   /* 00001100 */
01256         0xf8,                   /* 11111000 */
01257 
01258         /*
01259         * 104 0x68 'h' 
01260         */
01261         0xe0,                   /* 11100000 */
01262         0x60,                   /* 01100000 */
01263         0x6c,                   /* 01101100 */
01264         0x76,                   /* 01110110 */
01265         0x66,                   /* 01100110 */
01266         0x66,                   /* 01100110 */
01267         0xe6,                   /* 11100110 */
01268         0x00,                   /* 00000000 */
01269 
01270         /*
01271         * 105 0x69 'i' 
01272         */
01273         0x18,                   /* 00011000 */
01274         0x00,                   /* 00000000 */
01275         0x38,                   /* 00111000 */
01276         0x18,                   /* 00011000 */
01277         0x18,                   /* 00011000 */
01278         0x18,                   /* 00011000 */
01279         0x3c,                   /* 00111100 */
01280         0x00,                   /* 00000000 */
01281 
01282         /*
01283         * 106 0x6a 'j' 
01284         */
01285         0x06,                   /* 00000110 */
01286         0x00,                   /* 00000000 */
01287         0x06,                   /* 00000110 */
01288         0x06,                   /* 00000110 */
01289         0x06,                   /* 00000110 */
01290         0x66,                   /* 01100110 */
01291         0x66,                   /* 01100110 */
01292         0x3c,                   /* 00111100 */
01293 
01294         /*
01295         * 107 0x6b 'k' 
01296         */
01297         0xe0,                   /* 11100000 */
01298         0x60,                   /* 01100000 */
01299         0x66,                   /* 01100110 */
01300         0x6c,                   /* 01101100 */
01301         0x78,                   /* 01111000 */
01302         0x6c,                   /* 01101100 */
01303         0xe6,                   /* 11100110 */
01304         0x00,                   /* 00000000 */
01305 
01306         /*
01307         * 108 0x6c 'l' 
01308         */
01309         0x38,                   /* 00111000 */
01310         0x18,                   /* 00011000 */
01311         0x18,                   /* 00011000 */
01312         0x18,                   /* 00011000 */
01313         0x18,                   /* 00011000 */
01314         0x18,                   /* 00011000 */
01315         0x3c,                   /* 00111100 */
01316         0x00,                   /* 00000000 */
01317 
01318         /*
01319         * 109 0x6d 'm' 
01320         */
01321         0x00,                   /* 00000000 */
01322         0x00,                   /* 00000000 */
01323         0xec,                   /* 11101100 */
01324         0xfe,                   /* 11111110 */
01325         0xd6,                   /* 11010110 */
01326         0xd6,                   /* 11010110 */
01327         0xd6,                   /* 11010110 */
01328         0x00,                   /* 00000000 */
01329 
01330         /*
01331         * 110 0x6e 'n' 
01332         */
01333         0x00,                   /* 00000000 */
01334         0x00,                   /* 00000000 */
01335         0xdc,                   /* 11011100 */
01336         0x66,                   /* 01100110 */
01337         0x66,                   /* 01100110 */
01338         0x66,                   /* 01100110 */
01339         0x66,                   /* 01100110 */
01340         0x00,                   /* 00000000 */
01341 
01342         /*
01343         * 111 0x6f 'o' 
01344         */
01345         0x00,                   /* 00000000 */
01346         0x00,                   /* 00000000 */
01347         0x7c,                   /* 01111100 */
01348         0xc6,                   /* 11000110 */
01349         0xc6,                   /* 11000110 */
01350         0xc6,                   /* 11000110 */
01351         0x7c,                   /* 01111100 */
01352         0x00,                   /* 00000000 */
01353 
01354         /*
01355         * 112 0x70 'p' 
01356         */
01357         0x00,                   /* 00000000 */
01358         0x00,                   /* 00000000 */
01359         0xdc,                   /* 11011100 */
01360         0x66,                   /* 01100110 */
01361         0x66,                   /* 01100110 */
01362         0x7c,                   /* 01111100 */
01363         0x60,                   /* 01100000 */
01364         0xf0,                   /* 11110000 */
01365 
01366         /*
01367         * 113 0x71 'q' 
01368         */
01369         0x00,                   /* 00000000 */
01370         0x00,                   /* 00000000 */
01371         0x76,                   /* 01110110 */
01372         0xcc,                   /* 11001100 */
01373         0xcc,                   /* 11001100 */
01374         0x7c,                   /* 01111100 */
01375         0x0c,                   /* 00001100 */
01376         0x1e,                   /* 00011110 */
01377 
01378         /*
01379         * 114 0x72 'r' 
01380         */
01381         0x00,                   /* 00000000 */
01382         0x00,                   /* 00000000 */
01383         0xdc,                   /* 11011100 */
01384         0x76,                   /* 01110110 */
01385         0x60,                   /* 01100000 */
01386         0x60,                   /* 01100000 */
01387         0xf0,                   /* 11110000 */
01388         0x00,                   /* 00000000 */
01389 
01390         /*
01391         * 115 0x73 's' 
01392         */
01393         0x00,                   /* 00000000 */
01394         0x00,                   /* 00000000 */
01395         0x7e,                   /* 01111110 */
01396         0xc0,                   /* 11000000 */
01397         0x7c,                   /* 01111100 */
01398         0x06,                   /* 00000110 */
01399         0xfc,                   /* 11111100 */
01400         0x00,                   /* 00000000 */
01401 
01402         /*
01403         * 116 0x74 't' 
01404         */
01405         0x30,                   /* 00110000 */
01406         0x30,                   /* 00110000 */
01407         0xfc,                   /* 11111100 */
01408         0x30,                   /* 00110000 */
01409         0x30,                   /* 00110000 */
01410         0x36,                   /* 00110110 */
01411         0x1c,                   /* 00011100 */
01412         0x00,                   /* 00000000 */
01413 
01414         /*
01415         * 117 0x75 'u' 
01416         */
01417         0x00,                   /* 00000000 */
01418         0x00,                   /* 00000000 */
01419         0xcc,                   /* 11001100 */
01420         0xcc,                   /* 11001100 */
01421         0xcc,                   /* 11001100 */
01422         0xcc,                   /* 11001100 */
01423         0x76,                   /* 01110110 */
01424         0x00,                   /* 00000000 */
01425 
01426         /*
01427         * 118 0x76 'v' 
01428         */
01429         0x00,                   /* 00000000 */
01430         0x00,                   /* 00000000 */
01431         0xc6,                   /* 11000110 */
01432         0xc6,                   /* 11000110 */
01433         0xc6,                   /* 11000110 */
01434         0x6c,                   /* 01101100 */
01435         0x38,                   /* 00111000 */
01436         0x00,                   /* 00000000 */
01437 
01438         /*
01439         * 119 0x77 'w' 
01440         */
01441         0x00,                   /* 00000000 */
01442         0x00,                   /* 00000000 */
01443         0xc6,                   /* 11000110 */
01444         0xd6,                   /* 11010110 */
01445         0xd6,                   /* 11010110 */
01446         0xfe,                   /* 11111110 */
01447         0x6c,                   /* 01101100 */
01448         0x00,                   /* 00000000 */
01449 
01450         /*
01451         * 120 0x78 'x' 
01452         */
01453         0x00,                   /* 00000000 */
01454         0x00,                   /* 00000000 */
01455         0xc6,                   /* 11000110 */
01456         0x6c,                   /* 01101100 */
01457         0x38,                   /* 00111000 */
01458         0x6c,                   /* 01101100 */
01459         0xc6,                   /* 11000110 */
01460         0x00,                   /* 00000000 */
01461 
01462         /*
01463         * 121 0x79 'y' 
01464         */
01465         0x00,                   /* 00000000 */
01466         0x00,                   /* 00000000 */
01467         0xc6,                   /* 11000110 */
01468         0xc6,                   /* 11000110 */
01469         0xc6,                   /* 11000110 */
01470         0x7e,                   /* 01111110 */
01471         0x06,                   /* 00000110 */
01472         0xfc,                   /* 11111100 */
01473 
01474         /*
01475         * 122 0x7a 'z' 
01476         */
01477         0x00,                   /* 00000000 */
01478         0x00,                   /* 00000000 */
01479         0x7e,                   /* 01111110 */
01480         0x4c,                   /* 01001100 */
01481         0x18,                   /* 00011000 */
01482         0x32,                   /* 00110010 */
01483         0x7e,                   /* 01111110 */
01484         0x00,                   /* 00000000 */
01485 
01486         /*
01487         * 123 0x7b '{' 
01488         */
01489         0x0e,                   /* 00001110 */
01490         0x18,                   /* 00011000 */
01491         0x18,                   /* 00011000 */
01492         0x70,                   /* 01110000 */
01493         0x18,                   /* 00011000 */
01494         0x18,                   /* 00011000 */
01495         0x0e,                   /* 00001110 */
01496         0x00,                   /* 00000000 */
01497 
01498         /*
01499         * 124 0x7c '|' 
01500         */
01501         0x18,                   /* 00011000 */
01502         0x18,                   /* 00011000 */
01503         0x18,                   /* 00011000 */
01504         0x18,                   /* 00011000 */
01505         0x18,                   /* 00011000 */
01506         0x18,                   /* 00011000 */
01507         0x18,                   /* 00011000 */
01508         0x00,                   /* 00000000 */
01509 
01510         /*
01511         * 125 0x7d '}' 
01512         */
01513         0x70,                   /* 01110000 */
01514         0x18,                   /* 00011000 */
01515         0x18,                   /* 00011000 */
01516         0x0e,                   /* 00001110 */
01517         0x18,                   /* 00011000 */
01518         0x18,                   /* 00011000 */
01519         0x70,                   /* 01110000 */
01520         0x00,                   /* 00000000 */
01521 
01522         /*
01523         * 126 0x7e '~' 
01524         */
01525         0x76,                   /* 01110110 */
01526         0xdc,                   /* 11011100 */
01527         0x00,                   /* 00000000 */
01528         0x00,                   /* 00000000 */
01529         0x00,                   /* 00000000 */
01530         0x00,                   /* 00000000 */
01531         0x00,                   /* 00000000 */
01532         0x00,                   /* 00000000 */
01533 
01534         /*
01535         * 127 0x7f '' 
01536         */
01537         0x00,                   /* 00000000 */
01538         0x10,                   /* 00010000 */
01539         0x38,                   /* 00111000 */
01540         0x6c,                   /* 01101100 */
01541         0xc6,                   /* 11000110 */
01542         0xc6,                   /* 11000110 */
01543         0xfe,                   /* 11111110 */
01544         0x00,                   /* 00000000 */
01545 
01546         /*
01547         * 128 0x80 '€' 
01548         */
01549         0x7c,                   /* 01111100 */
01550         0xc6,                   /* 11000110 */
01551         0xc0,                   /* 11000000 */
01552         0xc0,                   /* 11000000 */
01553         0xc6,                   /* 11000110 */
01554         0x7c,                   /* 01111100 */
01555         0x0c,                   /* 00001100 */
01556         0x78,                   /* 01111000 */
01557 
01558         /*
01559         * 129 0x81 '' 
01560         */
01561         0xcc,                   /* 11001100 */
01562         0x00,                   /* 00000000 */
01563         0xcc,                   /* 11001100 */
01564         0xcc,                   /* 11001100 */
01565         0xcc,                   /* 11001100 */
01566         0xcc,                   /* 11001100 */
01567         0x76,                   /* 01110110 */
01568         0x00,                   /* 00000000 */
01569 
01570         /*
01571         * 130 0x82 '‚' 
01572         */
01573         0x0c,                   /* 00001100 */
01574         0x18,                   /* 00011000 */
01575         0x7c,                   /* 01111100 */
01576         0xc6,                   /* 11000110 */
01577         0xfe,                   /* 11111110 */
01578         0xc0,                   /* 11000000 */
01579         0x7c,                   /* 01111100 */
01580         0x00,                   /* 00000000 */
01581 
01582         /*
01583         * 131 0x83 'ƒ' 
01584         */
01585         0x7c,                   /* 01111100 */
01586         0x82,                   /* 10000010 */
01587         0x78,                   /* 01111000 */
01588         0x0c,                   /* 00001100 */
01589         0x7c,                   /* 01111100 */
01590         0xcc,                   /* 11001100 */
01591         0x76,                   /* 01110110 */
01592         0x00,                   /* 00000000 */
01593 
01594         /*
01595         * 132 0x84 '„' 
01596         */
01597         0xc6,                   /* 11000110 */
01598         0x00,                   /* 00000000 */
01599         0x78,                   /* 01111000 */
01600         0x0c,                   /* 00001100 */
01601         0x7c,                   /* 01111100 */
01602         0xcc,                   /* 11001100 */
01603         0x76,                   /* 01110110 */
01604         0x00,                   /* 00000000 */
01605 
01606         /*
01607         * 133 0x85 '…' 
01608         */
01609         0x30,                   /* 00110000 */
01610         0x18,                   /* 00011000 */
01611         0x78,                   /* 01111000 */
01612         0x0c,                   /* 00001100 */
01613         0x7c,                   /* 01111100 */
01614         0xcc,                   /* 11001100 */
01615         0x76,                   /* 01110110 */
01616         0x00,                   /* 00000000 */
01617 
01618         /*
01619         * 134 0x86 '†' 
01620         */
01621         0x30,                   /* 00110000 */
01622         0x30,                   /* 00110000 */
01623         0x78,                   /* 01111000 */
01624         0x0c,                   /* 00001100 */
01625         0x7c,                   /* 01111100 */
01626         0xcc,                   /* 11001100 */
01627         0x76,                   /* 01110110 */
01628         0x00,                   /* 00000000 */
01629 
01630         /*
01631         * 135 0x87 '‡' 
01632         */
01633         0x00,                   /* 00000000 */
01634         0x00,                   /* 00000000 */
01635         0x7e,                   /* 01111110 */
01636         0xc0,                   /* 11000000 */
01637         0xc0,                   /* 11000000 */
01638         0x7e,                   /* 01111110 */
01639         0x0c,                   /* 00001100 */
01640         0x38,                   /* 00111000 */
01641 
01642         /*
01643         * 136 0x88 'ˆ' 
01644         */
01645         0x7c,                   /* 01111100 */
01646         0x82,                   /* 10000010 */
01647         0x7c,                   /* 01111100 */
01648         0xc6,                   /* 11000110 */
01649         0xfe,                   /* 11111110 */
01650         0xc0,                   /* 11000000 */
01651         0x7c,                   /* 01111100 */
01652         0x00,                   /* 00000000 */
01653 
01654         /*
01655         * 137 0x89 '‰' 
01656         */
01657         0xc6,                   /* 11000110 */
01658         0x00,                   /* 00000000 */
01659         0x7c,                   /* 01111100 */
01660         0xc6,                   /* 11000110 */
01661         0xfe,                   /* 11111110 */
01662         0xc0,                   /* 11000000 */
01663         0x7c,                   /* 01111100 */
01664         0x00,                   /* 00000000 */
01665 
01666         /*
01667         * 138 0x8a 'Š' 
01668         */
01669         0x30,                   /* 00110000 */
01670         0x18,                   /* 00011000 */
01671         0x7c,                   /* 01111100 */
01672         0xc6,                   /* 11000110 */
01673         0xfe,                   /* 11111110 */
01674         0xc0,                   /* 11000000 */
01675         0x7c,                   /* 01111100 */
01676         0x00,                   /* 00000000 */
01677 
01678         /*
01679         * 139 0x8b '‹' 
01680         */
01681         0x66,                   /* 01100110 */
01682         0x00,                   /* 00000000 */
01683         0x38,                   /* 00111000 */
01684         0x18,                   /* 00011000 */
01685         0x18,                   /* 00011000 */
01686         0x18,                   /* 00011000 */
01687         0x3c,                   /* 00111100 */
01688         0x00,                   /* 00000000 */
01689 
01690         /*
01691         * 140 0x8c 'Œ' 
01692         */
01693         0x7c,                   /* 01111100 */
01694         0x82,                   /* 10000010 */
01695         0x38,                   /* 00111000 */
01696         0x18,                   /* 00011000 */
01697         0x18,                   /* 00011000 */
01698         0x18,                   /* 00011000 */
01699         0x3c,                   /* 00111100 */
01700         0x00,                   /* 00000000 */
01701 
01702         /*
01703         * 141 0x8d '' 
01704         */
01705         0x30,                   /* 00110000 */
01706         0x18,                   /* 00011000 */
01707         0x00,                   /* 00000000 */
01708         0x38,                   /* 00111000 */
01709         0x18,                   /* 00011000 */
01710         0x18,                   /* 00011000 */
01711         0x3c,                   /* 00111100 */
01712         0x00,                   /* 00000000 */
01713 
01714         /*
01715         * 142 0x8e 'Ž' 
01716         */
01717         0xc6,                   /* 11000110 */
01718         0x38,                   /* 00111000 */
01719         0x6c,                   /* 01101100 */
01720         0xc6,                   /* 11000110 */
01721         0xfe,                   /* 11111110 */
01722         0xc6,                   /* 11000110 */
01723         0xc6,                   /* 11000110 */
01724         0x00,                   /* 00000000 */
01725 
01726         /*
01727         * 143 0x8f '' 
01728         */
01729         0x38,                   /* 00111000 */
01730         0x6c,                   /* 01101100 */
01731         0x7c,                   /* 01111100 */
01732         0xc6,                   /* 11000110 */
01733         0xfe,                   /* 11111110 */
01734         0xc6,                   /* 11000110 */
01735         0xc6,                   /* 11000110 */
01736         0x00,                   /* 00000000 */
01737 
01738         /*
01739         * 144 0x90 '' 
01740         */
01741         0x18,                   /* 00011000 */
01742         0x30,                   /* 00110000 */
01743         0xfe,                   /* 11111110 */
01744         0xc0,                   /* 11000000 */
01745         0xf8,                   /* 11111000 */
01746         0xc0,                   /* 11000000 */
01747         0xfe,                   /* 11111110 */
01748         0x00,                   /* 00000000 */
01749 
01750         /*
01751         * 145 0x91 '‘' 
01752         */
01753         0x00,                   /* 00000000 */
01754         0x00,                   /* 00000000 */
01755         0x7e,                   /* 01111110 */
01756         0x18,                   /* 00011000 */
01757         0x7e,                   /* 01111110 */
01758         0xd8,                   /* 11011000 */
01759         0x7e,                   /* 01111110 */
01760         0x00,                   /* 00000000 */
01761 
01762         /*
01763         * 146 0x92 '’' 
01764         */
01765         0x3e,                   /* 00111110 */
01766         0x6c,                   /* 01101100 */
01767         0xcc,                   /* 11001100 */
01768         0xfe,                   /* 11111110 */
01769         0xcc,                   /* 11001100 */
01770         0xcc,                   /* 11001100 */
01771         0xce,                   /* 11001110 */
01772         0x00,                   /* 00000000 */
01773 
01774         /*
01775         * 147 0x93 '“' 
01776         */
01777         0x7c,                   /* 01111100 */
01778         0x82,                   /* 10000010 */
01779         0x7c,                   /* 01111100 */
01780         0xc6,                   /* 11000110 */
01781         0xc6,                   /* 11000110 */
01782         0xc6,                   /* 11000110 */
01783         0x7c,                   /* 01111100 */
01784         0x00,                   /* 00000000 */
01785 
01786         /*
01787         * 148 0x94 '”' 
01788         */
01789         0xc6,                   /* 11000110 */
01790         0x00,                   /* 00000000 */
01791         0x7c,                   /* 01111100 */
01792         0xc6,                   /* 11000110 */
01793         0xc6,                   /* 11000110 */
01794         0xc6,                   /* 11000110 */
01795         0x7c,                   /* 01111100 */
01796         0x00,                   /* 00000000 */
01797 
01798         /*
01799         * 149 0x95 '•' 
01800         */
01801         0x30,                   /* 00110000 */
01802         0x18,                   /* 00011000 */
01803         0x7c,                   /* 01111100 */
01804         0xc6,                   /* 11000110 */
01805         0xc6,                   /* 11000110 */
01806         0xc6,                   /* 11000110 */
01807         0x7c,                   /* 01111100 */
01808         0x00,                   /* 00000000 */
01809 
01810         /*
01811         * 150 0x96 '–' 
01812         */
01813         0x78,                   /* 01111000 */
01814         0x84,                   /* 10000100 */
01815         0x00,                   /* 00000000 */
01816         0xcc,                   /* 11001100 */
01817         0xcc,                   /* 11001100 */
01818         0xcc,                   /* 11001100 */
01819         0x76,                   /* 01110110 */
01820         0x00,                   /* 00000000 */
01821 
01822         /*
01823         * 151 0x97 '—' 
01824         */
01825         0x60,                   /* 01100000 */
01826         0x30,                   /* 00110000 */
01827         0xcc,                   /* 11001100 */
01828         0xcc,                   /* 11001100 */
01829         0xcc,                   /* 11001100 */
01830         0xcc,                   /* 11001100 */
01831         0x76,                   /* 01110110 */
01832         0x00,                   /* 00000000 */
01833 
01834         /*
01835         * 152 0x98 '˜' 
01836         */
01837         0xc6,                   /* 11000110 */
01838         0x00,                   /* 00000000 */
01839         0xc6,                   /* 11000110 */
01840         0xc6,                   /* 11000110 */
01841         0xc6,                   /* 11000110 */
01842         0x7e,                   /* 01111110 */
01843         0x06,                   /* 00000110 */
01844         0xfc,                   /* 11111100 */
01845 
01846         /*
01847         * 153 0x99 '™' 
01848         */
01849         0xc6,                   /* 11000110 */
01850         0x38,                   /* 00111000 */
01851         0x6c,                   /* 01101100 */
01852         0xc6,                   /* 11000110 */
01853         0xc6,                   /* 11000110 */
01854         0x6c,                   /* 01101100 */
01855         0x38,                   /* 00111000 */
01856         0x00,                   /* 00000000 */
01857 
01858         /*
01859         * 154 0x9a 'š' 
01860         */
01861         0xc6,                   /* 11000110 */
01862         0x00,                   /* 00000000 */
01863         0xc6,                   /* 11000110 */
01864         0xc6,                   /* 11000110 */
01865         0xc6,                   /* 11000110 */
01866         0xc6,                   /* 11000110 */
01867         0x7c,                   /* 01111100 */
01868         0x00,                   /* 00000000 */
01869 
01870         /*
01871         * 155 0x9b '›' 
01872         */
01873         0x18,                   /* 00011000 */
01874         0x18,                   /* 00011000 */
01875         0x7e,                   /* 01111110 */
01876         0xc0,                   /* 11000000 */
01877         0xc0,                   /* 11000000 */
01878         0x7e,                   /* 01111110 */
01879         0x18,                   /* 00011000 */
01880         0x18,                   /* 00011000 */
01881 
01882         /*
01883         * 156 0x9c 'œ' 
01884         */
01885         0x38,                   /* 00111000 */
01886         0x6c,                   /* 01101100 */
01887         0x64,                   /* 01100100 */
01888         0xf0,                   /* 11110000 */
01889         0x60,                   /* 01100000 */
01890         0x66,                   /* 01100110 */
01891         0xfc,                   /* 11111100 */
01892         0x00,                   /* 00000000 */
01893 
01894         /*
01895         * 157 0x9d '' 
01896         */
01897         0x66,                   /* 01100110 */
01898         0x66,                   /* 01100110 */
01899         0x3c,                   /* 00111100 */
01900         0x7e,                   /* 01111110 */
01901         0x18,                   /* 00011000 */
01902         0x7e,                   /* 01111110 */
01903         0x18,                   /* 00011000 */
01904         0x18,                   /* 00011000 */
01905 
01906         /*
01907         * 158 0x9e 'ž' 
01908         */
01909         0xf8,                   /* 11111000 */
01910         0xcc,                   /* 11001100 */
01911         0xcc,                   /* 11001100 */
01912         0xfa,                   /* 11111010 */
01913         0xc6,                   /* 11000110 */
01914         0xcf,                   /* 11001111 */
01915         0xc6,                   /* 11000110 */
01916         0xc7,                   /* 11000111 */
01917 
01918         /*
01919         * 159 0x9f 'Ÿ' 
01920         */
01921         0x0e,                   /* 00001110 */
01922         0x1b,                   /* 00011011 */
01923         0x18,                   /* 00011000 */
01924         0x3c,                   /* 00111100 */
01925         0x18,                   /* 00011000 */
01926         0xd8,                   /* 11011000 */
01927         0x70,                   /* 01110000 */
01928         0x00,                   /* 00000000 */
01929 
01930         /*
01931         * 160 0xa0 ' ' 
01932         */
01933         0x18,                   /* 00011000 */
01934         0x30,                   /* 00110000 */
01935         0x78,                   /* 01111000 */
01936         0x0c,                   /* 00001100 */
01937         0x7c,                   /* 01111100 */
01938         0xcc,                   /* 11001100 */
01939         0x76,                   /* 01110110 */
01940         0x00,                   /* 00000000 */
01941 
01942         /*
01943         * 161 0xa1 '¡' 
01944         */
01945         0x0c,                   /* 00001100 */
01946         0x18,                   /* 00011000 */
01947         0x00,                   /* 00000000 */
01948         0x38,                   /* 00111000 */
01949         0x18,                   /* 00011000 */
01950         0x18,                   /* 00011000 */
01951         0x3c,                   /* 00111100 */
01952         0x00,                   /* 00000000 */
01953 
01954         /*
01955         * 162 0xa2 '¢' 
01956         */
01957         0x0c,                   /* 00001100 */
01958         0x18,                   /* 00011000 */
01959         0x7c,                   /* 01111100 */
01960         0xc6,                   /* 11000110 */
01961         0xc6,                   /* 11000110 */
01962         0xc6,                   /* 11000110 */
01963         0x7c,                   /* 01111100 */
01964         0x00,                   /* 00000000 */
01965 
01966         /*
01967         * 163 0xa3 '£' 
01968         */
01969         0x18,                   /* 00011000 */
01970         0x30,                   /* 00110000 */
01971         0xcc,                   /* 11001100 */
01972         0xcc,                   /* 11001100 */
01973         0xcc,                   /* 11001100 */
01974         0xcc,                   /* 11001100 */
01975         0x76,                   /* 01110110 */
01976         0x00,                   /* 00000000 */
01977 
01978         /*
01979         * 164 0xa4 '¤' 
01980         */
01981         0x76,                   /* 01110110 */
01982         0xdc,                   /* 11011100 */
01983         0x00,                   /* 00000000 */
01984         0xdc,                   /* 11011100 */
01985         0x66,                   /* 01100110 */
01986         0x66,                   /* 01100110 */
01987         0x66,                   /* 01100110 */
01988         0x00,                   /* 00000000 */
01989 
01990         /*
01991         * 165 0xa5 '¥' 
01992         */
01993         0x76,                   /* 01110110 */
01994         0xdc,                   /* 11011100 */
01995         0x00,                   /* 00000000 */
01996         0xe6,                   /* 11100110 */
01997         0xf6,                   /* 11110110 */
01998         0xde,                   /* 11011110 */
01999         0xce,                   /* 11001110 */
02000         0x00,                   /* 00000000 */
02001 
02002         /*
02003         * 166 0xa6 '¦' 
02004         */
02005         0x3c,                   /* 00111100 */
02006         0x6c,                   /* 01101100 */
02007         0x6c,                   /* 01101100 */
02008         0x3e,                   /* 00111110 */
02009         0x00,                   /* 00000000 */
02010         0x7e,                   /* 01111110 */
02011         0x00,                   /* 00000000 */
02012         0x00,                   /* 00000000 */
02013 
02014         /*
02015         * 167 0xa7 '§' 
02016         */
02017         0x38,                   /* 00111000 */
02018         0x6c,                   /* 01101100 */
02019         0x6c,                   /* 01101100 */
02020         0x38,                   /* 00111000 */
02021         0x00,                   /* 00000000 */
02022         0x7c,                   /* 01111100 */
02023         0x00,                   /* 00000000 */
02024         0x00,                   /* 00000000 */
02025 
02026         /*
02027         * 168 0xa8 '¨' 
02028         */
02029         0x18,                   /* 00011000 */
02030         0x00,                   /* 00000000 */
02031         0x18,                   /* 00011000 */
02032         0x18,                   /* 00011000 */
02033         0x30,                   /* 00110000 */
02034         0x63,                   /* 01100011 */
02035         0x3e,                   /* 00111110 */
02036         0x00,                   /* 00000000 */
02037 
02038         /*
02039         * 169 0xa9 '©' 
02040         */
02041         0x00,                   /* 00000000 */
02042         0x00,                   /* 00000000 */
02043         0x00,                   /* 00000000 */
02044         0xfe,                   /* 11111110 */
02045         0xc0,                   /* 11000000 */
02046         0xc0,                   /* 11000000 */
02047         0x00,                   /* 00000000 */
02048         0x00,                   /* 00000000 */
02049 
02050         /*
02051         * 170 0xaa 'ª' 
02052         */
02053         0x00,                   /* 00000000 */
02054         0x00,                   /* 00000000 */
02055         0x00,                   /* 00000000 */
02056         0xfe,                   /* 11111110 */
02057         0x06,                   /* 00000110 */
02058         0x06,                   /* 00000110 */
02059         0x00,                   /* 00000000 */
02060         0x00,                   /* 00000000 */
02061 
02062         /*
02063         * 171 0xab '«' 
02064         */
02065         0x63,                   /* 01100011 */
02066         0xe6,                   /* 11100110 */
02067         0x6c,                   /* 01101100 */
02068         0x7e,                   /* 01111110 */
02069         0x33,                   /* 00110011 */
02070         0x66,                   /* 01100110 */
02071         0xcc,                   /* 11001100 */
02072         0x0f,                   /* 00001111 */
02073 
02074         /*
02075         * 172 0xac '¬' 
02076         */
02077         0x63,                   /* 01100011 */
02078         0xe6,                   /* 11100110 */
02079         0x6c,                   /* 01101100 */
02080         0x7a,                   /* 01111010 */
02081         0x36,                   /* 00110110 */
02082         0x6a,                   /* 01101010 */
02083         0xdf,                   /* 11011111 */
02084         0x06,                   /* 00000110 */
02085 
02086         /*
02087         * 173 0xad '­' 
02088         */
02089         0x18,                   /* 00011000 */
02090         0x00,                   /* 00000000 */
02091         0x18,                   /* 00011000 */
02092         0x18,                   /* 00011000 */
02093         0x3c,                   /* 00111100 */
02094         0x3c,                   /* 00111100 */
02095         0x18,                   /* 00011000 */
02096         0x00,                   /* 00000000 */
02097 
02098         /*
02099         * 174 0xae '®' 
02100         */
02101         0x00,                   /* 00000000 */
02102         0x33,                   /* 00110011 */
02103         0x66,                   /* 01100110 */
02104         0xcc,                   /* 11001100 */
02105         0x66,                   /* 01100110 */
02106         0x33,                   /* 00110011 */
02107         0x00,                   /* 00000000 */
02108         0x00,                   /* 00000000 */
02109 
02110         /*
02111         * 175 0xaf '¯' 
02112         */
02113         0x00,                   /* 00000000 */
02114         0xcc,                   /* 11001100 */
02115         0x66,                   /* 01100110 */
02116         0x33,                   /* 00110011 */
02117         0x66,                   /* 01100110 */
02118         0xcc,                   /* 11001100 */
02119         0x00,                   /* 00000000 */
02120         0x00,                   /* 00000000 */
02121 
02122         /*
02123         * 176 0xb0 '°' 
02124         */
02125         0x22,                   /* 00100010 */
02126         0x88,                   /* 10001000 */
02127         0x22,                   /* 00100010 */
02128         0x88,                   /* 10001000 */
02129         0x22,                   /* 00100010 */
02130         0x88,                   /* 10001000 */
02131         0x22,                   /* 00100010 */
02132         0x88,                   /* 10001000 */
02133 
02134         /*
02135         * 177 0xb1 '±' 
02136         */
02137         0x55,                   /* 01010101 */
02138         0xaa,                   /* 10101010 */
02139         0x55,                   /* 01010101 */
02140         0xaa,                   /* 10101010 */
02141         0x55,                   /* 01010101 */
02142         0xaa,                   /* 10101010 */
02143         0x55,                   /* 01010101 */
02144         0xaa,                   /* 10101010 */
02145 
02146         /*
02147         * 178 0xb2 '²' 
02148         */
02149         0x77,                   /* 01110111 */
02150         0xdd,                   /* 11011101 */
02151         0x77,                   /* 01110111 */
02152         0xdd,                   /* 11011101 */
02153         0x77,                   /* 01110111 */
02154         0xdd,                   /* 11011101 */
02155         0x77,                   /* 01110111 */
02156         0xdd,                   /* 11011101 */
02157 
02158         /*
02159         * 179 0xb3 '³' 
02160         */
02161         0x18,                   /* 00011000 */
02162         0x18,                   /* 00011000 */
02163         0x18,                   /* 00011000 */
02164         0x18,                   /* 00011000 */
02165         0x18,                   /* 00011000 */
02166         0x18,                   /* 00011000 */
02167         0x18,                   /* 00011000 */
02168         0x18,                   /* 00011000 */
02169 
02170         /*
02171         * 180 0xb4 '´' 
02172         */
02173         0x18,                   /* 00011000 */
02174         0x18,                   /* 00011000 */
02175         0x18,                   /* 00011000 */
02176         0x18,                   /* 00011000 */
02177         0xf8,                   /* 11111000 */
02178         0x18,                   /* 00011000 */
02179         0x18,                   /* 00011000 */
02180         0x18,                   /* 00011000 */
02181 
02182         /*
02183         * 181 0xb5 'µ' 
02184         */
02185         0x18,                   /* 00011000 */
02186         0x18,                   /* 00011000 */
02187         0xf8,                   /* 11111000 */
02188         0x18,                   /* 00011000 */
02189         0xf8,                   /* 11111000 */
02190         0x18,                   /* 00011000 */
02191         0x18,                   /* 00011000 */
02192         0x18,                   /* 00011000 */
02193 
02194         /*
02195         * 182 0xb6 '¶' 
02196         */
02197         0x36,                   /* 00110110 */
02198         0x36,                   /* 00110110 */
02199         0x36,                   /* 00110110 */
02200         0x36,                   /* 00110110 */
02201         0xf6,                   /* 11110110 */
02202         0x36,                   /* 00110110 */
02203         0x36,                   /* 00110110 */
02204         0x36,                   /* 00110110 */
02205 
02206         /*
02207         * 183 0xb7 '·' 
02208         */
02209         0x00,                   /* 00000000 */
02210         0x00,                   /* 00000000 */
02211         0x00,                   /* 00000000 */
02212         0x00,                   /* 00000000 */
02213         0xfe,                   /* 11111110 */
02214         0x36,                   /* 00110110 */
02215         0x36,                   /* 00110110 */
02216         0x36,                   /* 00110110 */
02217 
02218         /*
02219         * 184 0xb8 '¸' 
02220         */
02221         0x00,                   /* 00000000 */
02222         0x00,                   /* 00000000 */
02223         0xf8,                   /* 11111000 */
02224         0x18,                   /* 00011000 */
02225         0xf8,                   /* 11111000 */
02226         0x18,                   /* 00011000 */
02227         0x18,                   /* 00011000 */
02228         0x18,                   /* 00011000 */
02229 
02230         /*
02231         * 185 0xb9 '¹' 
02232         */
02233         0x36,                   /* 00110110 */
02234         0x36,                   /* 00110110 */
02235         0xf6,                   /* 11110110 */
02236         0x06,                   /* 00000110 */
02237         0xf6,                   /* 11110110 */
02238         0x36,                   /* 00110110 */
02239         0x36,                   /* 00110110 */
02240         0x36,                   /* 00110110 */
02241 
02242         /*
02243         * 186 0xba 'º' 
02244         */
02245         0x36,                   /* 00110110 */
02246         0x36,                   /* 00110110 */
02247         0x36,                   /* 00110110 */
02248         0x36,                   /* 00110110 */
02249         0x36,                   /* 00110110 */
02250         0x36,                   /* 00110110 */
02251         0x36,                   /* 00110110 */
02252         0x36,                   /* 00110110 */
02253 
02254         /*
02255         * 187 0xbb '»' 
02256         */
02257         0x00,                   /* 00000000 */
02258         0x00,                   /* 00000000 */
02259         0xfe,                   /* 11111110 */
02260         0x06,                   /* 00000110 */
02261         0xf6,                   /* 11110110 */
02262         0x36,                   /* 00110110 */
02263         0x36,                   /* 00110110 */
02264         0x36,                   /* 00110110 */
02265 
02266         /*
02267         * 188 0xbc '¼' 
02268         */
02269         0x36,                   /* 00110110 */
02270         0x36,                   /* 00110110 */
02271         0xf6,                   /* 11110110 */
02272         0x06,                   /* 00000110 */
02273         0xfe,                   /* 11111110 */
02274         0x00,                   /* 00000000 */
02275         0x00,                   /* 00000000 */
02276         0x00,                   /* 00000000 */
02277 
02278         /*
02279         * 189 0xbd '½' 
02280         */
02281         0x36,                   /* 00110110 */
02282         0x36,                   /* 00110110 */
02283         0x36,                   /* 00110110 */
02284         0x36,                   /* 00110110 */
02285         0xfe,                   /* 11111110 */
02286         0x00,                   /* 00000000 */
02287         0x00,                   /* 00000000 */
02288         0x00,                   /* 00000000 */
02289 
02290         /*
02291         * 190 0xbe '¾' 
02292         */
02293         0x18,                   /* 00011000 */
02294         0x18,                   /* 00011000 */
02295         0xf8,                   /* 11111000 */
02296         0x18,                   /* 00011000 */
02297         0xf8,                   /* 11111000 */
02298         0x00,                   /* 00000000 */
02299         0x00,                   /* 00000000 */
02300         0x00,                   /* 00000000 */
02301 
02302         /*
02303         * 191 0xbf '¿' 
02304         */
02305         0x00,                   /* 00000000 */
02306         0x00,                   /* 00000000 */
02307         0x00,                   /* 00000000 */
02308         0x00,                   /* 00000000 */
02309         0xf8,                   /* 11111000 */
02310         0x18,                   /* 00011000 */
02311         0x18,                   /* 00011000 */
02312         0x18,                   /* 00011000 */
02313 
02314         /*
02315         * 192 0xc0 'À' 
02316         */
02317         0x18,                   /* 00011000 */
02318         0x18,                   /* 00011000 */
02319         0x18,                   /* 00011000 */
02320         0x18,                   /* 00011000 */
02321         0x1f,                   /* 00011111 */
02322         0x00,                   /* 00000000 */
02323         0x00,                   /* 00000000 */
02324         0x00,                   /* 00000000 */
02325 
02326         /*
02327         * 193 0xc1 'Á' 
02328         */
02329         0x18,                   /* 00011000 */
02330         0x18,                   /* 00011000 */
02331         0x18,                   /* 00011000 */
02332         0x18,                   /* 00011000 */
02333         0xff,                   /* 11111111 */
02334         0x00,                   /* 00000000 */
02335         0x00,                   /* 00000000 */
02336         0x00,                   /* 00000000 */
02337 
02338         /*
02339         * 194 0xc2 'Â' 
02340         */
02341         0x00,                   /* 00000000 */
02342         0x00,                   /* 00000000 */
02343         0x00,                   /* 00000000 */
02344         0x00,                   /* 00000000 */
02345         0xff,                   /* 11111111 */
02346         0x18,                   /* 00011000 */
02347         0x18,                   /* 00011000 */
02348         0x18,                   /* 00011000 */
02349 
02350         /*
02351         * 195 0xc3 'Ã' 
02352         */
02353         0x18,                   /* 00011000 */
02354         0x18,                   /* 00011000 */
02355         0x18,                   /* 00011000 */
02356         0x18,                   /* 00011000 */
02357         0x1f,                   /* 00011111 */
02358         0x18,                   /* 00011000 */
02359         0x18,                   /* 00011000 */
02360         0x18,                   /* 00011000 */
02361 
02362         /*
02363         * 196 0xc4 'Ä' 
02364         */
02365         0x00,                   /* 00000000 */
02366         0x00,                   /* 00000000 */
02367         0x00,                   /* 00000000 */
02368         0x00,                   /* 00000000 */
02369         0xff,                   /* 11111111 */
02370         0x00,                   /* 00000000 */
02371         0x00,                   /* 00000000 */
02372         0x00,                   /* 00000000 */
02373 
02374         /*
02375         * 197 0xc5 'Å' 
02376         */
02377         0x18,                   /* 00011000 */
02378         0x18,                   /* 00011000 */
02379         0x18,                   /* 00011000 */
02380         0x18,                   /* 00011000 */
02381         0xff,                   /* 11111111 */
02382         0x18,                   /* 00011000 */
02383         0x18,                   /* 00011000 */
02384         0x18,                   /* 00011000 */
02385 
02386         /*
02387         * 198 0xc6 'Æ' 
02388         */
02389         0x18,                   /* 00011000 */
02390         0x18,                   /* 00011000 */
02391         0x1f,                   /* 00011111 */
02392         0x18,                   /* 00011000 */
02393         0x1f,                   /* 00011111 */
02394         0x18,                   /* 00011000 */
02395         0x18,                   /* 00011000 */
02396         0x18,                   /* 00011000 */
02397 
02398         /*
02399         * 199 0xc7 'Ç' 
02400         */
02401         0x36,                   /* 00110110 */
02402         0x36,                   /* 00110110 */
02403         0x36,                   /* 00110110 */
02404         0x36,                   /* 00110110 */
02405         0x37,                   /* 00110111 */
02406         0x36,                   /* 00110110 */
02407         0x36,                   /* 00110110 */
02408         0x36,                   /* 00110110 */
02409 
02410         /*
02411         * 200 0xc8 'È' 
02412         */
02413         0x36,                   /* 00110110 */
02414         0x36,                   /* 00110110 */
02415         0x37,                   /* 00110111 */
02416         0x30,                   /* 00110000 */
02417         0x3f,                   /* 00111111 */
02418         0x00,                   /* 00000000 */
02419         0x00,                   /* 00000000 */
02420         0x00,                   /* 00000000 */
02421 
02422         /*
02423         * 201 0xc9 'É' 
02424         */
02425         0x00,                   /* 00000000 */
02426         0x00,                   /* 00000000 */
02427         0x3f,                   /* 00111111 */
02428         0x30,                   /* 00110000 */
02429         0x37,                   /* 00110111 */
02430         0x36,                   /* 00110110 */
02431         0x36,                   /* 00110110 */
02432         0x36,                   /* 00110110 */
02433 
02434         /*
02435         * 202 0xca 'Ê' 
02436         */
02437         0x36,                   /* 00110110 */
02438         0x36,                   /* 00110110 */
02439         0xf7,                   /* 11110111 */
02440         0x00,                   /* 00000000 */
02441         0xff,                   /* 11111111 */
02442         0x00,                   /* 00000000 */
02443         0x00,                   /* 00000000 */
02444         0x00,                   /* 00000000 */
02445 
02446         /*
02447         * 203 0xcb 'Ë' 
02448         */
02449         0x00,                   /* 00000000 */
02450         0x00,                   /* 00000000 */
02451         0xff,                   /* 11111111 */
02452         0x00,                   /* 00000000 */
02453         0xf7,                   /* 11110111 */
02454         0x36,                   /* 00110110 */
02455         0x36,                   /* 00110110 */
02456         0x36,                   /* 00110110 */
02457 
02458         /*
02459         * 204 0xcc 'Ì' 
02460         */
02461         0x36,                   /* 00110110 */
02462         0x36,                   /* 00110110 */
02463         0x37,                   /* 00110111 */
02464         0x30,                   /* 00110000 */
02465         0x37,                   /* 00110111 */
02466         0x36,                   /* 00110110 */
02467         0x36,                   /* 00110110 */
02468         0x36,                   /* 00110110 */
02469 
02470         /*
02471         * 205 0xcd 'Í' 
02472         */
02473         0x00,                   /* 00000000 */
02474         0x00,                   /* 00000000 */
02475         0xff,                   /* 11111111 */
02476         0x00,                   /* 00000000 */
02477         0xff,                   /* 11111111 */
02478         0x00,                   /* 00000000 */
02479         0x00,                   /* 00000000 */
02480         0x00,                   /* 00000000 */
02481 
02482         /*
02483         * 206 0xce 'Î' 
02484         */
02485         0x36,                   /* 00110110 */
02486         0x36,                   /* 00110110 */
02487         0xf7,                   /* 11110111 */
02488         0x00,                   /* 00000000 */
02489         0xf7,                   /* 11110111 */
02490         0x36,                   /* 00110110 */
02491         0x36,                   /* 00110110 */
02492         0x36,                   /* 00110110 */
02493 
02494         /*
02495         * 207 0xcf 'Ï' 
02496         */
02497         0x18,                   /* 00011000 */
02498         0x18,                   /* 00011000 */
02499         0xff,                   /* 11111111 */
02500         0x00,                   /* 00000000 */
02501         0xff,                   /* 11111111 */
02502         0x00,                   /* 00000000 */
02503         0x00,                   /* 00000000 */
02504         0x00,                   /* 00000000 */
02505 
02506         /*
02507         * 208 0xd0 'Ð' 
02508         */
02509         0x36,                   /* 00110110 */
02510         0x36,                   /* 00110110 */
02511         0x36,                   /* 00110110 */
02512         0x36,                   /* 00110110 */
02513         0xff,                   /* 11111111 */
02514         0x00,                   /* 00000000 */
02515         0x00,                   /* 00000000 */
02516         0x00,                   /* 00000000 */
02517 
02518         /*
02519         * 209 0xd1 'Ñ' 
02520         */
02521         0x00,                   /* 00000000 */
02522         0x00,                   /* 00000000 */
02523         0xff,                   /* 11111111 */
02524         0x00,                   /* 00000000 */
02525         0xff,                   /* 11111111 */
02526         0x18,                   /* 00011000 */
02527         0x18,                   /* 00011000 */
02528         0x18,                   /* 00011000 */
02529 
02530         /*
02531         * 210 0xd2 'Ò' 
02532         */
02533         0x00,                   /* 00000000 */
02534         0x00,                   /* 00000000 */
02535         0x00,                   /* 00000000 */
02536         0x00,                   /* 00000000 */
02537         0xff,                   /* 11111111 */
02538         0x36,                   /* 00110110 */
02539         0x36,                   /* 00110110 */
02540         0x36,                   /* 00110110 */
02541 
02542         /*
02543         * 211 0xd3 'Ó' 
02544         */
02545         0x36,                   /* 00110110 */
02546         0x36,                   /* 00110110 */
02547         0x36,                   /* 00110110 */
02548         0x36,                   /* 00110110 */
02549         0x3f,                   /* 00111111 */
02550         0x00,                   /* 00000000 */
02551         0x00,                   /* 00000000 */
02552         0x00,                   /* 00000000 */
02553 
02554         /*
02555         * 212 0xd4 'Ô' 
02556         */
02557         0x18,                   /* 00011000 */
02558         0x18,                   /* 00011000 */
02559         0x1f,                   /* 00011111 */
02560         0x18,                   /* 00011000 */
02561         0x1f,                   /* 00011111 */
02562         0x00,                   /* 00000000 */
02563         0x00,                   /* 00000000 */
02564         0x00,                   /* 00000000 */
02565 
02566         /*
02567         * 213 0xd5 'Õ' 
02568         */
02569         0x00,                   /* 00000000 */
02570         0x00,                   /* 00000000 */
02571         0x1f,                   /* 00011111 */
02572         0x18,                   /* 00011000 */
02573         0x1f,                   /* 00011111 */
02574         0x18,                   /* 00011000 */
02575         0x18,                   /* 00011000 */
02576         0x18,                   /* 00011000 */
02577 
02578         /*
02579         * 214 0xd6 'Ö' 
02580         */
02581         0x00,                   /* 00000000 */
02582         0x00,                   /* 00000000 */
02583         0x00,                   /* 00000000 */
02584         0x00,                   /* 00000000 */
02585         0x3f,                   /* 00111111 */
02586         0x36,                   /* 00110110 */
02587         0x36,                   /* 00110110 */
02588         0x36,                   /* 00110110 */
02589 
02590         /*
02591         * 215 0xd7 '×' 
02592         */
02593         0x36,                   /* 00110110 */
02594         0x36,                   /* 00110110 */
02595         0x36,                   /* 00110110 */
02596         0x36,                   /* 00110110 */
02597         0xff,                   /* 11111111 */
02598         0x36,                   /* 00110110 */
02599         0x36,                   /* 00110110 */
02600         0x36,                   /* 00110110 */
02601 
02602         /*
02603         * 216 0xd8 'Ø' 
02604         */
02605         0x18,                   /* 00011000 */
02606         0x18,                   /* 00011000 */
02607         0xff,                   /* 11111111 */
02608         0x18,                   /* 00011000 */
02609         0xff,                   /* 11111111 */
02610         0x18,                   /* 00011000 */
02611         0x18,                   /* 00011000 */
02612         0x18,                   /* 00011000 */
02613 
02614         /*
02615         * 217 0xd9 'Ù' 
02616         */
02617         0x18,                   /* 00011000 */
02618         0x18,                   /* 00011000 */
02619         0x18,                   /* 00011000 */
02620         0x18,                   /* 00011000 */
02621         0xf8,                   /* 11111000 */
02622         0x00,                   /* 00000000 */
02623         0x00,                   /* 00000000 */
02624         0x00,                   /* 00000000 */
02625 
02626         /*
02627         * 218 0xda 'Ú' 
02628         */
02629         0x00,                   /* 00000000 */
02630         0x00,                   /* 00000000 */
02631         0x00,                   /* 00000000 */
02632         0x00,                   /* 00000000 */
02633         0x1f,                   /* 00011111 */
02634         0x18,                   /* 00011000 */
02635         0x18,                   /* 00011000 */
02636         0x18,                   /* 00011000 */
02637 
02638         /*
02639         * 219 0xdb 'Û' 
02640         */
02641         0xff,                   /* 11111111 */
02642         0xff,                   /* 11111111 */
02643         0xff,                   /* 11111111 */
02644         0xff,                   /* 11111111 */
02645         0xff,                   /* 11111111 */
02646         0xff,                   /* 11111111 */
02647         0xff,                   /* 11111111 */
02648         0xff,                   /* 11111111 */
02649 
02650         /*
02651         * 220 0xdc 'Ü' 
02652         */
02653         0x00,                   /* 00000000 */
02654         0x00,                   /* 00000000 */
02655         0x00,                   /* 00000000 */
02656         0x00,                   /* 00000000 */
02657         0xff,                   /* 11111111 */
02658         0xff,                   /* 11111111 */
02659         0xff,                   /* 11111111 */
02660         0xff,                   /* 11111111 */
02661 
02662         /*
02663         * 221 0xdd 'Ý' 
02664         */
02665         0xf0,                   /* 11110000 */
02666         0xf0,                   /* 11110000 */
02667         0xf0,                   /* 11110000 */
02668         0xf0,                   /* 11110000 */
02669         0xf0,                   /* 11110000 */
02670         0xf0,                   /* 11110000 */
02671         0xf0,                   /* 11110000 */
02672         0xf0,                   /* 11110000 */
02673 
02674         /*
02675         * 222 0xde 'Þ' 
02676         */
02677         0x0f,                   /* 00001111 */
02678         0x0f,                   /* 00001111 */
02679         0x0f,                   /* 00001111 */
02680         0x0f,                   /* 00001111 */
02681         0x0f,                   /* 00001111 */
02682         0x0f,                   /* 00001111 */
02683         0x0f,                   /* 00001111 */
02684         0x0f,                   /* 00001111 */
02685 
02686         /*
02687         * 223 0xdf 'ß' 
02688         */
02689         0xff,                   /* 11111111 */
02690         0xff,                   /* 11111111 */
02691         0xff,                   /* 11111111 */
02692         0xff,                   /* 11111111 */
02693         0x00,                   /* 00000000 */
02694         0x00,                   /* 00000000 */
02695         0x00,                   /* 00000000 */
02696         0x00,                   /* 00000000 */
02697 
02698         /*
02699         * 224 0xe0 'à' 
02700         */
02701         0x00,                   /* 00000000 */
02702         0x00,                   /* 00000000 */
02703         0x76,                   /* 01110110 */
02704         0xdc,                   /* 11011100 */
02705         0xc8,                   /* 11001000 */
02706         0xdc,                   /* 11011100 */
02707         0x76,                   /* 01110110 */
02708         0x00,                   /* 00000000 */
02709 
02710         /*
02711         * 225 0xe1 'á' 
02712         */
02713         0x78,                   /* 01111000 */
02714         0xcc,                   /* 11001100 */
02715         0xcc,                   /* 11001100 */
02716         0xd8,                   /* 11011000 */
02717         0xcc,                   /* 11001100 */
02718         0xc6,                   /* 11000110 */
02719         0xcc,                   /* 11001100 */
02720         0x00,                   /* 00000000 */
02721 
02722         /*
02723         * 226 0xe2 'â' 
02724         */
02725         0xfe,                   /* 11111110 */
02726         0xc6,                   /* 11000110 */
02727         0xc0,                   /* 11000000 */
02728         0xc0,                   /* 11000000 */
02729         0xc0,                   /* 11000000 */
02730         0xc0,                   /* 11000000 */
02731         0xc0,                   /* 11000000 */
02732         0x00,                   /* 00000000 */
02733 
02734         /*
02735         * 227 0xe3 'ã' 
02736         */
02737         0x00,                   /* 00000000 */
02738         0x00,                   /* 00000000 */
02739         0xfe,                   /* 11111110 */
02740         0x6c,                   /* 01101100 */
02741         0x6c,                   /* 01101100 */
02742         0x6c,                   /* 01101100 */
02743         0x6c,                   /* 01101100 */
02744         0x00,                   /* 00000000 */
02745 
02746         /*
02747         * 228 0xe4 'ä' 
02748         */
02749         0xfe,                   /* 11111110 */
02750         0xc6,                   /* 11000110 */
02751         0x60,                   /* 01100000 */
02752         0x30,                   /* 00110000 */
02753         0x60,                   /* 01100000 */
02754         0xc6,                   /* 11000110 */
02755         0xfe,                   /* 11111110 */
02756         0x00,                   /* 00000000 */
02757 
02758         /*
02759         * 229 0xe5 'å' 
02760         */
02761         0x00,                   /* 00000000 */
02762         0x00,                   /* 00000000 */
02763         0x7e,                   /* 01111110 */
02764         0xd8,                   /* 11011000 */
02765         0xd8,                   /* 11011000 */
02766         0xd8,                   /* 11011000 */
02767         0x70,                   /* 01110000 */
02768         0x00,                   /* 00000000 */
02769 
02770         /*
02771         * 230 0xe6 'æ' 
02772         */
02773         0x00,                   /* 00000000 */
02774         0x00,                   /* 00000000 */
02775         0x66,                   /* 01100110 */
02776         0x66,                   /* 01100110 */
02777         0x66,                   /* 01100110 */
02778         0x66,                   /* 01100110 */
02779         0x7c,                   /* 01111100 */
02780         0xc0,                   /* 11000000 */
02781 
02782         /*
02783         * 231 0xe7 'ç' 
02784         */
02785         0x00,                   /* 00000000 */
02786         0x76,                   /* 01110110 */
02787         0xdc,                   /* 11011100 */
02788         0x18,                   /* 00011000 */
02789         0x18,                   /* 00011000 */
02790         0x18,                   /* 00011000 */
02791         0x18,                   /* 00011000 */
02792         0x00,                   /* 00000000 */
02793 
02794         /*
02795         * 232 0xe8 'è' 
02796         */
02797         0x7e,                   /* 01111110 */
02798         0x18,                   /* 00011000 */
02799         0x3c,                   /* 00111100 */
02800         0x66,                   /* 01100110 */
02801         0x66,                   /* 01100110 */
02802         0x3c,                   /* 00111100 */
02803         0x18,                   /* 00011000 */
02804         0x7e,                   /* 01111110 */
02805 
02806         /*
02807         * 233 0xe9 'é' 
02808         */
02809         0x38,                   /* 00111000 */
02810         0x6c,                   /* 01101100 */
02811         0xc6,                   /* 11000110 */
02812         0xfe,                   /* 11111110 */
02813         0xc6,                   /* 11000110 */
02814         0x6c,                   /* 01101100 */
02815         0x38,                   /* 00111000 */
02816         0x00,                   /* 00000000 */
02817 
02818         /*
02819         * 234 0xea 'ê' 
02820         */
02821         0x38,                   /* 00111000 */
02822         0x6c,                   /* 01101100 */
02823         0xc6,                   /* 11000110 */
02824         0xc6,                   /* 11000110 */
02825         0x6c,                   /* 01101100 */
02826         0x6c,                   /* 01101100 */
02827         0xee,                   /* 11101110 */
02828         0x00,                   /* 00000000 */
02829 
02830         /*
02831         * 235 0xeb 'ë' 
02832         */
02833         0x0e,                   /* 00001110 */
02834         0x18,                   /* 00011000 */
02835         0x0c,                   /* 00001100 */
02836         0x3e,                   /* 00111110 */
02837         0x66,                   /* 01100110 */
02838         0x66,                   /* 01100110 */
02839         0x3c,                   /* 00111100 */
02840         0x00,                   /* 00000000 */
02841 
02842         /*
02843         * 236 0xec 'ì' 
02844         */
02845         0x00,                   /* 00000000 */
02846         0x00,                   /* 00000000 */
02847         0x7e,                   /* 01111110 */
02848         0xdb,                   /* 11011011 */
02849         0xdb,                   /* 11011011 */
02850         0x7e,                   /* 01111110 */
02851         0x00,                   /* 00000000 */
02852         0x00,                   /* 00000000 */
02853 
02854         /*
02855         * 237 0xed 'í' 
02856         */
02857         0x06,                   /* 00000110 */
02858         0x0c,                   /* 00001100 */
02859         0x7e,                   /* 01111110 */
02860         0xdb,                   /* 11011011 */
02861         0xdb,                   /* 11011011 */
02862         0x7e,                   /* 01111110 */
02863         0x60,                   /* 01100000 */
02864         0xc0,                   /* 11000000 */
02865 
02866         /*
02867         * 238 0xee 'î' 
02868         */
02869         0x1e,                   /* 00011110 */
02870         0x30,                   /* 00110000 */
02871         0x60,                   /* 01100000 */
02872         0x7e,                   /* 01111110 */
02873         0x60,                   /* 01100000 */
02874         0x30,                   /* 00110000 */
02875         0x1e,                   /* 00011110 */
02876         0x00,                   /* 00000000 */
02877 
02878         /*
02879         * 239 0xef 'ï' 
02880         */
02881         0x00,                   /* 00000000 */
02882         0x7c,                   /* 01111100 */
02883         0xc6,                   /* 11000110 */
02884         0xc6,                   /* 11000110 */
02885         0xc6,                   /* 11000110 */
02886         0xc6,                   /* 11000110 */
02887         0xc6,                   /* 11000110 */
02888         0x00,                   /* 00000000 */
02889 
02890         /*
02891         * 240 0xf0 'ð' 
02892         */
02893         0x00,                   /* 00000000 */
02894         0xfe,                   /* 11111110 */
02895         0x00,                   /* 00000000 */
02896         0xfe,                   /* 11111110 */
02897         0x00,                   /* 00000000 */
02898         0xfe,                   /* 11111110 */
02899         0x00,                   /* 00000000 */
02900         0x00,                   /* 00000000 */
02901 
02902         /*
02903         * 241 0xf1 'ñ' 
02904         */
02905         0x18,                   /* 00011000 */
02906         0x18,                   /* 00011000 */
02907         0x7e,                   /* 01111110 */
02908         0x18,                   /* 00011000 */
02909         0x18,                   /* 00011000 */
02910         0x00,                   /* 00000000 */
02911         0x7e,                   /* 01111110 */
02912         0x00,                   /* 00000000 */
02913 
02914         /*
02915         * 242 0xf2 'ò' 
02916         */
02917         0x30,                   /* 00110000 */
02918         0x18,                   /* 00011000 */
02919         0x0c,                   /* 00001100 */
02920         0x18,                   /* 00011000 */
02921         0x30,                   /* 00110000 */
02922         0x00,                   /* 00000000 */
02923         0x7e,                   /* 01111110 */
02924         0x00,                   /* 00000000 */
02925 
02926         /*
02927         * 243 0xf3 'ó' 
02928         */
02929         0x0c,                   /* 00001100 */
02930         0x18,                   /* 00011000 */
02931         0x30,                   /* 00110000 */
02932         0x18,                   /* 00011000 */
02933         0x0c,                   /* 00001100 */
02934         0x00,                   /* 00000000 */
02935         0x7e,                   /* 01111110 */
02936         0x00,                   /* 00000000 */
02937 
02938         /*
02939         * 244 0xf4 'ô' 
02940         */
02941         0x0e,                   /* 00001110 */
02942         0x1b,                   /* 00011011 */
02943         0x1b,                   /* 00011011 */
02944         0x18,                   /* 00011000 */
02945         0x18,                   /* 00011000 */
02946         0x18,                   /* 00011000 */
02947         0x18,                   /* 00011000 */
02948         0x18,                   /* 00011000 */
02949 
02950         /*
02951         * 245 0xf5 'õ' 
02952         */
02953         0x18,                   /* 00011000 */
02954         0x18,                   /* 00011000 */
02955         0x18,                   /* 00011000 */
02956         0x18,                   /* 00011000 */
02957         0x18,                   /* 00011000 */
02958         0xd8,                   /* 11011000 */
02959         0xd8,                   /* 11011000 */
02960         0x70,                   /* 01110000 */
02961 
02962         /*
02963         * 246 0xf6 'ö' 
02964         */
02965         0x00,                   /* 00000000 */
02966         0x18,                   /* 00011000 */
02967         0x00,                   /* 00000000 */
02968         0x7e,                   /* 01111110 */
02969         0x00,                   /* 00000000 */
02970         0x18,                   /* 00011000 */
02971         0x00,                   /* 00000000 */
02972         0x00,                   /* 00000000 */
02973 
02974         /*
02975         * 247 0xf7 '÷' 
02976         */
02977         0x00,                   /* 00000000 */
02978         0x76,                   /* 01110110 */
02979         0xdc,                   /* 11011100 */
02980         0x00,                   /* 00000000 */
02981         0x76,                   /* 01110110 */
02982         0xdc,                   /* 11011100 */
02983         0x00,                   /* 00000000 */
02984         0x00,                   /* 00000000 */
02985 
02986         /*
02987         * 248 0xf8 'ø' 
02988         */
02989         0x38,                   /* 00111000 */
02990         0x6c,                   /* 01101100 */
02991         0x6c,                   /* 01101100 */
02992         0x38,                   /* 00111000 */
02993         0x00,                   /* 00000000 */
02994         0x00,                   /* 00000000 */
02995         0x00,                   /* 00000000 */
02996         0x00,                   /* 00000000 */
02997 
02998         /*
02999         * 249 0xf9 'ù' 
03000         */
03001         0x00,                   /* 00000000 */
03002         0x00,                   /* 00000000 */
03003         0x00,                   /* 00000000 */
03004         0x18,                   /* 00011000 */
03005         0x18,                   /* 00011000 */
03006         0x00,                   /* 00000000 */
03007         0x00,                   /* 00000000 */
03008         0x00,                   /* 00000000 */
03009 
03010         /*
03011         * 250 0xfa 'ú' 
03012         */
03013         0x00,                   /* 00000000 */
03014         0x00,                   /* 00000000 */
03015         0x00,                   /* 00000000 */
03016         0x18,                   /* 00011000 */
03017         0x00,                   /* 00000000 */
03018         0x00,                   /* 00000000 */
03019         0x00,                   /* 00000000 */
03020         0x00,                   /* 00000000 */
03021 
03022         /*
03023         * 251 0xfb 'û' 
03024         */
03025         0x0f,                   /* 00001111 */
03026         0x0c,                   /* 00001100 */
03027         0x0c,                   /* 00001100 */
03028         0x0c,                   /* 00001100 */
03029         0xec,                   /* 11101100 */
03030         0x6c,                   /* 01101100 */
03031         0x3c,                   /* 00111100 */
03032         0x1c,                   /* 00011100 */
03033 
03034         /*
03035         * 252 0xfc 'ü' 
03036         */
03037         0x6c,                   /* 01101100 */
03038         0x36,                   /* 00110110 */
03039         0x36,                   /* 00110110 */
03040         0x36,                   /* 00110110 */
03041         0x36,                   /* 00110110 */
03042         0x00,                   /* 00000000 */
03043         0x00,                   /* 00000000 */
03044         0x00,                   /* 00000000 */
03045 
03046         /*
03047         * 253 0xfd 'ý' 
03048         */
03049         0x78,                   /* 01111000 */
03050         0x0c,                   /* 00001100 */
03051         0x18,                   /* 00011000 */
03052         0x30,                   /* 00110000 */
03053         0x7c,                   /* 01111100 */
03054         0x00,                   /* 00000000 */
03055         0x00,                   /* 00000000 */
03056         0x00,                   /* 00000000 */
03057 
03058         /*
03059         * 254 0xfe 'þ' 
03060         */
03061         0x00,                   /* 00000000 */
03062         0x00,                   /* 00000000 */
03063         0x3c,                   /* 00111100 */
03064         0x3c,                   /* 00111100 */
03065         0x3c,                   /* 00111100 */
03066         0x3c,                   /* 00111100 */
03067         0x00,                   /* 00000000 */
03068         0x00,                   /* 00000000 */
03069 
03070         /*
03071         * 255 0xff ' ' 
03072         */
03073         0x00,                   /* 00000000 */
03074         0x00,                   /* 00000000 */
03075         0x00,                   /* 00000000 */
03076         0x00,                   /* 00000000 */
03077         0x00,                   /* 00000000 */
03078         0x00,                   /* 00000000 */
03079         0x00,                   /* 00000000 */
03080         0x00,                   /* 00000000 */
03081 
03082 };
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__image_filter_8c.html000077500000000000000000003601461226521303400231230ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_imageFilter.c File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_imageFilter.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "SDL2_imageFilter.h"

Go to the source code of this file.

Defines

#define SWAP_32(x)   (((x) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | ((x) << 24))
 Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).

Functions

int SDL_imageFilterMMXdetect (void)
 MMX detection routine (with override flag).
void SDL_imageFilterMMXoff ()
 Disable MMX check for filter functions and and force to use non-MMX C based code.
void SDL_imageFilterMMXon ()
 Enable MMX check for filter functions and use MMX code if available.
int SDL_imageFilterAdd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Add: D = saturation255(S1 + S2)
int SDL_imageFilterMean (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mean: D = S1/2 + S2/2.
int SDL_imageFilterSub (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Sub: D = saturation0(S1 - S2)
int SDL_imageFilterAbsDiff (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using AbsDiff: D = | S1 - S2 |.
int SDL_imageFilterMult (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mult: D = saturation255(S1 * S2)
int SDL_imageFilterMultNorASM (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
 Internal ASM Filter using MultNor: D = S1 * S2.
int SDL_imageFilterMultNor (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultNor: D = S1 * S2.
int SDL_imageFilterMultDivby2 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby2: D = saturation255(S1/2 * S2)
int SDL_imageFilterMultDivby4 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby4: D = saturation255(S1/2 * S2/2)
int SDL_imageFilterBitAnd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitAnd: D = S1 & S2.
int SDL_imageFilterBitOr (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitOr: D = S1 | S2.
int SDL_imageFilterDiv (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Div: D = S1 / S2.
int SDL_imageFilterBitNegation (unsigned char *Src1, unsigned char *Dest, unsigned int length)
 Filter using BitNegation: D = !S.
int SDL_imageFilterAddByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByte: D = saturation255(S + C)
int SDL_imageFilterAddUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)
int SDL_imageFilterAddByteToHalf (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByteToHalf: D = saturation255(S/2 + C)
int SDL_imageFilterSubByteMMX (unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
 Internal MMX Filter using SubByte: D = saturation0(S - C)
int SDL_imageFilterSubByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using SubByte: D = saturation0(S - C)
int SDL_imageFilterSubUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)
int SDL_imageFilterShiftRight (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRight: D = saturation0(S >> N)
int SDL_imageFilterShiftRightUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)
int SDL_imageFilterMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using MultByByte: D = saturation255(S * C)
int SDL_imageFilterShiftRightAndMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C)
 Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)
int SDL_imageFilterShiftLeftByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftByte: D = (S << N)
int SDL_imageFilterShiftLeftUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftUint: D = ((uint)S << N)
int SDL_imageFilterShiftLeft (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter ShiftLeft: D = saturation255(S << N)
int SDL_imageFilterBinarizeUsingThreshold (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
 Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.
int SDL_imageFilterClipToRange (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax)
 Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.
int SDL_imageFilterNormalizeLinear (unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax)
 Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
int SDL_imageFilterConvolveKernel3x3Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel5x5Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel7x7Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel9x9Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel3x3ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel5x5ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel7x7ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel9x9ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )
int SDL_imageFilterSobelX (unsigned char *Src, unsigned char *Dest, int rows, int columns)
 Filter using SobelX: Dij = saturation255( ... )
int SDL_imageFilterSobelXShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, unsigned char NRightShift)
 Filter using SobelXShiftRight: Dij = saturation255( ... )
void SDL_imageFilterAlignStack (void)
 Align stack to 32 byte boundary,.
void SDL_imageFilterRestoreStack (void)
 Restore previously aligned stack.

Define Documentation

#define SWAP_32 (   x)    (((x) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | ((x) << 24))

Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).

Definition at line 61 of file SDL2_imageFilter.c.


Function Documentation

int SDL_imageFilterAbsDiff ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using AbsDiff: D = | S1 - S2 |.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 542 of file SDL2_imageFilter.c.

int SDL_imageFilterAdd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Add: D = saturation255(S1 + S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 173 of file SDL2_imageFilter.c.

int SDL_imageFilterAddByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByte: D = saturation255(S + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant value to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1791 of file SDL2_imageFilter.c.

int SDL_imageFilterAddByteToHalf ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByteToHalf: D = saturation255(S/2 + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2068 of file SDL2_imageFilter.c.

int SDL_imageFilterAddUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1919 of file SDL2_imageFilter.c.

void SDL_imageFilterAlignStack ( void  )

Align stack to 32 byte boundary,.

Definition at line 7326 of file SDL2_imageFilter.c.

int SDL_imageFilterBinarizeUsingThreshold ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  T 
)

Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TThe threshold boundary (inclusive).
Returns:
Returns 0 for success or -1 for error.

Definition at line 3534 of file SDL2_imageFilter.c.

int SDL_imageFilterBitAnd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitAnd: D = S1 & S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1278 of file SDL2_imageFilter.c.

int SDL_imageFilterBitNegation ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitNegation: D = !S.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1671 of file SDL2_imageFilter.c.

int SDL_imageFilterBitOr ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitOr: D = S1 | S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1392 of file SDL2_imageFilter.c.

int SDL_imageFilterClipToRange ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  Tmin,
unsigned char  Tmax 
)

Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TminLower (inclusive) boundary of the clipping range.
TmaxUpper (inclusive) boundary of the clipping range.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3691 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel3x3Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >2.
KernelThe 2D convolution kernel of size 3x3.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 3980 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel3x3ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >2.
KernelThe 2D convolution kernel of size 3x3.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5378 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel5x5Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >4.
columnsNumber of columns in source/destination array. Must be >4.
KernelThe 2D convolution kernel of size 5x5.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4170 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel5x5ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >4.
columnsNumber of columns in source/destination array. Must be >4.
KernelThe 2D convolution kernel of size 5x5.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5555 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel7x7Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >6.
columnsNumber of columns in source/destination array. Must be >6.
KernelThe 2D convolution kernel of size 7x7.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4473 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel7x7ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >6.
columnsNumber of columns in source/destination array. Must be >6.
KernelThe 2D convolution kernel of size 7x7.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5856 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel9x9Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >8.
columnsNumber of columns in source/destination array. Must be >8.
KernelThe 2D convolution kernel of size 9x9.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4830 of file SDL2_imageFilter.c.

int SDL_imageFilterConvolveKernel9x9ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >8.
columnsNumber of columns in source/destination array. Must be >8.
KernelThe 2D convolution kernel of size 9x9.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 6219 of file SDL2_imageFilter.c.

int SDL_imageFilterDiv ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Div: D = S1 / S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1549 of file SDL2_imageFilter.c.

int SDL_imageFilterMean ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mean: D = S1/2 + S2/2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 308 of file SDL2_imageFilter.c.

int SDL_imageFilterMMXdetect ( void  )

MMX detection routine (with override flag).

Returns:
1 of MMX was detected, 0 otherwise.

Definition at line 80 of file SDL2_imageFilter.c.

void SDL_imageFilterMMXoff ( void  )

Disable MMX check for filter functions and and force to use non-MMX C based code.

Definition at line 93 of file SDL2_imageFilter.c.

void SDL_imageFilterMMXon ( void  )

Enable MMX check for filter functions and use MMX code if available.

Definition at line 101 of file SDL2_imageFilter.c.

int SDL_imageFilterMult ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mult: D = saturation255(S1 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 729 of file SDL2_imageFilter.c.

int SDL_imageFilterMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using MultByByte: D = saturation255(S * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2790 of file SDL2_imageFilter.c.

int SDL_imageFilterMultDivby2 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby2: D = saturation255(S1/2 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1000 of file SDL2_imageFilter.c.

int SDL_imageFilterMultDivby4 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby4: D = saturation255(S1/2 * S2/2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1141 of file SDL2_imageFilter.c.

int SDL_imageFilterMultNor ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultNor: D = S1 * S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 862 of file SDL2_imageFilter.c.

int SDL_imageFilterMultNorASM ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  SrcLength 
)

Internal ASM Filter using MultNor: D = S1 * S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
SrcLengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 792 of file SDL2_imageFilter.c.

int SDL_imageFilterNormalizeLinear ( unsigned char *  Src,
unsigned char *  Dest,
unsigned int  length,
int  Cmin,
int  Cmax,
int  Nmin,
int  Nmax 
)

Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)

Parameters:
SrcPointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CminNormalization constant.
CmaxNormalization constant.
NminNormalization constant.
NmaxNormalization constant.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3909 of file SDL2_imageFilter.c.

void SDL_imageFilterRestoreStack ( void  )

Restore previously aligned stack.

Definition at line 7354 of file SDL2_imageFilter.c.

int SDL_imageFilterShiftLeft ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter ShiftLeft: D = saturation255(S << N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3393 of file SDL2_imageFilter.c.

int SDL_imageFilterShiftLeftByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftByte: D = (S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3093 of file SDL2_imageFilter.c.

int SDL_imageFilterShiftLeftUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftUint: D = ((uint)S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3210 of file SDL2_imageFilter.c.

int SDL_imageFilterShiftRight ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRight: D = saturation0(S >> N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2476 of file SDL2_imageFilter.c.

int SDL_imageFilterShiftRightAndMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N,
unsigned char  C 
)

Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2943 of file SDL2_imageFilter.c.

int SDL_imageFilterShiftRightUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2594 of file SDL2_imageFilter.c.

int SDL_imageFilterSobelX ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns 
)

Filter using SobelX: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to sobel-filter. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 6799 of file SDL2_imageFilter.c.

int SDL_imageFilterSobelXShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
unsigned char  NRightShift 
)

Filter using SobelXShiftRight: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to sobel-filter. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >8.
NRightShiftThe number of right bit shifts to apply to the filter sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 7052 of file SDL2_imageFilter.c.

int SDL_imageFilterSub ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Sub: D = saturation0(S1 - S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 422 of file SDL2_imageFilter.c.

int SDL_imageFilterSubByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using SubByte: D = saturation0(S - C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2196 of file SDL2_imageFilter.c.

int SDL_imageFilterSubByteMMX ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  SrcLength,
unsigned char  C 
)

Internal MMX Filter using SubByte: D = saturation0(S - C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
SrcLengthThe number of bytes in the source array.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2130 of file SDL2_imageFilter.c.

int SDL_imageFilterSubUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2325 of file SDL2_imageFilter.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__image_filter_8c_source.html000077500000000000000000032271451226521303400245070ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_imageFilter.c Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_imageFilter.c
Go to the documentation of this file.
00001 /*
00002 
00003 SDL2_imageFilter.c: byte-image "filter" routines
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 Copyright (C) 2013  Sylvain Beucler
00007 
00008 This software is provided 'as-is', without any express or implied
00009 warranty. In no event will the authors be held liable for any damages
00010 arising from the use of this software.
00011 
00012 Permission is granted to anyone to use this software for any purpose,
00013 including commercial applications, and to alter it and redistribute it
00014 freely, subject to the following restrictions:
00015 
00016    1. The origin of this software must not be misrepresented; you must not
00017    claim that you wrote the original software. If you use this software
00018    in a product, an acknowledgment in the product documentation would be
00019    appreciated but is not required.
00020 
00021    2. Altered source versions must be plainly marked as such, and must not be
00022    misrepresented as being the original software.
00023 
00024    3. This notice may not be removed or altered from any source
00025    distribution.
00026 
00027 Andreas Schiffler -- aschiffler at ferzkopp dot net
00028 
00029 */
00030 
00031 /*
00032 
00033 Note: Uses inline x86 MMX or ASM optimizations if available and enabled.
00034 
00035 Note: Most of the MMX code is based on published routines 
00036 by Vladimir Kravtchenko at vk@cs.ubc.ca - credits go to 
00037 him for his work.
00038 
00039 */
00040 
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 #include <string.h>
00044 
00045 #include "SDL.h"
00046 
00047 /* Use GCC intrinsics if available: they support both i386 and x86_64,
00048    provide ASM-grade performances, and lift the PUSHA/POPA issues. */
00049 #ifdef __GNUC__
00050 #  ifdef USE_MMX
00051 #    include <mmintrin.h>
00052 #  endif
00053 #  include <SDL_cpuinfo.h>
00054 #endif
00055 
00056 #include "SDL2_imageFilter.h"
00057 
00061 #define SWAP_32(x) (((x) >> 24) | (((x) & 0x00ff0000) >> 8)  | (((x) & 0x0000ff00) << 8)  | ((x) << 24))
00062 
00063 /* ------ Static variables ----- */
00064 
00068 static int SDL_imageFilterUseMMX = 1;
00069 
00070 /* Detect GCC */
00071 #if defined(__GNUC__)
00072 #define GCC__
00073 #endif
00074 
00080 int SDL_imageFilterMMXdetect(void)
00081 {
00082         /* Check override flag */
00083         if (SDL_imageFilterUseMMX == 0) {
00084                 return (0);
00085         }
00086 
00087     return SDL_HasMMX();
00088 }
00089 
00093 void SDL_imageFilterMMXoff()
00094 {
00095         SDL_imageFilterUseMMX = 0;
00096 }
00097 
00101 void SDL_imageFilterMMXon()
00102 {
00103         SDL_imageFilterUseMMX = 1;
00104 }
00105 
00106 /* ------------------------------------------------------------------------------------ */
00107 
00118 static int SDL_imageFilterAddMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00119 {
00120 #ifdef USE_MMX
00121 #if !defined(GCC__)
00122         __asm
00123         {
00124                 pusha
00125                         mov eax, Src1   /* load Src1 address into eax */
00126                         mov ebx, Src2   /* load Src2 address into ebx */
00127                         mov edi, Dest   /* load Dest address into edi */
00128                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
00129                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
00130                         align 16        /* 16 byte alignment of the loop entry */
00131 L1010:
00132                 movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
00133                 paddusb mm1, [ebx]      /* mm1=Src1+Src2 (add 8 bytes with saturation) */
00134                 movq [edi], mm1 /* store result in Dest */
00135                         add eax, 8      /* increase Src1, Src2 and Dest  */
00136                         add ebx, 8      /* register pointers by 8 */
00137                         add edi, 8
00138                         dec ecx /* decrease loop counter */
00139                         jnz L1010       /* check loop termination, proceed if required */
00140                         emms /* exit MMX state */
00141                         popa
00142         }
00143 #else
00144         /* i386 and x86_64 */
00145         __m64 *mSrc1 = (__m64*)Src1;
00146         __m64 *mSrc2 = (__m64*)Src2;
00147         __m64 *mDest = (__m64*)Dest;
00148         int i;
00149         for (i = 0; i < SrcLength/8; i++) {
00150                 *mDest = _m_paddusb(*mSrc1, *mSrc2);    /* Src1+Src2 (add 8 bytes with saturation) */
00151                 mSrc1++;
00152                 mSrc2++;
00153                 mDest++;
00154         }
00155         _m_empty();                                     /* clean MMX state */
00156 #endif
00157         return (0);
00158 #else
00159         return (-1);
00160 #endif
00161 }
00162 
00173 int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00174 {
00175         unsigned int i, istart;
00176         unsigned char *cursrc1, *cursrc2, *curdst;
00177         int result;
00178 
00179         /* Validate input parameters */
00180         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00181                 return(-1);
00182         if (length == 0)
00183                 return(0);
00184 
00185         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00186 
00187                 /* Use MMX assembly routine */
00188                 SDL_imageFilterAddMMX(Src1, Src2, Dest, length);
00189 
00190                 /* Check for unaligned bytes */
00191                 if ((length & 7) > 0) {
00192                         /* Setup to process unaligned bytes */
00193                         istart = length & 0xfffffff8;
00194                         cursrc1 = &Src1[istart];
00195                         cursrc2 = &Src2[istart];
00196                         curdst = &Dest[istart];
00197                 } else {
00198                         /* No unaligned bytes - we are done */
00199                         return (0);
00200                 }
00201         } else {
00202                 /* Setup to process whole image */
00203                 istart = 0;
00204                 cursrc1 = Src1;
00205                 cursrc2 = Src2;
00206                 curdst = Dest;
00207         }
00208 
00209         /* C routine to process image */
00210         for (i = istart; i < length; i++) {
00211                 result = (int) *cursrc1 + (int) *cursrc2;
00212                 if (result > 255)
00213                         result = 255;
00214                 *curdst = (unsigned char) result;
00215                 /* Advance pointers */
00216                 cursrc1++;
00217                 cursrc2++;
00218                 curdst++;
00219         }
00220 
00221         return (0);
00222 }
00223 
00235 static int SDL_imageFilterMeanMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength,
00236                                                    unsigned char *Mask)
00237 {
00238 #ifdef USE_MMX
00239 #if !defined(GCC__)
00240         __asm
00241         { 
00242                 pusha
00243                         mov edx, Mask /* load Mask address into edx */
00244                         movq mm0, [edx] /* load Mask into mm0 */
00245                 mov eax, Src1 /* load Src1 address into eax */
00246                         mov ebx, Src2 /* load Src2 address into ebx */
00247                         mov edi, Dest /* load Dest address into edi */
00248                         mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
00249                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
00250                         align 16        /* 16 byte alignment of the loop entry */
00251 L21011:
00252                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00253                 movq mm2,  [ebx]        /* load 8 bytes from Src2 into mm2 */
00254                 /* --- Byte shift via Word shift --- */
00255                 psrlw mm1, 1    /* shift 4 WORDS of mm1 1 bit to the right */
00256                         psrlw mm2, 1    /* shift 4 WORDS of mm2 1 bit to the right */
00257                         pand mm1, mm0   // apply Mask to 8 BYTES of mm1 */
00258                         /* byte     0x0f, 0xdb, 0xc8 */
00259                         pand mm2, mm0   // apply Mask to 8 BYTES of mm2 */
00260                         /* byte     0x0f, 0xdb, 0xd0 */
00261                         paddusb mm1,  mm2       /* mm1=mm1+mm2 (add 8 bytes with saturation) */
00262                         movq [edi],  mm1        /* store result in Dest */
00263                         add eax,  8     /* increase Src1, Src2 and Dest  */
00264                         add ebx,  8     /* register pointers by 8 */
00265                         add edi,  8
00266                         dec ecx         /* decrease loop counter */
00267                         jnz L21011      /* check loop termination, proceed if required */
00268                         emms    /* exit MMX state */
00269                         popa
00270         }
00271 #else
00272         /* i386 and x86_64 */
00273         __m64 *mSrc1 = (__m64*)Src1;
00274         __m64 *mSrc2 = (__m64*)Src2;
00275         __m64 *mDest = (__m64*)Dest;
00276         __m64 *mMask = (__m64*)Mask;
00277         int i;
00278         for (i = 0; i < SrcLength/8; i++) {
00279                 __m64 mm1 = *mSrc1,
00280                       mm2 = *mSrc2;
00281                 mm1 = _m_psrlwi(mm1, 1);        /* shift 4 WORDS of mm1 1 bit to the right */
00282                 mm2 = _m_psrlwi(mm2, 1);        /* shift 4 WORDS of mm2 1 bit to the right */
00283                 mm1 = _m_pand(mm1, *mMask);     /* apply Mask to 8 BYTES of mm1 */
00284                 mm2 = _m_pand(mm2, *mMask);     /* apply Mask to 8 BYTES of mm2 */
00285                 *mDest = _m_paddusb(mm1, mm2);  /* mm1+mm2 (add 8 bytes with saturation) */
00286                 mSrc1++;
00287                 mSrc2++;
00288                 mDest++;
00289         }
00290         _m_empty();                             /* clean MMX state */
00291 #endif
00292         return (0);
00293 #else
00294         return (-1);
00295 #endif
00296 }
00297 
00308 int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00309 {
00310         static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
00311         unsigned int i, istart;
00312         unsigned char *cursrc1, *cursrc2, *curdst;
00313         int result;
00314 
00315         /* Validate input parameters */
00316         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00317                 return(-1);
00318         if (length == 0)
00319                 return(0);
00320 
00321         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00322                 /* MMX routine */
00323                 SDL_imageFilterMeanMMX(Src1, Src2, Dest, length, Mask);
00324 
00325                 /* Check for unaligned bytes */
00326                 if ((length & 7) > 0) {
00327                         /* Setup to process unaligned bytes */
00328                         istart = length & 0xfffffff8;
00329                         cursrc1 = &Src1[istart];
00330                         cursrc2 = &Src2[istart];
00331                         curdst = &Dest[istart];
00332                 } else {
00333                         /* No unaligned bytes - we are done */
00334                         return (0);
00335                 }
00336         } else {
00337                 /* Setup to process whole image */
00338                 istart = 0;
00339                 cursrc1 = Src1;
00340                 cursrc2 = Src2;
00341                 curdst = Dest;
00342         }
00343 
00344         /* C routine to process image */
00345         for (i = istart; i < length; i++) {
00346                 result = (int) *cursrc1 / 2 + (int) *cursrc2 / 2;
00347                 *curdst = (unsigned char) result;
00348                 /* Advance pointers */
00349                 cursrc1++;
00350                 cursrc2++;
00351                 curdst++;
00352         }
00353 
00354         return (0);
00355 }
00356 
00367 static int SDL_imageFilterSubMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00368 {
00369 #ifdef USE_MMX
00370 #if !defined(GCC__)
00371         __asm
00372         {
00373                 pusha
00374                         mov eax,  Src1  /* load Src1 address into eax */
00375                         mov ebx,  Src2  /* load Src2 address into ebx */
00376                         mov edi,  Dest  /* load Dest address into edi */
00377                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
00378                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
00379                         align 16 /* 16 byte alignment of the loop entry */
00380 L1012:
00381                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00382                 psubusb mm1,  [ebx]     /* mm1=Src1-Src2 (sub 8 bytes with saturation) */
00383                 movq [edi],  mm1        /* store result in Dest */
00384                         add eax, 8      /* increase Src1, Src2 and Dest  */
00385                         add ebx, 8      /* register pointers by 8 */
00386                         add edi, 8
00387                         dec ecx /* decrease loop counter */
00388                         jnz L1012       /* check loop termination, proceed if required */
00389                         emms /* exit MMX state */
00390                         popa
00391         }
00392 #else
00393         /* i386 and x86_64 */
00394         __m64 *mSrc1 = (__m64*)Src1;
00395         __m64 *mSrc2 = (__m64*)Src2;
00396         __m64 *mDest = (__m64*)Dest;
00397         int i;
00398         for (i = 0; i < SrcLength/8; i++) {
00399                 *mDest = _m_psubusb(*mSrc1, *mSrc2);    /* Src1-Src2 (sub 8 bytes with saturation) */
00400                 mSrc1++;
00401                 mSrc2++;
00402                 mDest++;
00403         }
00404         _m_empty();                                     /* clean MMX state */
00405 #endif
00406         return (0);
00407 #else
00408         return (-1);
00409 #endif
00410 }
00411 
00422 int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00423 {
00424         unsigned int i, istart;
00425         unsigned char *cursrc1, *cursrc2, *curdst;
00426         int result;
00427 
00428         /* Validate input parameters */
00429         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00430                 return(-1);
00431         if (length == 0)
00432                 return(0);
00433 
00434         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00435                 /* MMX routine */
00436                 SDL_imageFilterSubMMX(Src1, Src2, Dest, length);
00437 
00438                 /* Check for unaligned bytes */
00439                 if ((length & 7) > 0) {
00440                         /* Setup to process unaligned bytes */
00441                         istart = length & 0xfffffff8;
00442                         cursrc1 = &Src1[istart];
00443                         cursrc2 = &Src2[istart];
00444                         curdst = &Dest[istart];
00445                 } else {
00446                         /* No unaligned bytes - we are done */
00447                         return (0);
00448                 }
00449         } else {
00450                 /* Setup to process whole image */
00451                 istart = 0;
00452                 cursrc1 = Src1;
00453                 cursrc2 = Src2;
00454                 curdst = Dest;
00455         }
00456 
00457         /* C routine to process image */
00458         for (i = istart; i < length; i++) {
00459                 result = (int) *cursrc1 - (int) *cursrc2;
00460                 if (result < 0)
00461                         result = 0;
00462                 *curdst = (unsigned char) result;
00463                 /* Advance pointers */
00464                 cursrc1++;
00465                 cursrc2++;
00466                 curdst++;
00467         }
00468 
00469         return (0);
00470 }
00471 
00482 static int SDL_imageFilterAbsDiffMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00483 {
00484 #ifdef USE_MMX
00485 #if !defined(GCC__)
00486         __asm
00487         {
00488                 pusha
00489                         mov eax, Src1   /* load Src1 address into eax */
00490                         mov ebx, Src2   /* load Src2 address into ebx */
00491                         mov edi, Dest   /* load Dest address into edi */
00492                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
00493                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
00494                         align 16        /* 16 byte alignment of the loop entry */
00495 L1013:
00496                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00497                 movq mm2,  [ebx]        /* load 8 bytes from Src2 into mm2 */
00498                 psubusb mm1,  [ebx]     /* mm1=Src1-Src2 (sub 8 bytes with saturation) */
00499                 psubusb mm2,  [eax]     /* mm2=Src2-Src1 (sub 8 bytes with saturation) */
00500                 por mm1,  mm2   /* combine both mm2 and mm1 results */
00501                         movq [edi],  mm1        /* store result in Dest */
00502                         add eax, 8      /* increase Src1, Src2 and Dest  */
00503                         add ebx, 8      /* register pointers by 8 */
00504                         add edi, 8
00505                         dec ecx         /* decrease loop counter */
00506                         jnz L1013       /* check loop termination, proceed if required */
00507                         emms         /* exit MMX state */
00508                         popa
00509         }
00510 #else
00511         /* i386 and x86_64 */
00512         __m64 *mSrc1 = (__m64*)Src1;
00513         __m64 *mSrc2 = (__m64*)Src2;
00514         __m64 *mDest = (__m64*)Dest;
00515         int i;
00516         for (i = 0; i < SrcLength/8; i++) {
00517                 __m64 mm1 = _m_psubusb(*mSrc2, *mSrc1); /* Src1-Src2 (sub 8 bytes with saturation) */
00518                 __m64 mm2 = _m_psubusb(*mSrc1, *mSrc2); /* Src2-Src1 (sub 8 bytes with saturation) */
00519                 *mDest = _m_por(mm1, mm2);              /* combine both mm2 and mm1 results */
00520                 mSrc1++;
00521                 mSrc2++;
00522                 mDest++;
00523         }
00524         _m_empty();                                     /* clean MMX state */
00525 #endif
00526         return (0);
00527 #else
00528         return (-1);
00529 #endif
00530 }
00531 
00542 int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00543 {
00544         unsigned int i, istart;
00545         unsigned char *cursrc1, *cursrc2, *curdst;
00546         int result;
00547 
00548         /* Validate input parameters */
00549         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00550                 return(-1);
00551         if (length == 0)
00552                 return(0);
00553 
00554         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00555                 /* MMX routine */
00556                 SDL_imageFilterAbsDiffMMX(Src1, Src2, Dest, length);
00557 
00558                 /* Check for unaligned bytes */
00559                 if ((length & 7) > 0) {
00560                         /* Setup to process unaligned bytes */
00561                         istart = length & 0xfffffff8;
00562                         cursrc1 = &Src1[istart];
00563                         cursrc2 = &Src2[istart];
00564                         curdst = &Dest[istart];
00565                 } else {
00566                         /* No unaligned bytes - we are done */
00567                         return (0);
00568                 }
00569         } else {
00570                 /* Setup to process whole image */
00571                 istart = 0;
00572                 cursrc1 = Src1;
00573                 cursrc2 = Src2;
00574                 curdst = Dest;
00575         }
00576 
00577         /* C routine to process image */
00578         for (i = istart; i < length; i++) {
00579                 result = abs((int) *cursrc1 - (int) *cursrc2);
00580                 *curdst = (unsigned char) result;
00581                 /* Advance pointers */
00582                 cursrc1++;
00583                 cursrc2++;
00584                 curdst++;
00585         }
00586 
00587         return (0);
00588 }
00589 
00600 static int SDL_imageFilterMultMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00601 {
00602 #ifdef USE_MMX
00603 #if !defined(GCC__)
00604         __asm
00605         {
00606                 pusha
00607                         mov eax, Src1   /* load Src1 address into eax */
00608                         mov ebx, Src2   /* load Src2 address into ebx */
00609                         mov edi, Dest   /* load Dest address into edi */
00610                         mov ecx, SrcLength   /* load loop counter (SIZE) into ecx */
00611                         shr ecx, 3   /* counter/8 (MMX loads 8 bytes at a time) */
00612                         pxor mm0, mm0   /* zero mm0 register */
00613                         align 16        /* 16 byte alignment of the loop entry */
00614 L1014:
00615                 movq mm1, [eax]   /* load 8 bytes from Src1 into mm1 */
00616                 movq mm3, [ebx]   /* load 8 bytes from Src2 into mm3 */
00617                 movq mm2, mm1   /* copy mm1 into mm2 */
00618                         movq mm4, mm3   /* copy mm3 into mm4  */
00619                         punpcklbw mm1, mm0   /* unpack low  bytes of Src1 into words */
00620                         punpckhbw mm2, mm0   /* unpack high bytes of Src1 into words */
00621                         punpcklbw mm3, mm0   /* unpack low  bytes of Src2 into words */
00622                         punpckhbw mm4, mm0   /* unpack high bytes of Src2 into words */
00623                         pmullw mm1, mm3   /* mul low  bytes of Src1 and Src2  */
00624                         pmullw mm2, mm4   /* mul high bytes of Src1 and Src2 */
00625                         /* Take abs value of the results (signed words) */
00626                         movq mm5, mm1   /* copy mm1 into mm5 */
00627                         movq mm6, mm2   /* copy mm2 into mm6 */
00628                         psraw mm5, 15   /* fill mm5 words with word sign bit */
00629                         psraw mm6, 15   /* fill mm6 words with word sign bit */
00630                         pxor mm1, mm5   /* take 1's compliment of only neg. words */
00631                         pxor mm2, mm6   /* take 1's compliment of only neg. words */
00632                         psubsw mm1, mm5   /* add 1 to only neg. words, W-(-1) or W-0 */
00633                         psubsw mm2, mm6   /* add 1 to only neg. words, W-(-1) or W-0 */
00634                         packuswb mm1, mm2   /* pack words back into bytes with saturation */
00635                         movq [edi], mm1   /* store result in Dest */
00636                         add eax, 8   /* increase Src1, Src2 and Dest  */
00637                         add ebx, 8   /* register pointers by 8 */
00638                         add edi, 8
00639                         dec ecx         /* decrease loop counter */
00640                         jnz L1014       /* check loop termination, proceed if required */
00641                         emms /* exit MMX state */
00642                         popa
00643         }
00644 #else
00645         /* i386 ASM with constraints: */
00646         /* asm volatile ( */
00647         /*      "shr $3, %%ecx \n\t"    /\* counter/8 (MMX loads 8 bytes at a time) *\/ */
00648         /*      "pxor      %%mm0, %%mm0 \n\t"   /\* zero mm0 register *\/ */
00649         /*      ".align 16       \n\t"  /\* 16 byte alignment of the loop entry *\/ */
00650         /*      "1: movq (%%eax), %%mm1 \n\t"     /\* load 8 bytes from Src1 into mm1 *\/ */
00651         /*      "movq    (%%ebx), %%mm3 \n\t"   /\* load 8 bytes from Src2 into mm3 *\/ */
00652         /*      "movq      %%mm1, %%mm2 \n\t"   /\* copy mm1 into mm2 *\/ */
00653         /*      "movq      %%mm3, %%mm4 \n\t"   /\* copy mm3 into mm4  *\/ */
00654         /*      "punpcklbw %%mm0, %%mm1 \n\t"   /\* unpack low  bytes of Src1 into words *\/ */
00655         /*      "punpckhbw %%mm0, %%mm2 \n\t"   /\* unpack high bytes of Src1 into words *\/ */
00656         /*      "punpcklbw %%mm0, %%mm3 \n\t"   /\* unpack low  bytes of Src2 into words *\/ */
00657         /*      "punpckhbw %%mm0, %%mm4 \n\t"   /\* unpack high bytes of Src2 into words *\/ */
00658         /*      "pmullw    %%mm3, %%mm1 \n\t"   /\* mul low  bytes of Src1 and Src2  *\/ */
00659         /*      "pmullw    %%mm4, %%mm2 \n\t"   /\* mul high bytes of Src1 and Src2 *\/ */
00660         /*      /\* Take abs value of the results (signed words) *\/ */
00661         /*      "movq      %%mm1, %%mm5 \n\t"   /\* copy mm1 into mm5 *\/ */
00662         /*      "movq      %%mm2, %%mm6 \n\t"   /\* copy mm2 into mm6 *\/ */
00663         /*      "psraw       $15, %%mm5 \n\t"   /\* fill mm5 words with word sign bit *\/ */
00664         /*      "psraw       $15, %%mm6 \n\t"   /\* fill mm6 words with word sign bit *\/ */
00665         /*      "pxor      %%mm5, %%mm1 \n\t"   /\* take 1's compliment of only neg. words *\/ */
00666         /*      "pxor      %%mm6, %%mm2 \n\t"   /\* take 1's compliment of only neg. words *\/ */
00667         /*      "psubsw    %%mm5, %%mm1 \n\t"   /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */
00668         /*      "psubsw    %%mm6, %%mm2 \n\t"   /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */
00669         /*      "packuswb  %%mm2, %%mm1 \n\t"   /\* pack words back into bytes with saturation *\/ */
00670         /*      "movq    %%mm1, (%%edi) \n\t"   /\* store result in Dest *\/ */
00671         /*      "add $8, %%eax \n\t"    /\* increase Src1, Src2 and Dest  *\/ */
00672         /*      "add $8, %%ebx \n\t"    /\* register pointers by 8 *\/ */
00673         /*      "add $8, %%edi \n\t" */
00674         /*      "dec %%ecx     \n\t"    /\* decrease loop counter *\/ */
00675         /*      "jnz 1b        \n\t"    /\* check loop termination, proceed if required *\/ */
00676         /*      "emms          \n\t"    /\* exit MMX state *\/ */
00677         /*      : "+a" (Src1),          /\* load Src1 address into rax, modified by the loop *\/ */
00678         /*        "+b" (Src2),          /\* load Src2 address into rbx, modified by the loop *\/ */
00679         /*        "+c" (SrcLength),     /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */
00680         /*        "+D" (Dest)           /\* load Dest address into rdi, modified by the loop *\/ */
00681         /*      : */
00682         /*      : "memory",             /\* *Dest is modified *\/ */
00683         /*           "mm0","mm1","mm2","mm3","mm4","mm5","mm6"  /\* registers modified *\/ */
00684         /* ); */
00685 
00686         /* i386 and x86_64 */
00687         __m64 *mSrc1 = (__m64*)Src1;
00688         __m64 *mSrc2 = (__m64*)Src2;
00689         __m64 *mDest = (__m64*)Dest;
00690         __m64 mm0 = _m_from_int(0); /* zero mm0 register */
00691         int i;
00692         for (i = 0; i < SrcLength/8; i++) {
00693                 __m64 mm1, mm2, mm3, mm4, mm5, mm6;
00694                 mm1 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
00695                 mm2 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
00696                 mm3 = _m_punpcklbw(*mSrc2, mm0);        /* unpack low  bytes of Src2 into words */
00697                 mm4 = _m_punpckhbw(*mSrc2, mm0);        /* unpack high bytes of Src2 into words */
00698                 mm1 = _m_pmullw(mm1, mm3);              /* mul low  bytes of Src1 and Src2  */
00699                 mm2 = _m_pmullw(mm2, mm4);              /* mul high bytes of Src1 and Src2 */
00700                 mm5 = _m_psrawi(mm1, 15);               /* fill mm5 words with word sign bit */
00701                 mm6 = _m_psrawi(mm2, 15);               /* fill mm6 words with word sign bit */
00702                 mm1 = _m_pxor(mm1, mm5);                /* take 1's compliment of only neg. words */
00703                 mm2 = _m_pxor(mm2, mm6);                /* take 1's compliment of only neg. words */
00704                 mm1 = _m_psubsw(mm1, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
00705                 mm2 = _m_psubsw(mm2, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
00706                 *mDest = _m_packuswb(mm1, mm2);         /* pack words back into bytes with saturation */
00707                 mSrc1++;
00708                 mSrc2++;
00709                 mDest++;
00710         }
00711         _m_empty();                                     /* clean MMX state */
00712 #endif
00713         return (0);
00714 #else
00715         return (-1);
00716 #endif
00717 }
00718 
00729 int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00730 {
00731         unsigned int i, istart;
00732         unsigned char *cursrc1, *cursrc2, *curdst;
00733         int result;
00734 
00735         /* Validate input parameters */
00736         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00737                 return(-1);
00738         if (length == 0)
00739                 return(0);
00740 
00741         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00742                 /* MMX routine */
00743                 SDL_imageFilterMultMMX(Src1, Src2, Dest, length);
00744 
00745                 /* Check for unaligned bytes */
00746                 if ((length & 7) > 0) {
00747                         /* Setup to process unaligned bytes */
00748                         istart = length & 0xfffffff8;
00749                         cursrc1 = &Src1[istart];
00750                         cursrc2 = &Src2[istart];
00751                         curdst = &Dest[istart];
00752                 } else {
00753                         /* No unaligned bytes - we are done */
00754                         return (0);
00755                 }
00756         } else {
00757                 /* Setup to process whole image */
00758                 istart = 0;
00759                 cursrc1 = Src1;
00760                 cursrc2 = Src2;
00761                 curdst = Dest;
00762         }
00763 
00764         /* C routine to process image */
00765         for (i = istart; i < length; i++) {
00766 
00767                 /* NOTE: this is probably wrong - dunno what the MMX code does */
00768 
00769                 result = (int) *cursrc1 * (int) *cursrc2;
00770                 if (result > 255)
00771                         result = 255;
00772                 *curdst = (unsigned char) result;
00773                 /* Advance pointers */
00774                 cursrc1++;
00775                 cursrc2++;
00776                 curdst++;
00777         }
00778 
00779         return (0);
00780 }
00781 
00792 int SDL_imageFilterMultNorASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00793 {
00794 #ifdef USE_MMX
00795 #if !defined(GCC__)
00796         __asm
00797         {
00798                 pusha
00799                         mov edx, Src1   /* load Src1 address into edx */
00800                         mov esi, Src2   /* load Src2 address into esi */
00801                         mov edi, Dest   /* load Dest address into edi */
00802                         mov ecx, SrcLength   /* load loop counter (SIZE) into ecx */
00803                         align 16        /* 16 byte alignment of the loop entry */
00804 L10141:
00805                 mov al, [edx]   /* load a byte from Src1 */
00806                 mul [esi]       /* mul with a byte from Src2 */
00807                 mov [edi], al   /* move a byte result to Dest */
00808                         inc edx         /* increment Src1, Src2, Dest */
00809                         inc esi                 /* pointer registers by one */
00810                         inc edi
00811                         dec ecx /* decrease loop counter */
00812                         jnz L10141      /* check loop termination, proceed if required */
00813                         popa
00814         }
00815 #else
00816         /* Note: ~5% gain on i386, less efficient than C on x86_64 */
00817         /* Also depends on whether this function is static (?!) */
00818         asm volatile (
00819                 ".align 16       \n\t"  /* 16 byte alignment of the loop entry */
00820 #  if defined(i386)
00821                 "1:mov  (%%edx), %%al \n\t"      /* load a byte from Src1 */
00822                 "mulb (%%esi)       \n\t"       /* mul with a byte from Src2 */
00823                 "mov %%al, (%%edi)  \n\t"       /* move a byte result to Dest */
00824                 "inc %%edx \n\t"                /* increment Src1, Src2, Dest */
00825                 "inc %%esi \n\t"                /* pointer registers by one */
00826                 "inc %%edi \n\t"
00827                 "dec %%ecx      \n\t"   /* decrease loop counter */
00828 #  elif defined(__x86_64__)
00829                 "1:mov  (%%rdx), %%al \n\t"      /* load a byte from Src1 */
00830                 "mulb (%%rsi)       \n\t"       /* mul with a byte from Src2 */
00831                 "mov %%al, (%%rdi)  \n\t"       /* move a byte result to Dest */
00832                 "inc %%rdx \n\t"                /* increment Src1, Src2, Dest */
00833                 "inc %%rsi \n\t"                /* pointer registers by one */
00834                 "inc %%rdi \n\t"
00835                 "dec %%rcx      \n\t"   /* decrease loop counter */
00836 #  endif
00837                 "jnz 1b         \n\t"   /* check loop termination, proceed if required */
00838                 : "+d" (Src1),          /* load Src1 address into edx */
00839                   "+S" (Src2),          /* load Src2 address into esi */
00840                   "+c" (SrcLength),     /* load loop counter (SIZE) into ecx */
00841                   "+D" (Dest)           /* load Dest address into edi */
00842                 :
00843                 : "memory", "rax"
00844                 );
00845 #endif
00846         return (0);
00847 #else
00848         return (-1);
00849 #endif
00850 }
00851 
00862 int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00863 {
00864         unsigned int i, istart;
00865         unsigned char *cursrc1, *cursrc2, *curdst;
00866 
00867         /* Validate input parameters */
00868         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00869                 return(-1);
00870         if (length == 0)
00871                 return(0);
00872 
00873         if (SDL_imageFilterMMXdetect()) {
00874                 if (length > 0) {
00875                         /* ASM routine */
00876                         SDL_imageFilterMultNorASM(Src1, Src2, Dest, length);
00877 
00878                         /* Check for unaligned bytes */
00879                         if ((length & 7) > 0) {
00880                                 /* Setup to process unaligned bytes */
00881                                 istart = length & 0xfffffff8;
00882                                 cursrc1 = &Src1[istart];
00883                                 cursrc2 = &Src2[istart];
00884                                 curdst = &Dest[istart];
00885                         } else {
00886                                 /* No unaligned bytes - we are done */
00887                                 return (0);
00888                         }
00889                 } else {
00890                         /* No bytes - we are done */
00891                         return (0);
00892                 }
00893         } else {
00894                 /* Setup to process whole image */
00895                 istart = 0;
00896                 cursrc1 = Src1;
00897                 cursrc2 = Src2;
00898                 curdst = Dest;
00899         }
00900 
00901         /* C routine to process image */
00902         for (i = istart; i < length; i++) {
00903                 *curdst = (int)*cursrc1 * (int)*cursrc2;  // (int) for efficiency
00904                 /* Advance pointers */
00905                 cursrc1++;
00906                 cursrc2++;
00907                 curdst++;
00908         }
00909 
00910         return (0);
00911 }
00912 
00923 static int SDL_imageFilterMultDivby2MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00924 {
00925 #ifdef USE_MMX
00926 #if !defined(GCC__)
00927         __asm
00928         { 
00929                 pusha
00930                         mov eax, Src1           /* load Src1 address into eax */
00931                         mov ebx, Src2           /* load Src2 address into ebx */
00932                         mov edi, Dest           /* load Dest address into edi */
00933                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
00934                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
00935                         pxor mm0,  mm0  /* zero mm0 register */
00936                         align 16                /* 16 byte alignment of the loop entry */
00937 L1015:
00938                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00939                 movq mm3,  [ebx]        /* load 8 bytes from Src2 into mm3 */
00940                 movq mm2,  mm1  /* copy mm1 into mm2 */
00941                         movq mm4,  mm3  /* copy mm3 into mm4  */
00942                         punpcklbw mm1,  mm0     /* unpack low  bytes of Src1 into words */
00943                         punpckhbw mm2,  mm0     /* unpack high bytes of Src1 into words */
00944                         punpcklbw mm3,  mm0     /* unpack low  bytes of Src2 into words */
00945                         punpckhbw mm4,  mm0     /* unpack high bytes of Src2 into words */
00946                         psrlw mm1,  1   /* divide mm1 words by 2, Src1 low bytes */
00947                         psrlw mm2,  1   /* divide mm2 words by 2, Src1 high bytes */
00948                         pmullw mm1,  mm3        /* mul low  bytes of Src1 and Src2  */
00949                         pmullw mm2,  mm4        /* mul high bytes of Src1 and Src2 */
00950                         packuswb mm1,  mm2      /* pack words back into bytes with saturation */
00951                         movq [edi],  mm1        /* store result in Dest */
00952                         add eax,  8     /* increase Src1, Src2 and Dest  */
00953                         add ebx,  8     /* register pointers by 8 */
00954                         add edi,  8
00955                         dec ecx         /* decrease loop counter */
00956                         jnz L1015               /* check loop termination, proceed if required */
00957                         emms                    /* exit MMX state */
00958                         popa
00959         }
00960 #else
00961         /* i386 and x86_64 */
00962         __m64 *mSrc1 = (__m64*)Src1;
00963         __m64 *mSrc2 = (__m64*)Src2;
00964         __m64 *mDest = (__m64*)Dest;
00965         __m64 mm0 = _m_from_int(0); /* zero mm0 register */
00966         int i;
00967         for (i = 0; i < SrcLength/8; i++) {
00968                 __m64 mm1, mm2, mm3, mm4, mm5, mm6;
00969                 mm1 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
00970                 mm2 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
00971                 mm3 = _m_punpcklbw(*mSrc2, mm0);        /* unpack low  bytes of Src2 into words */
00972                 mm4 = _m_punpckhbw(*mSrc2, mm0);        /* unpack high bytes of Src2 into words */
00973                 mm1 = _m_psrlwi(mm1, 1);                /* divide mm1 words by 2, Src1 low bytes */
00974                 mm2 = _m_psrlwi(mm2, 1);                /* divide mm2 words by 2, Src1 high bytes */
00975                 mm1 = _m_pmullw(mm1, mm3);              /* mul low  bytes of Src1 and Src2  */
00976                 mm2 = _m_pmullw(mm2, mm4);              /* mul high bytes of Src1 and Src2 */
00977                 *mDest = _m_packuswb(mm1, mm2);         /* pack words back into bytes with saturation */
00978                 mSrc1++;
00979                 mSrc2++;
00980                 mDest++;
00981         }
00982         _m_empty();                                     /* clean MMX state */
00983 #endif
00984         return (0);
00985 #else
00986         return (-1);
00987 #endif
00988 }
00989 
01000 int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01001 {
01002         unsigned int i, istart;
01003         unsigned char *cursrc1, *cursrc2, *curdst;
01004         int result;
01005 
01006         /* Validate input parameters */
01007         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01008                 return(-1);
01009         if (length == 0)
01010                 return(0);
01011 
01012         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01013                 /* MMX routine */
01014                 SDL_imageFilterMultDivby2MMX(Src1, Src2, Dest, length);
01015 
01016                 /* Check for unaligned bytes */
01017                 if ((length & 7) > 0) {
01018                         /* Setup to process unaligned bytes */
01019                         istart = length & 0xfffffff8;
01020                         cursrc1 = &Src1[istart];
01021                         cursrc2 = &Src2[istart];
01022                         curdst = &Dest[istart];
01023                 } else {
01024                         /* No unaligned bytes - we are done */
01025                         return (0);
01026                 }
01027         } else {
01028                 /* Setup to process whole image */
01029                 istart = 0;
01030                 cursrc1 = Src1;
01031                 cursrc2 = Src2;
01032                 curdst = Dest;
01033         }
01034 
01035         /* C routine to process image */
01036         for (i = istart; i < length; i++) {
01037                 result = ((int) *cursrc1 / 2) * (int) *cursrc2;
01038                 if (result > 255)
01039                         result = 255;
01040                 *curdst = (unsigned char) result;
01041                 /* Advance pointers */
01042                 cursrc1++;
01043                 cursrc2++;
01044                 curdst++;
01045         }
01046 
01047         return (0);
01048 }
01049 
01060 static int SDL_imageFilterMultDivby4MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01061 {
01062 #ifdef USE_MMX
01063 #if !defined(GCC__)
01064         __asm
01065         {
01066                 pusha
01067                         mov eax, Src1           /* load Src1 address into eax */
01068                         mov ebx, Src2           /* load Src2 address into ebx */
01069                         mov edi, Dest           /* load Dest address into edi */
01070                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01071                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01072                         pxor mm0, mm0           /* zero mm0 register */
01073                         align 16                /* 16 byte alignment of the loop entry */
01074 L1016:
01075                 movq mm1, [eax]         /* load 8 bytes from Src1 into mm1 */
01076                 movq mm3, [ebx]         /* load 8 bytes from Src2 into mm3 */
01077                 movq mm2, mm1           /* copy mm1 into mm2 */
01078                         movq mm4, mm3           /* copy mm3 into mm4  */
01079                         punpcklbw mm1, mm0      /* unpack low  bytes of Src1 into words */
01080                         punpckhbw mm2, mm0      /* unpack high bytes of Src1 into words */
01081                         punpcklbw mm3, mm0      /* unpack low  bytes of Src2 into words */
01082                         punpckhbw mm4, mm0      /* unpack high bytes of Src2 into words */
01083                         psrlw mm1, 1    /* divide mm1 words by 2, Src1 low bytes */
01084                         psrlw mm2, 1    /* divide mm2 words by 2, Src1 high bytes */
01085                         psrlw mm3, 1    /* divide mm3 words by 2, Src2 low bytes */
01086                         psrlw mm4, 1    /* divide mm4 words by 2, Src2 high bytes */
01087                         pmullw mm1, mm3         /* mul low  bytes of Src1 and Src2  */
01088                         pmullw mm2, mm4         /* mul high bytes of Src1 and Src2 */
01089                         packuswb mm1, mm2       /* pack words back into bytes with saturation */
01090                         movq [edi], mm1         /* store result in Dest */
01091                         add eax, 8      /* increase Src1, Src2 and Dest  */
01092                         add ebx, 8      /* register pointers by 8 */
01093                         add edi,  8
01094                         dec ecx         /* decrease loop counter */
01095                         jnz L1016               /* check loop termination, proceed if required */
01096                         emms                    /* exit MMX state */
01097                         popa
01098         }
01099 #else
01100         /* i386 and x86_64 */
01101         __m64 *mSrc1 = (__m64*)Src1;
01102         __m64 *mSrc2 = (__m64*)Src2;
01103         __m64 *mDest = (__m64*)Dest;
01104         __m64 mm0 = _m_from_int(0); /* zero mm0 register */
01105         int i;
01106         for (i = 0; i < SrcLength/8; i++) {
01107                 __m64 mm1, mm2, mm3, mm4, mm5, mm6;
01108                 mm1 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
01109                 mm2 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
01110                 mm3 = _m_punpcklbw(*mSrc2, mm0);        /* unpack low  bytes of Src2 into words */
01111                 mm4 = _m_punpckhbw(*mSrc2, mm0);        /* unpack high bytes of Src2 into words */
01112                 mm1 = _m_psrlwi(mm1, 1);                /* divide mm1 words by 2, Src1 low bytes */
01113                 mm2 = _m_psrlwi(mm2, 1);                /* divide mm2 words by 2, Src1 high bytes */
01114                 mm3 = _m_psrlwi(mm3, 1);                /* divide mm3 words by 2, Src2 low bytes */
01115                 mm4 = _m_psrlwi(mm4, 1);                /* divide mm4 words by 2, Src2 high bytes */
01116                 mm1 = _m_pmullw(mm1, mm3);              /* mul low  bytes of Src1 and Src2  */
01117                 mm2 = _m_pmullw(mm2, mm4);              /* mul high bytes of Src1 and Src2 */
01118                 *mDest = _m_packuswb(mm1, mm2);         /* pack words back into bytes with saturation */
01119                 mSrc1++;
01120                 mSrc2++;
01121                 mDest++;
01122         }
01123         _m_empty();                                     /* clean MMX state */
01124 #endif
01125         return (0);
01126 #else
01127         return (-1);
01128 #endif
01129 }
01130 
01141 int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01142 {
01143         unsigned int i, istart;
01144         unsigned char *cursrc1, *cursrc2, *curdst;
01145         int result;
01146 
01147         /* Validate input parameters */
01148         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01149                 return(-1);
01150         if (length == 0)
01151                 return(0);
01152 
01153         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01154                 /* MMX routine */
01155                 SDL_imageFilterMultDivby4MMX(Src1, Src2, Dest, length);
01156 
01157                 /* Check for unaligned bytes */
01158                 if ((length & 7) > 0) {
01159                         /* Setup to process unaligned bytes */
01160                         istart = length & 0xfffffff8;
01161                         cursrc1 = &Src1[istart];
01162                         cursrc2 = &Src2[istart];
01163                         curdst = &Dest[istart];
01164                 } else {
01165                         /* No unaligned bytes - we are done */
01166                         return (0);
01167                 }
01168         } else {
01169                 /* Setup to process whole image */
01170                 istart = 0;
01171                 cursrc1 = Src1;
01172                 cursrc2 = Src2;
01173                 curdst = Dest;
01174         }
01175 
01176         /* C routine to process image */
01177         for (i = istart; i < length; i++) {
01178                 result = ((int) *cursrc1 / 2) * ((int) *cursrc2 / 2);
01179                 if (result > 255)
01180                         result = 255;
01181                 *curdst = (unsigned char) result;
01182                 /* Advance pointers */
01183                 cursrc1++;
01184                 cursrc2++;
01185                 curdst++;
01186         }
01187 
01188         return (0);
01189 }
01190 
01201 static int SDL_imageFilterBitAndMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01202 {
01203 #ifdef USE_MMX
01204 #if !defined(GCC__)
01205         __asm
01206         {
01207                 pusha
01208                         mov eax, Src1           /* load Src1 address into eax */
01209                         mov ebx, Src2           /* load Src2 address into ebx */
01210                         mov edi, Dest           /* load Dest address into edi */
01211                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01212                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
01213                         align 16                /* 16 byte alignment of the loop entry */
01214 L1017:
01215                 movq mm1, [eax]         /* load 8 bytes from Src1 into mm1 */
01216                 pand mm1, [ebx]         /* mm1=Src1&Src2 */
01217                 movq [edi], mm1         /* store result in Dest */
01218                         add eax, 8      /* increase Src1, Src2 and Dest  */
01219                         add ebx, 8      /* register pointers by 8 */
01220                         add edi, 8
01221                         dec ecx         /* decrease loop counter */
01222                         jnz L1017               /* check loop termination, proceed if required */
01223                         emms                    /* exit MMX state */
01224                         popa
01225         }
01226 #else
01227         /* x86_64 ASM with constraints: */
01228         /* asm volatile ( */
01229         /*      "shr $3, %%rcx \n\t"    /\* counter/8 (MMX loads 8 bytes at a time) *\/ */
01230         /*      ".align 16       \n\t"  /\* 16 byte alignment of the loop entry *\/ */
01231         /*      "1: movq (%%rax), %%mm1 \n\t"   /\* load 8 bytes from Src1 into mm1 *\/ */
01232         /*      "pand    (%%rbx), %%mm1 \n\t"   /\* mm1=Src1&Src2 *\/ */
01233         /*      "movq    %%mm1, (%%rdi) \n\t"   /\* store result in Dest *\/ */
01234         /*      "add $8, %%rax \n\t"    /\* increase Src1, Src2 and Dest  *\/ */
01235         /*      "add $8, %%rbx \n\t"    /\* register pointers by 8 *\/ */
01236         /*      "add $8, %%rdi \n\t" */
01237         /*      "dec %%rcx     \n\t"    /\* decrease loop counter *\/ */
01238         /*      "jnz 1b        \n\t"    /\* check loop termination, proceed if required *\/ */
01239         /*      "emms          \n\t"    /\* exit MMX state *\/ */
01240         /*      : "+a" (Src1),          /\* load Src1 address into rax, modified by the loop *\/ */
01241         /*        "+b" (Src2),          /\* load Src2 address into rbx, modified by the loop *\/ */
01242         /*        "+c" (SrcLength),     /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */
01243         /*        "+D" (Dest)           /\* load Dest address into rdi, modified by the loop *\/ */
01244         /*      : */
01245         /*      : "memory",             /\* *Dest is modified *\/ */
01246         /*           "mm1"                      /\* register mm1 modified *\/ */
01247         /* ); */
01248 
01249         /* i386 and x86_64 */
01250         __m64 *mSrc1 = (__m64*)Src1;
01251         __m64 *mSrc2 = (__m64*)Src2;
01252         __m64 *mDest = (__m64*)Dest;
01253         int i;
01254         for (i = 0; i < SrcLength/8; i++) {
01255                 *mDest = _m_pand(*mSrc1, *mSrc2);       /* Src1&Src2 */
01256                 mSrc1++;
01257                 mSrc2++;
01258                 mDest++;
01259         }
01260         _m_empty();                                     /* clean MMX state */
01261 #endif
01262         return (0);
01263 #else
01264         return (-1);
01265 #endif
01266 }
01267 
01278 int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01279 {
01280         unsigned int i, istart;
01281         unsigned char *cursrc1, *cursrc2, *curdst;
01282 
01283         /* Validate input parameters */
01284         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01285                 return(-1);
01286         if (length == 0)
01287                 return(0);
01288 
01289         if ((SDL_imageFilterMMXdetect()>0) && (length>7)) {
01290                 /*  if (length > 7) { */
01291                 /* Call MMX routine */
01292 
01293                 SDL_imageFilterBitAndMMX(Src1, Src2, Dest, length);
01294 
01295                 /* Check for unaligned bytes */
01296                 if ((length & 7) > 0) {
01297 
01298                         /* Setup to process unaligned bytes */
01299                         istart = length & 0xfffffff8;
01300                         cursrc1 = &Src1[istart];
01301                         cursrc2 = &Src2[istart];
01302                         curdst = &Dest[istart];
01303                 } else {
01304                         /* No unaligned bytes - we are done */
01305                         return (0);
01306                 }
01307         } else {
01308                 /* Setup to process whole image */
01309                 istart = 0;
01310                 cursrc1 = Src1;
01311                 cursrc2 = Src2;
01312                 curdst = Dest;
01313         }
01314 
01315         /* C routine to process image */
01316         for (i = istart; i < length; i++) {
01317                 *curdst = (*cursrc1) & (*cursrc2);
01318                 /* Advance pointers */
01319                 cursrc1++;
01320                 cursrc2++;
01321                 curdst++;
01322         }
01323 
01324         return (0);
01325 }
01326 
01337 static int SDL_imageFilterBitOrMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01338 {
01339 #ifdef USE_MMX
01340 #if !defined(GCC__)
01341         __asm
01342         {
01343                 pusha
01344                         mov eax, Src1           /* load Src1 address into eax */
01345                         mov ebx, Src2           /* load Src2 address into ebx */
01346                         mov edi, Dest           /* load Dest address into edi */
01347                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01348                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01349                         align 16                /* 16 byte alignment of the loop entry */
01350 L91017:
01351                 movq mm1, [eax]         /* load 8 bytes from Src1 into mm1 */
01352                 por mm1, [ebx]          /* mm1=Src1|Src2 */
01353                 movq [edi], mm1         /* store result in Dest */
01354                         add eax, 8      /* increase Src1, Src2 and Dest  */
01355                         add ebx, 8      /* register pointers by 8 */
01356                         add edi,  8
01357                         dec ecx         /* decrease loop counter */
01358                         jnz L91017              /* check loop termination, proceed if required */
01359                         emms                    /* exit MMX state */
01360                         popa
01361         }
01362 #else
01363         /* i386 and x86_64 */
01364         __m64 *mSrc1 = (__m64*)Src1;
01365         __m64 *mSrc2 = (__m64*)Src2;
01366         __m64 *mDest = (__m64*)Dest;
01367         int i;
01368         for (i = 0; i < SrcLength/8; i++) {
01369                 *mDest = _m_por(*mSrc1, *mSrc2);        /* Src1|Src2 */
01370                 mSrc1++;
01371                 mSrc2++;
01372                 mDest++;
01373         }
01374         _m_empty();                                     /* clean MMX state */
01375 #endif
01376         return (0);
01377 #else
01378         return (-1);
01379 #endif
01380 }
01381 
01392 int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01393 {
01394         unsigned int i, istart;
01395         unsigned char *cursrc1, *cursrc2, *curdst;
01396 
01397         /* Validate input parameters */
01398         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01399                 return(-1);
01400         if (length == 0)
01401                 return(0);
01402 
01403         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01404 
01405                 /* MMX routine */
01406                 SDL_imageFilterBitOrMMX(Src1, Src2, Dest, length);
01407 
01408                 /* Check for unaligned bytes */
01409                 if ((length & 7) > 0) {
01410                         /* Setup to process unaligned bytes */
01411                         istart = length & 0xfffffff8;
01412                         cursrc1 = &Src1[istart];
01413                         cursrc2 = &Src2[istart];
01414                         curdst = &Dest[istart];
01415                 } else {
01416                         /* No unaligned bytes - we are done */
01417                         return (0);
01418                 }
01419         } else {
01420                 /* Setup to process whole image */
01421                 istart = 0;
01422                 cursrc1 = Src1;
01423                 cursrc2 = Src2;
01424                 curdst = Dest;
01425         }
01426 
01427         /* C routine to process image */
01428         for (i = istart; i < length; i++) {
01429                 *curdst = *cursrc1 | *cursrc2;
01430                 /* Advance pointers */
01431                 cursrc1++;
01432                 cursrc2++;
01433                 curdst++;
01434         }
01435         return (0);
01436 }
01437 
01448 static int SDL_imageFilterDivASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01449 {
01450 #ifdef USE_MMX
01451 #if !defined(GCC__)
01452         __asm
01453         {
01454                 pusha
01455                         mov edx, Src1           /* load Src1 address into edx */
01456                         mov esi, Src2           /* load Src2 address into esi */
01457                         mov edi, Dest           /* load Dest address into edi */
01458                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01459                         align 16                /* 16 byte alignment of the loop entry */
01460 L10191:
01461                 mov bl, [esi]           /* load a byte from Src2 */
01462                 cmp bl, 0       /* check if it zero */
01463                         jnz L10192
01464                         mov [edi], 255          /* division by zero = 255 !!! */
01465                         jmp  L10193
01466 L10192:
01467                 xor ah, ah      /* prepare AX, zero AH register */
01468                         mov al, [edx]           /* load a byte from Src1 into AL */
01469                 div   bl                /* divide AL by BL */
01470                         mov [edi], al           /* move a byte result to Dest */
01471 L10193:
01472                 inc edx         /* increment Src1, Src2, Dest */
01473                         inc esi                 /* pointer registers by one */
01474                         inc edi
01475                         dec ecx         /* decrease loop counter */
01476                         jnz L10191      /* check loop termination, proceed if required */
01477                         popa
01478         }
01479 #else
01480         /* Note: ~15% gain on i386, less efficient than C on x86_64 */
01481         /* Also depends on whether the function is static (?!) */
01482         /* Also depends on whether we work on malloc() or static char[] */
01483         asm volatile (
01484 #  if defined(i386)
01485                 "pushl %%ebx \n\t"              /* %ebx may be the PIC register.  */
01486                 ".align 16     \n\t"            /* 16 byte alignment of the loop entry */
01487                 "1: mov (%%esi), %%bl  \n\t"    /* load a byte from Src2 */
01488                 "cmp       $0, %%bl    \n\t"    /* check if it zero */
01489                 "jnz 2f                \n\t"
01490                 "movb  $255, (%%edi)   \n\t"    /* division by zero = 255 !!! */
01491                 "jmp 3f                \n\t"
01492                 "2: xor %%ah, %%ah     \n\t"    /* prepare AX, zero AH register */
01493                 "mov   (%%edx), %%al   \n\t"    /* load a byte from Src1 into AL */
01494                 "div   %%bl            \n\t"    /* divide AL by BL */
01495                 "mov   %%al, (%%edi)   \n\t"    /* move a byte result to Dest */
01496                 "3: inc %%edx          \n\t"    /* increment Src1, Src2, Dest */
01497                 "inc %%esi \n\t"                /* pointer registers by one */
01498                 "inc %%edi \n\t"
01499                 "dec %%ecx \n\t"                /* decrease loop counter */
01500                 "jnz 1b    \n\t"                /* check loop termination, proceed if required */
01501                 "popl %%ebx \n\t"               /* restore %ebx */
01502                 : "+d" (Src1),          /* load Src1 address into edx */
01503                   "+S" (Src2),          /* load Src2 address into esi */
01504                   "+c" (SrcLength),     /* load loop counter (SIZE) into ecx */
01505                   "+D" (Dest)           /* load Dest address into edi */
01506                 :
01507                 : "memory", "rax"
01508 #  elif defined(__x86_64__)
01509                 ".align 16     \n\t"            /* 16 byte alignment of the loop entry */
01510                 "1: mov (%%rsi), %%bl  \n\t"    /* load a byte from Src2 */
01511                 "cmp       $0, %%bl    \n\t"    /* check if it zero */
01512                 "jnz 2f                \n\t"
01513                 "movb  $255, (%%rdi)   \n\t"    /* division by zero = 255 !!! */
01514                 "jmp 3f                \n\t"
01515                 "2: xor %%ah, %%ah     \n\t"    /* prepare AX, zero AH register */
01516                 "mov   (%%rdx), %%al   \n\t"    /* load a byte from Src1 into AL */
01517                 "div   %%bl            \n\t"    /* divide AL by BL */
01518                 "mov   %%al, (%%rdi)   \n\t"    /* move a byte result to Dest */
01519                 "3: inc %%rdx          \n\t"    /* increment Src1, Src2, Dest */
01520                 "inc %%rsi \n\t"                /* pointer registers by one */
01521                 "inc %%rdi \n\t"
01522                 "dec %%rcx \n\t"                /* decrease loop counter */
01523                 "jnz 1b    \n\t"                /* check loop termination, proceed if required */
01524                 : "+d" (Src1),          /* load Src1 address into edx */
01525                   "+S" (Src2),          /* load Src2 address into esi */
01526                   "+c" (SrcLength),     /* load loop counter (SIZE) into ecx */
01527                   "+D" (Dest)           /* load Dest address into edi */
01528                 :
01529                 : "memory", "rax", "rbx"
01530 #  endif
01531                 );
01532 #endif
01533         return (0);
01534 #else
01535         return (-1);
01536 #endif
01537 }
01538 
01549 int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01550 {
01551         unsigned int i, istart;
01552         unsigned char *cursrc1, *cursrc2, *curdst;
01553 
01554         /* Validate input parameters */
01555         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01556                 return(-1);
01557         if (length == 0)
01558                 return(0);
01559 
01560         if (SDL_imageFilterMMXdetect()) {
01561                 if (length > 0) {
01562                         /* Call ASM routine */
01563                         SDL_imageFilterDivASM(Src1, Src2, Dest, length);
01564 
01565                         /* Never unaligned bytes - we are done */
01566                         return (0);
01567                 } else {
01568                         return (-1);
01569                 }
01570         } 
01571         
01572         /* Setup to process whole image */
01573         istart = 0;
01574         cursrc1 = Src1;
01575         cursrc2 = Src2;
01576         curdst = Dest;
01577 
01578         /* C routine to process image */
01579         /* for (i = istart; i < length; i++) { */
01580         /*      if (*cursrc2 == 0) { */
01581         /*              *curdst = 255; */
01582         /*      } else { */
01583         /*              result = (int) *cursrc1 / (int) *cursrc2; */
01584         /*              *curdst = (unsigned char) result; */
01585         /*      } */
01586         /*      /\* Advance pointers *\/ */
01587         /*      cursrc1++; */
01588         /*      cursrc2++; */
01589         /*      curdst++; */
01590         /* } */
01591         for (i = istart; i < length; i++) {
01592                 if (*cursrc2 == 0) {
01593                         *curdst = 255;
01594                 } else {
01595                         *curdst = (int)*cursrc1 / (int)*cursrc2;  // (int) for efficiency
01596                 }
01597                 /* Advance pointers */
01598                 cursrc1++;
01599                 cursrc2++;
01600                 curdst++;
01601         }
01602 
01603         return (0);
01604 }
01605 
01606 /* ------------------------------------------------------------------------------------ */
01607 
01617 static int SDL_imageFilterBitNegationMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength)
01618 {
01619 #ifdef USE_MMX
01620 #if !defined(GCC__)
01621         __asm
01622         {
01623                 pusha
01624                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
01625                         mov eax, Src1           /* load Src1 address into eax */
01626                         mov edi, Dest           /* load Dest address into edi */
01627                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01628                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01629                         align 16                /* 16 byte alignment of the loop entry */
01630 L91117:
01631                 movq mm0, [eax]         /* load 8 bytes from Src1 into mm1 */
01632                 pxor mm0, mm1           /* negate mm0 by xoring with mm1 */
01633                         movq [edi], mm0         /* store result in Dest */
01634                         add eax, 8      /* increase Src1, Src2 and Dest  */
01635                         add edi,  8
01636                         dec ecx         /* decrease loop counter */
01637                         jnz L91117              /* check loop termination, proceed if required */
01638                         emms                    /* exit MMX state */
01639                         popa
01640         }
01641 #else
01642         /* i386 and x86_64 */
01643         __m64 *mSrc1 = (__m64*)Src1;
01644         __m64 *mDest = (__m64*)Dest;
01645         __m64 mm1;
01646         mm1 = _m_pcmpeqb(mm1, mm1);             /* generate all 1's in mm1 */
01647         int i;
01648         for (i = 0; i < SrcLength/8; i++) {
01649                 *mDest = _m_pxor(*mSrc1, mm1);  /* negate mm0 by xoring with mm1 */
01650                 mSrc1++;
01651                 mDest++;
01652         }
01653         _m_empty();                             /* clean MMX state */
01654 
01655 #endif
01656         return (0);
01657 #else
01658         return (-1);
01659 #endif
01660 }
01661 
01671 int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length)
01672 {
01673         unsigned int i, istart;
01674         unsigned char *cursrc1, *curdst;
01675 
01676         /* Validate input parameters */
01677         if ((Src1 == NULL) || (Dest == NULL))
01678                 return(-1);
01679         if (length == 0)
01680                 return(0);
01681 
01682         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01683                 /* MMX routine */
01684                 SDL_imageFilterBitNegationMMX(Src1, Dest, length);
01685 
01686                 /* Check for unaligned bytes */
01687                 if ((length & 7) > 0) {
01688                         /* Setup to process unaligned bytes */
01689                         istart = length & 0xfffffff8;
01690                         cursrc1 = &Src1[istart];
01691                         curdst = &Dest[istart];
01692                 } else {
01693                         /* No unaligned bytes - we are done */
01694                         return (0);
01695                 }
01696         } else {
01697                 /* Setup to process whole image */
01698                 istart = 0;
01699                 cursrc1 = Src1;
01700                 curdst = Dest;
01701         }
01702 
01703         /* C routine to process image */
01704         for (i = istart; i < length; i++) {
01705                 *curdst = ~(*cursrc1);
01706                 /* Advance pointers */
01707                 cursrc1++;
01708                 curdst++;
01709         }
01710 
01711         return (0);
01712 }
01713 
01724 static int SDL_imageFilterAddByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
01725 {
01726 #ifdef USE_MMX
01727 #if !defined(GCC__)
01728         __asm
01729         {
01730                 pusha
01731                         /* ** Duplicate C in 8 bytes of MM1 ** */
01732                         mov al, C       /* load C into AL */
01733                         mov ah, al      /* copy AL into AH */
01734                         mov bx, ax      /* copy AX into BX */
01735                         shl eax, 16     /* shift 2 bytes of EAX left */
01736                         mov ax, bx      /* copy BX into AX */
01737                         movd mm1, eax           /* copy EAX into MM1 */
01738                         movd mm2, eax           /* copy EAX into MM2 */
01739                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
01740                         mov eax, Src1           /* load Src1 address into eax */
01741                         mov edi, Dest           /* load Dest address into edi */
01742                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01743                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01744                         align 16                        /* 16 byte alignment of the loop entry */
01745 L1021:
01746                 movq mm0, [eax]         /* load 8 bytes from Src1 into MM0 */
01747                 paddusb mm0,  mm1       /* MM0=SrcDest+C (add 8 bytes with saturation) */
01748                         movq [edi], mm0         /* store result in Dest */
01749                         add eax, 8      /* increase Dest register pointer by 8 */
01750                         add edi, 8      /* increase Dest register pointer by 8 */
01751                         dec              ecx            /* decrease loop counter */
01752                         jnz             L1021           /* check loop termination, proceed if required */
01753                         emms                            /* exit MMX state */
01754                         popa
01755         }
01756 #else
01757         /* i386 and x86_64 */
01758         __m64 *mSrc1 = (__m64*)Src1;
01759         __m64 *mDest = (__m64*)Dest;
01760         /* Duplicate C in 8 bytes of MM1 */
01761         int i;
01762         memset(&i, C, 4);
01763         __m64 mm1 = _m_from_int(i);
01764         __m64 mm2 = _m_from_int(i);
01765         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
01766         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
01767         for (i = 0; i < SrcLength/8; i++) {
01768                 *mDest = _m_paddusb(*mSrc1, mm1);       /* Src1+C (add 8 bytes with saturation) */
01769                 mSrc1++;
01770                 mDest++;
01771         }
01772         _m_empty();                                     /* clean MMX state */
01773 #endif
01774         return (0);
01775 #else
01776         return (-1);
01777 #endif
01778 }
01779 
01791 int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
01792 {
01793         unsigned int i, istart;
01794         int iC;
01795         unsigned char *cursrc1, *curdest;
01796         int result;
01797 
01798         /* Validate input parameters */
01799         if ((Src1 == NULL) || (Dest == NULL))
01800                 return(-1);
01801         if (length == 0)
01802                 return(0);
01803 
01804         /* Special case: C==0 */
01805         if (C == 0) {
01806                 memcpy(Src1, Dest, length);
01807                 return (0); 
01808         }
01809 
01810         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01811 
01812                 /* MMX routine */
01813                 SDL_imageFilterAddByteMMX(Src1, Dest, length, C);
01814 
01815                 /* Check for unaligned bytes */
01816                 if ((length & 7) > 0) {
01817                         /* Setup to process unaligned bytes */
01818                         istart = length & 0xfffffff8;
01819                         cursrc1 = &Src1[istart];
01820                         curdest = &Dest[istart];
01821                 } else {
01822                         /* No unaligned bytes - we are done */
01823                         return (0);
01824                 }
01825         } else {
01826                 /* Setup to process whole image */
01827                 istart = 0;
01828                 cursrc1 = Src1;
01829                 curdest = Dest;
01830         }
01831 
01832         /* C routine to process image */
01833         iC = (int) C;
01834         for (i = istart; i < length; i++) {
01835                 result = (int) *cursrc1 + iC;
01836                 if (result > 255)
01837                         result = 255;
01838                 *curdest = (unsigned char) result;
01839                 /* Advance pointers */
01840                 cursrc1++;
01841                 curdest++;
01842         }
01843         return (0);
01844 }
01845 
01857 static int SDL_imageFilterAddUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D)
01858 {
01859 #ifdef USE_MMX
01860 #if !defined(GCC__)
01861         __asm
01862         {
01863                 pusha
01864                         /* ** Duplicate (int)C in 8 bytes of MM1 ** */
01865                         mov eax, C      /* load C into EAX */
01866                         movd mm1, eax           /* copy EAX into MM1 */
01867                         mov eax, D      /* load D into EAX */
01868                         movd mm2, eax           /* copy EAX into MM2 */
01869                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
01870                         mov eax, Src1           /* load Src1 address into eax */
01871                         mov edi, Dest           /* load Dest address into edi */
01872                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01873                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01874                         align 16                        /* 16 byte alignment of the loop entry */
01875 L11023:
01876                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
01877                 paddusb mm0,  mm1       /* MM0=SrcDest+C (add 8 bytes with saturation) */
01878                         movq [edi],  mm0        /* store result in SrcDest */
01879                         add eax, 8      /* increase Src1 register pointer by 8 */
01880                         add edi, 8      /* increase Dest register pointer by 8 */
01881                         dec              ecx            /* decrease loop counter */
01882                         jnz             L11023          /* check loop termination, proceed if required */
01883                         emms                            /* exit MMX state */
01884                         popa
01885         }
01886 #else
01887         /* i386 and x86_64 */
01888         __m64 *mSrc1 = (__m64*)Src1;
01889         __m64 *mDest = (__m64*)Dest;
01890         /* Duplicate (int)C in 8 bytes of MM1 */
01891         __m64 mm1 = _m_from_int(C);
01892         __m64 mm2 = _m_from_int(C);
01893         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
01894         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
01895         int i;
01896         for (i = 0; i < SrcLength/8; i++) {
01897                 *mDest = _m_paddusb(*mSrc1, mm1);       /* Src1+C (add 8 bytes with saturation) */
01898                 mSrc1++;
01899                 mDest++;
01900         }
01901         _m_empty();                                     /* clean MMX state */
01902 #endif
01903         return (0);
01904 #else
01905         return (-1);
01906 #endif
01907 }
01908 
01919 int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
01920 {
01921         unsigned int i, j, istart, D;
01922         int iC[4];
01923         unsigned char *cursrc1;
01924         unsigned char *curdest;
01925         int result;
01926 
01927         /* Validate input parameters */
01928         if ((Src1 == NULL) || (Dest == NULL))
01929                 return(-1);
01930         if (length == 0)
01931                 return(0);
01932 
01933         /* Special case: C==0 */
01934         if (C == 0) {
01935                 memcpy(Src1, Dest, length);
01936                 return (0); 
01937         }
01938 
01939         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01940 
01941                 /* MMX routine */
01942                 D=SWAP_32(C);
01943                 SDL_imageFilterAddUintMMX(Src1, Dest, length, C, D);
01944 
01945                 /* Check for unaligned bytes */
01946                 if ((length & 7) > 0) {
01947                         /* Setup to process unaligned bytes */
01948                         istart = length & 0xfffffff8;
01949                         cursrc1 = &Src1[istart];
01950                         curdest = &Dest[istart];
01951                 } else {
01952                         /* No unaligned bytes - we are done */
01953                         return (0);
01954                 }
01955         } else {
01956                 /* Setup to process whole image */
01957                 istart = 0;
01958                 cursrc1 = Src1;
01959                 curdest = Dest;
01960         }
01961 
01962         /* C routine to process bytes */
01963         iC[3] = (int) ((C >> 24) & 0xff);
01964         iC[2] = (int) ((C >> 16) & 0xff);
01965         iC[1] = (int) ((C >>  8) & 0xff);
01966         iC[0] = (int) ((C >>  0) & 0xff);
01967         for (i = istart; i < length; i += 4) {
01968                 for (j = 0; j < 4; j++) {
01969                         if ((i+j)<length) {
01970                                 result = (int) *cursrc1 + iC[j];
01971                                 if (result > 255) result = 255;
01972                                 *curdest = (unsigned char) result;
01973                                 /* Advance pointers */
01974                                 cursrc1++;
01975                                 curdest++;
01976                         }
01977                 }
01978         }
01979         return (0);
01980 }
01981 
01993 static int SDL_imageFilterAddByteToHalfMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C,
01994                                                                         unsigned char *Mask)
01995 {
01996 #ifdef USE_MMX
01997 #if !defined(GCC__)
01998         __asm
01999         {
02000                 pusha
02001                         /* ** Duplicate C in 8 bytes of MM1 ** */
02002                         mov al, C       /* load C into AL */
02003                         mov ah, al      /* copy AL into AH */
02004                         mov bx, ax      /* copy AX into BX */
02005                         shl eax, 16     /* shift 2 bytes of EAX left */
02006                         mov ax, bx      /* copy BX into AX */
02007                         movd mm1, eax           /* copy EAX into MM1 */
02008                         movd mm2, eax           /* copy EAX into MM2 */
02009                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
02010                         mov edx, Mask           /* load Mask address into edx */
02011                         movq mm0, [edx]         /* load Mask into mm0 */
02012                 mov eax, Src1           /* load Src1 address into eax */
02013                         mov edi, Dest           /* load Dest address into edi */
02014                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02015                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02016                         align 16                        /* 16 byte alignment of the loop entry */
02017 L1022:
02018                 movq mm2, [eax]         /* load 8 bytes from Src1 into MM2 */
02019                 psrlw mm2, 1    /* shift 4 WORDS of MM2 1 bit to the right */
02020                         pand mm2, mm0        // apply Mask to 8 BYTES of MM2 */
02021                         paddusb mm2,  mm1       /* MM2=SrcDest+C (add 8 bytes with saturation) */
02022                         movq [edi], mm2         /* store result in Dest */
02023                         add eax, 8      /* increase Src1 register pointer by 8 */
02024                         add edi, 8      /* increase Dest register pointer by 8 */
02025                         dec              ecx            /* decrease loop counter */
02026                         jnz             L1022           /* check loop termination, proceed if required */
02027                         emms                            /* exit MMX state */
02028                         popa
02029         }
02030 #else
02031         /* i386 and x86_64 */
02032         __m64 *mSrc1 = (__m64*)Src1;
02033         __m64 *mDest = (__m64*)Dest;
02034         __m64 *mMask = (__m64*)Mask;
02035         /* Duplicate C in 8 bytes of MM1 */
02036         int i;
02037         memset(&i, C, 4);
02038         __m64 mm1 = _m_from_int(i);
02039         __m64 mm2 = _m_from_int(i);
02040         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
02041         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02042         for (i = 0; i < SrcLength/8; i++) {
02043                 __m64 mm2 = _m_psrlwi(*mSrc1, 1);       /* shift 4 WORDS of MM2 1 bit to the right */
02044                 mm2 = _m_pand(mm2, *mMask);             /* apply Mask to 8 BYTES of MM2 */
02045                                                         /* byte     0x0f, 0xdb, 0xd0 */
02046                 *mDest = _m_paddusb(mm1, mm2);          /* Src1+C (add 8 bytes with saturation) */
02047                 mSrc1++;
02048                 mDest++;
02049         }
02050         _m_empty();                                     /* clean MMX state */
02051 #endif
02052         return (0);
02053 #else
02054         return (-1);
02055 #endif
02056 }
02057 
02068 int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
02069 {
02070         static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
02071         unsigned int i, istart;
02072         int iC;
02073         unsigned char *cursrc1;
02074         unsigned char *curdest;
02075         int result;
02076 
02077         /* Validate input parameters */
02078         if ((Src1 == NULL) || (Dest == NULL))
02079                 return(-1);
02080         if (length == 0)
02081                 return(0);
02082 
02083         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02084 
02085                 /* MMX routine */
02086                 SDL_imageFilterAddByteToHalfMMX(Src1, Dest, length, C, Mask);
02087 
02088                 /* Check for unaligned bytes */
02089                 if ((length & 7) > 0) {
02090                         /* Setup to process unaligned bytes */
02091                         istart = length & 0xfffffff8;
02092                         cursrc1 = &Src1[istart];
02093                         curdest = &Dest[istart];
02094                 } else {
02095                         /* No unaligned bytes - we are done */
02096                         return (0);
02097                 }
02098         } else {
02099                 /* Setup to process whole image */
02100                 istart = 0;
02101                 cursrc1 = Src1;
02102                 curdest = Dest;
02103         }
02104 
02105         /* C routine to process image */
02106         iC = (int) C;
02107         for (i = istart; i < length; i++) {
02108                 result = (int) (*cursrc1 / 2) + iC;
02109                 if (result > 255)
02110                         result = 255;
02111                 *curdest = (unsigned char) result;
02112                 /* Advance pointers */
02113                 cursrc1++;
02114                 curdest++;
02115         }
02116 
02117         return (0);
02118 }
02119 
02130 int SDL_imageFilterSubByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
02131 {
02132 #ifdef USE_MMX
02133 #if !defined(GCC__)
02134         __asm
02135         {
02136                 pusha
02137                         /* ** Duplicate C in 8 bytes of MM1 ** */
02138                         mov al, C       /* load C into AL */
02139                         mov ah, al      /* copy AL into AH */
02140                         mov bx, ax      /* copy AX into BX */
02141                         shl eax, 16     /* shift 2 bytes of EAX left */
02142                         mov ax, bx      /* copy BX into AX */
02143                         movd mm1, eax           /* copy EAX into MM1 */
02144                         movd mm2, eax           /* copy EAX into MM2 */
02145                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
02146                         mov eax, Src1           /* load Src1 address into eax */
02147                         mov edi, Dest           /* load Dest address into edi */
02148                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02149                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02150                         align 16                        /* 16 byte alignment of the loop entry */
02151 L1023:
02152                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02153                 psubusb mm0,  mm1       /* MM0=SrcDest-C (sub 8 bytes with saturation) */
02154                         movq [edi], mm0         /* store result in SrcDest */
02155                         add eax, 8      /* increase Src1 register pointer by 8 */
02156                         add edi, 8      /* increase Dest register pointer by 8 */
02157                         dec              ecx            /* decrease loop counter */
02158                         jnz             L1023           /* check loop termination, proceed if required */
02159                         emms                            /* exit MMX state */
02160                         popa
02161         }
02162 #else
02163         /* i386 and x86_64 */
02164         __m64 *mSrc1 = (__m64*)Src1;
02165         __m64 *mDest = (__m64*)Dest;
02166         /* Duplicate C in 8 bytes of MM1 */
02167         int i;
02168         memset(&i, C, 4);
02169         __m64 mm1 = _m_from_int(i);
02170         __m64 mm2 = _m_from_int(i);
02171         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
02172         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02173         for (i = 0; i < SrcLength/8; i++) {
02174                 *mDest = _m_psubusb(*mSrc1, mm1);       /* Src1-C (sub 8 bytes with saturation) */
02175                 mSrc1++;
02176                 mDest++;
02177         }
02178         _m_empty();                                     /* clean MMX state */
02179 #endif
02180         return (0);
02181 #else
02182         return (-1);
02183 #endif
02184 }
02185 
02196 int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
02197 {
02198         unsigned int i, istart;
02199         int iC;
02200         unsigned char *cursrc1;
02201         unsigned char *curdest;
02202         int result;
02203 
02204         /* Validate input parameters */
02205         if ((Src1 == NULL) || (Dest == NULL))
02206                 return(-1);
02207         if (length == 0)
02208                 return(0);
02209 
02210         /* Special case: C==0 */
02211         if (C == 0) {
02212                 memcpy(Src1, Dest, length);
02213                 return (0); 
02214         }
02215 
02216         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02217 
02218                 /* MMX routine */
02219                 SDL_imageFilterSubByteMMX(Src1, Dest, length, C);
02220 
02221                 /* Check for unaligned bytes */
02222                 if ((length & 7) > 0) {
02223                         /* Setup to process unaligned bytes */
02224                         istart = length & 0xfffffff8;
02225                         cursrc1 = &Src1[istart];
02226                         curdest = &Dest[istart];
02227                 } else {
02228                         /* No unaligned bytes - we are done */
02229                         return (0);
02230                 }
02231         } else {
02232                 /* Setup to process whole image */
02233                 istart = 0;
02234                 cursrc1 = Src1;
02235                 curdest = Dest;
02236         }
02237 
02238         /* C routine to process image */
02239         iC = (int) C;
02240         for (i = istart; i < length; i++) {
02241                 result = (int) *cursrc1 - iC;
02242                 if (result < 0)
02243                         result = 0;
02244                 *curdest = (unsigned char) result;
02245                 /* Advance pointers */
02246                 cursrc1++;
02247                 curdest++;
02248         }
02249         return (0);
02250 }
02251 
02263 static int SDL_imageFilterSubUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D)
02264 {
02265 #ifdef USE_MMX
02266 #if !defined(GCC__)
02267         __asm
02268         {
02269                 pusha
02270                         /* ** Duplicate (int)C in 8 bytes of MM1 ** */
02271                         mov eax, C      /* load C into EAX */
02272                         movd mm1, eax           /* copy EAX into MM1 */
02273                         mov eax, D      /* load D into EAX */
02274                         movd mm2, eax           /* copy EAX into MM2 */
02275                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
02276                         mov eax, Src1           /* load Src1 address into eax */
02277                         mov edi, Dest           /* load Dest address into edi */
02278                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02279                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02280                         align 16                        /* 16 byte alignment of the loop entry */
02281 L11024:
02282                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02283                 psubusb mm0, mm1        /* MM0=SrcDest-C (sub 8 bytes with saturation) */
02284                         movq [edi], mm0         /* store result in SrcDest */
02285                         add eax, 8      /* increase Src1 register pointer by 8 */
02286                         add edi, 8      /* increase Dest register pointer by 8 */
02287                         dec              ecx            /* decrease loop counter */
02288                         jnz             L11024          /* check loop termination, proceed if required */
02289                         emms                            /* exit MMX state */
02290                         popa
02291         }
02292 #else
02293         /* i386 and x86_64 */
02294         __m64 *mSrc1 = (__m64*)Src1;
02295         __m64 *mDest = (__m64*)Dest;
02296         /* Duplicate (int)C in 8 bytes of MM1 */
02297         __m64 mm1 = _m_from_int(C);
02298         __m64 mm2 = _m_from_int(C);
02299         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
02300         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02301         int i;
02302         for (i = 0; i < SrcLength/8; i++) {
02303                 *mDest = _m_psubusb(*mSrc1, mm1);       /* Src1-C (sub 8 bytes with saturation) */
02304                 mSrc1++;
02305                 mDest++;
02306         }
02307         _m_empty();                                     /* clean MMX state */
02308 #endif
02309         return (0);
02310 #else
02311         return (-1);
02312 #endif
02313 }
02314 
02325 int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
02326 {
02327         unsigned int i, j, istart, D;
02328         int iC[4];
02329         unsigned char *cursrc1;
02330         unsigned char *curdest;
02331         int result;
02332 
02333         /* Validate input parameters */
02334         if ((Src1 == NULL) || (Dest == NULL))
02335                 return(-1);
02336         if (length == 0)
02337                 return(0);
02338 
02339     /* Special case: C==0 */
02340         if (C == 0) {
02341                 memcpy(Src1, Dest, length);
02342                 return (0); 
02343         }
02344 
02345         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02346 
02347                 /* MMX routine */
02348                 D=SWAP_32(C);
02349                 SDL_imageFilterSubUintMMX(Src1, Dest, length, C, D);
02350 
02351                 /* Check for unaligned bytes */
02352                 if ((length & 7) > 0) {
02353                         /* Setup to process unaligned bytes */
02354                         istart = length & 0xfffffff8;
02355                         cursrc1 = &Src1[istart];
02356                         curdest = &Dest[istart];
02357                 } else {
02358                         /* No unaligned bytes - we are done */
02359                         return (0);
02360                 }
02361         } else {
02362                 /* Setup to process whole image */
02363                 istart = 0;
02364                 cursrc1 = Src1;
02365                 curdest = Dest;
02366         }
02367 
02368         /* C routine to process image */
02369         iC[3] = (int) ((C >> 24) & 0xff);
02370         iC[2] = (int) ((C >> 16) & 0xff);
02371         iC[1] = (int) ((C >>  8) & 0xff);
02372         iC[0] = (int) ((C >>  0) & 0xff);
02373         for (i = istart; i < length; i += 4) {
02374                 for (j = 0; j < 4; j++) {
02375                         if ((i+j)<length) {
02376                                 result = (int) *cursrc1 - iC[j];
02377                                 if (result < 0) result = 0;
02378                                 *curdest = (unsigned char) result;
02379                                 /* Advance pointers */
02380                                 cursrc1++;
02381                                 curdest++;
02382                         }
02383                 }
02384         }
02385         return (0);
02386 }
02387 
02399 static int SDL_imageFilterShiftRightMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
02400                                                                  unsigned char *Mask)
02401 {
02402 #ifdef USE_MMX
02403 #if !defined(GCC__)
02404         __asm
02405         {
02406                 pusha
02407                         mov edx, Mask           /* load Mask address into edx */
02408                         movq mm0, [edx]         /* load Mask into mm0 */
02409                 xor ecx, ecx    /* zero ECX */
02410                         mov cl,  N      /* load loop counter (N) into CL */
02411                         movd mm3,  ecx  /* copy (N) into MM3  */
02412                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
02413 L10240:                         /* ** Prepare proper bit-Mask in MM1 ** */
02414                 psrlw mm1,  1   /* shift 4 WORDS of MM1 1 bit to the right */
02415                         pand mm1, mm0   // apply Mask to 8 BYTES of MM1 */
02416                         /*  byte     0x0f, 0xdb, 0xc8 */
02417                         dec               cl            /* decrease loop counter */
02418                         jnz            L10240           /* check loop termination, proceed if required */
02419                         /* ** Shift all bytes of the image ** */
02420                         mov eax, Src1           /* load Src1 address into eax */
02421                         mov edi, Dest           /* load Dest address into edi */
02422                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02423                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02424                         align 16                        /* 16 byte alignment of the loop entry */
02425 L10241:
02426                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02427                 psrlw mm0, mm3          /* shift 4 WORDS of MM0 (N) bits to the right */
02428                         pand mm0, mm1    // apply proper bit-Mask to 8 BYTES of MM0 */
02429                         /* byte     0x0f, 0xdb, 0xc1 */
02430                         movq [edi], mm0         /* store result in SrcDest */
02431                         add eax, 8      /* increase Src1 register pointer by 8 */
02432                         add edi, 8      /* increase Dest register pointer by 8 */
02433                         dec              ecx            /* decrease loop counter */
02434                         jnz            L10241           /* check loop termination, proceed if required */
02435                         emms                            /* exit MMX state */
02436                         popa
02437         }
02438 #else
02439         /* i386 and x86_64 */
02440         __m64 *mSrc1 = (__m64*)Src1;
02441         __m64 *mDest = (__m64*)Dest;
02442         __m64 *mMask = (__m64*)Mask;
02443         __m64 mm1;
02444         int i;
02445         mm1 = _m_pcmpeqb(mm1, mm1);                     /* generate all 1's in mm1 */
02446         /* Prepare proper bit-Mask in MM1 */
02447         for (i = 0; i < N; i++) {
02448                 mm1 = _m_psrlwi(mm1, 1);                /* shift 4 WORDS of MM1 1 bit to the right */
02449                 mm1 = _m_pand(mm1, *mMask);             /* apply Mask to 8 BYTES of MM1 */
02450         }
02451         /* Shift all bytes of the image */
02452         for (i = 0; i < SrcLength/8; i++) {
02453                 __m64 mm0 = _m_psrlwi(*mSrc1, N);       /* shift 4 WORDS of MM0 (N) bits to the right */
02454                 *mDest = _m_pand(mm0, mm1);             /* apply proper bit-Mask to 8 BYTES of MM0 */
02455                 mSrc1++;
02456                 mDest++;
02457         }
02458         _m_empty();                                     /* clean MMX state */
02459 #endif
02460         return (0);
02461 #else
02462         return (-1);
02463 #endif
02464 }
02465 
02476 int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
02477 {
02478         static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
02479         unsigned int i, istart;
02480         unsigned char *cursrc1;
02481         unsigned char *curdest;
02482 
02483         /* Validate input parameters */
02484         if ((Src1 == NULL) || (Dest == NULL))
02485                 return(-1);
02486         if (length == 0)
02487                 return(0);
02488 
02489         /* Check shift */
02490         if (N > 8) {
02491                 return (-1);
02492         }
02493 
02494         /* Special case: N==0 */
02495         if (N == 0) {
02496                 memcpy(Src1, Dest, length);
02497                 return (0); 
02498         }
02499 
02500         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02501 
02502                 /* MMX routine */
02503                 SDL_imageFilterShiftRightMMX(Src1, Dest, length, N, Mask);
02504 
02505                 /* Check for unaligned bytes */
02506                 if ((length & 7) > 0) {
02507                         /* Setup to process unaligned bytes */
02508                         istart = length & 0xfffffff8;
02509                         cursrc1 = &Src1[istart];
02510                         curdest = &Dest[istart];
02511                 } else {
02512                         /* No unaligned bytes - we are done */
02513                         return (0);
02514                 }
02515         } else {
02516                 /* Setup to process whole image */
02517                 istart = 0;
02518                 cursrc1 = Src1;
02519                 curdest = Dest;
02520         }
02521 
02522         /* C routine to process image */
02523         for (i = istart; i < length; i++) {
02524                 *curdest = (unsigned char) *cursrc1 >> N;
02525                 /* Advance pointers */
02526                 cursrc1++;
02527                 curdest++;
02528         }
02529 
02530         return (0);
02531 }
02532 
02543 static int SDL_imageFilterShiftRightUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
02544 {
02545 #ifdef USE_MMX
02546 #if !defined(GCC__)
02547         __asm
02548         {
02549                 pusha
02550                         mov eax, Src1           /* load Src1 address into eax */
02551                         mov edi, Dest           /* load Dest address into edi */
02552                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
02553                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
02554                         align 16                        /* 16 byte alignment of the loop entry */
02555 L13023:
02556                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02557                 psrld mm0, N
02558                         movq [edi], mm0         /* store result in SrcDest */
02559                         add eax, 8      /* increase Src1 register pointer by 8 */
02560                         add edi, 8      /* increase Dest register pointer by 8 */
02561                         dec              ecx            /* decrease loop counter */
02562                         jnz             L13023          /* check loop termination, proceed if required */
02563                         emms                            /* exit MMX state */
02564                         popa
02565         }
02566 #else
02567         /* i386 and x86_64 */
02568         __m64 *mSrc1 = (__m64*)Src1;
02569         __m64 *mDest = (__m64*)Dest;
02570         int i;
02571         for (i = 0; i < SrcLength/8; i++) {
02572                 *mDest = _m_psrldi(*mSrc1, N);
02573                 mSrc1++;
02574                 mDest++;
02575         }
02576         _m_empty();                                     /* clean MMX state */
02577 #endif
02578         return (0);
02579 #else
02580         return (-1);
02581 #endif
02582 }
02583 
02594 int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
02595 {
02596         unsigned int i, istart;
02597         unsigned char *cursrc1, *curdest;
02598         unsigned int *icursrc1, *icurdest;
02599         unsigned int result;
02600 
02601         /* Validate input parameters */
02602         if ((Src1 == NULL) || (Dest == NULL))
02603                 return(-1);
02604         if (length == 0)
02605                 return(0);
02606 
02607         if (N > 32) {
02608                 return (-1);
02609         }
02610 
02611         /* Special case: N==0 */
02612         if (N == 0) {
02613                 memcpy(Src1, Dest, length);
02614                 return (0); 
02615         }
02616 
02617         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02618 
02619                 SDL_imageFilterShiftRightUintMMX(Src1, Dest, length, N);
02620 
02621                 /* Check for unaligned bytes */
02622                 if ((length & 7) > 0) {
02623                         /* Setup to process unaligned bytes */
02624                         istart = length & 0xfffffff8;
02625                         cursrc1 = &Src1[istart];
02626                         curdest = &Dest[istart];
02627                 } else {
02628                         /* No unaligned bytes - we are done */
02629                         return (0);
02630                 }
02631         } else {
02632                 /* Setup to process whole image */
02633                 istart = 0;
02634                 cursrc1 = Src1;
02635                 curdest = Dest;
02636         }
02637 
02638         /* C routine to process image */
02639         icursrc1=(unsigned int *)cursrc1;
02640         icurdest=(unsigned int *)curdest;
02641         for (i = istart; i < length; i += 4) {
02642                 if ((i+4)<length) {
02643                         result = ((unsigned int)*icursrc1 >> N);
02644                         *icurdest = result;
02645                 }
02646                 /* Advance pointers */
02647                 icursrc1++;
02648                 icurdest++;
02649         }
02650 
02651         return (0);
02652 }
02653 
02664 static int SDL_imageFilterMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
02665 {
02666 #ifdef USE_MMX
02667 #if !defined(GCC__)
02668         __asm
02669         {
02670                 pusha
02671                         /* ** Duplicate C in 4 words of MM1 ** */
02672                         mov al, C       /* load C into AL */
02673                         xor ah, ah      /* zero AH */
02674                         mov bx, ax      /* copy AX into BX */
02675                         shl eax, 16     /* shift 2 bytes of EAX left */
02676                         mov ax, bx      /* copy BX into AX */
02677                         movd mm1, eax           /* copy EAX into MM1 */
02678                         movd mm2, eax           /* copy EAX into MM2 */
02679                         punpckldq mm1, mm2      /* fill higher words of MM1 with C */
02680                         pxor mm0, mm0           /* zero MM0 register */
02681                         mov eax, Src1           /* load Src1 address into eax */
02682                         mov edi, Dest           /* load Dest address into edi */
02683                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
02684                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
02685                         cmp al, 128     /* if (C <= 128) execute more efficient code */
02686                         jg             L10251
02687                         align 16                        /* 16 byte alignment of the loop entry */
02688 L10250:
02689                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
02690                 movq mm4, mm3           /* copy MM3 into MM4  */
02691                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
02692                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
02693                         pmullw mm3, mm1         /* mul low  bytes of SrcDest and MM1 */
02694                         pmullw mm4, mm1         /* mul high bytes of SrcDest and MM1 */
02695                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
02696                         movq [edi], mm3         /* store result in Dest */
02697                         add eax, 8      /* increase Src1 register pointer by 8 */
02698                         add edi, 8      /* increase Dest register pointer by 8 */
02699                         dec              ecx            /* decrease loop counter */
02700                         jnz            L10250           /* check loop termination, proceed if required */
02701                         jmp            L10252
02702                         align 16                        /* 16 byte alignment of the loop entry */
02703 L10251:
02704                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
02705                 movq mm4, mm3           /* copy MM3 into MM4  */
02706                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
02707                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
02708                         pmullw mm3, mm1         /* mul low  bytes of SrcDest and MM1 */
02709                         pmullw mm4, mm1         /* mul high bytes of SrcDest and MM1 */
02710                         /* ** Take abs value of the results (signed words) ** */
02711                         movq mm5, mm3           /* copy mm3 into mm5 */
02712                         movq mm6, mm4           /* copy mm4 into mm6 */
02713                         psraw mm5, 15           /* fill mm5 words with word sign bit */
02714                         psraw mm6, 15           /* fill mm6 words with word sign bit */
02715                         pxor mm3, mm5           /* take 1's compliment of only neg words */
02716                         pxor mm4, mm6           /* take 1's compliment of only neg words */
02717                         psubsw mm3, mm5         /* add 1 to only neg words, W-(-1) or W-0 */
02718                         psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
02719                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
02720                         movq [edi], mm3         /* store result in Dest */
02721                         add eax, 8      /* increase Src1 register pointer by 8 */
02722                         add edi, 8      /* increase Dest register pointer by 8 */
02723                         dec              ecx            /* decrease loop counter */
02724                         jnz            L10251           /* check loop termination, proceed if required */
02725 L10252:
02726                 emms                            /* exit MMX state */
02727                         popa
02728         }
02729 #else
02730         /* i386 and x86_64 */
02731         __m64 *mSrc1 = (__m64*)Src1;
02732         __m64 *mDest = (__m64*)Dest;
02733         __m64 mm0 = _m_from_int(0);                             /* zero mm0 register */
02734         /* Duplicate C in 4 words of MM1 */
02735         int i;
02736         i = C | C<<16;
02737         __m64 mm1 = _m_from_int(i);
02738         __m64 mm2 = _m_from_int(i);
02739         mm1 = _m_punpckldq(mm1, mm2);                           /* fill higher words of MM1 with C */
02740         // long long lli = C | C<<16 | (long long)C<<32 | (long long)C<<48;
02741         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02742         if (C <= 128) {                                         /* if (C <= 128) execute more efficient code */
02743                 for (i = 0; i < SrcLength/8; i++) {
02744                         __m64 mm3, mm4;
02745                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
02746                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
02747                         mm3 = _m_pmullw(mm3, mm1);              /* mul low  bytes of Src1 and MM1 */
02748                         mm4 = _m_pmullw(mm4, mm1);              /* mul high bytes of Src1 and MM1 */
02749                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
02750                         mSrc1++;
02751                         mDest++;
02752                 }
02753         } else {
02754                 for (i = 0; i < SrcLength/8; i++) {
02755                         __m64 mm3, mm4, mm5, mm6;
02756                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
02757                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
02758                         mm3 = _m_pmullw(mm3, mm1);              /* mul low  bytes of Src1 and MM1 */
02759                         mm4 = _m_pmullw(mm4, mm1);              /* mul high bytes of Src1 and MM1 */
02760                         /* Take abs value of the results (signed words) */
02761                         mm5 = _m_psrawi(mm3, 15);               /* fill mm5 words with word sign bit */
02762                         mm6 = _m_psrawi(mm4, 15);               /* fill mm6 words with word sign bit */
02763                         mm3 = _m_pxor(mm3, mm5);                /* take 1's compliment of only neg. words */
02764                         mm4 = _m_pxor(mm4, mm6);                /* take 1's compliment of only neg. words */
02765                         mm3 = _m_psubsw(mm3, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
02766                         mm4 = _m_psubsw(mm4, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
02767                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
02768                         mSrc1++;
02769                         mDest++;
02770                 }
02771         }
02772         _m_empty();                                             /* clean MMX state */
02773 #endif
02774         return (0);
02775 #else
02776         return (-1);
02777 #endif
02778 }
02779 
02790 int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
02791 {
02792         unsigned int i, istart;
02793         int iC;
02794         unsigned char *cursrc1;
02795         unsigned char *curdest;
02796         int result;
02797 
02798         /* Validate input parameters */
02799         if ((Src1 == NULL) || (Dest == NULL))
02800                 return(-1);
02801         if (length == 0)
02802                 return(0);
02803 
02804         /* Special case: C==1 */
02805         if (C == 1) {
02806                 memcpy(Src1, Dest, length);
02807                 return (0); 
02808         }
02809 
02810         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02811 
02812                 SDL_imageFilterMultByByteMMX(Src1, Dest, length, C);
02813 
02814                 /* Check for unaligned bytes */
02815                 if ((length & 7) > 0) {
02816                         /* Setup to process unaligned bytes */
02817                         istart = length & 0xfffffff8;
02818                         cursrc1 = &Src1[istart];
02819                         curdest = &Dest[istart];
02820                 } else {
02821                         /* No unaligned bytes - we are done */
02822                         return (0);
02823                 }
02824         } else {
02825                 /* Setup to process whole image */
02826                 istart = 0;
02827                 cursrc1 = Src1;
02828                 curdest = Dest;
02829         }
02830 
02831         /* C routine to process image */
02832         iC = (int) C;
02833         for (i = istart; i < length; i++) {
02834                 result = (int) *cursrc1 * iC;
02835                 if (result > 255)
02836                         result = 255;
02837                 *curdest = (unsigned char) result;
02838                 /* Advance pointers */
02839                 cursrc1++;
02840                 curdest++;
02841         }
02842 
02843         return (0);
02844 }
02845 
02857 static int SDL_imageFilterShiftRightAndMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
02858                                                                                           unsigned char C)
02859 {
02860 #ifdef USE_MMX
02861 #if !defined(GCC__)
02862         __asm
02863         {
02864                 pusha
02865                         /* ** Duplicate C in 4 words of MM1 ** */
02866                         mov al, C       /* load C into AL */
02867                         xor ah, ah      /* zero AH */
02868                         mov bx, ax      /* copy AX into BX */
02869                         shl eax, 16     /* shift 2 bytes of EAX left */
02870                         mov ax, bx      /* copy BX into AX */
02871                         movd mm1, eax           /* copy EAX into MM1 */
02872                         movd mm2, eax           /* copy EAX into MM2 */
02873                         punpckldq mm1, mm2      /* fill higher words of MM1 with C */
02874                         xor ecx, ecx    /* zero ECX */
02875                         mov cl, N       /* load N into CL */
02876                         movd mm7, ecx           /* copy N into MM7 */
02877                         pxor mm0, mm0           /* zero MM0 register */
02878                         mov eax, Src1           /* load Src1 address into eax */
02879                         mov edi, Dest           /* load Dest address into edi */
02880                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
02881                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
02882                         align 16                        /* 16 byte alignment of the loop entry */
02883 L1026:
02884                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
02885                 movq mm4, mm3           /* copy MM3 into MM4  */
02886                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
02887                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
02888                         psrlw mm3, mm7          /* shift 4 WORDS of MM3 (N) bits to the right */
02889                         psrlw mm4, mm7          /* shift 4 WORDS of MM4 (N) bits to the right */
02890                         pmullw mm3, mm1         /* mul low  bytes of SrcDest by MM1 */
02891                         pmullw mm4, mm1         /* mul high bytes of SrcDest by MM1 */
02892                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
02893                         movq [edi], mm3         /* store result in Dest */
02894                         add eax, 8      /* increase Src1 register pointer by 8 */
02895                         add edi, 8      /* increase Dest register pointer by 8 */
02896                         dec              ecx            /* decrease loop counter */
02897                         jnz             L1026           /* check loop termination, proceed if required */
02898                         emms                            /* exit MMX state */
02899                         popa
02900         }
02901 #else
02902         /* i386 and x86_64 */
02903         __m64 *mSrc1 = (__m64*)Src1;
02904         __m64 *mDest = (__m64*)Dest;
02905         __m64 mm0 = _m_from_int(0);                     /* zero mm0 register */
02906         /* Duplicate C in 4 words of MM1 */
02907         int i;
02908         i = (C<<16)|C;
02909         __m64 mm1 = _m_from_int(i);
02910         __m64 mm2 = _m_from_int(i);
02911         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher words of MM1 with C */
02912         for (i = 0; i < SrcLength/8; i++) {
02913                 __m64 mm3, mm4, mm5, mm6;
02914                 mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
02915                 mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
02916                 mm3 = _m_psrlwi(mm3, N);                /* shift 4 WORDS of MM3 (N) bits to the right */
02917                 mm4 = _m_psrlwi(mm4, N);                /* shift 4 WORDS of MM4 (N) bits to the right */
02918                 mm3 = _m_pmullw(mm3, mm1);              /* mul low  bytes of Src1 and MM1 */
02919                 mm4 = _m_pmullw(mm4, mm1);              /* mul high bytes of Src1 and MM1 */
02920                 *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
02921                 mSrc1++;
02922                 mDest++;
02923         }
02924         _m_empty();                                     /* clean MMX state */
02925 #endif
02926         return (0);
02927 #else
02928         return (-1);
02929 #endif
02930 }
02931 
02943 int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N,
02944                                                                                    unsigned char C)
02945 {
02946         unsigned int i, istart;
02947         int iC;
02948         unsigned char *cursrc1;
02949         unsigned char *curdest;
02950         int result;
02951 
02952         /* Validate input parameters */
02953         if ((Src1 == NULL) || (Dest == NULL))
02954                 return(-1);
02955         if (length == 0)
02956                 return(0);
02957 
02958         /* Check shift */
02959         if (N > 8) {
02960                 return (-1);
02961         }
02962 
02963         /* Special case: N==0 && C==1 */
02964         if ((N == 0) && (C == 1)) {
02965                 memcpy(Src1, Dest, length);
02966                 return (0); 
02967         }
02968 
02969         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02970 
02971                 SDL_imageFilterShiftRightAndMultByByteMMX(Src1, Dest, length, N, C);
02972 
02973                 /* Check for unaligned bytes */
02974                 if ((length & 7) > 0) {
02975                         /* Setup to process unaligned bytes */
02976                         istart = length & 0xfffffff8;
02977                         cursrc1 = &Src1[istart];
02978                         curdest = &Dest[istart];
02979                 } else {
02980                         /* No unaligned bytes - we are done */
02981                         return (0);
02982                 }
02983         } else {
02984                 /* Setup to process whole image */
02985                 istart = 0;
02986                 cursrc1 = Src1;
02987                 curdest = Dest;
02988         }
02989 
02990         /* C routine to process image */
02991         iC = (int) C;
02992         for (i = istart; i < length; i++) {
02993                 result = (int) (*cursrc1 >> N) * iC;
02994                 if (result > 255)
02995                         result = 255;
02996                 *curdest = (unsigned char) result;
02997                 /* Advance pointers */
02998                 cursrc1++;
02999                 curdest++;
03000         }
03001 
03002         return (0);
03003 }
03004 
03016 static int SDL_imageFilterShiftLeftByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
03017                                                                         unsigned char *Mask)
03018 {
03019 #ifdef USE_MMX
03020 #if !defined(GCC__)
03021         __asm
03022         {
03023                 pusha
03024                         mov edx, Mask           /* load Mask address into edx */
03025                         movq mm0, [edx]         /* load Mask into mm0 */
03026                 xor ecx, ecx    /* zero ECX */
03027                         mov cl, N       /* load loop counter (N) into CL */
03028                         movd mm3, ecx           /* copy (N) into MM3  */
03029                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
03030 L10270:                         /* ** Prepare proper bit-Mask in MM1 ** */
03031                 psllw mm1, 1    /* shift 4 WORDS of MM1 1 bit to the left */
03032                         pand mm1, mm0        // apply Mask to 8 BYTES of MM1 */
03033                         /*  byte     0x0f, 0xdb, 0xc8 */
03034                         dec cl                          /* decrease loop counter */
03035                         jnz            L10270           /* check loop termination, proceed if required */
03036                         /* ** Shift all bytes of the image ** */
03037                         mov eax, Src1           /* load Src1 address into eax */
03038                         mov edi, Dest           /* load SrcDest address into edi */
03039                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03040                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03041                         align 16                        /* 16 byte alignment of the loop entry */
03042 L10271:
03043                 movq mm0, [eax]         /* load 8 bytes from Src1 into MM0 */
03044                 psllw mm0, mm3          /* shift 4 WORDS of MM0 (N) bits to the left */
03045                         pand mm0, mm1    // apply proper bit-Mask to 8 BYTES of MM0 */
03046                         /* byte     0x0f, 0xdb, 0xc1 */
03047                         movq [edi], mm0         /* store result in Dest */
03048                         add eax, 8      /* increase Src1 register pointer by 8 */
03049                         add edi, 8      /* increase Dest register pointer by 8 */
03050                         dec              ecx            /* decrease loop counter */
03051                         jnz            L10271           /* check loop termination, proceed if required */
03052                         emms                            /* exit MMX state */
03053                         popa
03054         }
03055 #else
03056         /* i386 and x86_64 */
03057         __m64 *mSrc1 = (__m64*)Src1;
03058         __m64 *mDest = (__m64*)Dest;
03059         __m64 *mMask = (__m64*)Mask;
03060         __m64 mm1;
03061         int i;
03062         mm1 = _m_pcmpeqb(mm1, mm1);                     /* generate all 1's in mm1 */
03063         /* Prepare proper bit-Mask in MM1 */
03064         for (i = 0; i < N; i++) {
03065                 mm1 = _m_psllwi(mm1, 1);                /* shift 4 WORDS of MM1 1 bit to the left */
03066                 mm1 = _m_pand(mm1, *mMask);             /* apply Mask to 8 BYTES of MM1 */
03067         }
03068         /* ** Shift all bytes of the image ** */
03069         for (i = 0; i < SrcLength/8; i++) {
03070                 __m64 mm0 = _m_psllwi(*mSrc1, N);       /* shift 4 WORDS of MM0 (N) bits to the left */
03071                 *mDest = _m_pand(mm0, mm1);             /* apply proper bit-Mask to 8 BYTES of MM0 */
03072                 mSrc1++;
03073                 mDest++;
03074         }
03075         _m_empty();                                     /* clean MMX state */
03076 #endif
03077         return (0);
03078 #else
03079         return (-1);
03080 #endif
03081 }
03082 
03093 int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
03094 {
03095         static unsigned char Mask[8] = { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE };
03096         unsigned int i, istart;
03097         unsigned char *cursrc1, *curdest;
03098         int result;
03099 
03100         /* Validate input parameters */
03101         if ((Src1 == NULL) || (Dest == NULL))
03102                 return(-1);
03103         if (length == 0)
03104                 return(0);
03105 
03106         if (N > 8) {
03107                 return (-1);
03108         }
03109 
03110         /* Special case: N==0 */
03111         if (N == 0) {
03112                 memcpy(Src1, Dest, length);
03113                 return (0); 
03114         }
03115 
03116         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03117 
03118                 SDL_imageFilterShiftLeftByteMMX(Src1, Dest, length, N, Mask);
03119 
03120                 /* Check for unaligned bytes */
03121                 if ((length & 7) > 0) {
03122                         /* Setup to process unaligned bytes */
03123                         istart = length & 0xfffffff8;
03124                         cursrc1 = &Src1[istart];
03125                         curdest = &Dest[istart];
03126                 } else {
03127                         /* No unaligned bytes - we are done */
03128                         return (0);
03129                 }
03130         } else {
03131                 /* Setup to process whole image */
03132                 istart = 0;
03133                 cursrc1 = Src1;
03134                 curdest = Dest;
03135         }
03136 
03137         /* C routine to process image */
03138         for (i = istart; i < length; i++) {
03139                 result = ((int) *cursrc1 << N) & 0xff;
03140                 *curdest = (unsigned char) result;
03141                 /* Advance pointers */
03142                 cursrc1++;
03143                 curdest++;
03144         }
03145 
03146         return (0);
03147 }
03148 
03159 static int SDL_imageFilterShiftLeftUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
03160 {
03161 #ifdef USE_MMX
03162 #if !defined(GCC__)
03163         __asm
03164         {
03165                 pusha
03166                         mov eax, Src1           /* load Src1 address into eax */
03167                         mov edi, Dest           /* load Dest address into edi */
03168                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03169                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03170                         align 16                        /* 16 byte alignment of the loop entry */
03171 L12023:
03172                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
03173                 pslld mm0, N    /* MM0=SrcDest+C (add 8 bytes with saturation) */
03174                         movq [edi], mm0         /* store result in SrcDest */
03175                         add eax, 8      /* increase Src1 register pointer by 8 */
03176                         add edi, 8      /* increase Dest register pointer by 8 */
03177                         dec              ecx            /* decrease loop counter */
03178                         jnz             L12023          /* check loop termination, proceed if required */
03179                         emms                            /* exit MMX state */
03180                         popa
03181         }
03182 #else
03183         /* i386 and x86_64 */
03184         __m64 *mSrc1 = (__m64*)Src1;
03185         __m64 *mDest = (__m64*)Dest;
03186         int i;
03187         for (i = 0; i < SrcLength/8; i++) {
03188                 *mDest = _m_pslldi(*mSrc1, N);  /* Src1+C (add 8 bytes with saturation) */
03189                 mSrc1++;
03190                 mDest++;
03191         }
03192         _m_empty();                             /* clean MMX state */
03193 #endif
03194         return (0);
03195 #else
03196         return (-1);
03197 #endif
03198 }
03199 
03210 int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
03211 {
03212         unsigned int i, istart;
03213         unsigned char *cursrc1, *curdest;
03214         unsigned int *icursrc1, *icurdest;
03215         unsigned int result;
03216 
03217         /* Validate input parameters */
03218         if ((Src1 == NULL) || (Dest == NULL))
03219                 return(-1);
03220         if (length == 0)
03221                 return(0);
03222 
03223         if (N > 32) {
03224                 return (-1);
03225         }
03226 
03227         /* Special case: N==0 */
03228         if (N == 0) {
03229                 memcpy(Src1, Dest, length);
03230                 return (0); 
03231         }
03232 
03233         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03234 
03235                 SDL_imageFilterShiftLeftUintMMX(Src1, Dest, length, N);
03236 
03237                 /* Check for unaligned bytes */
03238                 if ((length & 7) > 0) {
03239                         /* Setup to process unaligned bytes */
03240                         istart = length & 0xfffffff8;
03241                         cursrc1 = &Src1[istart];
03242                         curdest = &Dest[istart];
03243                 } else {
03244                         /* No unaligned bytes - we are done */
03245                         return (0);
03246                 }
03247         } else {
03248                 /* Setup to process whole image */
03249                 istart = 0;
03250                 cursrc1 = Src1;
03251                 curdest = Dest;
03252         }
03253 
03254         /* C routine to process image */
03255         icursrc1=(unsigned int *)cursrc1;
03256         icurdest=(unsigned int *)curdest;
03257         for (i = istart; i < length; i += 4) {
03258                 if ((i+4)<length) {
03259                         result = ((unsigned int)*icursrc1 << N);
03260                         *icurdest = result;
03261                 }
03262                 /* Advance pointers */
03263                 icursrc1++;
03264                 icurdest++;
03265         }
03266 
03267         return (0);
03268 }
03269 
03280 static int SDL_imageFilterShiftLeftMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
03281 {
03282 #ifdef USE_MMX
03283 #if !defined(GCC__)
03284         __asm
03285         {
03286                 pusha
03287                         xor eax, eax    /* zero EAX */
03288                         mov al, N       /* load N into AL */
03289                         movd mm7, eax           /* copy N into MM7 */
03290                         pxor mm0, mm0           /* zero MM0 register */
03291                         mov eax, Src1           /* load Src1 address into eax */
03292                         mov edi, Dest           /* load Dest address into edi */
03293                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03294                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03295                         cmp al, 7       /* if (N <= 7) execute more efficient code */
03296                         jg             L10281
03297                         align 16                        /* 16 byte alignment of the loop entry */
03298 L10280:
03299                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
03300                 movq mm4, mm3           /* copy MM3 into MM4  */
03301                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
03302                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
03303                         psllw mm3, mm7          /* shift 4 WORDS of MM3 (N) bits to the left */
03304                         psllw mm4, mm7          /* shift 4 WORDS of MM4 (N) bits to the left */
03305                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
03306                         movq [edi], mm3         /* store result in Dest */
03307                         add eax, 8      /* increase Src1 register pointer by 8 */
03308                         add edi, 8      /* increase Dest register pointer by 8 */
03309                         dec              ecx            /* decrease loop counter */
03310                         jnz            L10280           /* check loop termination, proceed if required */
03311                         jmp            L10282
03312                         align 16                        /* 16 byte alignment of the loop entry */
03313 L10281:
03314                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
03315                 movq mm4, mm3           /* copy MM3 into MM4  */
03316                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
03317                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
03318                         psllw mm3, mm7          /* shift 4 WORDS of MM3 (N) bits to the left */
03319                         psllw mm4, mm7          /* shift 4 WORDS of MM4 (N) bits to the left */
03320                         /* ** Take abs value of the signed words ** */
03321                         movq mm5, mm3           /* copy mm3 into mm5 */
03322                         movq mm6, mm4           /* copy mm4 into mm6 */
03323                         psraw mm5, 15           /* fill mm5 words with word sign bit */
03324                         psraw mm6, 15           /* fill mm6 words with word sign bit */
03325                         pxor mm3, mm5           /* take 1's compliment of only neg words */
03326                         pxor mm4, mm6           /* take 1's compliment of only neg words */
03327                         psubsw mm3, mm5         /* add 1 to only neg words, W-(-1) or W-0 */
03328                         psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
03329                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
03330                         movq [edi], mm3         /* store result in Dest */
03331                         add eax, 8      /* increase Src1 register pointer by 8 */
03332                         add edi, 8      /* increase Dest register pointer by 8 */
03333                         dec              ecx            /* decrease loop counter */
03334                         jnz            L10281           /* check loop termination, proceed if required */
03335 L10282:
03336                 emms                            /* exit MMX state */
03337                         popa
03338         }
03339 #else
03340         /* i386 and x86_64 */
03341         __m64 *mSrc1 = (__m64*)Src1;
03342         __m64 *mDest = (__m64*)Dest;
03343         __m64 mm0 = _m_from_int(0);                             /* zero mm0 register */
03344         int i;
03345         if (N <= 7) {                                           /* if (N <= 7) execute more efficient code */
03346                 for (i = 0; i < SrcLength/8; i++) {
03347                         __m64 mm3, mm4;
03348                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
03349                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
03350                         mm3 = _m_psllwi(mm3, N);                /* shift 4 WORDS of MM3 (N) bits to the left */
03351                         mm4 = _m_psllwi(mm4, N);                /* shift 4 WORDS of MM4 (N) bits to the left */
03352                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
03353                         mSrc1++;
03354                         mDest++;
03355                 }
03356         } else {
03357                 for (i = 0; i < SrcLength/8; i++) {
03358                         __m64 mm3, mm4, mm5, mm6;
03359                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
03360                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
03361                         mm3 = _m_psllwi(mm3, N);                /* shift 4 WORDS of MM3 (N) bits to the left */
03362                         mm4 = _m_psllwi(mm4, N);                /* shift 4 WORDS of MM4 (N) bits to the left */
03363                         /* Take abs value of the signed words */
03364                         mm5 = _m_psrawi(mm3, 15);               /* fill mm5 words with word sign bit */
03365                         mm6 = _m_psrawi(mm4, 15);               /* fill mm6 words with word sign bit */
03366                         mm3 = _m_pxor(mm3, mm5);                /* take 1's compliment of only neg. words */
03367                         mm4 = _m_pxor(mm4, mm6);                /* take 1's compliment of only neg. words */
03368                         mm3 = _m_psubsw(mm3, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
03369                         mm4 = _m_psubsw(mm4, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
03370                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
03371                         mSrc1++;
03372                         mDest++;
03373                 }
03374         }
03375         _m_empty();                                             /* clean MMX state */
03376 #endif
03377         return (0);
03378 #else
03379         return (-1);
03380 #endif
03381 }
03382 
03393 int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
03394 {
03395         unsigned int i, istart;
03396         unsigned char *cursrc1, *curdest;
03397         int result;
03398 
03399         /* Validate input parameters */
03400         if ((Src1 == NULL) || (Dest == NULL))
03401                 return(-1);
03402         if (length == 0)
03403                 return(0);
03404 
03405         if (N > 8) {
03406                 return (-1);
03407         }
03408 
03409         /* Special case: N==0 */
03410         if (N == 0) {
03411                 memcpy(Src1, Dest, length);
03412                 return (0); 
03413         }
03414 
03415         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03416 
03417                 SDL_imageFilterShiftLeftMMX(Src1, Dest, length, N);
03418 
03419                 /* Check for unaligned bytes */
03420                 if ((length & 7) > 0) {
03421                         /* Setup to process unaligned bytes */
03422                         istart = length & 0xfffffff8;
03423                         cursrc1 = &Src1[istart];
03424                         curdest = &Dest[istart];
03425                 } else {
03426                         /* No unaligned bytes - we are done */
03427                         return (0);
03428                 }
03429         } else {
03430                 /* Setup to process whole image */
03431                 istart = 0;
03432                 cursrc1 = Src1;
03433                 curdest = Dest;
03434         }
03435 
03436         /* C routine to process image */
03437         for (i = istart; i < length; i++) {
03438                 result = (int) *cursrc1 << N;
03439                 if (result > 255)
03440                         result = 255;
03441                 *curdest = (unsigned char) result;
03442                 /* Advance pointers */
03443                 cursrc1++;
03444                 curdest++;
03445         }
03446 
03447         return (0);
03448 }
03449 
03460 static int SDL_imageFilterBinarizeUsingThresholdMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char T)
03461 {
03462 #ifdef USE_MMX
03463 #if !defined(GCC__)
03464         __asm
03465         {
03466                 pusha
03467                         /* ** Duplicate T in 8 bytes of MM3 ** */
03468                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
03469                         pcmpeqb mm2, mm2        /* generate all 1's in mm2 */
03470                         mov al, T       /* load T into AL */
03471                         mov ah, al      /* copy AL into AH */
03472                         mov bx, ax      /* copy AX into BX */
03473                         shl eax, 16     /* shift 2 bytes of EAX left */
03474                         mov ax, bx      /* copy BX into AX */
03475                         movd mm3, eax           /* copy EAX into MM3 */
03476                         movd mm4, eax           /* copy EAX into MM4 */
03477                         punpckldq mm3, mm4      /* fill higher bytes of MM3 with T */
03478                         psubusb mm2, mm3        /* store 0xFF - T in MM2 */
03479                         mov eax, Src1           /* load Src1 address into eax */
03480                         mov edi, Dest           /* load Dest address into edi */
03481                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03482                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03483                         align 16                        /* 16 byte alignment of the loop entry */
03484 L1029:
03485                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
03486                 paddusb mm0, mm2        /* MM0=SrcDest+(0xFF-T) (add 8 bytes with saturation) */
03487                         pcmpeqb mm0, mm1        /* binarize 255:0, comparing to 255 */
03488                         movq [edi], mm0         /* store result in SrcDest */
03489                         add eax, 8      /* increase Src1 register pointer by 8 */
03490                         add edi, 8      /* increase Dest register pointer by 8 */
03491                         dec              ecx            /* decrease loop counter */
03492                         jnz             L1029           /* check loop termination, proceed if required */
03493                         emms                            /* exit MMX state */
03494                         popa
03495         }
03496 #else
03497         /* i386 and x86_64 */
03498         __m64 *mSrc1 = (__m64*)Src1;
03499         __m64 *mDest = (__m64*)Dest;
03500         /* Duplicate T in 8 bytes of MM3 */
03501         __m64 mm1 = _m_pcmpeqb(mm1, mm1);                       /* generate all 1's in mm1 */
03502         __m64 mm2 = _m_pcmpeqb(mm2, mm2);                       /* generate all 1's in mm1 */
03503         int i;
03504         memset(&i, T, 4);
03505         __m64 mm3 = _m_from_int(i);
03506         __m64 mm4 = _m_from_int(i);
03507         mm3 = _m_punpckldq(mm3, mm4);                   /* fill higher bytes of MM3 with T */
03508         mm2 = _m_psubusb(mm2, mm3);                     /* store 0xFF - T in MM2 */
03509         //__m64 mm3 = _m_from_int64(lli); // x86_64 only
03510         for (i = 0; i < SrcLength/8; i++) {
03511                 __m64 mm0 = _m_paddusb(*mSrc1, mm2);    /* Src1+(0xFF-T) (add 8 bytes with saturation) */
03512                 *mDest = _m_pcmpeqb(mm0, mm1);          /* binarize 255:0, comparing to 255 */
03513                 mSrc1++;
03514                 mDest++;
03515         }
03516         _m_empty();                                     /* clean MMX state */
03517 #endif
03518         return (0);
03519 #else
03520         return (-1);
03521 #endif
03522 }
03523 
03534 int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
03535 {
03536         unsigned int i, istart;
03537         unsigned char *cursrc1;
03538         unsigned char *curdest;
03539 
03540         /* Validate input parameters */
03541         if ((Src1 == NULL) || (Dest == NULL))
03542                 return(-1);
03543         if (length == 0)
03544                 return(0);
03545 
03546         /* Special case: T==0 */
03547         if (T == 0) {
03548                 memset(Dest, 255, length);
03549                 return (0); 
03550         }
03551 
03552         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03553 
03554                 SDL_imageFilterBinarizeUsingThresholdMMX(Src1, Dest, length, T);
03555 
03556                 /* Check for unaligned bytes */
03557                 if ((length & 7) > 0) {
03558                         /* Setup to process unaligned bytes */
03559                         istart = length & 0xfffffff8;
03560                         cursrc1 = &Src1[istart];
03561                         curdest = &Dest[istart];
03562                 } else {
03563                         /* No unaligned bytes - we are done */
03564                         return (0);
03565                 }
03566         } else {
03567                 /* Setup to process whole image */
03568                 istart = 0;
03569                 cursrc1 = Src1;
03570                 curdest = Dest;
03571         }
03572 
03573         /* C routine to process image */
03574         for (i = istart; i < length; i++) {
03575                 *curdest = (unsigned char)(((unsigned char)*cursrc1 >= T) ? 255 : 0);
03576                 /* Advance pointers */
03577                 cursrc1++;
03578                 curdest++;
03579         }
03580 
03581         return (0);
03582 }
03583 
03595 static int SDL_imageFilterClipToRangeMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char Tmin,
03596                                                                   unsigned char Tmax)
03597 {
03598 #ifdef USE_MMX
03599 #if !defined(GCC__)
03600         __asm
03601         {
03602                 pusha
03603                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
03604                         /* ** Duplicate Tmax in 8 bytes of MM3 ** */
03605                         mov al, Tmax    /* load Tmax into AL */
03606                         mov ah, al      /* copy AL into AH */
03607                         mov bx, ax      /* copy AX into BX */
03608                         shl eax, 16     /* shift 2 bytes of EAX left */
03609                         mov ax, bx      /* copy BX into AX */
03610                         movd mm3, eax           /* copy EAX into MM3 */
03611                         movd mm4, eax           /* copy EAX into MM4 */
03612                         punpckldq mm3, mm4      /* fill higher bytes of MM3 with Tmax */
03613                         psubusb mm1, mm3        /* store 0xFF - Tmax in MM1 */
03614                         /* ** Duplicate Tmin in 8 bytes of MM5 ** */
03615                         mov al, Tmin    /* load Tmin into AL */
03616                         mov ah, al      /* copy AL into AH */
03617                         mov bx, ax      /* copy AX into BX */
03618                         shl eax, 16     /* shift 2 bytes of EAX left */
03619                         mov ax, bx      /* copy BX into AX */
03620                         movd mm5, eax           /* copy EAX into MM5 */
03621                         movd mm4, eax           /* copy EAX into MM4 */
03622                         punpckldq mm5, mm4      /* fill higher bytes of MM5 with Tmin */
03623                         movq mm7, mm5           /* copy MM5 into MM7 */
03624                         paddusb mm7, mm1        /* store 0xFF - Tmax + Tmin in MM7 */
03625                         mov eax, Src1           /* load Src1 address into eax */
03626                         mov edi, Dest           /* load Dest address into edi */
03627                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03628                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03629                         align 16                        /* 16 byte alignment of the loop entry */
03630 L1030:
03631                 movq mm0, [eax]         /* load 8 bytes from Src1 into MM0 */
03632                 paddusb mm0, mm1        /* MM0=SrcDest+(0xFF-Tmax) */
03633                         psubusb mm0, mm7        /* MM0=MM0-(0xFF-Tmax+Tmin) */
03634                         paddusb mm0, mm5        /* MM0=MM0+Tmin */
03635                         movq [edi], mm0         /* store result in Dest */
03636                         add eax, 8      /* increase Src1 register pointer by 8 */
03637                         add edi, 8      /* increase Dest register pointer by 8 */
03638                         dec              ecx            /* decrease loop counter */
03639                         jnz             L1030           /* check loop termination, proceed if required */
03640                         emms                            /* exit MMX state */
03641                         popa
03642         }
03643 #else
03644         /* i386 and x86_64 */
03645         __m64 *mSrc1 = (__m64*)Src1;
03646         __m64 *mDest = (__m64*)Dest;
03647         __m64 mm1 = _m_pcmpeqb(mm1, mm1);       /* generate all 1's in mm1 */
03648         int i;
03649         /* Duplicate Tmax in 8 bytes of MM3 */
03650         __m64 mm3, mm4;
03651         memset(&i, Tmax, 4);
03652         mm3 = _m_from_int(i);
03653         mm4 = _m_from_int(i);
03654         mm3 = _m_punpckldq(mm3, mm4);           /* fill higher bytes of MM3 with Tmax */
03655         mm1 = _m_psubusb(mm1, mm3);             /* store 0xFF - Tmax in MM1 */
03656         //__m64 mm3 = _m_from_int64(lli); // x86_64 only
03657         /* Duplicate Tmax in 8 bytes of MM3 */
03658         __m64 mm5, mm7;
03659         memset(&i, Tmin, 4);
03660         mm5 = _m_from_int(i);
03661         mm4 = _m_from_int(i);
03662         mm5 = _m_punpckldq(mm5, mm4);           /* fill higher bytes of MM5 with Tmin */
03663         mm7 = _m_paddusb(mm5, mm1);     /* store 0xFF - Tmax + Tmin in MM7 */
03664         for (i = 0; i < SrcLength/8; i++) {
03665                 __m64 mm0;
03666                 mm0 = _m_paddusb(*mSrc1, mm1);  /* MM0=Src1+(0xFF-Tmax) */
03667                 mm0 = _m_psubusb(mm0, mm7);     /* MM0=MM0-(0xFF-Tmax+Tmin) */
03668                 *mDest = _m_paddusb(mm0, mm5);  /* MM0+Tmin */
03669                 mSrc1++;
03670                 mDest++;
03671         }
03672         _m_empty();                             /* clean MMX state */
03673 #endif
03674         return (0);
03675 #else
03676         return (-1);
03677 #endif
03678 }
03679 
03691 int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin,
03692                                                            unsigned char Tmax)
03693 {
03694         unsigned int i, istart;
03695         unsigned char *cursrc1;
03696         unsigned char *curdest;
03697 
03698         /* Validate input parameters */
03699         if ((Src1 == NULL) || (Dest == NULL))
03700                 return(-1);
03701         if (length == 0)
03702                 return(0);
03703 
03704         /* Special case: Tmin==0 && Tmax = 255 */
03705         if ((Tmin == 0) && (Tmax == 25)) {
03706                 memcpy(Src1, Dest, length);
03707                 return (0); 
03708         }
03709 
03710         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03711 
03712                 SDL_imageFilterClipToRangeMMX(Src1, Dest, length, Tmin, Tmax);
03713 
03714                 /* Check for unaligned bytes */
03715                 if ((length & 7) > 0) {
03716                         /* Setup to process unaligned bytes */
03717                         istart = length & 0xfffffff8;
03718                         cursrc1 = &Src1[istart];
03719                         curdest = &Dest[istart];
03720                 } else {
03721                         /* No unaligned bytes - we are done */
03722                         return (0);
03723                 }
03724         } else {
03725                 /* Setup to process whole image */
03726                 istart = 0;
03727                 cursrc1 = Src1;
03728                 curdest = Dest;
03729         }
03730 
03731         /* C routine to process image */
03732         for (i = istart; i < length; i++) {
03733                 if (*cursrc1 < Tmin) {
03734                         *curdest = Tmin;
03735                 } else if (*cursrc1 > Tmax) {
03736                         *curdest = Tmax;
03737                 } else {
03738                         *curdest = *cursrc1;
03739                 }
03740                 /* Advance pointers */
03741                 cursrc1++;
03742                 curdest++;
03743         }
03744 
03745         return (0);
03746 }
03747 
03761 static int SDL_imageFilterNormalizeLinearMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, int Cmin, int Cmax,
03762                                                                           int Nmin, int Nmax)
03763 {
03764 #ifdef USE_MMX
03765 #if !defined(GCC__)
03766         __asm
03767         {
03768                 pusha
03769                         mov ax, WORD PTR Nmax           /* load Nmax in AX */
03770                         mov bx, WORD PTR Cmax           /* load Cmax in BX */
03771                         sub ax, WORD PTR Nmin           /* AX = Nmax - Nmin */
03772                         sub bx, WORD PTR Cmin           /* BX = Cmax - Cmin */
03773                         jz             L10311           /* check division by zero */
03774                         xor dx, dx      /* prepare for division, zero DX */
03775                         div               bx            /* AX = AX/BX */
03776                         jmp            L10312
03777 L10311:
03778                 mov ax, 255     /* if div by zero, assume result max byte value */
03779 L10312:                         /* ** Duplicate AX in 4 words of MM0 ** */
03780                 mov bx, ax      /* copy AX into BX */
03781                         shl eax, 16     /* shift 2 bytes of EAX left */
03782                         mov ax, bx      /* copy BX into AX */
03783                         movd mm0, eax           /* copy EAX into MM0 */
03784                         movd mm1, eax           /* copy EAX into MM1 */
03785                         punpckldq mm0, mm1      /* fill higher words of MM0 with AX */
03786                         /* ** Duplicate Cmin in 4 words of MM1 ** */
03787                         mov ax, WORD PTR Cmin           /* load Cmin into AX */
03788                         mov bx, ax      /* copy AX into BX */
03789                         shl eax, 16     /* shift 2 bytes of EAX left */
03790                         mov ax, bx      /* copy BX into AX */
03791                         movd mm1, eax           /* copy EAX into MM1 */
03792                         movd mm2, eax           /* copy EAX into MM2 */
03793                         punpckldq mm1, mm2      /* fill higher words of MM1 with Cmin */
03794                         /* ** Duplicate Nmin in 4 words of MM2 ** */
03795                         mov ax, WORD PTR Nmin           /* load Nmin into AX */
03796                         mov bx, ax      /* copy AX into BX */
03797                         shl eax, 16     /* shift 2 bytes of EAX left */
03798                         mov ax, bx      /* copy BX into AX */
03799                         movd mm2, eax           /* copy EAX into MM2 */
03800                         movd mm3, eax           /* copy EAX into MM3 */
03801                         punpckldq mm2, mm3      /* fill higher words of MM2 with Nmin */
03802                         pxor mm7, mm7           /* zero MM7 register */
03803                         mov eax, Src1           /* load Src1 address into eax */
03804                         mov edi, Dest           /* load Dest address into edi */
03805                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03806                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03807                         align 16                        /* 16 byte alignment of the loop entry */
03808 L1031:
03809                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
03810                 movq mm4, mm3           /* copy MM3 into MM4  */
03811                         punpcklbw mm3, mm7      /* unpack low  bytes of SrcDest into words */
03812                         punpckhbw mm4, mm7      /* unpack high bytes of SrcDest into words */
03813                         psubusb mm3, mm1        /* S-Cmin, low  bytes */
03814                         psubusb mm4, mm1        /* S-Cmin, high bytes */
03815                         pmullw mm3, mm0         /* MM0*(S-Cmin), low  bytes */
03816                         pmullw mm4, mm0         /* MM0*(S-Cmin), high bytes */
03817                         paddusb mm3, mm2        /* MM0*(S-Cmin)+Nmin, low  bytes */
03818                         paddusb mm4, mm2        /* MM0*(S-Cmin)+Nmin, high bytes */
03819                         /* ** Take abs value of the signed words ** */
03820                         movq mm5, mm3           /* copy mm3 into mm5 */
03821                         movq mm6, mm4           /* copy mm4 into mm6 */
03822                         psraw mm5, 15           /* fill mm5 words with word sign bit */
03823                         psraw mm6, 15           /* fill mm6 words with word sign bit */
03824                         pxor mm3, mm5           /* take 1's compliment of only neg words */
03825                         pxor mm4, mm6           /* take 1's compliment of only neg words */
03826                         psubsw mm3, mm5         /* add 1 to only neg words, W-(-1) or W-0 */
03827                         psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
03828                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
03829                         movq [edi], mm3         /* store result in Dest */
03830                         add eax, 8      /* increase Src1 register pointer by 8 */
03831                         add edi, 8      /* increase Dest register pointer by 8 */
03832                         dec              ecx            /* decrease loop counter */
03833                         jnz             L1031           /* check loop termination, proceed if required */
03834                         emms                            /* exit MMX state */
03835                         popa
03836         }
03837 #else
03838         /* i386 and x86_64 */
03839         __m64 *mSrc1 = (__m64*)Src1;
03840         __m64 *mDest = (__m64*)Dest;
03841         __m64 mm0, mm1, mm2, mm3;
03842 
03843         int i;
03844         /* Duplicate (Nmax-Nmin)/(Cmax-Cmin) in 4 words of MM0 */
03845         unsigned short a = Nmax - Nmin;
03846         unsigned short b = Cmax - Cmin;
03847         if (b == 0) {
03848             a = 255;
03849         } else {
03850             a /= b;
03851         }
03852         i = (a<<16)|a;
03853         mm0 = _m_from_int(i);
03854         mm1 = _m_from_int(i);
03855         mm0 = _m_punpckldq(mm0, mm1);                   /* fill higher words of MM0 with AX */
03856         /* Duplicate Cmin in 4 words of MM1 */
03857         i = (Cmin<<16)|(short)Cmin;
03858         mm1 = _m_from_int(i);
03859         mm2 = _m_from_int(i);
03860         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher words of MM1 with Cmin */
03861         /* Duplicate Nmin in 4 words of MM2 */
03862         i = (Nmin<<16)|(short)Nmin;
03863         mm2 = _m_from_int(i);
03864         mm3 = _m_from_int(i);
03865         mm2 = _m_punpckldq(mm2, mm3);                   /* fill higher words of MM2 with Nmin */
03866         __m64 mm7 = _m_from_int(0);                     /* zero mm0 register */
03867         for (i = 0; i < SrcLength/8; i++) {
03868                 __m64 mm3, mm4, mm5, mm6;
03869                 mm3 = _m_punpcklbw(*mSrc1, mm7);        /* unpack low  bytes of Src1 into words */
03870                 mm4 = _m_punpckhbw(*mSrc1, mm7);        /* unpack high bytes of Src1 into words */
03871                 mm3 = _m_psubusb(mm3, mm1);             /* S-Cmin, low  bytes */
03872                 mm4 = _m_psubusb(mm4, mm1);             /* S-Cmin, high bytes */
03873                 mm3 = _m_pmullw(mm3, mm0);              /* MM0*(S-Cmin), low  bytes */
03874                 mm4 = _m_pmullw(mm4, mm0);              /* MM0*(S-Cmin), high bytes */
03875                 mm3 = _m_paddusb(mm3, mm2);             /* MM0*(S-Cmin)+Nmin, low  bytes */
03876                 mm4 = _m_paddusb(mm4, mm2);             /* MM0*(S-Cmin)+Nmin, high bytes */
03877                 /* Take abs value of the signed words */
03878                 mm5 = _m_psrawi(mm3, 15);               /* fill mm5 words with word sign bit */
03879                 mm6 = _m_psrawi(mm4, 15);               /* fill mm6 words with word sign bit */
03880                 mm3 = _m_pxor(mm3, mm5);                /* take 1's compliment of only neg. words */
03881                 mm4 = _m_pxor(mm4, mm6);                /* take 1's compliment of only neg. words */
03882                 mm3 = _m_psubsw(mm3, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
03883                 mm4 = _m_psubsw(mm4, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
03884                 *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
03885                 mSrc1++;
03886                 mDest++;
03887         }
03888         _m_empty();                                     /* clean MMX state */
03889 #endif
03890         return (0);
03891 #else
03892         return (-1);
03893 #endif
03894 }
03895 
03909 int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin,
03910                                                                    int Nmax)
03911 {
03912         unsigned int i, istart;
03913         unsigned char *cursrc;
03914         unsigned char *curdest;
03915         int dN, dC, factor;
03916         int result;
03917 
03918         /* Validate input parameters */
03919         if ((Src == NULL) || (Dest == NULL))
03920                 return(-1);
03921         if (length == 0)
03922                 return(0);
03923 
03924         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03925 
03926                 SDL_imageFilterNormalizeLinearMMX(Src, Dest, length, Cmin, Cmax, Nmin, Nmax);
03927 
03928                 /* Check for unaligned bytes */
03929                 if ((length & 7) > 0) {
03930                         /* Setup to process unaligned bytes */
03931                         istart = length & 0xfffffff8;
03932                         cursrc = &Src[istart];
03933                         curdest = &Dest[istart];
03934                 } else {
03935                         /* No unaligned bytes - we are done */
03936                         return (0);
03937                 }
03938         } else {
03939                 /* Setup to process whole image */
03940                 istart = 0;
03941                 cursrc = Src;
03942                 curdest = Dest;
03943         }
03944 
03945         /* C routine to process image */
03946         dC = Cmax - Cmin;
03947         if (dC == 0)
03948                 return (0);
03949         dN = Nmax - Nmin;
03950         factor = dN / dC;
03951         for (i = istart; i < length; i++) {
03952                 result = factor * ((int) (*cursrc) - Cmin) + Nmin;
03953                 if (result > 255)
03954                         result = 255;
03955                 *curdest = (unsigned char) result;
03956                 /* Advance pointers */
03957                 cursrc++;
03958                 curdest++;
03959         }
03960 
03961         return (0);
03962 }
03963 
03964 /* ------------------------------------------------------------------------------------ */
03965 
03980 int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
03981                                                                                    signed short *Kernel, unsigned char Divisor)
03982 {
03983         /* Validate input parameters */
03984         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
03985                 return(-1);
03986 
03987         if ((columns < 3) || (rows < 3) || (Divisor == 0))
03988                 return (-1);
03989 
03990         if ((SDL_imageFilterMMXdetect())) {
03991 //#ifdef USE_MMX
03992 #if defined(USE_MMX) && defined(i386)
03993 #if !defined(GCC__)
03994                 __asm
03995                 {
03996                         pusha
03997                                 pxor mm0, mm0           /* zero MM0 */
03998                                 xor ebx, ebx    /* zero EBX */
03999                                 mov bl, Divisor         /* load Divisor into BL */
04000                                 mov edx, Kernel         /* load Kernel address into EDX */
04001                                 movq mm5, [edx]         /* MM5 = {0,K2,K1,K0} */
04002                         add edx, 8      /* second row              |K0 K1 K2 0| */
04003                                 movq mm6, [edx]         /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
04004                         add edx, 8      /* third row               |K6 K7 K8 0| */
04005                                 movq mm7, [edx]         /* MM7 = {0,K8,K7,K6} */
04006                         /* ---, */
04007                         mov eax, columns        /* load columns into EAX */
04008                                 mov esi, Src    /* ESI = Src row 0 address */
04009                                 mov edi, Dest           /* load Dest address to EDI */
04010                                 add edi, eax    /* EDI = EDI + columns */
04011                                 inc              edi            /* 1 byte offset from the left edge */
04012                                 mov edx, rows           /* initialize ROWS counter */
04013                                 sub edx, 2      /* do not use first and last row */
04014                                 /* ---, */
04015 L10320:
04016                         mov ecx, eax    /* initialize COLUMS counter */
04017                                 sub ecx, 2      /* do not use first and last column */
04018                                 align 16                        /* 16 byte alignment of the loop entry */
04019 L10322:
04020                         /* ---, */
04021                         movq mm1, [esi]         /* load 8 bytes of the image first row */
04022                         add esi, eax    /* move one row below */
04023                                 movq mm2, [esi]         /* load 8 bytes of the image second row */
04024                         add esi, eax    /* move one row below */
04025                                 movq mm3, [esi]         /* load 8 bytes of the image third row */
04026                         punpcklbw mm1, mm0      /* unpack first 4 bytes into words */
04027                                 punpcklbw mm2, mm0      /* unpack first 4 bytes into words */
04028                                 punpcklbw mm3, mm0      /* unpack first 4 bytes into words */
04029                                 pmullw mm1, mm5         /* multiply words first row  image*Kernel */
04030                                 pmullw mm2, mm6         /* multiply words second row image*Kernel */
04031                                 pmullw mm3, mm7         /* multiply words third row  image*Kernel */
04032                                 paddsw mm1, mm2         /* add 4 words of the first and second rows */
04033                                 paddsw mm1, mm3         /* add 4 words of the third row and result */
04034                                 movq mm2, mm1           /* copy MM1 into MM2 */
04035                                 psrlq mm1, 32           /* shift 2 left words to the right */
04036                                 paddsw mm1, mm2         /* add 2 left and 2 right result words */
04037                                 movq mm3, mm1           /* copy MM1 into MM3 */
04038                                 psrlq mm1, 16           /* shift 1 left word to the right */
04039                                 paddsw mm1, mm3         /* add 1 left and 1 right result words */
04040                                 /* --, */
04041                                 movd mm2, eax           /* save EAX in MM2 */
04042                                 movd mm3, edx           /* save EDX in MM3 */
04043                                 movd eax, mm1           /* copy MM1 into EAX */
04044                                 psraw mm1, 15           /* spread sign bit of the result */
04045                                 movd edx, mm1           /* fill EDX with a sign bit */
04046                                 idiv bx         /* IDIV - VERY EXPENSIVE */
04047                                 movd mm1, eax           /* move result of division into MM1 */
04048                                 packuswb mm1, mm0       /* pack division result with saturation */
04049                                 movd eax, mm1           /* copy saturated result into EAX */
04050                                 mov [edi], al           /* copy a byte result into Dest */
04051                                 movd edx, mm3           /* restore saved EDX */
04052                                 movd eax, mm2           /* restore saved EAX */
04053                                 /* --, */
04054                                 sub esi, eax    /* move two rows up */
04055                                 sub esi, eax    /* */
04056                                 inc              esi            /* move Src  pointer to the next pixel */
04057                                 inc              edi            /* move Dest pointer to the next pixel */
04058                                 /* ---, */
04059                                 dec              ecx            /* decrease loop counter COLUMNS */
04060                                 jnz            L10322           /* check loop termination, proceed if required */
04061                                 add esi, 2      /* move to the next row in Src */
04062                                 add edi, 2      /* move to the next row in Dest */
04063                                 dec              edx            /* decrease loop counter ROWS */
04064                                 jnz            L10320           /* check loop termination, proceed if required */
04065                                 /* ---, */
04066                                 emms                            /* exit MMX state */
04067                                 popa
04068                 }
04069 #else
04070                 asm volatile
04071                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
04072                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
04073                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
04074                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
04075                         "movq    (%%edx), %%mm5 \n\t"   /* MM5 = {0,K2,K1,K0} */
04076                         "add          $8, %%edx \n\t"   /* second row              |K0 K1 K2 0| */
04077                         "movq    (%%edx), %%mm6 \n\t"   /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
04078                         "add          $8, %%edx \n\t"   /* third row               |K6 K7 K8 0| */
04079                         "movq    (%%edx), %%mm7 \n\t"   /* MM7 = {0,K8,K7,K6} */
04080                         /* --- */
04081                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
04082                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
04083                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
04084                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
04085                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
04086                         "mov          %2, %%edx \n\t"   /* initialize ROWS counter */
04087                         "sub          $2, %%edx \n\t"   /* do not use first and last row */
04088                         /* --- */
04089                         ".L10320:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMS counter */
04090                         "sub          $2, %%ecx \n\t"   /* do not use first and last column */
04091                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
04092                         ".L10322:               \n\t"
04093                         /* --- */
04094                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the image first row */
04095                         "add       %%eax, %%esi \n\t"   /* move one row below */
04096                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes of the image second row */
04097                         "add       %%eax, %%esi \n\t"   /* move one row below */
04098                         "movq    (%%esi), %%mm3 \n\t"   /* load 8 bytes of the image third row */
04099                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first 4 bytes into words */
04100                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack first 4 bytes into words */
04101                         "punpcklbw %%mm0, %%mm3 \n\t"   /* unpack first 4 bytes into words */
04102                         "pmullw    %%mm5, %%mm1 \n\t"   /* multiply words first row  image*Kernel */
04103                         "pmullw    %%mm6, %%mm2 \n\t"   /* multiply words second row image*Kernel */
04104                         "pmullw    %%mm7, %%mm3 \n\t"   /* multiply words third row  image*Kernel */
04105                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the first and second rows */
04106                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 4 words of the third row and result */
04107                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04108                         "psrlq       $32, %%mm1 \n\t"   /* shift 2 left words to the right */
04109                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 2 left and 2 right result words */
04110                         "movq      %%mm1, %%mm3 \n\t"   /* copy MM1 into MM3 */
04111                         "psrlq       $16, %%mm1 \n\t"   /* shift 1 left word to the right */
04112                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 1 left and 1 right result words */
04113                         /* -- */
04114                         "movd      %%eax, %%mm2 \n\t"   /* save EAX in MM2 */
04115                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
04116                         "movd      %%mm1, %%eax \n\t"   /* copy MM1 into EAX */
04117                         "psraw       $15, %%mm1 \n\t"   /* spread sign bit of the result */
04118                         "movd      %%mm1, %%edx \n\t"   /* fill EDX with a sign bit */
04119                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
04120                         "movd      %%eax, %%mm1 \n\t"   /* move result of division into MM1 */
04121                         "packuswb  %%mm0, %%mm1 \n\t"   /* pack division result with saturation */
04122                         "movd      %%mm1, %%eax \n\t"   /* copy saturated result into EAX */
04123                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
04124                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
04125                         "movd      %%mm2, %%eax \n\t"   /* restore saved EAX */
04126                         /* -- */
04127                         "sub       %%eax, %%esi \n\t"   /* move two rows up */
04128                         "sub       %%eax, %%esi \n\t"   /* */
04129                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
04130                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
04131                         /* --- */
04132                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
04133                         "jnz            .L10322 \n\t"   /* check loop termination, proceed if required */
04134                         "add          $2, %%esi \n\t"   /* move to the next row in Src */
04135                         "add          $2, %%edi \n\t"   /* move to the next row in Dest */
04136                         "dec              %%edx \n\t"   /* decrease loop counter ROWS */
04137                         "jnz            .L10320 \n\t"   /* check loop termination, proceed if required */
04138                         /* --- */
04139                         "emms                   \n\t"   /* exit MMX state */
04140                         "popa                   \n\t":"=m" (Dest)       /* %0 */
04141                         :"m"(Src),              /* %1 */
04142                         "m"(rows),              /* %2 */
04143                         "m"(columns),           /* %3 */
04144                         "m"(Kernel),            /* %4 */
04145                         "m"(Divisor)            /* %5 */
04146                         );
04147 #endif
04148 #endif
04149                 return (0);
04150         } else {
04151                 /* No non-MMX implementation yet */
04152                 return (-1);
04153         }
04154 }
04155 
04170 int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
04171                                                                                    signed short *Kernel, unsigned char Divisor)
04172 {
04173         /* Validate input parameters */
04174         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
04175                 return(-1);
04176 
04177         if ((columns < 5) || (rows < 5) || (Divisor == 0))
04178                 return (-1);
04179 
04180         if ((SDL_imageFilterMMXdetect())) {
04181 //#ifdef USE_MMX
04182 #if defined(USE_MMX) && defined(i386)
04183 #if !defined(GCC__)
04184                 __asm
04185                 {
04186                         pusha
04187                                 pxor mm0, mm0           /* zero MM0 */
04188                                 xor ebx, ebx    /* zero EBX */
04189                                 mov bl, Divisor         /* load Divisor into BL */
04190                                 movd mm5, ebx           /* copy Divisor into MM5 */
04191                                 mov edx, Kernel         /* load Kernel address into EDX */
04192                                 mov esi, Src    /* load Src  address to ESI */
04193                                 mov edi, Dest           /* load Dest address to EDI */
04194                                 add edi, 2      /* 2 column offset from the left edge */
04195                                 mov eax, columns        /* load columns into EAX */
04196                                 shl eax, 1      /* EAX = columns * 2 */
04197                                 add edi, eax    /* 2 row offset from the top edge */
04198                                 shr eax, 1      /* EAX = columns */
04199                                 mov ebx, rows           /* initialize ROWS counter */
04200                                 sub ebx, 4      /* do not use first 2 and last 2 rows */
04201                                 /* ---, */
04202 L10330:
04203                         mov ecx, eax    /* initialize COLUMNS counter */
04204                                 sub ecx, 4      /* do not use first 2 and last 2 columns */
04205                                 align 16                        /* 16 byte alignment of the loop entry */
04206 L10332:
04207                         pxor mm7, mm7           /* zero MM7 (accumulator) */
04208                                 movd mm6, esi           /* save ESI in MM6 */
04209                                 /* --- 1 */
04210                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04211                         movq mm2, mm1           /* copy MM1 into MM2 */
04212                                 add esi, eax    /* move Src pointer 1 row below */
04213                                 movq mm3, [edx]         /* load 4 words of Kernel */
04214                         add edx, 8      /* move pointer to other 4 words */
04215                                 movq mm4, [edx]         /* load 4 words of Kernel */
04216                         add edx, 8      /* move pointer to other 4 words */
04217                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04218                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04219                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04220                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04221                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04222                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04223                                 /* --- 2 */
04224                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04225                         movq mm2, mm1           /* copy MM1 into MM2 */
04226                                 add esi, eax    /* move Src pointer 1 row below */
04227                                 movq mm3, [edx]         /* load 4 words of Kernel */
04228                         add edx, 8      /* move pointer to other 4 words */
04229                                 movq mm4, [edx]         /* load 4 words of Kernel */
04230                         add edx, 8      /* move pointer to other 4 words */
04231                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04232                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04233                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04234                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04235                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04236                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04237                                 /* --- 3 */
04238                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04239                         movq mm2, mm1           /* copy MM1 into MM2 */
04240                                 add esi, eax    /* move Src pointer 1 row below */
04241                                 movq mm3, [edx]         /* load 4 words of Kernel */
04242                         add edx, 8      /* move pointer to other 4 words */
04243                                 movq mm4, [edx]         /* load 4 words of Kernel */
04244                         add edx, 8      /* move pointer to other 4 words */
04245                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04246                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04247                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04248                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04249                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04250                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04251                                 /* --- 4 */
04252                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04253                         movq mm2, mm1           /* copy MM1 into MM2 */
04254                                 add esi, eax    /* move Src pointer 1 row below */
04255                                 movq mm3, [edx]         /* load 4 words of Kernel */
04256                         add edx, 8      /* move pointer to other 4 words */
04257                                 movq mm4, [edx]         /* load 4 words of Kernel */
04258                         add edx, 8      /* move pointer to other 4 words */
04259                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04260                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04261                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04262                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04263                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04264                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04265                                 /* --- 5 */
04266                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04267                         movq mm2, mm1           /* copy MM1 into MM2 */
04268                                 movq mm3, [edx]         /* load 4 words of Kernel */
04269                         add edx, 8      /* move pointer to other 4 words */
04270                                 movq mm4, [edx]         /* load 4 words of Kernel */
04271                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04272                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04273                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04274                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04275                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04276                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04277                                 /* ---, */
04278                                 movq mm3, mm7           /* copy MM7 into MM3 */
04279                                 psrlq mm7, 32           /* shift 2 left words to the right */
04280                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
04281                                 movq mm2, mm7           /* copy MM7 into MM2 */
04282                                 psrlq mm7, 16           /* shift 1 left word to the right */
04283                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
04284                                 /* ---, */
04285                                 movd mm1, eax           /* save EDX in MM1 */
04286                                 movd mm2, ebx           /* save EDX in MM2 */
04287                                 movd mm3, edx           /* save EDX in MM3 */
04288                                 movd eax, mm7           /* load summation result into EAX */
04289                                 psraw mm7, 15           /* spread sign bit of the result */
04290                                 movd ebx, mm5           /* load Divisor into EBX */
04291                                 movd edx, mm7           /* fill EDX with a sign bit */
04292                                 idiv bx         /* IDIV - VERY EXPENSIVE */
04293                                 movd mm7, eax           /* move result of division into MM7 */
04294                                 packuswb mm7, mm0       /* pack division result with saturation */
04295                                 movd eax, mm7           /* copy saturated result into EAX */
04296                                 mov [edi], al           /* copy a byte result into Dest */
04297                                 movd edx, mm3           /* restore saved EDX */
04298                                 movd ebx, mm2           /* restore saved EBX */
04299                                 movd eax, mm1           /* restore saved EAX */
04300                                 /* --, */
04301                                 movd esi, mm6           /* move Src pointer to the top pixel */
04302                                 sub edx, 72     /* EDX = Kernel address */
04303                                 inc              esi            /* move Src  pointer to the next pixel */
04304                                 inc              edi            /* move Dest pointer to the next pixel */
04305                                 /* ---, */
04306                                 dec              ecx            /* decrease loop counter COLUMNS */
04307                                 jnz            L10332           /* check loop termination, proceed if required */
04308                                 add esi, 4      /* move to the next row in Src */
04309                                 add edi, 4      /* move to the next row in Dest */
04310                                 dec              ebx            /* decrease loop counter ROWS */
04311                                 jnz            L10330           /* check loop termination, proceed if required */
04312                                 /* ---, */
04313                                 emms                            /* exit MMX state */
04314                                 popa
04315                 }
04316 #else
04317                 asm volatile
04318                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
04319                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
04320                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
04321                         "movd      %%ebx, %%mm5 \n\t"   /* copy Divisor into MM5 */
04322                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
04323                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
04324                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
04325                         "add          $2, %%edi \n\t"   /* 2 column offset from the left edge */
04326                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
04327                         "shl          $1, %%eax \n\t"   /* EAX = columns * 2 */
04328                         "add       %%eax, %%edi \n\t"   /* 2 row offset from the top edge */
04329                         "shr          $1, %%eax \n\t"   /* EAX = columns */
04330                         "mov          %2, %%ebx \n\t"   /* initialize ROWS counter */
04331                         "sub          $4, %%ebx \n\t"   /* do not use first 2 and last 2 rows */
04332                         /* --- */
04333                         ".L10330:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
04334                         "sub          $4, %%ecx \n\t"   /* do not use first 2 and last 2 columns */
04335                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
04336                         ".L10332:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
04337                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
04338                         /* --- 1 */
04339                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04340                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04341                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04342                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04343                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04344                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04345                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04346                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04347                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04348                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04349                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04350                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04351                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04352                         /* --- 2 */
04353                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04354                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04355                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04356                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04357                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04358                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04359                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04360                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04361                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04362                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04363                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04364                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04365                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04366                         /* --- 3 */
04367                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04368                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04369                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04370                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04371                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04372                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04373                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04374                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04375                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04376                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04377                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04378                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04379                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04380                         /* --- 4 */
04381                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04382                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04383                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04384                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04385                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04386                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04387                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04388                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04389                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04390                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04391                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04392                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04393                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04394                         /* --- 5 */
04395                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04396                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04397                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04398                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04399                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04400                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04401                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04402                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04403                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04404                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04405                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04406                         /* --- */
04407                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
04408                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
04409                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
04410                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
04411                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
04412                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
04413                         /* --- */
04414                         "movd      %%eax, %%mm1 \n\t"   /* save EDX in MM1 */
04415                         "movd      %%ebx, %%mm2 \n\t"   /* save EDX in MM2 */
04416                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
04417                         "movd      %%mm7, %%eax \n\t"   /* load summation result into EAX */
04418                         "psraw       $15, %%mm7 \n\t"   /* spread sign bit of the result */
04419                         "movd      %%mm5, %%ebx \n\t"   /* load Divisor into EBX */
04420                         "movd      %%mm7, %%edx \n\t"   /* fill EDX with a sign bit */
04421                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
04422                         "movd      %%eax, %%mm7 \n\t"   /* move result of division into MM7 */
04423                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
04424                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
04425                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
04426                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
04427                         "movd      %%mm2, %%ebx \n\t"   /* restore saved EBX */
04428                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
04429                         /* -- */
04430                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
04431                         "sub         $72, %%edx \n\t"   /* EDX = Kernel address */
04432                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
04433                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
04434                         /* --- */
04435                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
04436                         "jnz            .L10332 \n\t"   /* check loop termination, proceed if required */
04437                         "add          $4, %%esi \n\t"   /* move to the next row in Src */
04438                         "add          $4, %%edi \n\t"   /* move to the next row in Dest */
04439                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
04440                         "jnz            .L10330 \n\t"   /* check loop termination, proceed if required */
04441                         /* --- */
04442                         "emms                   \n\t"   /* exit MMX state */
04443                         "popa                   \n\t":"=m" (Dest)       /* %0 */
04444                         :"m"(Src),              /* %1 */
04445                         "m"(rows),              /* %2 */
04446                         "m"(columns),           /* %3 */
04447                         "m"(Kernel),            /* %4 */
04448                         "m"(Divisor)            /* %5 */
04449                         );
04450 #endif
04451 #endif
04452                 return (0);
04453         } else {
04454                 /* No non-MMX implementation yet */
04455                 return (-1);
04456         }
04457 }
04458 
04473 int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
04474                                                                                    signed short *Kernel, unsigned char Divisor)
04475 {
04476         /* Validate input parameters */
04477         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
04478                 return(-1);
04479 
04480         if ((columns < 7) || (rows < 7) || (Divisor == 0))
04481                 return (-1);
04482 
04483         if ((SDL_imageFilterMMXdetect())) {
04484 //#ifdef USE_MMX
04485 #if defined(USE_MMX) && defined(i386)
04486 #if !defined(GCC__)
04487                 __asm
04488                 {
04489                         pusha
04490                                 pxor mm0, mm0           /* zero MM0 */
04491                                 xor ebx, ebx    /* zero EBX */
04492                                 mov bl, Divisor         /* load Divisor into BL */
04493                                 movd mm5, ebx           /* copy Divisor into MM5 */
04494                                 mov edx, Kernel         /* load Kernel address into EDX */
04495                                 mov esi, Src    /* load Src  address to ESI */
04496                                 mov edi, Dest           /* load Dest address to EDI */
04497                                 add edi, 3      /* 3 column offset from the left edge */
04498                                 mov eax, columns        /* load columns into EAX */
04499                                 add edi, eax    /* 3 row offset from the top edge */
04500                                 add edi, eax
04501                                 add edi, eax
04502                                 mov ebx, rows           /* initialize ROWS counter */
04503                                 sub ebx, 6      /* do not use first 3 and last 3 rows */
04504                                 /* ---, */
04505 L10340:
04506                         mov ecx, eax    /* initialize COLUMNS counter */
04507                                 sub ecx, 6      /* do not use first 3 and last 3 columns */
04508                                 align 16                        /* 16 byte alignment of the loop entry */
04509 L10342:
04510                         pxor mm7, mm7           /* zero MM7 (accumulator) */
04511                                 movd mm6, esi           /* save ESI in MM6 */
04512                                 /* --- 1 */
04513                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04514                         movq mm2, mm1           /* copy MM1 into MM2 */
04515                                 add esi, eax    /* move Src pointer 1 row below */
04516                                 movq mm3, [edx]         /* load 4 words of Kernel */
04517                         add edx, 8      /* move pointer to other 4 words */
04518                                 movq mm4, [edx]         /* load 4 words of Kernel */
04519                         add edx, 8      /* move pointer to other 4 words */
04520                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04521                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04522                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04523                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04524                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04525                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04526                                 /* --- 2 */
04527                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04528                         movq mm2, mm1           /* copy MM1 into MM2 */
04529                                 add esi, eax    /* move Src pointer 1 row below */
04530                                 movq mm3, [edx]         /* load 4 words of Kernel */
04531                         add edx, 8      /* move pointer to other 4 words */
04532                                 movq mm4, [edx]         /* load 4 words of Kernel */
04533                         add edx, 8      /* move pointer to other 4 words */
04534                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04535                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04536                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04537                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04538                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04539                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04540                                 /* --- 3 */
04541                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04542                         movq mm2, mm1           /* copy MM1 into MM2 */
04543                                 add esi, eax    /* move Src pointer 1 row below */
04544                                 movq mm3, [edx]         /* load 4 words of Kernel */
04545                         add edx, 8      /* move pointer to other 4 words */
04546                                 movq mm4, [edx]         /* load 4 words of Kernel */
04547                         add edx, 8      /* move pointer to other 4 words */
04548                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04549                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04550                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04551                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04552                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04553                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04554                                 /* --- 4 */
04555                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04556                         movq mm2, mm1           /* copy MM1 into MM2 */
04557                                 add esi, eax    /* move Src pointer 1 row below */
04558                                 movq mm3, [edx]         /* load 4 words of Kernel */
04559                         add edx, 8      /* move pointer to other 4 words */
04560                                 movq mm4, [edx]         /* load 4 words of Kernel */
04561                         add edx, 8      /* move pointer to other 4 words */
04562                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04563                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04564                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04565                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04566                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04567                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04568                                 /* --- 5 */
04569                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04570                         movq mm2, mm1           /* copy MM1 into MM2 */
04571                                 add esi, eax    /* move Src pointer 1 row below */
04572                                 movq mm3, [edx]         /* load 4 words of Kernel */
04573                         add edx, 8      /* move pointer to other 4 words */
04574                                 movq mm4, [edx]         /* load 4 words of Kernel */
04575                         add edx, 8      /* move pointer to other 4 words */
04576                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04577                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04578                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04579                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04580                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04581                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04582                                 /* --- 6 */
04583                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04584                         movq mm2, mm1           /* copy MM1 into MM2 */
04585                                 add esi, eax    /* move Src pointer 1 row below */
04586                                 movq mm3, [edx]         /* load 4 words of Kernel */
04587                         add edx, 8      /* move pointer to other 4 words */
04588                                 movq mm4, [edx]         /* load 4 words of Kernel */
04589                         add edx, 8      /* move pointer to other 4 words */
04590                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04591                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04592                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04593                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04594                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04595                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04596                                 /* --- 7 */
04597                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04598                         movq mm2, mm1           /* copy MM1 into MM2 */
04599                                 movq mm3, [edx]         /* load 4 words of Kernel */
04600                         add edx, 8      /* move pointer to other 4 words */
04601                                 movq mm4, [edx]         /* load 4 words of Kernel */
04602                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04603                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04604                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04605                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04606                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04607                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04608                                 /* ---, */
04609                                 movq mm3, mm7           /* copy MM7 into MM3 */
04610                                 psrlq mm7, 32           /* shift 2 left words to the right */
04611                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
04612                                 movq mm2, mm7           /* copy MM7 into MM2 */
04613                                 psrlq mm7, 16           /* shift 1 left word to the right */
04614                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
04615                                 /* ---, */
04616                                 movd mm1, eax           /* save EDX in MM1 */
04617                                 movd mm2, ebx           /* save EDX in MM2 */
04618                                 movd mm3, edx           /* save EDX in MM3 */
04619                                 movd eax, mm7           /* load summation result into EAX */
04620                                 psraw mm7, 15           /* spread sign bit of the result */
04621                                 movd ebx, mm5           /* load Divisor into EBX */
04622                                 movd edx, mm7           /* fill EDX with a sign bit */
04623                                 idiv bx         /* IDIV - VERY EXPENSIVE */
04624                                 movd mm7, eax           /* move result of division into MM7 */
04625                                 packuswb mm7, mm0       /* pack division result with saturation */
04626                                 movd eax, mm7           /* copy saturated result into EAX */
04627                                 mov [edi], al           /* copy a byte result into Dest */
04628                                 movd edx, mm3           /* restore saved EDX */
04629                                 movd ebx, mm2           /* restore saved EBX */
04630                                 movd eax, mm1           /* restore saved EAX */
04631                                 /* --, */
04632                                 movd esi, mm6           /* move Src pointer to the top pixel */
04633                                 sub edx, 104    /* EDX = Kernel address */
04634                                 inc              esi            /* move Src  pointer to the next pixel */
04635                                 inc              edi            /* move Dest pointer to the next pixel */
04636                                 /* ---, */
04637                                 dec              ecx            /* decrease loop counter COLUMNS */
04638                                 jnz            L10342           /* check loop termination, proceed if required */
04639                                 add esi, 6      /* move to the next row in Src */
04640                                 add edi, 6      /* move to the next row in Dest */
04641                                 dec              ebx            /* decrease loop counter ROWS */
04642                                 jnz            L10340           /* check loop termination, proceed if required */
04643                                 /* ---, */
04644                                 emms                            /* exit MMX state */
04645                                 popa
04646                 }
04647 #else
04648                 asm volatile
04649                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
04650                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
04651                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
04652                         "movd      %%ebx, %%mm5 \n\t"   /* copy Divisor into MM5 */
04653                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
04654                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
04655                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
04656                         "add          $3, %%edi \n\t"   /* 3 column offset from the left edge */
04657                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
04658                         "add       %%eax, %%edi \n\t"   /* 3 row offset from the top edge */
04659                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t"       /* initialize ROWS counter */
04660                         "sub          $6, %%ebx \n\t"   /* do not use first 3 and last 3 rows */
04661                         /* --- */
04662                         ".L10340:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
04663                         "sub          $6, %%ecx \n\t"   /* do not use first 3 and last 3 columns */
04664                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
04665                         ".L10342:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
04666                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
04667                         /* --- 1 */
04668                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04669                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04670                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04671                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04672                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04673                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04674                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04675                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04676                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04677                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04678                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04679                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04680                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04681                         /* --- 2 */
04682                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04683                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04684                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04685                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04686                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04687                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04688                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04689                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04690                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04691                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04692                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04693                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04694                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04695                         /* --- 3 */
04696                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04697                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04698                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04699                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04700                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04701                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04702                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04703                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04704                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04705                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04706                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04707                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04708                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04709                         /* --- 4 */
04710                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04711                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04712                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04713                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04714                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04715                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04716                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04717                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04718                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04719                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04720                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04721                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04722                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04723                         /* --- 5 */
04724                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04725                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04726                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04727                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04728                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04729                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04730                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04731                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04732                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04733                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04734                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04735                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04736                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04737                         /* --- 6 */
04738                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04739                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04740                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04741                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04742                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04743                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04744                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04745                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04746                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04747                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04748                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04749                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04750                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04751                         /* --- 7 */
04752                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04753                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04754                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04755                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04756                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04757                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04758                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04759                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04760                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04761                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04762                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04763                         /* --- */
04764                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
04765                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
04766                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
04767                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
04768                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
04769                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
04770                         /* --- */
04771                         "movd      %%eax, %%mm1 \n\t"   /* save EDX in MM1 */
04772                         "movd      %%ebx, %%mm2 \n\t"   /* save EDX in MM2 */
04773                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
04774                         "movd      %%mm7, %%eax \n\t"   /* load summation result into EAX */
04775                         "psraw       $15, %%mm7 \n\t"   /* spread sign bit of the result */
04776                         "movd      %%mm5, %%ebx \n\t"   /* load Divisor into EBX */
04777                         "movd      %%mm7, %%edx \n\t"   /* fill EDX with a sign bit */
04778                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
04779                         "movd      %%eax, %%mm7 \n\t"   /* move result of division into MM7 */
04780                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
04781                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
04782                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
04783                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
04784                         "movd      %%mm2, %%ebx \n\t"   /* restore saved EBX */
04785                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
04786                         /* -- */
04787                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
04788                         "sub        $104, %%edx \n\t"   /* EDX = Kernel address */
04789                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
04790                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
04791                         /* --- */
04792                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
04793                         "jnz            .L10342 \n\t"   /* check loop termination, proceed if required */
04794                         "add          $6, %%esi \n\t"   /* move to the next row in Src */
04795                         "add          $6, %%edi \n\t"   /* move to the next row in Dest */
04796                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
04797                         "jnz            .L10340 \n\t"   /* check loop termination, proceed if required */
04798                         /* --- */
04799                         "emms                   \n\t"   /* exit MMX state */
04800                         "popa                   \n\t":"=m" (Dest)       /* %0 */
04801                         :"m"(Src),              /* %1 */
04802                         "m"(rows),              /* %2 */
04803                         "m"(columns),           /* %3 */
04804                         "m"(Kernel),            /* %4 */
04805                         "m"(Divisor)            /* %5 */
04806                         );
04807 #endif
04808 #endif
04809                 return (0);
04810         } else {
04811                 /* No non-MMX implementation yet */
04812                 return (-1);
04813         }
04814 }
04815 
04830 int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
04831                                                                                    signed short *Kernel, unsigned char Divisor)
04832 {
04833         /* Validate input parameters */
04834         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
04835                 return(-1);
04836 
04837         if ((columns < 9) || (rows < 9) || (Divisor == 0))
04838                 return (-1);
04839 
04840         if ((SDL_imageFilterMMXdetect())) {
04841 //#ifdef USE_MMX
04842 #if defined(USE_MMX) && defined(i386)
04843 #if !defined(GCC__)
04844                 __asm
04845                 {
04846                         pusha
04847                                 pxor mm0, mm0           /* zero MM0 */
04848                                 xor ebx, ebx    /* zero EBX */
04849                                 mov bl, Divisor         /* load Divisor into BL */
04850                                 movd mm5, ebx           /* copy Divisor into MM5 */
04851                                 mov edx, Kernel         /* load Kernel address into EDX */
04852                                 mov esi, Src    /* load Src  address to ESI */
04853                                 mov edi, Dest           /* load Dest address to EDI */
04854                                 add edi, 4      /* 4 column offset from the left edge */
04855                                 mov eax, columns        /* load columns into EAX */
04856                                 add edi, eax    /* 4 row offset from the top edge */
04857                                 add edi, eax
04858                                 add edi, eax
04859                                 add edi, eax
04860                                 mov ebx, rows           /* initialize ROWS counter */
04861                                 sub ebx, 8      /* do not use first 4 and last 4 rows */
04862                                 /* ---, */
04863 L10350:
04864                         mov ecx, eax    /* initialize COLUMNS counter */
04865                                 sub ecx, 8      /* do not use first 4 and last 4 columns */
04866                                 align 16                        /* 16 byte alignment of the loop entry */
04867 L10352:
04868                         pxor mm7, mm7           /* zero MM7 (accumulator) */
04869                                 movd mm6, esi           /* save ESI in MM6 */
04870                                 /* --- 1 */
04871                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04872                         movq mm2, mm1           /* copy MM1 into MM2 */
04873                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04874                                 movq mm3, [edx]         /* load 4 words of Kernel */
04875                         add edx, 8      /* move pointer to other 4 words */
04876                                 movq mm4, [edx]         /* load 4 words of Kernel */
04877                         add edx, 8      /* move pointer to other 4 words */
04878                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04879                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04880                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04881                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04882                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04883                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04884                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04885                         dec              esi
04886                                 add esi, eax    /* move Src pointer 1 row below */
04887                                 movq mm3, [edx]         /* load 4 words of Kernel */
04888                         add edx, 8      /* move pointer to other 4 words */
04889                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04890                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04891                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04892                                 /* --- 2 */
04893                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04894                         movq mm2, mm1           /* copy MM1 into MM2 */
04895                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04896                                 movq mm3, [edx]         /* load 4 words of Kernel */
04897                         add edx, 8      /* move pointer to other 4 words */
04898                                 movq mm4, [edx]         /* load 4 words of Kernel */
04899                         add edx, 8      /* move pointer to other 4 words */
04900                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04901                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04902                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04903                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04904                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04905                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04906                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04907                         dec              esi
04908                                 add esi, eax    /* move Src pointer 1 row below */
04909                                 movq mm3, [edx]         /* load 4 words of Kernel */
04910                         add edx, 8      /* move pointer to other 4 words */
04911                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04912                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04913                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04914                                 /* --- 3 */
04915                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04916                         movq mm2, mm1           /* copy MM1 into MM2 */
04917                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04918                                 movq mm3, [edx]         /* load 4 words of Kernel */
04919                         add edx, 8      /* move pointer to other 4 words */
04920                                 movq mm4, [edx]         /* load 4 words of Kernel */
04921                         add edx, 8      /* move pointer to other 4 words */
04922                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04923                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04924                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04925                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04926                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04927                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04928                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04929                         dec              esi
04930                                 add esi, eax    /* move Src pointer 1 row below */
04931                                 movq mm3, [edx]         /* load 4 words of Kernel */
04932                         add edx, 8      /* move pointer to other 4 words */
04933                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04934                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04935                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04936                                 /* --- 4 */
04937                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04938                         movq mm2, mm1           /* copy MM1 into MM2 */
04939                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04940                                 movq mm3, [edx]         /* load 4 words of Kernel */
04941                         add edx, 8      /* move pointer to other 4 words */
04942                                 movq mm4, [edx]         /* load 4 words of Kernel */
04943                         add edx, 8      /* move pointer to other 4 words */
04944                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04945                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04946                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04947                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04948                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04949                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04950                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04951                         dec              esi
04952                                 add esi, eax    /* move Src pointer 1 row below */
04953                                 movq mm3, [edx]         /* load 4 words of Kernel */
04954                         add edx, 8      /* move pointer to other 4 words */
04955                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04956                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04957                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04958                                 /* --- 5 */
04959                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04960                         movq mm2, mm1           /* copy MM1 into MM2 */
04961                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04962                                 movq mm3, [edx]         /* load 4 words of Kernel */
04963                         add edx, 8      /* move pointer to other 4 words */
04964                                 movq mm4, [edx]         /* load 4 words of Kernel */
04965                         add edx, 8      /* move pointer to other 4 words */
04966                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04967                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04968                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04969                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04970                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04971                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04972                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04973                         dec              esi
04974                                 add esi, eax    /* move Src pointer 1 row below */
04975                                 movq mm3, [edx]         /* load 4 words of Kernel */
04976                         add edx, 8      /* move pointer to other 4 words */
04977                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04978                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04979                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04980                                 /* --- 6 */
04981                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04982                         movq mm2, mm1           /* copy MM1 into MM2 */
04983                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04984                                 movq mm3, [edx]         /* load 4 words of Kernel */
04985                         add edx, 8      /* move pointer to other 4 words */
04986                                 movq mm4, [edx]         /* load 4 words of Kernel */
04987                         add edx, 8      /* move pointer to other 4 words */
04988                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04989                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04990                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04991                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04992                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04993                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04994                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04995                         dec              esi
04996                                 add esi, eax    /* move Src pointer 1 row below */
04997                                 movq mm3, [edx]         /* load 4 words of Kernel */
04998                         add edx, 8      /* move pointer to other 4 words */
04999                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05000                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05001                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05002                                 /* --- 7 */
05003                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05004                         movq mm2, mm1           /* copy MM1 into MM2 */
05005                                 inc              esi            /* move pointer to the next 8 bytes of Src */
05006                                 movq mm3, [edx]         /* load 4 words of Kernel */
05007                         add edx, 8      /* move pointer to other 4 words */
05008                                 movq mm4, [edx]         /* load 4 words of Kernel */
05009                         add edx, 8      /* move pointer to other 4 words */
05010                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05011                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05012                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05013                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
05014                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05015                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05016                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05017                         dec              esi
05018                                 add esi, eax    /* move Src pointer 1 row below */
05019                                 movq mm3, [edx]         /* load 4 words of Kernel */
05020                         add edx, 8      /* move pointer to other 4 words */
05021                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05022                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05023                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05024                                 /* --- 8 */
05025                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05026                         movq mm2, mm1           /* copy MM1 into MM2 */
05027                                 inc              esi            /* move pointer to the next 8 bytes of Src */
05028                                 movq mm3, [edx]         /* load 4 words of Kernel */
05029                         add edx, 8      /* move pointer to other 4 words */
05030                                 movq mm4, [edx]         /* load 4 words of Kernel */
05031                         add edx, 8      /* move pointer to other 4 words */
05032                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05033                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05034                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05035                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
05036                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05037                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05038                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05039                         dec              esi
05040                                 add esi, eax    /* move Src pointer 1 row below */
05041                                 movq mm3, [edx]         /* load 4 words of Kernel */
05042                         add edx, 8      /* move pointer to other 4 words */
05043                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05044                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05045                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05046                                 /* --- 9 */
05047                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05048                         movq mm2, mm1           /* copy MM1 into MM2 */
05049                                 inc              esi            /* move pointer to the next 8 bytes of Src */
05050                                 movq mm3, [edx]         /* load 4 words of Kernel */
05051                         add edx, 8      /* move pointer to other 4 words */
05052                                 movq mm4, [edx]         /* load 4 words of Kernel */
05053                         add edx, 8      /* move pointer to other 4 words */
05054                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05055                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05056                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05057                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
05058                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05059                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05060                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05061                         movq mm3, [edx]         /* load 4 words of Kernel */
05062                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05063                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05064                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05065                                 /* ---, */
05066                                 movq mm3, mm7           /* copy MM7 into MM3 */
05067                                 psrlq mm7, 32           /* shift 2 left words to the right */
05068                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
05069                                 movq mm2, mm7           /* copy MM7 into MM2 */
05070                                 psrlq mm7, 16           /* shift 1 left word to the right */
05071                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
05072                                 /* ---, */
05073                                 movd mm1, eax           /* save EDX in MM1 */
05074                                 movd mm2, ebx           /* save EDX in MM2 */
05075                                 movd mm3, edx           /* save EDX in MM3 */
05076                                 movd eax, mm7           /* load summation result into EAX */
05077                                 psraw mm7, 15           /* spread sign bit of the result */
05078                                 movd ebx, mm5           /* load Divisor into EBX */
05079                                 movd edx, mm7           /* fill EDX with a sign bit */
05080                                 idiv bx         /* IDIV - VERY EXPENSIVE */
05081                                 movd mm7, eax           /* move result of division into MM7 */
05082                                 packuswb mm7, mm0       /* pack division result with saturation */
05083                                 movd eax, mm7           /* copy saturated result into EAX */
05084                                 mov [edi], al           /* copy a byte result into Dest */
05085                                 movd edx, mm3           /* restore saved EDX */
05086                                 movd ebx, mm2           /* restore saved EBX */
05087                                 movd eax, mm1           /* restore saved EAX */
05088                                 /* --, */
05089                                 movd esi, mm6           /* move Src pointer to the top pixel */
05090                                 sub edx, 208    /* EDX = Kernel address */
05091                                 inc              esi            /* move Src  pointer to the next pixel */
05092                                 inc              edi            /* move Dest pointer to the next pixel */
05093                                 /* ---, */
05094                                 dec              ecx            /* decrease loop counter COLUMNS */
05095                                 jnz            L10352           /* check loop termination, proceed if required */
05096                                 add esi, 8      /* move to the next row in Src */
05097                                 add edi, 8      /* move to the next row in Dest */
05098                                 dec              ebx            /* decrease loop counter ROWS */
05099                                 jnz            L10350           /* check loop termination, proceed if required */
05100                                 /* ---, */
05101                                 emms                            /* exit MMX state */
05102                                 popa
05103                 }
05104 #else
05105                 asm volatile
05106                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
05107                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
05108                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
05109                         "movd      %%ebx, %%mm5 \n\t"   /* copy Divisor into MM5 */
05110                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
05111                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
05112                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
05113                         "add          $4, %%edi \n\t"   /* 4 column offset from the left edge */
05114                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
05115                         "add       %%eax, %%edi \n\t"   /* 4 row offset from the top edge */
05116                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t" /* initialize ROWS counter */
05117                         "sub          $8, %%ebx \n\t"   /* do not use first 4 and last 4 rows */
05118                         /* --- */
05119                         ".L10350:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
05120                         "sub          $8, %%ecx \n\t"   /* do not use first 4 and last 4 columns */
05121                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
05122                         ".L10352:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
05123                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
05124                         /* --- 1 */
05125                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05126                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05127                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05128                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05129                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05130                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05131                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05132                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05133                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05134                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05135                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05136                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05137                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05138                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05139                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05140                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05141                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05142                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05143                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05144                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05145                         /* --- 2 */
05146                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05147                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05148                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05149                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05150                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05151                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05152                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05153                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05154                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05155                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05156                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05157                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05158                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05159                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05160                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05161                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05162                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05163                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05164                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05165                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05166                         /* --- 3 */
05167                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05168                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05169                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05170                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05171                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05172                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05173                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05174                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05175                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05176                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05177                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05178                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05179                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05180                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05181                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05182                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05183                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05184                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05185                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05186                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05187                         /* --- 4 */
05188                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05189                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05190                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05191                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05192                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05193                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05194                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05195                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05196                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05197                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05198                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05199                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05200                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05201                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05202                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05203                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05204                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05205                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05206                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05207                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05208                         /* --- 5 */
05209                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05210                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05211                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05212                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05213                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05214                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05215                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05216                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05217                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05218                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05219                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05220                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05221                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05222                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05223                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05224                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05225                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05226                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05227                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05228                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05229                         /* --- 6 */
05230                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05231                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05232                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05233                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05234                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05235                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05236                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05237                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05238                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05239                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05240                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05241                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05242                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05243                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05244                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05245                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05246                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05247                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05248                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05249                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05250                         /* --- 7 */
05251                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05252                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05253                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05254                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05255                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05256                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05257                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05258                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05259                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05260                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05261                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05262                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05263                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05264                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05265                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05266                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05267                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05268                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05269                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05270                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05271                         /* --- 8 */
05272                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05273                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05274                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05275                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05276                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05277                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05278                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05279                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05280                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05281                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05282                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05283                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05284                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05285                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05286                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05287                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05288                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05289                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05290                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05291                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05292                         /* --- 9 */
05293                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05294                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05295                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05296                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05297                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05298                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05299                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05300                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05301                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05302                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05303                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05304                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05305                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05306                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05307                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05308                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05309                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05310                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05311                         /* --- */
05312                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
05313                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
05314                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
05315                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
05316                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
05317                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
05318                         /* --- */
05319                         "movd      %%eax, %%mm1 \n\t"   /* save EDX in MM1 */
05320                         "movd      %%ebx, %%mm2 \n\t"   /* save EDX in MM2 */
05321                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
05322                         "movd      %%mm7, %%eax \n\t"   /* load summation result into EAX */
05323                         "psraw       $15, %%mm7 \n\t"   /* spread sign bit of the result */
05324                         "movd      %%mm5, %%ebx \n\t"   /* load Divisor into EBX */
05325                         "movd      %%mm7, %%edx \n\t"   /* fill EDX with a sign bit */
05326                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
05327                         "movd      %%eax, %%mm7 \n\t"   /* move result of division into MM7 */
05328                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
05329                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
05330                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
05331                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
05332                         "movd      %%mm2, %%ebx \n\t"   /* restore saved EBX */
05333                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
05334                         /* -- */
05335                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
05336                         "sub        $208, %%edx \n\t"   /* EDX = Kernel address */
05337                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
05338                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
05339                         /* --- */
05340                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
05341                         "jnz            .L10352 \n\t"   /* check loop termination, proceed if required */
05342                         "add          $8, %%esi \n\t"   /* move to the next row in Src */
05343                         "add          $8, %%edi \n\t"   /* move to the next row in Dest */
05344                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
05345                         "jnz            .L10350 \n\t"   /* check loop termination, proceed if required */
05346                         /* --- */
05347                         "emms                   \n\t"   /* exit MMX state */
05348                         "popa                   \n\t":"=m" (Dest)       /* %0 */
05349                         :"m"(Src),              /* %1 */
05350                         "m"(rows),              /* %2 */
05351                         "m"(columns),           /* %3 */
05352                         "m"(Kernel),            /* %4 */
05353                         "m"(Divisor)            /* %5 */
05354                         );
05355 #endif
05356 #endif
05357                 return (0);
05358         } else {
05359                 /* No non-MMX implementation yet */
05360                 return (-1);
05361         }
05362 }
05363 
05378 int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
05379                                                                                            signed short *Kernel, unsigned char NRightShift)
05380 {
05381         /* Validate input parameters */
05382         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
05383                 return(-1);
05384 
05385         if ((columns < 3) || (rows < 3) || (NRightShift > 7))
05386                 return (-1);
05387 
05388         if ((SDL_imageFilterMMXdetect())) {
05389 //#ifdef USE_MMX
05390 #if defined(USE_MMX) && defined(i386)
05391 #if !defined(GCC__)
05392                 __asm
05393                 {
05394                         pusha
05395                                 pxor mm0, mm0           /* zero MM0 */
05396                                 xor ebx, ebx    /* zero EBX */
05397                                 mov bl, NRightShift     /* load NRightShift into BL */
05398                                 movd mm4, ebx           /* copy NRightShift into MM4 */
05399                                 mov edx, Kernel         /* load Kernel address into EDX */
05400                                 movq mm5, [edx]         /* MM5 = {0,K2,K1,K0} */
05401                         add edx, 8      /* second row              |K0 K1 K2 0| */
05402                                 movq mm6, [edx]         /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
05403                         add edx, 8      /* third row               |K6 K7 K8 0| */
05404                                 movq mm7, [edx]         /* MM7 = {0,K8,K7,K6} */
05405                         /* ---, */
05406                         mov eax, columns        /* load columns into EAX */
05407                                 mov esi, Src    /* ESI = Src row 0 address */
05408                                 mov edi, Dest           /* load Dest address to EDI */
05409                                 add edi, eax    /* EDI = EDI + columns */
05410                                 inc              edi            /* 1 byte offset from the left edge */
05411                                 mov edx, rows           /* initialize ROWS counter */
05412                                 sub edx, 2      /* do not use first and last row */
05413                                 /* ---, */
05414 L10360:
05415                         mov ecx, eax    /* initialize COLUMS counter */
05416                                 sub ecx, 2      /* do not use first and last column */
05417                                 align 16                        /* 16 byte alignment of the loop entry */
05418 L10362:
05419                         /* ---, */
05420                         movq mm1, [esi]         /* load 8 bytes of the image first row */
05421                         add esi, eax    /* move one row below */
05422                                 movq mm2, [esi]         /* load 8 bytes of the image second row */
05423                         add esi, eax    /* move one row below */
05424                                 movq mm3, [esi]         /* load 8 bytes of the image third row */
05425                         punpcklbw mm1, mm0      /* unpack first 4 bytes into words */
05426                                 punpcklbw mm2, mm0      /* unpack first 4 bytes into words */
05427                                 punpcklbw mm3, mm0      /* unpack first 4 bytes into words */
05428                                 psrlw mm1, mm4          /* shift right each pixel NshiftRight times */
05429                                 psrlw mm2, mm4          /* shift right each pixel NshiftRight times */
05430                                 psrlw mm3, mm4          /* shift right each pixel NshiftRight times */
05431                                 pmullw mm1, mm5         /* multiply words first row  image*Kernel */
05432                                 pmullw mm2, mm6         /* multiply words second row image*Kernel */
05433                                 pmullw mm3, mm7         /* multiply words third row  image*Kernel */
05434                                 paddsw mm1, mm2         /* add 4 words of the first and second rows */
05435                                 paddsw mm1, mm3         /* add 4 words of the third row and result */
05436                                 movq mm2, mm1           /* copy MM1 into MM2 */
05437                                 psrlq mm1, 32           /* shift 2 left words to the right */
05438                                 paddsw mm1, mm2         /* add 2 left and 2 right result words */
05439                                 movq mm3, mm1           /* copy MM1 into MM3 */
05440                                 psrlq mm1, 16           /* shift 1 left word to the right */
05441                                 paddsw mm1, mm3         /* add 1 left and 1 right result words */
05442                                 packuswb mm1, mm0       /* pack shift result with saturation */
05443                                 movd ebx, mm1           /* copy saturated result into EBX */
05444                                 mov [edi], bl           /* copy a byte result into Dest */
05445                                 /* --, */
05446                                 sub esi, eax    /* move two rows up */
05447                                 sub esi, eax
05448                                 inc              esi            /* move Src  pointer to the next pixel */
05449                                 inc              edi            /* move Dest pointer to the next pixel */
05450                                 /* ---, */
05451                                 dec              ecx            /* decrease loop counter COLUMNS */
05452                                 jnz            L10362           /* check loop termination, proceed if required */
05453                                 add esi, 2      /* move to the next row in Src */
05454                                 add edi, 2      /* move to the next row in Dest */
05455                                 dec              edx            /* decrease loop counter ROWS */
05456                                 jnz            L10360           /* check loop termination, proceed if required */
05457                                 /* ---, */
05458                                 emms                            /* exit MMX state */
05459                                 popa
05460                 }
05461 #else
05462                 asm volatile
05463                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
05464                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
05465                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
05466                         "movd      %%ebx, %%mm4 \n\t"   /* copy NRightShift into MM4 */
05467                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
05468                         "movq    (%%edx), %%mm5 \n\t"   /* MM5 = {0,K2,K1,K0} */
05469                         "add          $8, %%edx \n\t"   /* second row              |K0 K1 K2 0| */
05470                         "movq    (%%edx), %%mm6 \n\t"   /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
05471                         "add          $8, %%edx \n\t"   /* third row               |K6 K7 K8 0| */
05472                         "movq    (%%edx), %%mm7 \n\t"   /* MM7 = {0,K8,K7,K6} */
05473                         /* --- */
05474                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
05475                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
05476                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
05477                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
05478                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
05479                         "mov          %2, %%edx \n\t"   /* initialize ROWS counter */
05480                         "sub          $2, %%edx \n\t"   /* do not use first and last row */
05481                         /* --- */
05482                         ".L10360:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMS counter */
05483                         "sub          $2, %%ecx \n\t"   /* do not use first and last column */
05484                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
05485                         ".L10362:               \n\t"
05486                         /* --- */
05487                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the image first row */
05488                         "add       %%eax, %%esi \n\t"   /* move one row below */
05489                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes of the image second row */
05490                         "add       %%eax, %%esi \n\t"   /* move one row below */
05491                         "movq    (%%esi), %%mm3 \n\t"   /* load 8 bytes of the image third row */
05492                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first 4 bytes into words */
05493                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack first 4 bytes into words */
05494                         "punpcklbw %%mm0, %%mm3 \n\t"   /* unpack first 4 bytes into words */
05495                         "psrlw     %%mm4, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05496                         "psrlw     %%mm4, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05497                         "psrlw     %%mm4, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
05498                         "pmullw    %%mm5, %%mm1 \n\t"   /* multiply words first row  image*Kernel */
05499                         "pmullw    %%mm6, %%mm2 \n\t"   /* multiply words second row image*Kernel */
05500                         "pmullw    %%mm7, %%mm3 \n\t"   /* multiply words third row  image*Kernel */
05501                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the first and second rows */
05502                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 4 words of the third row and result */
05503                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05504                         "psrlq       $32, %%mm1 \n\t"   /* shift 2 left words to the right */
05505                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 2 left and 2 right result words */
05506                         "movq      %%mm1, %%mm3 \n\t"   /* copy MM1 into MM3 */
05507                         "psrlq       $16, %%mm1 \n\t"   /* shift 1 left word to the right */
05508                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 1 left and 1 right result words */
05509                         "packuswb  %%mm0, %%mm1 \n\t"   /* pack shift result with saturation */
05510                         "movd      %%mm1, %%ebx \n\t"   /* copy saturated result into EBX */
05511                         "mov      %%bl, (%%edi) \n\t"   /* copy a byte result into Dest */
05512                         /* -- */
05513                         "sub       %%eax, %%esi \n\t"   /* move two rows up */
05514                         "sub       %%eax, %%esi \n\t" "inc              %%esi \n\t"     /* move Src  pointer to the next pixel */
05515                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
05516                         /* --- */
05517                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
05518                         "jnz            .L10362 \n\t"   /* check loop termination, proceed if required */
05519                         "add          $2, %%esi \n\t"   /* move to the next row in Src */
05520                         "add          $2, %%edi \n\t"   /* move to the next row in Dest */
05521                         "dec              %%edx \n\t"   /* decrease loop counter ROWS */
05522                         "jnz            .L10360 \n\t"   /* check loop termination, proceed if required */
05523                         /* --- */
05524                         "emms                   \n\t"   /* exit MMX state */
05525                         "popa                   \n\t":"=m" (Dest)       /* %0 */
05526                         :"m"(Src),              /* %1 */
05527                         "m"(rows),              /* %2 */
05528                         "m"(columns),           /* %3 */
05529                         "m"(Kernel),            /* %4 */
05530                         "m"(NRightShift)        /* %5 */
05531                         );
05532 #endif
05533 #endif
05534                 return (0);
05535         } else {
05536                 /* No non-MMX implementation yet */
05537                 return (-1);
05538         }
05539 }
05540 
05555 int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
05556                                                                                            signed short *Kernel, unsigned char NRightShift)
05557 {
05558         /* Validate input parameters */
05559         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
05560                 return(-1);
05561 
05562         if ((columns < 5) || (rows < 5) || (NRightShift > 7))
05563                 return (-1);
05564 
05565         if ((SDL_imageFilterMMXdetect())) {
05566 //#ifdef USE_MMX
05567 #if defined(USE_MMX) && defined(i386)
05568 #if !defined(GCC__)
05569                 __asm
05570                 {
05571                         pusha
05572                                 pxor mm0, mm0           /* zero MM0 */
05573                                 xor ebx, ebx    /* zero EBX */
05574                                 mov bl, NRightShift     /* load NRightShift into BL */
05575                                 movd mm5, ebx           /* copy NRightShift into MM5 */
05576                                 mov edx, Kernel         /* load Kernel address into EDX */
05577                                 mov esi, Src    /* load Src  address to ESI */
05578                                 mov edi, Dest           /* load Dest address to EDI */
05579                                 add edi, 2      /* 2 column offset from the left edge */
05580                                 mov eax, columns        /* load columns into EAX */
05581                                 shl eax, 1      /* EAX = columns * 2 */
05582                                 add edi, eax    /* 2 row offset from the top edge */
05583                                 shr eax, 1      /* EAX = columns */
05584                                 mov ebx, rows           /* initialize ROWS counter */
05585                                 sub ebx, 4      /* do not use first 2 and last 2 rows */
05586                                 /* ---, */
05587 L10370:
05588                         mov ecx, eax    /* initialize COLUMNS counter */
05589                                 sub ecx, 4      /* do not use first 2 and last 2 columns */
05590                                 align 16                        /* 16 byte alignment of the loop entry */
05591 L10372:
05592                         pxor mm7, mm7           /* zero MM7 (accumulator) */
05593                                 movd mm6, esi           /* save ESI in MM6 */
05594                                 /* --- 1 */
05595                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05596                         movq mm2, mm1           /* copy MM1 into MM2 */
05597                                 add esi, eax    /* move Src pointer 1 row below */
05598                                 movq mm3, [edx]         /* load 4 words of Kernel */
05599                         add edx, 8      /* move pointer to other 4 words */
05600                                 movq mm4, [edx]         /* load 4 words of Kernel */
05601                         add edx, 8      /* move pointer to other 4 words */
05602                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05603                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05604                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05605                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05606                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05607                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05608                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05609                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05610                                 /* --- 2 */
05611                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05612                         movq mm2, mm1           /* copy MM1 into MM2 */
05613                                 add esi, eax    /* move Src pointer 1 row below */
05614                                 movq mm3, [edx]         /* load 4 words of Kernel */
05615                         add edx, 8      /* move pointer to other 4 words */
05616                                 movq mm4, [edx]         /* load 4 words of Kernel */
05617                         add edx, 8      /* move pointer to other 4 words */
05618                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05619                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05620                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05621                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05622                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05623                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05624                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05625                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05626                                 /* --- 3 */
05627                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05628                         movq mm2, mm1           /* copy MM1 into MM2 */
05629                                 add esi, eax    /* move Src pointer 1 row below */
05630                                 movq mm3, [edx]         /* load 4 words of Kernel */
05631                         add edx, 8      /* move pointer to other 4 words */
05632                                 movq mm4, [edx]         /* load 4 words of Kernel */
05633                         add edx, 8      /* move pointer to other 4 words */
05634                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05635                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05636                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05637                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05638                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05639                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05640                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05641                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05642                                 /* --- 4 */
05643                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05644                         movq mm2, mm1           /* copy MM1 into MM2 */
05645                                 add esi, eax    /* move Src pointer 1 row below */
05646                                 movq mm3, [edx]         /* load 4 words of Kernel */
05647                         add edx, 8      /* move pointer to other 4 words */
05648                                 movq mm4, [edx]         /* load 4 words of Kernel */
05649                         add edx, 8      /* move pointer to other 4 words */
05650                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05651                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05652                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05653                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05654                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05655                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05656                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05657                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05658                                 /* --- 5 */
05659                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05660                         movq mm2, mm1           /* copy MM1 into MM2 */
05661                                 movq mm3, [edx]         /* load 4 words of Kernel */
05662                         add edx, 8      /* move pointer to other 4 words */
05663                                 movq mm4, [edx]         /* load 4 words of Kernel */
05664                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05665                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05666                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05667                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05668                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05669                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05670                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05671                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05672                                 /* ---, */
05673                                 movq mm3, mm7           /* copy MM7 into MM3 */
05674                                 psrlq mm7, 32           /* shift 2 left words to the right */
05675                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
05676                                 movq mm2, mm7           /* copy MM7 into MM2 */
05677                                 psrlq mm7, 16           /* shift 1 left word to the right */
05678                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
05679                                 movd mm1, eax           /* save EAX in MM1 */
05680                                 packuswb mm7, mm0       /* pack division result with saturation */
05681                                 movd eax, mm7           /* copy saturated result into EAX */
05682                                 mov [edi], al           /* copy a byte result into Dest */
05683                                 movd eax, mm1           /* restore saved EAX */
05684                                 /* --, */
05685                                 movd esi, mm6           /* move Src pointer to the top pixel */
05686                                 sub edx, 72     /* EDX = Kernel address */
05687                                 inc              esi            /* move Src  pointer to the next pixel */
05688                                 inc              edi            /* move Dest pointer to the next pixel */
05689                                 /* ---, */
05690                                 dec              ecx            /* decrease loop counter COLUMNS */
05691                                 jnz            L10372           /* check loop termination, proceed if required */
05692                                 add esi, 4      /* move to the next row in Src */
05693                                 add edi, 4      /* move to the next row in Dest */
05694                                 dec              ebx            /* decrease loop counter ROWS */
05695                                 jnz            L10370           /* check loop termination, proceed if required */
05696                                 /* ---, */
05697                                 emms                            /* exit MMX state */
05698                                 popa
05699                 }
05700 #else
05701                 asm volatile
05702                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
05703                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
05704                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
05705                         "movd      %%ebx, %%mm5 \n\t"   /* copy NRightShift into MM5 */
05706                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
05707                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
05708                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
05709                         "add          $2, %%edi \n\t"   /* 2 column offset from the left edge */
05710                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
05711                         "shl          $1, %%eax \n\t"   /* EAX = columns * 2 */
05712                         "add       %%eax, %%edi \n\t"   /* 2 row offset from the top edge */
05713                         "shr          $1, %%eax \n\t"   /* EAX = columns */
05714                         "mov          %2, %%ebx \n\t"   /* initialize ROWS counter */
05715                         "sub          $4, %%ebx \n\t"   /* do not use first 2 and last 2 rows */
05716                         /* --- */
05717                         ".L10370:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
05718                         "sub          $4, %%ecx \n\t"   /* do not use first 2 and last 2 columns */
05719                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
05720                         ".L10372:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
05721                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
05722                         /* --- 1 */
05723                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05724                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05725                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05726                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05727                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05728                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05729                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05730                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05731                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05732                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05733                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05734                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05735                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05736                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05737                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05738                         /* --- 2 */
05739                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05740                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05741                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05742                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05743                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05744                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05745                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05746                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05747                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05748                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05749                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05750                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05751                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05752                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05753                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05754                         /* --- 3 */
05755                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05756                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05757                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05758                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05759                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05760                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05761                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05762                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05763                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05764                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05765                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05766                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05767                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05768                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05769                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05770                         /* --- 4 */
05771                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05772                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05773                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05774                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05775                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05776                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05777                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05778                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05779                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05780                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05781                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05782                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05783                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05784                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05785                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05786                         /* --- 5 */
05787                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05788                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05789                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05790                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05791                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05792                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05793                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05794                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05795                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05796                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05797                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05798                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05799                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05800                         /* --- */
05801                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
05802                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
05803                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
05804                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
05805                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
05806                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
05807                         "movd      %%eax, %%mm1 \n\t"   /* save EAX in MM1 */
05808                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
05809                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
05810                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
05811                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
05812                         /* -- */
05813                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
05814                         "sub         $72, %%edx \n\t"   /* EDX = Kernel address */
05815                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
05816                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
05817                         /* --- */
05818                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
05819                         "jnz            .L10372 \n\t"   /* check loop termination, proceed if required */
05820                         "add          $4, %%esi \n\t"   /* move to the next row in Src */
05821                         "add          $4, %%edi \n\t"   /* move to the next row in Dest */
05822                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
05823                         "jnz            .L10370 \n\t"   /* check loop termination, proceed if required */
05824                         /* --- */
05825                         "emms                   \n\t"   /* exit MMX state */
05826                         "popa                   \n\t":"=m" (Dest)       /* %0 */
05827                         :"m"(Src),              /* %1 */
05828                         "m"(rows),              /* %2 */
05829                         "m"(columns),           /* %3 */
05830                         "m"(Kernel),            /* %4 */
05831                         "m"(NRightShift)        /* %5 */
05832                         );
05833 #endif
05834 #endif
05835                 return (0);
05836         } else {
05837                 /* No non-MMX implementation yet */
05838                 return (-1);
05839         }
05840 }
05841 
05856 int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
05857                                                                                            signed short *Kernel, unsigned char NRightShift)
05858 {
05859         /* Validate input parameters */
05860         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
05861                 return(-1);
05862 
05863         if ((columns < 7) || (rows < 7) || (NRightShift > 7))
05864                 return (-1);
05865 
05866         if ((SDL_imageFilterMMXdetect())) {
05867 //#ifdef USE_MMX
05868 #if defined(USE_MMX) && defined(i386)
05869 #if !defined(GCC__)
05870                 __asm
05871                 {
05872                         pusha
05873                                 pxor mm0, mm0           /* zero MM0 */
05874                                 xor ebx, ebx    /* zero EBX */
05875                                 mov bl, NRightShift     /* load NRightShift into BL */
05876                                 movd mm5, ebx           /* copy NRightShift into MM5 */
05877                                 mov edx, Kernel         /* load Kernel address into EDX */
05878                                 mov esi, Src    /* load Src  address to ESI */
05879                                 mov edi, Dest           /* load Dest address to EDI */
05880                                 add edi, 3      /* 3 column offset from the left edge */
05881                                 mov eax, columns        /* load columns into EAX */
05882                                 add edi, eax    /* 3 row offset from the top edge */
05883                                 add edi, eax
05884                                 add edi, eax
05885                                 mov ebx, rows           /* initialize ROWS counter */
05886                                 sub ebx, 6      /* do not use first 3 and last 3 rows */
05887                                 /* ---, */
05888 L10380:
05889                         mov ecx, eax    /* initialize COLUMNS counter */
05890                                 sub ecx, 6      /* do not use first 3 and last 3 columns */
05891                                 align 16                        /* 16 byte alignment of the loop entry */
05892 L10382:
05893                         pxor mm7, mm7           /* zero MM7 (accumulator) */
05894                                 movd mm6, esi           /* save ESI in MM6 */
05895                                 /* --- 1 */
05896                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05897                         movq mm2, mm1           /* copy MM1 into MM2 */
05898                                 add esi, eax    /* move Src pointer 1 row below */
05899                                 movq mm3, [edx]         /* load 4 words of Kernel */
05900                         add edx, 8      /* move pointer to other 4 words */
05901                                 movq mm4, [edx]         /* load 4 words of Kernel */
05902                         add edx, 8      /* move pointer to other 4 words */
05903                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05904                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05905                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05906                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05907                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05908                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05909                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05910                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05911                                 /* --- 2 */
05912                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05913                         movq mm2, mm1           /* copy MM1 into MM2 */
05914                                 add esi, eax    /* move Src pointer 1 row below */
05915                                 movq mm3, [edx]         /* load 4 words of Kernel */
05916                         add edx, 8      /* move pointer to other 4 words */
05917                                 movq mm4, [edx]         /* load 4 words of Kernel */
05918                         add edx, 8      /* move pointer to other 4 words */
05919                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05920                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05921                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05922                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05923                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05924                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05925                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05926                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05927                                 /* --- 3 */
05928                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05929                         movq mm2, mm1           /* copy MM1 into MM2 */
05930                                 add esi, eax    /* move Src pointer 1 row below */
05931                                 movq mm3, [edx]         /* load 4 words of Kernel */
05932                         add edx, 8      /* move pointer to other 4 words */
05933                                 movq mm4, [edx]         /* load 4 words of Kernel */
05934                         add edx, 8      /* move pointer to other 4 words */
05935                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05936                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05937                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05938                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05939                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05940                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05941                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05942                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05943                                 /* --- 4 */
05944                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05945                         movq mm2, mm1           /* copy MM1 into MM2 */
05946                                 add esi, eax    /* move Src pointer 1 row below */
05947                                 movq mm3, [edx]         /* load 4 words of Kernel */
05948                         add edx, 8      /* move pointer to other 4 words */
05949                                 movq mm4, [edx]         /* load 4 words of Kernel */
05950                         add edx, 8      /* move pointer to other 4 words */
05951                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05952                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05953                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05954                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05955                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05956                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05957                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05958                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05959                                 /* --- 5 */
05960                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05961                         movq mm2, mm1           /* copy MM1 into MM2 */
05962                                 add esi, eax    /* move Src pointer 1 row below */
05963                                 movq mm3, [edx]         /* load 4 words of Kernel */
05964                         add edx, 8      /* move pointer to other 4 words */
05965                                 movq mm4, [edx]         /* load 4 words of Kernel */
05966                         add edx, 8      /* move pointer to other 4 words */
05967                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05968                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05969                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05970                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05971                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05972                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05973                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05974                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05975                                 /* --- 6 */
05976                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05977                         movq mm2, mm1           /* copy MM1 into MM2 */
05978                                 add esi, eax    /* move Src pointer 1 row below */
05979                                 movq mm3, [edx]         /* load 4 words of Kernel */
05980                         add edx, 8      /* move pointer to other 4 words */
05981                                 movq mm4, [edx]         /* load 4 words of Kernel */
05982                         add edx, 8      /* move pointer to other 4 words */
05983                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05984                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05985                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05986                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05987                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05988                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05989                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05990                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05991                                 /* --- 7 */
05992                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05993                         movq mm2, mm1           /* copy MM1 into MM2 */
05994                                 movq mm3, [edx]         /* load 4 words of Kernel */
05995                         add edx, 8      /* move pointer to other 4 words */
05996                                 movq mm4, [edx]         /* load 4 words of Kernel */
05997                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05998                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05999                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06000                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06001                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06002                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06003                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06004                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06005                                 /* ---, */
06006                                 movq mm3, mm7           /* copy MM7 into MM3 */
06007                                 psrlq mm7, 32           /* shift 2 left words to the right */
06008                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
06009                                 movq mm2, mm7           /* copy MM7 into MM2 */
06010                                 psrlq mm7, 16           /* shift 1 left word to the right */
06011                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
06012                                 movd mm1, eax           /* save EAX in MM1 */
06013                                 packuswb mm7, mm0       /* pack division result with saturation */
06014                                 movd eax, mm7           /* copy saturated result into EAX */
06015                                 mov [edi], al           /* copy a byte result into Dest */
06016                                 movd eax, mm1           /* restore saved EAX */
06017                                 /* --, */
06018                                 movd esi, mm6           /* move Src pointer to the top pixel */
06019                                 sub edx, 104    /* EDX = Kernel address */
06020                                 inc              esi            /* move Src  pointer to the next pixel */
06021                                 inc              edi            /* move Dest pointer to the next pixel */
06022                                 /* ---, */
06023                                 dec              ecx            /* decrease loop counter COLUMNS */
06024                                 jnz            L10382           /* check loop termination, proceed if required */
06025                                 add esi, 6      /* move to the next row in Src */
06026                                 add edi, 6      /* move to the next row in Dest */
06027                                 dec              ebx            /* decrease loop counter ROWS */
06028                                 jnz            L10380           /* check loop termination, proceed if required */
06029                                 /* ---, */
06030                                 emms                            /* exit MMX state */
06031                                 popa
06032                 }
06033 #else
06034                 asm volatile
06035                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
06036                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
06037                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
06038                         "movd      %%ebx, %%mm5 \n\t"   /* copy NRightShift into MM5 */
06039                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
06040                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
06041                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
06042                         "add          $3, %%edi \n\t"   /* 3 column offset from the left edge */
06043                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
06044                         "add       %%eax, %%edi \n\t"   /* 3 row offset from the top edge */
06045                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t"       /* initialize ROWS counter */
06046                         "sub          $6, %%ebx \n\t"   /* do not use first 3 and last 3 rows */
06047                         /* --- */
06048                         ".L10380:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
06049                         "sub          $6, %%ecx \n\t"   /* do not use first 3 and last 3 columns */
06050                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
06051                         ".L10382:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
06052                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
06053                         /* --- 1 */
06054                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06055                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06056                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06057                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06058                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06059                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06060                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06061                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06062                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06063                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06064                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06065                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06066                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06067                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06068                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06069                         /* --- 2 */
06070                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06071                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06072                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06073                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06074                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06075                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06076                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06077                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06078                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06079                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06080                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06081                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06082                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06083                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06084                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06085                         /* --- 3 */
06086                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06087                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06088                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06089                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06090                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06091                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06092                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06093                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06094                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06095                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06096                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06097                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06098                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06099                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06100                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06101                         /* --- 4 */
06102                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06103                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06104                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06105                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06106                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06107                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06108                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06109                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06110                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06111                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06112                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06113                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06114                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06115                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06116                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06117                         /* --- 5 */
06118                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06119                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06120                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06121                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06122                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06123                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06124                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06125                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06126                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06127                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06128                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06129                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06130                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06131                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06132                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06133                         /* --- 6 */
06134                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06135                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06136                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06137                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06138                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06139                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06140                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06141                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06142                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06143                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06144                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06145                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06146                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06147                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06148                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06149                         /* --- 7 */
06150                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06151                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06152                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06153                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06154                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06155                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06156                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06157                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06158                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06159                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06160                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06161                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06162                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06163                         /* --- */
06164                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
06165                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
06166                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
06167                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
06168                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
06169                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
06170                         "movd      %%eax, %%mm1 \n\t"   /* save EAX in MM1 */
06171                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
06172                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
06173                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
06174                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
06175                         /* -- */
06176                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
06177                         "sub        $104, %%edx \n\t"   /* EDX = Kernel address */
06178                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
06179                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
06180                         /* --- */
06181                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
06182                         "jnz            .L10382 \n\t"   /* check loop termination, proceed if required */
06183                         "add          $6, %%esi \n\t"   /* move to the next row in Src */
06184                         "add          $6, %%edi \n\t"   /* move to the next row in Dest */
06185                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
06186                         "jnz            .L10380 \n\t"   /* check loop termination, proceed if required */
06187                         /* --- */
06188                         "emms                   \n\t"   /* exit MMX state */
06189                         "popa                   \n\t":"=m" (Dest)       /* %0 */
06190                         :"m"(Src),              /* %1 */
06191                         "m"(rows),              /* %2 */
06192                         "m"(columns),           /* %3 */
06193                         "m"(Kernel),            /* %4 */
06194                         "m"(NRightShift)        /* %5 */
06195                         );
06196 #endif
06197 #endif
06198                 return (0);
06199         } else {
06200                 /* No non-MMX implementation yet */
06201                 return (-1);
06202         }
06203 }
06204 
06219 int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
06220                                                                                            signed short *Kernel, unsigned char NRightShift)
06221 {
06222         /* Validate input parameters */
06223         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
06224                 return(-1);
06225 
06226         if ((columns < 9) || (rows < 9) || (NRightShift > 7))
06227                 return (-1);
06228 
06229         if ((SDL_imageFilterMMXdetect())) {
06230 //#ifdef USE_MMX
06231 #if defined(USE_MMX) && defined(i386)
06232 #if !defined(GCC__)
06233                 __asm
06234                 {
06235                         pusha
06236                                 pxor mm0, mm0           /* zero MM0 */
06237                                 xor ebx, ebx    /* zero EBX */
06238                                 mov bl, NRightShift     /* load NRightShift into BL */
06239                                 movd mm5, ebx           /* copy NRightShift into MM5 */
06240                                 mov edx, Kernel         /* load Kernel address into EDX */
06241                                 mov esi, Src    /* load Src  address to ESI */
06242                                 mov edi, Dest           /* load Dest address to EDI */
06243                                 add edi, 4      /* 4 column offset from the left edge */
06244                                 mov eax, columns        /* load columns into EAX */
06245                                 add edi, eax    /* 4 row offset from the top edge */
06246                                 add edi, eax
06247                                 add edi, eax
06248                                 add edi, eax
06249                                 mov ebx, rows           /* initialize ROWS counter */
06250                                 sub ebx, 8      /* do not use first 4 and last 4 rows */
06251                                 /* ---, */
06252 L10390:
06253                         mov ecx, eax    /* initialize COLUMNS counter */
06254                                 sub ecx, 8      /* do not use first 4 and last 4 columns */
06255                                 align 16                        /* 16 byte alignment of the loop entry */
06256 L10392:
06257                         pxor mm7, mm7           /* zero MM7 (accumulator) */
06258                                 movd mm6, esi           /* save ESI in MM6 */
06259                                 /* --- 1 */
06260                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06261                         movq mm2, mm1           /* copy MM1 into MM2 */
06262                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06263                                 movq mm3, [edx]         /* load 4 words of Kernel */
06264                         add edx, 8      /* move pointer to other 4 words */
06265                                 movq mm4, [edx]         /* load 4 words of Kernel */
06266                         add edx, 8      /* move pointer to other 4 words */
06267                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06268                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06269                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06270                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06271                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06272                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06273                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06274                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06275                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06276                         dec              esi
06277                                 add esi, eax    /* move Src pointer 1 row below */
06278                                 movq mm3, [edx]         /* load 4 words of Kernel */
06279                         add edx, 8      /* move pointer to other 4 words */
06280                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06281                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06282                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06283                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06284                                 /* --- 2 */
06285                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06286                         movq mm2, mm1           /* copy MM1 into MM2 */
06287                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06288                                 movq mm3, [edx]         /* load 4 words of Kernel */
06289                         add edx, 8      /* move pointer to other 4 words */
06290                                 movq mm4, [edx]         /* load 4 words of Kernel */
06291                         add edx, 8      /* move pointer to other 4 words */
06292                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06293                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06294                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06295                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06296                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06297                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06298                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06299                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06300                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06301                         dec              esi
06302                                 add esi, eax    /* move Src pointer 1 row below */
06303                                 movq mm3, [edx]         /* load 4 words of Kernel */
06304                         add edx, 8      /* move pointer to other 4 words */
06305                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06306                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06307                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06308                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06309                                 /* --- 3 */
06310                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06311                         movq mm2, mm1           /* copy MM1 into MM2 */
06312                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06313                                 movq mm3, [edx]         /* load 4 words of Kernel */
06314                         add edx, 8      /* move pointer to other 4 words */
06315                                 movq mm4, [edx]         /* load 4 words of Kernel */
06316                         add edx, 8      /* move pointer to other 4 words */
06317                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06318                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06319                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06320                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06321                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06322                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06323                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06324                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06325                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06326                         dec              esi
06327                                 add esi, eax    /* move Src pointer 1 row below */
06328                                 movq mm3, [edx]         /* load 4 words of Kernel */
06329                         add edx, 8      /* move pointer to other 4 words */
06330                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06331                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06332                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06333                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06334                                 /* --- 4 */
06335                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06336                         movq mm2, mm1           /* copy MM1 into MM2 */
06337                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06338                                 movq mm3, [edx]         /* load 4 words of Kernel */
06339                         add edx, 8      /* move pointer to other 4 words */
06340                                 movq mm4, [edx]         /* load 4 words of Kernel */
06341                         add edx, 8      /* move pointer to other 4 words */
06342                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06343                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06344                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06345                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06346                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06347                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06348                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06349                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06350                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06351                         dec              esi
06352                                 add esi, eax    /* move Src pointer 1 row below */
06353                                 movq mm3, [edx]         /* load 4 words of Kernel */
06354                         add edx, 8      /* move pointer to other 4 words */
06355                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06356                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06357                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06358                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06359                                 /* --- 5 */
06360                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06361                         movq mm2, mm1           /* copy MM1 into MM2 */
06362                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06363                                 movq mm3, [edx]         /* load 4 words of Kernel */
06364                         add edx, 8      /* move pointer to other 4 words */
06365                                 movq mm4, [edx]         /* load 4 words of Kernel */
06366                         add edx, 8      /* move pointer to other 4 words */
06367                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06368                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06369                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06370                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06371                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06372                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06373                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06374                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06375                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06376                         dec              esi
06377                                 add esi, eax    /* move Src pointer 1 row below */
06378                                 movq mm3, [edx]         /* load 4 words of Kernel */
06379                         add edx, 8      /* move pointer to other 4 words */
06380                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06381                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06382                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06383                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06384                                 /* --- 6 */
06385                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06386                         movq mm2, mm1           /* copy MM1 into MM2 */
06387                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06388                                 movq mm3, [edx]         /* load 4 words of Kernel */
06389                         add edx, 8      /* move pointer to other 4 words */
06390                                 movq mm4, [edx]         /* load 4 words of Kernel */
06391                         add edx, 8      /* move pointer to other 4 words */
06392                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06393                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06394                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06395                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06396                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06397                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06398                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06399                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06400                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06401                         dec              esi
06402                                 add esi, eax    /* move Src pointer 1 row below */
06403                                 movq mm3, [edx]         /* load 4 words of Kernel */
06404                         add edx, 8      /* move pointer to other 4 words */
06405                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06406                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06407                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06408                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06409                                 /* --- 7 */
06410                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06411                         movq mm2, mm1           /* copy MM1 into MM2 */
06412                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06413                                 movq mm3, [edx]         /* load 4 words of Kernel */
06414                         add edx, 8      /* move pointer to other 4 words */
06415                                 movq mm4, [edx]         /* load 4 words of Kernel */
06416                         add edx, 8      /* move pointer to other 4 words */
06417                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06418                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06419                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06420                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06421                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06422                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06423                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06424                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06425                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06426                         dec              esi
06427                                 add esi, eax    /* move Src pointer 1 row below */
06428                                 movq mm3, [edx]         /* load 4 words of Kernel */
06429                         add edx, 8      /* move pointer to other 4 words */
06430                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06431                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06432                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06433                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06434                                 /* --- 8 */
06435                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06436                         movq mm2, mm1           /* copy MM1 into MM2 */
06437                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06438                                 movq mm3, [edx]         /* load 4 words of Kernel */
06439                         add edx, 8      /* move pointer to other 4 words */
06440                                 movq mm4, [edx]         /* load 4 words of Kernel */
06441                         add edx, 8      /* move pointer to other 4 words */
06442                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06443                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06444                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06445                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06446                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06447                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06448                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06449                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06450                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06451                         dec              esi
06452                                 add esi, eax    /* move Src pointer 1 row below */
06453                                 movq mm3, [edx]         /* load 4 words of Kernel */
06454                         add edx, 8      /* move pointer to other 4 words */
06455                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06456                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06457                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06458                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06459                                 /* --- 9 */
06460                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06461                         movq mm2, mm1           /* copy MM1 into MM2 */
06462                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06463                                 movq mm3, [edx]         /* load 4 words of Kernel */
06464                         add edx, 8      /* move pointer to other 4 words */
06465                                 movq mm4, [edx]         /* load 4 words of Kernel */
06466                         add edx, 8      /* move pointer to other 4 words */
06467                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06468                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06469                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06470                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06471                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06472                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06473                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06474                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06475                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06476                         movq mm3, [edx]         /* load 4 words of Kernel */
06477                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06478                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06479                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06480                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06481                                 /* ---, */
06482                                 movq mm3, mm7           /* copy MM7 into MM3 */
06483                                 psrlq mm7, 32           /* shift 2 left words to the right */
06484                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
06485                                 movq mm2, mm7           /* copy MM7 into MM2 */
06486                                 psrlq mm7, 16           /* shift 1 left word to the right */
06487                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
06488                                 movd mm1, eax           /* save EAX in MM1 */
06489                                 packuswb mm7, mm0       /* pack division result with saturation */
06490                                 movd eax, mm7           /* copy saturated result into EAX */
06491                                 mov [edi], al           /* copy a byte result into Dest */
06492                                 movd eax, mm1           /* restore saved EAX */
06493                                 /* --, */
06494                                 movd esi, mm6           /* move Src pointer to the top pixel */
06495                                 sub edx, 208    /* EDX = Kernel address */
06496                                 inc              esi            /* move Src  pointer to the next pixel */
06497                                 inc              edi            /* move Dest pointer to the next pixel */
06498                                 /* ---, */
06499                                 dec              ecx            /* decrease loop counter COLUMNS */
06500                                 jnz            L10392           /* check loop termination, proceed if required */
06501                                 add esi, 8      /* move to the next row in Src */
06502                                 add edi, 8      /* move to the next row in Dest */
06503                                 dec              ebx            /* decrease loop counter ROWS */
06504                                 jnz            L10390           /* check loop termination, proceed if required */
06505                                 /* ---, */
06506                                 emms                            /* exit MMX state */
06507                                 popa
06508                 }
06509 #else
06510                 asm volatile
06511                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
06512                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
06513                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
06514                         "movd      %%ebx, %%mm5 \n\t"   /* copy NRightShift into MM5 */
06515                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
06516                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
06517                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
06518                         "add          $4, %%edi \n\t"   /* 4 column offset from the left edge */
06519                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
06520                         "add       %%eax, %%edi \n\t"   /* 4 row offset from the top edge */
06521                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t" /* initialize ROWS counter */
06522                         "sub          $8, %%ebx \n\t"   /* do not use first 4 and last 4 rows */
06523                         /* --- */
06524                         ".L10390:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
06525                         "sub          $8, %%ecx \n\t"   /* do not use first 4 and last 4 columns */
06526                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
06527                         ".L10392:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
06528                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
06529                         /* --- 1 */
06530                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06531                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06532                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06533                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06534                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06535                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06536                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06537                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06538                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06539                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06540                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06541                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06542                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06543                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06544                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06545                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06546                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06547                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06548                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06549                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06550                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06551                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06552                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06553                         /* --- 2 */
06554                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06555                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06556                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06557                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06558                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06559                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06560                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06561                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06562                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06563                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06564                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06565                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06566                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06567                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06568                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06569                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06570                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06571                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06572                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06573                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06574                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06575                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06576                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06577                         /* --- 3 */
06578                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06579                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06580                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06581                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06582                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06583                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06584                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06585                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06586                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06587                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06588                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06589                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06590                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06591                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06592                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06593                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06594                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06595                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06596                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06597                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06598                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06599                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06600                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06601                         /* --- 4 */
06602                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06603                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06604                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06605                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06606                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06607                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06608                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06609                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06610                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06611                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06612                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06613                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06614                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06615                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06616                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06617                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06618                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06619                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06620                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06621                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06622                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06623                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06624                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06625                         /* --- 5 */
06626                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06627                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06628                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06629                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06630                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06631                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06632                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06633                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06634                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06635                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06636                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06637                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06638                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06639                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06640                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06641                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06642                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06643                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06644                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06645                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06646                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06647                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06648                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06649                         /* --- 6 */
06650                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06651                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06652                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06653                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06654                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06655                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06656                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06657                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06658                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06659                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06660                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06661                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06662                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06663                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06664                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06665                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06666                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06667                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06668                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06669                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06670                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06671                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06672                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06673                         /* --- 7 */
06674                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06675                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06676                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06677                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06678                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06679                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06680                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06681                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06682                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06683                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06684                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06685                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06686                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06687                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06688                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06689                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06690                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06691                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06692                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06693                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06694                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06695                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06696                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06697                         /* --- 8 */
06698                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06699                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06700                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06701                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06702                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06703                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06704                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06705                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06706                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06707                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06708                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06709                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06710                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06711                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06712                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06713                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06714                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06715                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06716                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06717                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06718                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06719                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06720                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06721                         /* --- 9 */
06722                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06723                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06724                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06725                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06726                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06727                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06728                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06729                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06730                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06731                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06732                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06733                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06734                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06735                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06736                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06737                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06738                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06739                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06740                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06741                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06742                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06743                         /* --- */
06744                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
06745                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
06746                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
06747                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
06748                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
06749                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
06750                         "movd      %%eax, %%mm1 \n\t"   /* save EAX in MM1 */
06751                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
06752                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
06753                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
06754                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
06755                         /* -- */
06756                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
06757                         "sub        $208, %%edx \n\t"   /* EDX = Kernel address */
06758                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
06759                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
06760                         /* --- */
06761                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
06762                         "jnz            .L10392 \n\t"   /* check loop termination, proceed if required */
06763                         "add          $8, %%esi \n\t"   /* move to the next row in Src */
06764                         "add          $8, %%edi \n\t"   /* move to the next row in Dest */
06765                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
06766                         "jnz            .L10390 \n\t"   /* check loop termination, proceed if required */
06767                         /* --- */
06768                         "emms                   \n\t"   /* exit MMX state */
06769                         "popa                   \n\t":"=m" (Dest)       /* %0 */
06770                         :"m"(Src),              /* %1 */
06771                         "m"(rows),              /* %2 */
06772                         "m"(columns),           /* %3 */
06773                         "m"(Kernel),            /* %4 */
06774                         "m"(NRightShift)        /* %5 */
06775                         );
06776 #endif
06777 #endif
06778                 return (0);
06779         } else {
06780                 /* No non-MMX implementation yet */
06781                 return (-1);
06782         }
06783 }
06784 
06785 /* ------------------------------------------------------------------------------------ */
06786 
06799 int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns)
06800 {
06801         /* Validate input parameters */
06802         if ((Src == NULL) || (Dest == NULL))
06803                 return(-1);
06804 
06805         if ((columns < 8) || (rows < 3))
06806                 return (-1);
06807 
06808         if ((SDL_imageFilterMMXdetect())) {
06809 //#ifdef USE_MMX
06810 #if defined(USE_MMX) && defined(i386)
06811 #if !defined(GCC__)
06812                 __asm
06813                 {
06814                         pusha
06815                                 pxor mm0, mm0           /* zero MM0 */
06816                                 mov eax, columns        /* load columns into EAX */
06817                                 /* ---, */
06818                                 mov esi, Src    /* ESI = Src row 0 address */
06819                                 mov edi, Dest           /* load Dest address to EDI */
06820                                 add edi, eax    /* EDI = EDI + columns */
06821                                 inc              edi            /* 1 byte offset from the left edge */
06822                                 mov edx, rows           /* initialize ROWS counter */
06823                                 sub edx, 2      /* do not use first and last rows */
06824                                 /* ---, */
06825 L10400:
06826                         mov ecx, eax    /* initialize COLUMS counter */
06827                                 shr ecx, 3      /* EBX/8 (MMX loads 8 bytes at a time) */
06828                                 mov ebx, esi    /* save ESI in EBX */
06829                                 movd mm1, edi           /* save EDI in MM1 */
06830                                 align 16                        /* 16 byte alignment of the loop entry */
06831 L10402:
06832                         /* ---, */
06833                         movq mm4, [esi]         /* load 8 bytes from Src */
06834                         movq mm5, mm4           /* save MM4 in MM5 */
06835                                 add esi, 2      /* move ESI pointer 2 bytes right */
06836                                 punpcklbw mm4, mm0      /* unpack 4 low  bytes into words */
06837                                 punpckhbw mm5, mm0      /* unpack 4 high bytes into words */
06838                                 movq mm6, [esi]         /* load 8 bytes from Src */
06839                         movq mm7, mm6           /* save MM6 in MM7 */
06840                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
06841                                 punpcklbw mm6, mm0      /* unpack 4 low  bytes into words */
06842                                 punpckhbw mm7, mm0      /* unpack 4 high bytes into words */
06843                                 add esi, eax    /* move to the next row of Src */
06844                                 movq mm2, [esi]         /* load 8 bytes from Src */
06845                         movq mm3, mm2           /* save MM2 in MM3 */
06846                                 add esi, 2      /* move ESI pointer 2 bytes right */
06847                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06848                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06849                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
06850                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
06851                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
06852                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
06853                                 movq mm2, [esi]         /* load 8 bytes from Src */
06854                         movq mm3, mm2           /* save MM2 in MM3 */
06855                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
06856                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06857                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06858                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
06859                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
06860                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
06861                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
06862                                 add esi, eax    /* move to the next row of Src */
06863                                 movq mm2, [esi]         /* load 8 bytes from Src */
06864                         movq mm3, mm2           /* save MM2 in MM3 */
06865                                 add esi, 2      /* move ESI pointer 2 bytes right */
06866                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06867                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06868                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
06869                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
06870                                 movq mm2, [esi]         /* load 8 bytes from Src */
06871                         movq mm3, mm2           /* save MM2 in MM3 */
06872                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
06873                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06874                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06875                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
06876                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
06877                                 /* ---, */
06878                                 movq mm2, mm4           /* copy MM4 into MM2 */
06879                                 psrlq mm4, 32           /* shift 2 left words to the right */
06880                                 psubw mm4, mm2          /* MM4 = MM4 - MM2 */
06881                                 movq mm3, mm6           /* copy MM6 into MM3 */
06882                                 psrlq mm6, 32           /* shift 2 left words to the right */
06883                                 psubw mm6, mm3          /* MM6 = MM6 - MM3 */
06884                                 punpckldq mm4, mm6      /* combine 2 words of MM6 and 2 words of MM4 */
06885                                 movq mm2, mm5           /* copy MM6 into MM2 */
06886                                 psrlq mm5, 32           /* shift 2 left words to the right */
06887                                 psubw mm5, mm2          /* MM5 = MM5 - MM2 */
06888                                 movq mm3, mm7           /* copy MM7 into MM3 */
06889                                 psrlq mm7, 32           /* shift 2 left words to the right */
06890                                 psubw mm7, mm3          /* MM7 = MM7 - MM3 */
06891                                 punpckldq mm5, mm7      /* combine 2 words of MM7 and 2 words of MM5 */
06892                                 /* Take abs values of MM4 and MM5 */
06893                                 movq mm6, mm4           /* copy MM4 into MM6 */
06894                                 movq mm7, mm5           /* copy MM5 into MM7 */
06895                                 psraw mm6, 15           /* fill MM6 words with word sign bit */
06896                                 psraw mm7, 15           /* fill MM7 words with word sign bit */
06897                                 pxor mm4, mm6           /* take 1's compliment of only neg words */
06898                                 pxor mm5, mm7           /* take 1's compliment of only neg words */
06899                                 psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
06900                                 psubsw mm5, mm7         /* add 1 to only neg words, W-(-1) or W-0 */
06901                                 packuswb mm4, mm5       /* combine and pack/saturate MM5 and MM4 */
06902                                 movq [edi], mm4         /* store result in Dest */
06903                                 /* ---, */
06904                                 sub esi, eax    /* move to the current top row in Src */
06905                                 sub esi, eax
06906                                 add esi, 8      /* move Src  pointer to the next 8 pixels */
06907                                 add edi, 8      /* move Dest pointer to the next 8 pixels */
06908                                 /* ---, */
06909                                 dec              ecx            /* decrease loop counter COLUMNS */
06910                                 jnz            L10402           /* check loop termination, proceed if required */
06911                                 mov esi, ebx    /* restore most left current row Src  address */
06912                                 movd edi, mm1           /* restore most left current row Dest address */
06913                                 add esi, eax    /* move to the next row in Src */
06914                                 add edi, eax    /* move to the next row in Dest */
06915                                 dec              edx            /* decrease loop counter ROWS */
06916                                 jnz            L10400           /* check loop termination, proceed if required */
06917                                 /* ---, */
06918                                 emms                            /* exit MMX state */
06919                                 popa
06920                 }
06921 #else
06922                 asm volatile
06923                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
06924                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
06925                         /* --- */
06926                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
06927                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
06928                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
06929                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
06930                         "mov          %2, %%edx \n\t"   /* initialize ROWS counter */
06931                         "sub          $2, %%edx \n\t"   /* do not use first and last rows */
06932                         /* --- */
06933                         ".L10400:                \n\t" "mov       %%eax, %%ecx \n\t"    /* initialize COLUMS counter */
06934                         "shr          $3, %%ecx \n\t"   /* EBX/8 (MMX loads 8 bytes at a time) */
06935                         "mov       %%esi, %%ebx \n\t"   /* save ESI in EBX */
06936                         "movd      %%edi, %%mm1 \n\t"   /* save EDI in MM1 */
06937                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
06938                         ".L10402:               \n\t"
06939                         /* --- */
06940                         "movq    (%%esi), %%mm4 \n\t"   /* load 8 bytes from Src */
06941                         "movq      %%mm4, %%mm5 \n\t"   /* save MM4 in MM5 */
06942                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
06943                         "punpcklbw %%mm0, %%mm4 \n\t"   /* unpack 4 low  bytes into words */
06944                         "punpckhbw %%mm0, %%mm5 \n\t"   /* unpack 4 high bytes into words */
06945                         "movq    (%%esi), %%mm6 \n\t"   /* load 8 bytes from Src */
06946                         "movq      %%mm6, %%mm7 \n\t"   /* save MM6 in MM7 */
06947                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
06948                         "punpcklbw %%mm0, %%mm6 \n\t"   /* unpack 4 low  bytes into words */
06949                         "punpckhbw %%mm0, %%mm7 \n\t"   /* unpack 4 high bytes into words */
06950                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
06951                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06952                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06953                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
06954                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06955                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06956                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
06957                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
06958                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
06959                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
06960                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06961                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06962                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
06963                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06964                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06965                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
06966                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
06967                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
06968                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
06969                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
06970                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06971                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06972                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
06973                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06974                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06975                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
06976                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
06977                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06978                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06979                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
06980                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06981                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06982                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
06983                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
06984                         /* --- */
06985                         "movq      %%mm4, %%mm2 \n\t"   /* copy MM4 into MM2 */
06986                         "psrlq       $32, %%mm4 \n\t"   /* shift 2 left words to the right */
06987                         "psubw     %%mm2, %%mm4 \n\t"   /* MM4 = MM4 - MM2 */
06988                         "movq      %%mm6, %%mm3 \n\t"   /* copy MM6 into MM3 */
06989                         "psrlq       $32, %%mm6 \n\t"   /* shift 2 left words to the right */
06990                         "psubw     %%mm3, %%mm6 \n\t"   /* MM6 = MM6 - MM3 */
06991                         "punpckldq %%mm6, %%mm4 \n\t"   /* combine 2 words of MM6 and 2 words of MM4 */
06992                         "movq      %%mm5, %%mm2 \n\t"   /* copy MM6 into MM2 */
06993                         "psrlq       $32, %%mm5 \n\t"   /* shift 2 left words to the right */
06994                         "psubw     %%mm2, %%mm5 \n\t"   /* MM5 = MM5 - MM2 */
06995                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
06996                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
06997                         "psubw     %%mm3, %%mm7 \n\t"   /* MM7 = MM7 - MM3 */
06998                         "punpckldq %%mm7, %%mm5 \n\t"   /* combine 2 words of MM7 and 2 words of MM5 */
06999                         /* Take abs values of MM4 and MM5 */
07000                         "movq      %%mm4, %%mm6 \n\t"   /* copy MM4 into MM6 */
07001                         "movq      %%mm5, %%mm7 \n\t"   /* copy MM5 into MM7 */
07002                         "psraw       $15, %%mm6 \n\t"   /* fill MM6 words with word sign bit */
07003                         "psraw       $15, %%mm7 \n\t"   /* fill MM7 words with word sign bit */
07004                         "pxor      %%mm6, %%mm4 \n\t"   /* take 1's compliment of only neg. words */
07005                         "pxor      %%mm7, %%mm5 \n\t"   /* take 1's compliment of only neg. words */
07006                         "psubsw    %%mm6, %%mm4 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07007                         "psubsw    %%mm7, %%mm5 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07008                         "packuswb  %%mm5, %%mm4 \n\t"   /* combine and pack/saturate MM5 and MM4 */
07009                         "movq    %%mm4, (%%edi) \n\t"   /* store result in Dest */
07010                         /* --- */
07011                         "sub       %%eax, %%esi \n\t"   /* move to the current top row in Src */
07012                         "sub       %%eax, %%esi \n\t" "add $8,          %%esi \n\t"     /* move Src  pointer to the next 8 pixels */
07013                         "add $8,          %%edi \n\t"   /* move Dest pointer to the next 8 pixels */
07014                         /* --- */
07015                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
07016                         "jnz            .L10402 \n\t"   /* check loop termination, proceed if required */
07017                         "mov       %%ebx, %%esi \n\t"   /* restore most left current row Src  address */
07018                         "movd      %%mm1, %%edi \n\t"   /* restore most left current row Dest address */
07019                         "add       %%eax, %%esi \n\t"   /* move to the next row in Src */
07020                         "add       %%eax, %%edi \n\t"   /* move to the next row in Dest */
07021                         "dec              %%edx \n\t"   /* decrease loop counter ROWS */
07022                         "jnz            .L10400 \n\t"   /* check loop termination, proceed if required */
07023                         /* --- */
07024                         "emms                   \n\t"   /* exit MMX state */
07025                         "popa                   \n\t":"=m" (Dest)       /* %0 */
07026                         :"m"(Src),              /* %1 */
07027                         "m"(rows),              /* %2 */
07028                         "m"(columns)            /* %3 */
07029                         );
07030 #endif
07031 #endif
07032                 return (0);
07033         } else {
07034                 /* No non-MMX implementation yet */
07035                 return (-1);
07036         }
07037 }
07038 
07052 int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
07053                                                                         unsigned char NRightShift)
07054 {
07055         /* Validate input parameters */
07056         if ((Src == NULL) || (Dest == NULL))
07057                 return(-1);
07058         if ((columns < 8) || (rows < 3) || (NRightShift > 7))
07059                 return (-1);
07060 
07061         if ((SDL_imageFilterMMXdetect())) {
07062 //#ifdef USE_MMX
07063 #if defined(USE_MMX) && defined(i386)
07064 #if !defined(GCC__)
07065                 __asm
07066                 {
07067                         pusha
07068                                 pxor mm0, mm0           /* zero MM0 */
07069                                 mov eax, columns        /* load columns into EAX */
07070                                 xor ebx, ebx    /* zero EBX */
07071                                 mov bl, NRightShift     /* load NRightShift into BL */
07072                                 movd mm1, ebx           /* copy NRightShift into MM1 */
07073                                 /* ---, */
07074                                 mov esi, Src    /* ESI = Src row 0 address */
07075                                 mov edi, Dest           /* load Dest address to EDI */
07076                                 add edi, eax    /* EDI = EDI + columns */
07077                                 inc              edi            /* 1 byte offset from the left edge */
07078                                 /* initialize ROWS counter */
07079                                 sub rows, 2     /* do not use first and last rows */
07080                                 /* ---, */
07081 L10410:
07082                         mov ecx, eax    /* initialize COLUMS counter */
07083                                 shr ecx, 3      /* EBX/8 (MMX loads 8 bytes at a time) */
07084                                 mov ebx, esi    /* save ESI in EBX */
07085                                 mov edx, edi    /* save EDI in EDX */
07086                                 align 16                        /* 16 byte alignment of the loop entry */
07087 L10412:
07088                         /* ---, */
07089                         movq mm4, [esi]         /* load 8 bytes from Src */
07090                         movq mm5, mm4           /* save MM4 in MM5 */
07091                                 add esi, 2      /* move ESI pointer 2 bytes right */
07092                                 punpcklbw mm4, mm0      /* unpack 4 low  bytes into words */
07093                                 punpckhbw mm5, mm0      /* unpack 4 high bytes into words */
07094                                 psrlw mm4, mm1          /* shift right each pixel NshiftRight times */
07095                                 psrlw mm5, mm1          /* shift right each pixel NshiftRight times */
07096                                 movq mm6, [esi]         /* load 8 bytes from Src */
07097                         movq mm7, mm6           /* save MM6 in MM7 */
07098                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
07099                                 punpcklbw mm6, mm0      /* unpack 4 low  bytes into words */
07100                                 punpckhbw mm7, mm0      /* unpack 4 high bytes into words */
07101                                 psrlw mm6, mm1          /* shift right each pixel NshiftRight times */
07102                                 psrlw mm7, mm1          /* shift right each pixel NshiftRight times */
07103                                 add esi, eax    /* move to the next row of Src */
07104                                 movq mm2, [esi]         /* load 8 bytes from Src */
07105                         movq mm3, mm2           /* save MM2 in MM3 */
07106                                 add esi, 2      /* move ESI pointer 2 bytes right */
07107                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07108                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07109                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07110                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07111                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
07112                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
07113                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
07114                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
07115                                 movq mm2, [esi]         /* load 8 bytes from Src */
07116                         movq mm3, mm2           /* save MM2 in MM3 */
07117                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
07118                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07119                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07120                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07121                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07122                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
07123                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
07124                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
07125                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
07126                                 add esi, eax    /* move to the next row of Src */
07127                                 movq mm2, [esi]         /* load 8 bytes from Src */
07128                         movq mm3, mm2           /* save MM2 in MM3 */
07129                                 add esi, 2      /* move ESI pointer 2 bytes right */
07130                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07131                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07132                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07133                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07134                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
07135                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
07136                                 movq mm2, [esi]         /* load 8 bytes from Src */
07137                         movq mm3, mm2           /* save MM2 in MM3 */
07138                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
07139                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07140                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07141                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07142                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07143                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
07144                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
07145                                 /* ---, */
07146                                 movq mm2, mm4           /* copy MM4 into MM2 */
07147                                 psrlq mm4, 32           /* shift 2 left words to the right */
07148                                 psubw mm4, mm2          /* MM4 = MM4 - MM2 */
07149                                 movq mm3, mm6           /* copy MM6 into MM3 */
07150                                 psrlq mm6, 32           /* shift 2 left words to the right */
07151                                 psubw mm6, mm3          /* MM6 = MM6 - MM3 */
07152                                 punpckldq mm4, mm6      /* combine 2 words of MM6 and 2 words of MM4 */
07153                                 movq mm2, mm5           /* copy MM6 into MM2 */
07154                                 psrlq mm5, 32           /* shift 2 left words to the right */
07155                                 psubw mm5, mm2          /* MM5 = MM5 - MM2 */
07156                                 movq mm3, mm7           /* copy MM7 into MM3 */
07157                                 psrlq mm7, 32           /* shift 2 left words to the right */
07158                                 psubw mm7, mm3          /* MM7 = MM7 - MM3 */
07159                                 punpckldq mm5, mm7      /* combine 2 words of MM7 and 2 words of MM5 */
07160                                 /* Take abs values of MM4 and MM5 */
07161                                 movq mm6, mm4           /* copy MM4 into MM6 */
07162                                 movq mm7, mm5           /* copy MM5 into MM7 */
07163                                 psraw mm6, 15           /* fill MM6 words with word sign bit */
07164                                 psraw mm7, 15           /* fill MM7 words with word sign bit */
07165                                 pxor mm4, mm6           /* take 1's compliment of only neg words */
07166                                 pxor mm5, mm7           /* take 1's compliment of only neg words */
07167                                 psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
07168                                 psubsw mm5, mm7         /* add 1 to only neg words, W-(-1) or W-0 */
07169                                 packuswb mm4, mm5       /* combine and pack/saturate MM5 and MM4 */
07170                                 movq [edi], mm4         /* store result in Dest */
07171                                 /* ---, */
07172                                 sub esi, eax    /* move to the current top row in Src */
07173                                 sub esi, eax
07174                                 add esi, 8      /* move Src  pointer to the next 8 pixels */
07175                                 add edi, 8      /* move Dest pointer to the next 8 pixels */
07176                                 /* ---, */
07177                                 dec              ecx            /* decrease loop counter COLUMNS */
07178                                 jnz            L10412           /* check loop termination, proceed if required */
07179                                 mov esi, ebx    /* restore most left current row Src  address */
07180                                 mov edi, edx    /* restore most left current row Dest address */
07181                                 add esi, eax    /* move to the next row in Src */
07182                                 add edi, eax    /* move to the next row in Dest */
07183                                 dec rows        /* decrease loop counter ROWS */
07184                                 jnz            L10410           /* check loop termination, proceed if required */
07185                                 /* ---, */
07186                                 emms                            /* exit MMX state */
07187                                 popa
07188                 }
07189 #else
07190                 asm volatile
07191                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
07192                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
07193                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
07194                         "mov           %4, %%bl \n\t"   /* load NRightShift into BL */
07195                         "movd      %%ebx, %%mm1 \n\t"   /* copy NRightShift into MM1 */
07196                         /* --- */
07197                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
07198                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
07199                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
07200                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
07201                         /* initialize ROWS counter */
07202                         "subl            $2, %2 \n\t"   /* do not use first and last rows */
07203                         /* --- */
07204                         ".L10410:                \n\t" "mov       %%eax, %%ecx \n\t"    /* initialize COLUMS counter */
07205                         "shr          $3, %%ecx \n\t"   /* EBX/8 (MMX loads 8 bytes at a time) */
07206                         "mov       %%esi, %%ebx \n\t"   /* save ESI in EBX */
07207                         "mov       %%edi, %%edx \n\t"   /* save EDI in EDX */
07208                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
07209                         ".L10412:               \n\t"
07210                         /* --- */
07211                         "movq    (%%esi), %%mm4 \n\t"   /* load 8 bytes from Src */
07212                         "movq      %%mm4, %%mm5 \n\t"   /* save MM4 in MM5 */
07213                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
07214                         "punpcklbw %%mm0, %%mm4 \n\t"   /* unpack 4 low  bytes into words */
07215                         "punpckhbw %%mm0, %%mm5 \n\t"   /* unpack 4 high bytes into words */
07216                         "psrlw     %%mm1, %%mm4 \n\t"   /* shift right each pixel NshiftRight times */
07217                         "psrlw     %%mm1, %%mm5 \n\t"   /* shift right each pixel NshiftRight times */
07218                         "movq    (%%esi), %%mm6 \n\t"   /* load 8 bytes from Src */
07219                         "movq      %%mm6, %%mm7 \n\t"   /* save MM6 in MM7 */
07220                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
07221                         "punpcklbw %%mm0, %%mm6 \n\t"   /* unpack 4 low  bytes into words */
07222                         "punpckhbw %%mm0, %%mm7 \n\t"   /* unpack 4 high bytes into words */
07223                         "psrlw     %%mm1, %%mm6 \n\t"   /* shift right each pixel NshiftRight times */
07224                         "psrlw     %%mm1, %%mm7 \n\t"   /* shift right each pixel NshiftRight times */
07225                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
07226                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07227                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07228                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
07229                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07230                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07231                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07232                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07233                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
07234                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
07235                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
07236                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
07237                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07238                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07239                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
07240                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07241                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07242                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07243                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07244                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
07245                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
07246                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
07247                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
07248                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
07249                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07250                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07251                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
07252                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07253                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07254                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07255                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07256                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
07257                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
07258                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07259                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07260                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
07261                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07262                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07263                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07264                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07265                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
07266                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
07267                         /* --- */
07268                         "movq      %%mm4, %%mm2 \n\t"   /* copy MM4 into MM2 */
07269                         "psrlq       $32, %%mm4 \n\t"   /* shift 2 left words to the right */
07270                         "psubw     %%mm2, %%mm4 \n\t"   /* MM4 = MM4 - MM2 */
07271                         "movq      %%mm6, %%mm3 \n\t"   /* copy MM6 into MM3 */
07272                         "psrlq       $32, %%mm6 \n\t"   /* shift 2 left words to the right */
07273                         "psubw     %%mm3, %%mm6 \n\t"   /* MM6 = MM6 - MM3 */
07274                         "punpckldq %%mm6, %%mm4 \n\t"   /* combine 2 words of MM6 and 2 words of MM4 */
07275                         "movq      %%mm5, %%mm2 \n\t"   /* copy MM6 into MM2 */
07276                         "psrlq       $32, %%mm5 \n\t"   /* shift 2 left words to the right */
07277                         "psubw     %%mm2, %%mm5 \n\t"   /* MM5 = MM5 - MM2 */
07278                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
07279                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
07280                         "psubw     %%mm3, %%mm7 \n\t"   /* MM7 = MM7 - MM3 */
07281                         "punpckldq %%mm7, %%mm5 \n\t"   /* combine 2 words of MM7 and 2 words of MM5 */
07282                         /* Take abs values of MM4 and MM5 */
07283                         "movq      %%mm4, %%mm6 \n\t"   /* copy MM4 into MM6 */
07284                         "movq      %%mm5, %%mm7 \n\t"   /* copy MM5 into MM7 */
07285                         "psraw       $15, %%mm6 \n\t"   /* fill MM6 words with word sign bit */
07286                         "psraw       $15, %%mm7 \n\t"   /* fill MM7 words with word sign bit */
07287                         "pxor      %%mm6, %%mm4 \n\t"   /* take 1's compliment of only neg. words */
07288                         "pxor      %%mm7, %%mm5 \n\t"   /* take 1's compliment of only neg. words */
07289                         "psubsw    %%mm6, %%mm4 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07290                         "psubsw    %%mm7, %%mm5 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07291                         "packuswb  %%mm5, %%mm4 \n\t"   /* combine and pack/saturate MM5 and MM4 */
07292                         "movq    %%mm4, (%%edi) \n\t"   /* store result in Dest */
07293                         /* --- */
07294                         "sub       %%eax, %%esi \n\t"   /* move to the current top row in Src */
07295                         "sub       %%eax, %%esi \n\t" "add $8,          %%esi \n\t"     /* move Src  pointer to the next 8 pixels */
07296                         "add $8,          %%edi \n\t"   /* move Dest pointer to the next 8 pixels */
07297                         /* --- */
07298                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
07299                         "jnz            .L10412 \n\t"   /* check loop termination, proceed if required */
07300                         "mov       %%ebx, %%esi \n\t"   /* restore most left current row Src  address */
07301                         "mov       %%edx, %%edi \n\t"   /* restore most left current row Dest address */
07302                         "add       %%eax, %%esi \n\t"   /* move to the next row in Src */
07303                         "add       %%eax, %%edi \n\t"   /* move to the next row in Dest */
07304                         "decl                %2 \n\t"   /* decrease loop counter ROWS */
07305                         "jnz            .L10410 \n\t"   /* check loop termination, proceed if required */
07306                         /* --- */
07307                         "emms                   \n\t"   /* exit MMX state */
07308                         "popa                   \n\t":"=m" (Dest)       /* %0 */
07309                         :"m"(Src),              /* %1 */
07310                         "m"(rows),              /* %2 */
07311                         "m"(columns),           /* %3 */
07312                         "m"(NRightShift)        /* %4 */
07313                         );
07314 #endif
07315 #endif
07316                 return (0);
07317         } else {
07318                 /* No non-MMX implementation yet */
07319                 return (-1);
07320         }
07321 }
07322 
07326 void SDL_imageFilterAlignStack(void)
07327 {
07328 #ifdef USE_MMX
07329 #if !defined(GCC__)
07330         __asm
07331         {                               /* --- stack alignment --- */
07332                 mov ebx, esp    /* load ESP into EBX */
07333                         sub ebx, 4      /* reserve space on stack for old value of ESP */
07334                         and ebx, -32    /* align EBX along a 32 byte boundary */
07335                         mov [ebx], esp          /* save old value of ESP in stack, behind the bndry */
07336                         mov esp, ebx    /* align ESP along a 32 byte boundary */
07337         }
07338 #else
07339         asm volatile
07340                 (                               /* --- stack alignment --- */
07341                 "mov       %%esp, %%ebx \n\t"   /* load ESP into EBX */
07342                 "sub          $4, %%ebx \n\t"   /* reserve space on stack for old value of ESP */
07343                 "and        $-32, %%ebx \n\t"   /* align EBX along a 32 byte boundary */
07344                 "mov     %%esp, (%%ebx) \n\t"   /* save old value of ESP in stack, behind the bndry */
07345                 "mov       %%ebx, %%esp \n\t"   /* align ESP along a 32 byte boundary */
07346                 ::);
07347 #endif
07348 #endif
07349 }
07350 
07354 void SDL_imageFilterRestoreStack(void)
07355 {
07356 #ifdef USE_MMX
07357 #if !defined(GCC__)
07358         __asm
07359         {                               /* --- restoring old stack --- */
07360                 mov ebx, [esp]          /* load old value of ESP */
07361                 mov esp, ebx    /* restore old value of ESP */
07362         }
07363 #else
07364         asm volatile
07365                 (                               /* --- restoring old stack --- */
07366                 "mov     (%%esp), %%ebx \n\t"   /* load old value of ESP */
07367                 "mov       %%ebx, %%esp \n\t"   /* restore old value of ESP */
07368                 ::);
07369 #endif
07370 #endif
07371 }
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__image_filter_8h.html000077500000000000000000002515221226521303400231250ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_imageFilter.h File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_imageFilter.h File Reference

Go to the source code of this file.

Defines

#define SDL2_IMAGEFILTER_SCOPE   extern

Functions

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect (void)
 MMX detection routine (with override flag).
SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff (void)
 Disable MMX check for filter functions and and force to use non-MMX C based code.
SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon (void)
 Enable MMX check for filter functions and use MMX code if available.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAdd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Add: D = saturation255(S1 + S2)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMean (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mean: D = S1/2 + S2/2.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSub (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Sub: D = saturation0(S1 - S2)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using AbsDiff: D = | S1 - S2 |.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMult (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mult: D = saturation255(S1 * S2)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultNor: D = S1 * S2.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby2: D = saturation255(S1/2 * S2)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby4: D = saturation255(S1/2 * S2/2)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitAnd: D = S1 & S2.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitOr: D = S1 | S2.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterDiv (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Div: D = S1 / S2.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation (unsigned char *Src1, unsigned char *Dest, unsigned int length)
 Filter using BitNegation: D = !S.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByte: D = saturation255(S + C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByteToHalf: D = saturation255(S/2 + C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using SubByte: D = saturation0(S - C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRight: D = saturation0(S >> N)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using MultByByte: D = saturation255(S * C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C)
 Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftByte: D = (S << N)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftUint: D = ((uint)S << N)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter ShiftLeft: D = saturation255(S << N)
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
 Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax)
 Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.
SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear (unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax)
 Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)

Define Documentation

#define SDL2_IMAGEFILTER_SCOPE   extern

Definition at line 50 of file SDL2_imageFilter.h.


Function Documentation

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using AbsDiff: D = | S1 - S2 |.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 542 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAdd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Add: D = saturation255(S1 + S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 173 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByte: D = saturation255(S + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant value to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1791 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByteToHalf: D = saturation255(S/2 + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2068 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1919 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  T 
)

Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TThe threshold boundary (inclusive).
Returns:
Returns 0 for success or -1 for error.

Definition at line 3534 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitAnd: D = S1 & S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1278 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitNegation: D = !S.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1671 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitOr: D = S1 | S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1392 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  Tmin,
unsigned char  Tmax 
)

Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TminLower (inclusive) boundary of the clipping range.
TmaxUpper (inclusive) boundary of the clipping range.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3691 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterDiv ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Div: D = S1 / S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1549 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMean ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mean: D = S1/2 + S2/2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 308 of file SDL2_imageFilter.c.

MMX detection routine (with override flag).

Returns:
1 of MMX was detected, 0 otherwise.

Definition at line 80 of file SDL2_imageFilter.c.

Disable MMX check for filter functions and and force to use non-MMX C based code.

Definition at line 93 of file SDL2_imageFilter.c.

Enable MMX check for filter functions and use MMX code if available.

Definition at line 101 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMult ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mult: D = saturation255(S1 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 729 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using MultByByte: D = saturation255(S * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2790 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby2: D = saturation255(S1/2 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1000 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby4: D = saturation255(S1/2 * S2/2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1141 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultNor: D = S1 * S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 862 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear ( unsigned char *  Src,
unsigned char *  Dest,
unsigned int  length,
int  Cmin,
int  Cmax,
int  Nmin,
int  Nmax 
)

Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)

Parameters:
SrcPointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CminNormalization constant.
CmaxNormalization constant.
NminNormalization constant.
NmaxNormalization constant.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3909 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter ShiftLeft: D = saturation255(S << N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3393 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftByte: D = (S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3093 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftUint: D = ((uint)S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3210 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRight: D = saturation0(S >> N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2476 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N,
unsigned char  C 
)

Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2943 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2594 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSub ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Sub: D = saturation0(S1 - S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 422 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using SubByte: D = saturation0(S - C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2196 of file SDL2_imageFilter.c.

SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2325 of file SDL2_imageFilter.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__image_filter_8h_source.html000077500000000000000000001022451226521303400245020ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_imageFilter.h Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_imageFilter.h
Go to the documentation of this file.
00001 /*
00002 
00003 SDL2_imageFilter.h: byte-image "filter" routines 
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL2_imageFilter_h
00031 #define _SDL2_imageFilter_h
00032 
00033 /* Set up for C function definitions, even when using C++ */
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038         /* ---- Function Prototypes */
00039 
00040 #ifdef _MSC_VER
00041 #  if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)
00042 #    define SDL2_IMAGEFILTER_SCOPE __declspec(dllexport)
00043 #  else
00044 #    ifdef LIBSDL2_GFX_DLL_IMPORT
00045 #      define SDL2_IMAGEFILTER_SCOPE __declspec(dllimport)
00046 #    endif
00047 #  endif
00048 #endif
00049 #ifndef SDL2_IMAGEFILTER_SCOPE
00050 #  define SDL2_IMAGEFILTER_SCOPE extern
00051 #endif
00052 
00053         /* Comments:                                                                           */
00054         /*  1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */
00055         /*  2.) Data that is not within an 8 byte boundary is processed using the C routine.   */
00056         /*  3.) Convolution routines do not have C routines at this time.                      */
00057 
00058         // Detect MMX capability in CPU
00059         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect(void);
00060 
00061         // Force use of MMX off (or turn possible use back on)
00062         SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff(void);
00063         SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon(void);
00064 
00065         //
00066         // All routines return:
00067         //   0   OK
00068         //  -1   Error (internal error, parameter error)
00069         //
00070 
00071         //  SDL_imageFilterAdd: D = saturation255(S1 + S2)
00072         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00073 
00074         //  SDL_imageFilterMean: D = S1/2 + S2/2
00075         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00076 
00077         //  SDL_imageFilterSub: D = saturation0(S1 - S2)
00078         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00079 
00080         //  SDL_imageFilterAbsDiff: D = | S1 - S2 |
00081         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00082 
00083         //  SDL_imageFilterMult: D = saturation(S1 * S2)
00084         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00085 
00086         //  SDL_imageFilterMultNor: D = S1 * S2   (non-MMX)
00087         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00088 
00089         //  SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
00090         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
00091                 unsigned int length);
00092 
00093         //  SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
00094         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
00095                 unsigned int length);
00096 
00097         //  SDL_imageFilterBitAnd: D = S1 & S2
00098         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00099 
00100         //  SDL_imageFilterBitOr: D = S1 | S2
00101         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00102 
00103         //  SDL_imageFilterDiv: D = S1 / S2   (non-MMX)
00104         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00105 
00106         //  SDL_imageFilterBitNegation: D = !S
00107         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length);
00108 
00109         //  SDL_imageFilterAddByte: D = saturation255(S + C)
00110         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00111 
00112         //  SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
00113         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
00114 
00115         //  SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
00116         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00117                 unsigned char C);
00118 
00119         //  SDL_imageFilterSubByte: D = saturation0(S - C)
00120         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00121 
00122         //  SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
00123         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
00124 
00125         //  SDL_imageFilterShiftRight: D = saturation0(S >> N)
00126         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00127 
00128         //  SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
00129         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00130 
00131         //  SDL_imageFilterMultByByte: D = saturation255(S * C)
00132         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00133 
00134         //  SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
00135         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00136                 unsigned char N, unsigned char C);
00137 
00138         //  SDL_imageFilterShiftLeftByte: D = (S << N)
00139         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00140                 unsigned char N);
00141 
00142         //  SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
00143         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00144                 unsigned char N);
00145 
00146         //  SDL_imageFilterShiftLeft: D = saturation255(S << N)
00147         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00148 
00149         //  SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
00150         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00151                 unsigned char T);
00152 
00153         //  SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
00154         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00155                 unsigned char Tmin, unsigned char Tmax);
00156 
00157         //  SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
00158         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin,
00159                 int Cmax, int Nmin, int Nmax);
00160 
00161         /* Ends C function definitions when using C++ */
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165 
00166 #endif                          /* _SDL_imageFilter_h */
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__rotozoom_8c.html000077500000000000000000001633241226521303400223630ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_rotozoom.c File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_rotozoom.c File Reference
#include <stdlib.h>
#include <string.h>
#include "SDL2_rotozoom.h"

Go to the source code of this file.

Data Structures

struct  tColorRGBA
 A 32 bit RGBA pixel. More...
struct  tColorY
 A 8bit Y/palette pixel. More...

Defines

#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 Returns maximum of two numbers a and b.
#define GUARD_ROWS   (2)
 Number of guard rows added to destination surfaces.
#define VALUE_LIMIT   0.001
 Lower limit of absolute zoom factor or rotation degrees.

Typedefs

typedef struct tColorRGBA tColorRGBA
 A 32 bit RGBA pixel.
typedef struct tColorY tColorY
 A 8bit Y/palette pixel.

Functions

Uint32 _colorkey (SDL_Surface *src)
 Returns colorkey info for a surface.
int _shrinkSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
 Internal 32 bit integer-factor averaging Shrinker.
int _shrinkSurfaceY (SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
 Internal 8 bit integer-factor averaging shrinker.
int _zoomSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy, int smooth)
 Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.
int _zoomSurfaceY (SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy)
 Internal 8 bit Zoomer without smoothing.
void _transformSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
 Internal 32 bit rotozoomer with optional anti-aliasing.
void transformSurfaceY (SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
 Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.
SDL_Surface * rotateSurface90Degrees (SDL_Surface *src, int numClockwiseTurns)
 Rotates a 8/16/24/32 bit surface in increments of 90 degrees.
void _rotozoomSurfaceSizeTrig (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight, double *canglezoom, double *sanglezoom)
 Internal target surface sizing function for rotozooms with trig result return.
void rotozoomSurfaceSizeXY (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.
void rotozoomSurfaceSize (int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurface() call.
SDL_Surface * rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth)
 Rotates and zooms a surface and optional anti-aliasing.
SDL_Surface * rotozoomSurfaceXY (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)
 Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
void zoomSurfaceSize (int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Calculates the size of the target surface for a zoomSurface() call.
SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx, double zoomy, int smooth)
 Zoom a surface by independent horizontal and vertical factors with optional smoothing.
SDL_Surface * shrinkSurface (SDL_Surface *src, int factorx, int factory)
 Shrink a surface by an integer ratio using averaging.

Define Documentation

#define GUARD_ROWS   (2)

Number of guard rows added to destination surfaces.

This is a simple but effective workaround for observed issues. These rows allocate extra memory and are then hidden from the surface. Rows are added to the end of destination surfaces when they are allocated. This catches any potential overflows which seem to happen with just the right src image dimensions and scale/rotation and can lead to a situation where the program can segfault.

Definition at line 73 of file SDL2_rotozoom.c.

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Returns maximum of two numbers a and b.

Definition at line 61 of file SDL2_rotozoom.c.

#define VALUE_LIMIT   0.001

Lower limit of absolute zoom factor or rotation degrees.

Definition at line 78 of file SDL2_rotozoom.c.


Typedef Documentation

typedef struct tColorRGBA tColorRGBA

A 32 bit RGBA pixel.

typedef struct tColorY tColorY

A 8bit Y/palette pixel.


Function Documentation

Uint32 _colorkey ( SDL_Surface *  src)

Returns colorkey info for a surface.

Definition at line 83 of file SDL2_rotozoom.c.

void _rotozoomSurfaceSizeTrig ( int  width,
int  height,
double  angle,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight,
double *  canglezoom,
double *  sanglezoom 
)

Internal target surface sizing function for rotozooms with trig result return.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
dstwidthThe calculated width of the destination surface.
dstheightThe calculated height of the destination surface.
canglezoomThe sine of the angle adjusted by the zoom factor.
sanglezoomThe cosine of the angle adjusted by the zoom factor.

Definition at line 938 of file SDL2_rotozoom.c.

int _shrinkSurfaceRGBA ( SDL_Surface *  src,
SDL_Surface *  dst,
int  factorx,
int  factory 
)

Internal 32 bit integer-factor averaging Shrinker.

Shrinks 32 bit RGBA/ABGR 'src' surface to 'dst' surface. Averages color and alpha values values of src pixels to calculate dst pixels. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to shrink (input).
dstThe shrunken surface (output).
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
0 for success or -1 for error.

Definition at line 106 of file SDL2_rotozoom.c.

int _shrinkSurfaceY ( SDL_Surface *  src,
SDL_Surface *  dst,
int  factorx,
int  factory 
)

Internal 8 bit integer-factor averaging shrinker.

Shrinks 8bit Y 'src' surface to 'dst' surface. Averages color (brightness) values values of src pixels to calculate dst pixels. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to shrink (input).
dstThe shrunken surface (output).
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
0 for success or -1 for error.

Definition at line 194 of file SDL2_rotozoom.c.

void _transformSurfaceRGBA ( SDL_Surface *  src,
SDL_Surface *  dst,
int  cx,
int  cy,
int  isin,
int  icos,
int  flipx,
int  flipy,
int  smooth 
)

Internal 32 bit rotozoomer with optional anti-aliasing.

Rotates and zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control parameters by scanning the destination surface and applying optionally anti-aliasing by bilinear interpolation. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcSource surface.
dstDestination surface.
cxHorizontal center coordinate.
cyVertical center coordinate.
isinInteger version of sine of angle.
icosInteger version of cosine of angle.
flipxFlag indicating horizontal mirroring should be applied.
flipyFlag indicating vertical mirroring should be applied.
smoothFlag indicating anti-aliasing should be used.

Definition at line 629 of file SDL2_rotozoom.c.

int _zoomSurfaceRGBA ( SDL_Surface *  src,
SDL_Surface *  dst,
int  flipx,
int  flipy,
int  smooth 
)

Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.

Zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to zoom (input).
dstThe zoomed surface (output).
flipxFlag indicating if the image should be horizontally flipped.
flipyFlag indicating if the image should be vertically flipped.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
0 for success or -1 for error.

Definition at line 277 of file SDL2_rotozoom.c.

int _zoomSurfaceY ( SDL_Surface *  src,
SDL_Surface *  dst,
int  flipx,
int  flipy 
)

Internal 8 bit Zoomer without smoothing.

Zooms 8bit palette/Y 'src' surface to 'dst' surface. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to zoom (input).
dstThe zoomed surface (output).
flipxFlag indicating if the image should be horizontally flipped.
flipyFlag indicating if the image should be vertically flipped.
Returns:
0 for success or -1 for error.

Definition at line 510 of file SDL2_rotozoom.c.

SDL_Surface* rotateSurface90Degrees ( SDL_Surface *  src,
int  numClockwiseTurns 
)

Rotates a 8/16/24/32 bit surface in increments of 90 degrees.

Specialized 90 degree rotator which rotates a 'src' surface in 90 degree increments clockwise returning a new surface. Faster than rotozoomer since no scanning or interpolation takes place. Input surface must be 8/16/24/32 bit. (code contributed by J. Schiller, improved by C. Allport and A. Schiffler)

Parameters:
srcSource surface to rotate.
numClockwiseTurnsNumber of clockwise 90 degree turns to apply to the source.
Returns:
The new, rotated surface; or NULL for surfaces with incorrect input format.

Definition at line 803 of file SDL2_rotozoom.c.

SDL_Surface* rotozoomSurface ( SDL_Surface *  src,
double  angle,
double  zoom,
int  smooth 
)

Rotates and zooms a surface and optional anti-aliasing.

Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1019 of file SDL2_rotozoom.c.

void rotozoomSurfaceSize ( int  width,
int  height,
double  angle,
double  zoom,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurface() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 997 of file SDL2_rotozoom.c.

void rotozoomSurfaceSizeXY ( int  width,
int  height,
double  angle,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 980 of file SDL2_rotozoom.c.

SDL_Surface* rotozoomSurfaceXY ( SDL_Surface *  src,
double  angle,
double  zoomx,
double  zoomy,
int  smooth 
)

Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.

Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1040 of file SDL2_rotozoom.c.

SDL_Surface* shrinkSurface ( SDL_Surface *  src,
int  factorx,
int  factory 
)

Shrink a surface by an integer ratio using averaging.

Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface. 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, 3=1/3 the size, etc.) The destination surface is antialiased by averaging the source box RGBA or Y information. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. The input surface is not modified. The output surface is newly allocated.

Parameters:
srcThe surface to shrink.
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
The new, shrunken surface.

Definition at line 1496 of file SDL2_rotozoom.c.

void transformSurfaceY ( SDL_Surface *  src,
SDL_Surface *  dst,
int  cx,
int  cy,
int  isin,
int  icos,
int  flipx,
int  flipy 
)

Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.

Rotates and zooms 8 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control parameters by scanning the destination surface. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcSource surface.
dstDestination surface.
cxHorizontal center coordinate.
cyVertical center coordinate.
isinInteger version of sine of angle.
icosInteger version of cosine of angle.
flipxFlag indicating horizontal mirroring should be applied.
flipyFlag indicating vertical mirroring should be applied.

Definition at line 746 of file SDL2_rotozoom.c.

SDL_Surface* zoomSurface ( SDL_Surface *  src,
double  zoomx,
double  zoomy,
int  smooth 
)

Zoom a surface by independent horizontal and vertical factors with optional smoothing.

Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. If zoom factors are negative, the image is flipped on the axes.

Parameters:
srcThe surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new, zoomed surface.

Definition at line 1345 of file SDL2_rotozoom.c.

void zoomSurfaceSize ( int  width,
int  height,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Calculates the size of the target surface for a zoomSurface() call.

The minimum size of the target surface is 1. The input factors can be positive or negative.

Parameters:
widthThe width of the source surface to zoom.
heightThe height of the source surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
dstwidthPointer to an integer to store the calculated width of the zoomed target surface.
dstheightPointer to an integer to store the calculated height of the zoomed target surface.

Definition at line 1295 of file SDL2_rotozoom.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__rotozoom_8c_source.html000077500000000000000000004033631226521303400237430ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_rotozoom.c Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_rotozoom.c
Go to the documentation of this file.
00001 /*  
00002 
00003 SDL2_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
00004 
00005 Copyright (C) 2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifdef WIN32
00031 #include <windows.h>
00032 #endif
00033 
00034 #include <stdlib.h>
00035 #include <string.h>
00036 
00037 #include "SDL2_rotozoom.h"
00038 
00039 /* ---- Internally used structures */
00040 
00044 typedef struct tColorRGBA {
00045         Uint8 r;
00046         Uint8 g;
00047         Uint8 b;
00048         Uint8 a;
00049 } tColorRGBA;
00050 
00054 typedef struct tColorY {
00055         Uint8 y;
00056 } tColorY;
00057 
00061 #define MAX(a,b)    (((a) > (b)) ? (a) : (b))
00062 
00073 #define GUARD_ROWS (2)
00074 
00078 #define VALUE_LIMIT     0.001
00079 
00083 Uint32 _colorkey(SDL_Surface *src)
00084 {
00085         Uint32 key = 0; 
00086         SDL_GetColorKey(src, &key);
00087         return key;
00088 }
00089 
00090 
00106 int _shrinkSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory)
00107 {
00108         int x, y, dx, dy, dgap, ra, ga, ba, aa;
00109         int n_average;
00110         tColorRGBA *sp, *osp, *oosp;
00111         tColorRGBA *dp;
00112 
00113         /*
00114         * Averaging integer shrink
00115         */
00116 
00117         /* Precalculate division factor */
00118         n_average = factorx*factory;
00119 
00120         /*
00121         * Scan destination
00122         */
00123         sp = (tColorRGBA *) src->pixels;
00124         
00125         dp = (tColorRGBA *) dst->pixels;
00126         dgap = dst->pitch - dst->w * 4;
00127 
00128         for (y = 0; y < dst->h; y++) {
00129 
00130                 osp=sp;
00131                 for (x = 0; x < dst->w; x++) {
00132 
00133                         /* Trace out source box and accumulate */
00134                         oosp=sp;
00135                         ra=ga=ba=aa=0;
00136                         for (dy=0; dy < factory; dy++) {
00137                                 for (dx=0; dx < factorx; dx++) {
00138                                         ra += sp->r;
00139                                         ga += sp->g;
00140                                         ba += sp->b;
00141                                         aa += sp->a;
00142 
00143                                         sp++;
00144                                 } 
00145                                 /* src dx loop */
00146                                 sp = (tColorRGBA *)((Uint8*)sp + (src->pitch - 4*factorx)); // next y
00147                         }
00148                         /* src dy loop */
00149 
00150                         /* next box-x */
00151                         sp = (tColorRGBA *)((Uint8*)oosp + 4*factorx);
00152 
00153                         /* Store result in destination */
00154                         dp->r = ra/n_average;
00155                         dp->g = ga/n_average;
00156                         dp->b = ba/n_average;
00157                         dp->a = aa/n_average;
00158 
00159                         /*
00160                         * Advance destination pointer 
00161                         */
00162                         dp++;
00163                 } 
00164                 /* dst x loop */
00165 
00166                 /* next box-y */
00167                 sp = (tColorRGBA *)((Uint8*)osp + src->pitch*factory);
00168 
00169                 /*
00170                 * Advance destination pointers 
00171                 */
00172                 dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
00173         } 
00174         /* dst y loop */
00175 
00176         return (0);
00177 }
00178 
00194 int _shrinkSurfaceY(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory)
00195 {
00196         int x, y, dx, dy, dgap, a;
00197         int n_average;
00198         Uint8 *sp, *osp, *oosp;
00199         Uint8 *dp;
00200 
00201         /*
00202         * Averaging integer shrink
00203         */
00204 
00205         /* Precalculate division factor */
00206         n_average = factorx*factory;
00207 
00208         /*
00209         * Scan destination
00210         */
00211         sp = (Uint8 *) src->pixels;
00212 
00213         dp = (Uint8 *) dst->pixels;
00214         dgap = dst->pitch - dst->w;
00215 
00216         for (y = 0; y < dst->h; y++) {    
00217 
00218                 osp=sp;
00219                 for (x = 0; x < dst->w; x++) {
00220 
00221                         /* Trace out source box and accumulate */
00222                         oosp=sp;
00223                         a=0;
00224                         for (dy=0; dy < factory; dy++) {
00225                                 for (dx=0; dx < factorx; dx++) {
00226                                         a += (*sp);
00227                                         /* next x */           
00228                                         sp++;
00229                                 } 
00230                                 /* end src dx loop */         
00231                                 /* next y */
00232                                 sp = (Uint8 *)((Uint8*)sp + (src->pitch - factorx)); 
00233                         } 
00234                         /* end src dy loop */
00235 
00236                         /* next box-x */
00237                         sp = (Uint8 *)((Uint8*)oosp + factorx);
00238 
00239                         /* Store result in destination */
00240                         *dp = a/n_average;
00241 
00242                         /*
00243                         * Advance destination pointer 
00244                         */
00245                         dp++;
00246                 } 
00247                 /* end dst x loop */
00248 
00249                 /* next box-y */
00250                 sp = (Uint8 *)((Uint8*)osp + src->pitch*factory);
00251 
00252                 /*
00253                 * Advance destination pointers 
00254                 */
00255                 dp = (Uint8 *)((Uint8 *)dp + dgap);
00256         } 
00257         /* end dst y loop */
00258 
00259         return (0);
00260 }
00261 
00277 int _zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy, int smooth)
00278 {
00279         int x, y, sx, sy, ssx, ssy, *sax, *say, *csax, *csay, *salast, csx, csy, ex, ey, cx, cy, sstep, sstepx, sstepy;
00280         tColorRGBA *c00, *c01, *c10, *c11;
00281         tColorRGBA *sp, *csp, *dp;
00282         int spixelgap, spixelw, spixelh, dgap, t1, t2;
00283 
00284         /*
00285         * Allocate memory for row/column increments 
00286         */
00287         if ((sax = (int *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) {
00288                 return (-1);
00289         }
00290         if ((say = (int *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
00291                 free(sax);
00292                 return (-1);
00293         }
00294 
00295         /*
00296         * Precalculate row increments 
00297         */
00298         spixelw = (src->w - 1);
00299         spixelh = (src->h - 1);
00300         if (smooth) {
00301                 sx = (int) (65536.0 * (float) spixelw / (float) (dst->w - 1));
00302                 sy = (int) (65536.0 * (float) spixelh / (float) (dst->h - 1));
00303         } else {
00304                 sx = (int) (65536.0 * (float) (src->w) / (float) (dst->w));
00305                 sy = (int) (65536.0 * (float) (src->h) / (float) (dst->h));
00306         }
00307 
00308         /* Maximum scaled source size */
00309         ssx = (src->w << 16) - 1;
00310         ssy = (src->h << 16) - 1;
00311 
00312         /* Precalculate horizontal row increments */
00313         csx = 0;
00314         csax = sax;
00315         for (x = 0; x <= dst->w; x++) {
00316                 *csax = csx;
00317                 csax++;
00318                 csx += sx;
00319 
00320                 /* Guard from overflows */
00321                 if (csx > ssx) { 
00322                         csx = ssx; 
00323                 }
00324         }
00325 
00326         /* Precalculate vertical row increments */
00327         csy = 0;
00328         csay = say;
00329         for (y = 0; y <= dst->h; y++) {
00330                 *csay = csy;
00331                 csay++;
00332                 csy += sy;
00333 
00334                 /* Guard from overflows */
00335                 if (csy > ssy) {
00336                         csy = ssy;
00337                 }
00338         }
00339 
00340         sp = (tColorRGBA *) src->pixels;
00341         dp = (tColorRGBA *) dst->pixels;
00342         dgap = dst->pitch - dst->w * 4;
00343         spixelgap = src->pitch/4;
00344 
00345         if (flipx) sp += spixelw;
00346         if (flipy) sp += (spixelgap * spixelh);
00347 
00348         /*
00349         * Switch between interpolating and non-interpolating code 
00350         */
00351         if (smooth) {
00352 
00353                 /*
00354                 * Interpolating Zoom 
00355                 */
00356                 csay = say;
00357                 for (y = 0; y < dst->h; y++) {
00358                         csp = sp;
00359                         csax = sax;
00360                         for (x = 0; x < dst->w; x++) {
00361                                 /*
00362                                 * Setup color source pointers 
00363                                 */
00364                                 ex = (*csax & 0xffff);
00365                                 ey = (*csay & 0xffff);
00366                                 cx = (*csax >> 16);
00367                                 cy = (*csay >> 16);
00368                                 sstepx = cx < spixelw;
00369                                 sstepy = cy < spixelh;
00370                                 c00 = sp;
00371                                 c01 = sp;
00372                                 c10 = sp;
00373                                 if (sstepy) {
00374                                         if (flipy) {
00375                                                 c10 -= spixelgap;
00376                                         } else {
00377                                                 c10 += spixelgap;
00378                                         }
00379                                 }
00380                                 c11 = c10;
00381                                 if (sstepx) {
00382                                         if (flipx) {
00383                                                 c01--;
00384                                                 c11--;
00385                                         } else {
00386                                                 c01++;
00387                                                 c11++;
00388                                         }
00389                                 }
00390 
00391                                 /*
00392                                 * Draw and interpolate colors 
00393                                 */
00394                                 t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
00395                                 t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
00396                                 dp->r = (((t2 - t1) * ey) >> 16) + t1;
00397                                 t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
00398                                 t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
00399                                 dp->g = (((t2 - t1) * ey) >> 16) + t1;
00400                                 t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
00401                                 t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
00402                                 dp->b = (((t2 - t1) * ey) >> 16) + t1;
00403                                 t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
00404                                 t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
00405                                 dp->a = (((t2 - t1) * ey) >> 16) + t1;                          
00406                                 /*
00407                                 * Advance source pointer x
00408                                 */
00409                                 salast = csax;
00410                                 csax++;                         
00411                                 sstep = (*csax >> 16) - (*salast >> 16);
00412                                 if (flipx) {
00413                                         sp -= sstep;
00414                                 } else {
00415                                         sp += sstep;
00416                                 }
00417 
00418                                 /*
00419                                 * Advance destination pointer x
00420                                 */
00421                                 dp++;
00422                         }
00423                         /*
00424                         * Advance source pointer y
00425                         */
00426                         salast = csay;
00427                         csay++;
00428                         sstep = (*csay >> 16) - (*salast >> 16);
00429                         sstep *= spixelgap;
00430                         if (flipy) { 
00431                                 sp = csp - sstep;
00432                         } else {
00433                                 sp = csp + sstep;
00434                         }
00435 
00436                         /*
00437                         * Advance destination pointer y
00438                         */
00439                         dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
00440                 }
00441         } else {
00442                 /*
00443                 * Non-Interpolating Zoom 
00444                 */              
00445                 csay = say;
00446                 for (y = 0; y < dst->h; y++) {
00447                         csp = sp;
00448                         csax = sax;
00449                         for (x = 0; x < dst->w; x++) {
00450                                 /*
00451                                 * Draw 
00452                                 */
00453                                 *dp = *sp;
00454 
00455                                 /*
00456                                 * Advance source pointer x
00457                                 */
00458                                 salast = csax;
00459                                 csax++;                         
00460                                 sstep = (*csax >> 16) - (*salast >> 16);
00461                                 if (flipx) sstep = -sstep;
00462                                 sp += sstep;
00463 
00464                                 /*
00465                                 * Advance destination pointer x
00466                                 */
00467                                 dp++;
00468                         }
00469                         /*
00470                         * Advance source pointer y
00471                         */
00472                         salast = csay;
00473                         csay++;
00474                         sstep = (*csay >> 16) - (*salast >> 16);
00475                         sstep *= spixelgap;
00476                         if (flipy) sstep = -sstep;                      
00477                         sp = csp + sstep;
00478 
00479                         /*
00480                         * Advance destination pointer y
00481                         */
00482                         dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
00483                 }
00484         }
00485 
00486         /*
00487         * Remove temp arrays 
00488         */
00489         free(sax);
00490         free(say);
00491 
00492         return (0);
00493 }
00494 
00510 int _zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
00511 {
00512         int x, y;
00513         Uint32 *sax, *say, *csax, *csay;
00514         int csx, csy;
00515         Uint8 *sp, *dp, *csp;
00516         int dgap;
00517 
00518         /*
00519         * Allocate memory for row increments 
00520         */
00521         if ((sax = (Uint32 *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) {
00522                 return (-1);
00523         }
00524         if ((say = (Uint32 *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
00525                 free(sax);
00526                 return (-1);
00527         }
00528 
00529         /*
00530         * Pointer setup 
00531         */
00532         sp = csp = (Uint8 *) src->pixels;
00533         dp = (Uint8 *) dst->pixels;
00534         dgap = dst->pitch - dst->w;
00535 
00536         if (flipx) csp += (src->w-1);
00537         if (flipy) csp  = ( (Uint8*)csp + src->pitch*(src->h-1) );
00538 
00539         /*
00540         * Precalculate row increments 
00541         */
00542         csx = 0;
00543         csax = sax;
00544         for (x = 0; x < dst->w; x++) {
00545                 csx += src->w;
00546                 *csax = 0;
00547                 while (csx >= dst->w) {
00548                         csx -= dst->w;
00549                         (*csax)++;
00550                 }
00551                 (*csax) = (*csax) * (flipx ? -1 : 1);
00552                 csax++;
00553         }
00554         csy = 0;
00555         csay = say;
00556         for (y = 0; y < dst->h; y++) {
00557                 csy += src->h;
00558                 *csay = 0;
00559                 while (csy >= dst->h) {
00560                         csy -= dst->h;
00561                         (*csay)++;
00562                 }
00563                 (*csay) = (*csay) * (flipy ? -1 : 1);
00564                 csay++;
00565         }
00566 
00567         /*
00568         * Draw 
00569         */
00570         csay = say;
00571         for (y = 0; y < dst->h; y++) {
00572                 csax = sax;
00573                 sp = csp;
00574                 for (x = 0; x < dst->w; x++) {
00575                         /*
00576                         * Draw 
00577                         */
00578                         *dp = *sp;
00579                         /*
00580                         * Advance source pointers 
00581                         */
00582                         sp += (*csax);
00583                         csax++;
00584                         /*
00585                         * Advance destination pointer 
00586                         */
00587                         dp++;
00588                 }
00589                 /*
00590                 * Advance source pointer (for row) 
00591                 */
00592                 csp += ((*csay) * src->pitch);
00593                 csay++;
00594 
00595                 /*
00596                 * Advance destination pointers 
00597                 */
00598                 dp += dgap;
00599         }
00600 
00601         /*
00602         * Remove temp arrays 
00603         */
00604         free(sax);
00605         free(say);
00606 
00607         return (0);
00608 }
00609 
00629 void _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
00630 {
00631         int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
00632         tColorRGBA c00, c01, c10, c11, cswap;
00633         tColorRGBA *pc, *sp;
00634         int gap;
00635 
00636         /*
00637         * Variable setup 
00638         */
00639         xd = ((src->w - dst->w) << 15);
00640         yd = ((src->h - dst->h) << 15);
00641         ax = (cx << 16) - (icos * cx);
00642         ay = (cy << 16) - (isin * cx);
00643         sw = src->w - 1;
00644         sh = src->h - 1;
00645         pc = (tColorRGBA*) dst->pixels;
00646         gap = dst->pitch - dst->w * 4;
00647 
00648         /*
00649         * Switch between interpolating and non-interpolating code 
00650         */
00651         if (smooth) {
00652                 for (y = 0; y < dst->h; y++) {
00653                         dy = cy - y;
00654                         sdx = (ax + (isin * dy)) + xd;
00655                         sdy = (ay - (icos * dy)) + yd;
00656                         for (x = 0; x < dst->w; x++) {
00657                                 dx = (sdx >> 16);
00658                                 dy = (sdy >> 16);
00659                                 if (flipx) dx = sw - dx;
00660                                 if (flipy) dy = sh - dy;
00661                                 if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
00662                                         sp = (tColorRGBA *)src->pixels;;
00663                                         sp += ((src->pitch/4) * dy);
00664                                         sp += dx;
00665                                         c00 = *sp;
00666                                         sp += 1;
00667                                         c01 = *sp;
00668                                         sp += (src->pitch/4);
00669                                         c11 = *sp;
00670                                         sp -= 1;
00671                                         c10 = *sp;
00672                                         if (flipx) {
00673                                                 cswap = c00; c00=c01; c01=cswap;
00674                                                 cswap = c10; c10=c11; c11=cswap;
00675                                         }
00676                                         if (flipy) {
00677                                                 cswap = c00; c00=c10; c10=cswap;
00678                                                 cswap = c01; c01=c11; c11=cswap;
00679                                         }
00680                                         /*
00681                                         * Interpolate colors 
00682                                         */
00683                                         ex = (sdx & 0xffff);
00684                                         ey = (sdy & 0xffff);
00685                                         t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
00686                                         t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
00687                                         pc->r = (((t2 - t1) * ey) >> 16) + t1;
00688                                         t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
00689                                         t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
00690                                         pc->g = (((t2 - t1) * ey) >> 16) + t1;
00691                                         t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
00692                                         t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
00693                                         pc->b = (((t2 - t1) * ey) >> 16) + t1;
00694                                         t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
00695                                         t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
00696                                         pc->a = (((t2 - t1) * ey) >> 16) + t1;
00697                                 }
00698                                 sdx += icos;
00699                                 sdy += isin;
00700                                 pc++;
00701                         }
00702                         pc = (tColorRGBA *) ((Uint8 *) pc + gap);
00703                 }
00704         } else {
00705                 for (y = 0; y < dst->h; y++) {
00706                         dy = cy - y;
00707                         sdx = (ax + (isin * dy)) + xd;
00708                         sdy = (ay - (icos * dy)) + yd;
00709                         for (x = 0; x < dst->w; x++) {
00710                                 dx = (short) (sdx >> 16);
00711                                 dy = (short) (sdy >> 16);
00712                                 if (flipx) dx = (src->w-1)-dx;
00713                                 if (flipy) dy = (src->h-1)-dy;
00714                                 if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
00715                                         sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy);
00716                                         sp += dx;
00717                                         *pc = *sp;
00718                                 }
00719                                 sdx += icos;
00720                                 sdy += isin;
00721                                 pc++;
00722                         }
00723                         pc = (tColorRGBA *) ((Uint8 *) pc + gap);
00724                 }
00725         }
00726 }
00727 
00746 void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
00747 {
00748         int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay;
00749         tColorY *pc, *sp;
00750         int gap;
00751 
00752         /*
00753         * Variable setup 
00754         */
00755         xd = ((src->w - dst->w) << 15);
00756         yd = ((src->h - dst->h) << 15);
00757         ax = (cx << 16) - (icos * cx);
00758         ay = (cy << 16) - (isin * cx);
00759         pc = (tColorY*) dst->pixels;
00760         gap = dst->pitch - dst->w;
00761         /*
00762         * Clear surface to colorkey 
00763         */      
00764         memset(pc, (int)(_colorkey(src) & 0xff), dst->pitch * dst->h);
00765         /*
00766         * Iterate through destination surface 
00767         */
00768         for (y = 0; y < dst->h; y++) {
00769                 dy = cy - y;
00770                 sdx = (ax + (isin * dy)) + xd;
00771                 sdy = (ay - (icos * dy)) + yd;
00772                 for (x = 0; x < dst->w; x++) {
00773                         dx = (short) (sdx >> 16);
00774                         dy = (short) (sdy >> 16);
00775                         if (flipx) dx = (src->w-1)-dx;
00776                         if (flipy) dy = (src->h-1)-dy;
00777                         if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
00778                                 sp = (tColorY *) (src->pixels);
00779                                 sp += (src->pitch * dy + dx);
00780                                 *pc = *sp;
00781                         }
00782                         sdx += icos;
00783                         sdy += isin;
00784                         pc++;
00785                 }
00786                 pc += gap;
00787         }
00788 }
00789 
00803 SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns) 
00804 {
00805         int row, col, newWidth, newHeight;
00806         int bpp;
00807         SDL_Surface* dst;
00808         Uint8* srcBuf;
00809         Uint8* dstBuf;
00810 
00811         /* Has to be a valid surface pointer and be a 8/16/24/32-bit surface */
00812         if (!src || !src->format ||
00813                  !(src->format->BitsPerPixel == 8) || 
00814                   (src->format->BitsPerPixel == 16) ||
00815                   (src->format->BitsPerPixel == 24) ||
00816                   (src->format->BitsPerPixel == 32)) { return NULL; }
00817 
00818         /* normalize numClockwiseTurns */
00819         while(numClockwiseTurns < 0) { numClockwiseTurns += 4; }
00820         numClockwiseTurns = (numClockwiseTurns % 4);
00821 
00822         /* if it's even, our new width will be the same as the source surface */
00823         newWidth = (numClockwiseTurns % 2) ? (src->h) : (src->w);
00824         newHeight = (numClockwiseTurns % 2) ? (src->w) : (src->h);
00825         dst = SDL_CreateRGBSurface( src->flags, newWidth, newHeight, src->format->BitsPerPixel,
00826                 src->format->Rmask,
00827                 src->format->Gmask, 
00828                 src->format->Bmask, 
00829                 src->format->Amask);
00830         if(!dst) {
00831                 return NULL;
00832         }
00833 
00834         if (SDL_MUSTLOCK(src)) {
00835                 SDL_LockSurface(src);
00836         }
00837         if (SDL_MUSTLOCK(dst)) {
00838                 SDL_LockSurface(dst);
00839         }
00840 
00841         /* Calculate byte-per-pixel */
00842         bpp = src->format->BitsPerPixel / 8;
00843 
00844         switch(numClockwiseTurns) {
00845         case 0: /* Make a copy of the surface */
00846                 {
00847                         /* Unfortunately SDL_BlitSurface cannot be used to make a copy of the surface
00848                         since it does not preserve alpha. */
00849 
00850                         if (src->pitch == dst->pitch) {
00851                                 /* If the pitch is the same for both surfaces, the memory can be copied all at once. */
00852                                 memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
00853                         }
00854                         else
00855                         {
00856                                 /* If the pitch differs, copy each row separately */
00857                                 srcBuf = (Uint8*)(src->pixels);
00858                                 dstBuf = (Uint8*)(dst->pixels);
00859                                 for (row = 0; row < src->h; row++) {
00860                                         memcpy(dstBuf, srcBuf, dst->w * bpp);
00861                                         srcBuf += src->pitch;
00862                                         dstBuf += dst->pitch;
00863                                 } /* end for(col) */
00864                         } /* end for(row) */
00865                 }
00866                 break;
00867 
00868                 /* rotate clockwise */
00869         case 1: /* rotated 90 degrees clockwise */
00870                 {
00871                         for (row = 0; row < src->h; ++row) {
00872                                 srcBuf = (Uint8*)(src->pixels) + (row * src->pitch);
00873                                 dstBuf = (Uint8*)(dst->pixels) + (dst->w - row - 1) * bpp;
00874                                 for (col = 0; col < src->w; ++col) {
00875                                         memcpy (dstBuf, srcBuf, bpp);
00876                                         srcBuf += bpp;
00877                                         dstBuf += dst->pitch;
00878                                 } 
00879                         } 
00880                 }
00881                 break;
00882 
00883         case 2: /* rotated 180 degrees clockwise */
00884                 {
00885                         for (row = 0; row < src->h; ++row) {
00886                                 srcBuf = (Uint8*)(src->pixels) + (row * src->pitch);
00887                                 dstBuf = (Uint8*)(dst->pixels) + ((dst->h - row - 1) * dst->pitch) + (dst->w - 1) * bpp;
00888                                 for (col = 0; col < src->w; ++col) {
00889                                         memcpy (dstBuf, srcBuf, bpp);
00890                                         srcBuf += bpp;
00891                                         dstBuf -= bpp;
00892                                 } 
00893                         } 
00894                 }
00895                 break;
00896 
00897         case 3: /* rotated 270 degrees clockwise */
00898                 {
00899                         for (row = 0; row < src->h; ++row) {
00900                                 srcBuf = (Uint8*)(src->pixels) + (row * src->pitch);
00901                                 dstBuf = (Uint8*)(dst->pixels) + row + ((dst->h - 1) * dst->pitch);
00902                                 for (col = 0; col < src->w; ++col) {
00903                                         *dstBuf = *srcBuf;
00904                                         srcBuf += bpp;
00905                                         dstBuf -= dst->pitch;
00906                                 } 
00907                         } 
00908                 }
00909                 break;
00910         } 
00911         /* end switch */
00912 
00913         if (SDL_MUSTLOCK(src)) {
00914                 SDL_UnlockSurface(src);
00915         }
00916         if (SDL_MUSTLOCK(dst)) {
00917                 SDL_UnlockSurface(dst);
00918         }
00919 
00920         return dst;
00921 }
00922 
00923 
00938 void _rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, 
00939         int *dstwidth, int *dstheight, 
00940         double *canglezoom, double *sanglezoom)
00941 {
00942         double x, y, cx, cy, sx, sy;
00943         double radangle;
00944         int dstwidthhalf, dstheighthalf;
00945 
00946         /*
00947         * Determine destination width and height by rotating a centered source box 
00948         */
00949         radangle = angle * (M_PI / 180.0);
00950         *sanglezoom = sin(radangle);
00951         *canglezoom = cos(radangle);
00952         *sanglezoom *= zoomx;
00953         *canglezoom *= zoomx;
00954         x = (double)(width / 2);
00955         y = (double)(height / 2);
00956         cx = *canglezoom * x;
00957         cy = *canglezoom * y;
00958         sx = *sanglezoom * x;
00959         sy = *sanglezoom * y;
00960 
00961         dstwidthhalf = MAX((int)
00962                 ceil(MAX(MAX(MAX(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1);
00963         dstheighthalf = MAX((int)
00964                 ceil(MAX(MAX(MAX(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1);
00965         *dstwidth = 2 * dstwidthhalf;
00966         *dstheight = 2 * dstheighthalf;
00967 }
00968 
00980 void rotozoomSurfaceSizeXY(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
00981 {
00982         double dummy_sanglezoom, dummy_canglezoom;
00983 
00984         _rotozoomSurfaceSizeTrig(width, height, angle, zoomx, zoomy, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
00985 }
00986 
00997 void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
00998 {
00999         double dummy_sanglezoom, dummy_canglezoom;
01000 
01001         _rotozoomSurfaceSizeTrig(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
01002 }
01003 
01019 SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth)
01020 {
01021         return rotozoomSurfaceXY(src, angle, zoom, zoom, smooth);
01022 }
01023 
01040 SDL_Surface *rotozoomSurfaceXY(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth)
01041 {
01042         SDL_Surface *rz_src;
01043         SDL_Surface *rz_dst;
01044         double zoominv;
01045         double sanglezoom, canglezoom, sanglezoominv, canglezoominv;
01046         int dstwidthhalf, dstwidth, dstheighthalf, dstheight;
01047         int is32bit;
01048         int i, src_converted;
01049         int flipx,flipy;
01050 
01051         /*
01052         * Sanity check 
01053         */
01054         if (src == NULL) {
01055                 return (NULL);
01056         }
01057 
01058         /*
01059         * Determine if source surface is 32bit or 8bit 
01060         */
01061         is32bit = (src->format->BitsPerPixel == 32);
01062         if ((is32bit) || (src->format->BitsPerPixel == 8)) {
01063                 /*
01064                 * Use source surface 'as is' 
01065                 */
01066                 rz_src = src;
01067                 src_converted = 0;
01068         } else {
01069                 /*
01070                 * New source surface is 32bit with a defined RGBA ordering 
01071                 */
01072                 rz_src =
01073                         SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 
01074 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
01075                         0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
01076 #else
01077                         0xff000000,  0x00ff0000, 0x0000ff00, 0x000000ff
01078 #endif
01079                         );
01080 
01081                 SDL_BlitSurface(src, NULL, rz_src, NULL);
01082 
01083                 src_converted = 1;
01084                 is32bit = 1;
01085         }
01086 
01087         /*
01088         * Sanity check zoom factor 
01089         */
01090         flipx = (zoomx<0.0);
01091         if (flipx) zoomx=-zoomx;
01092         flipy = (zoomy<0.0);
01093         if (flipy) zoomy=-zoomy;
01094         if (zoomx < VALUE_LIMIT) zoomx = VALUE_LIMIT;
01095         if (zoomy < VALUE_LIMIT) zoomy = VALUE_LIMIT;
01096         zoominv = 65536.0 / (zoomx * zoomx);
01097 
01098         /*
01099         * Check if we have a rotozoom or just a zoom 
01100         */
01101         if (fabs(angle) > VALUE_LIMIT) {
01102 
01103                 /*
01104                 * Angle!=0: full rotozoom 
01105                 */
01106                 /*
01107                 * ----------------------- 
01108                 */
01109 
01110                 /* Determine target size */
01111                 _rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, zoomx, zoomy, &dstwidth, &dstheight, &canglezoom, &sanglezoom);
01112 
01113                 /*
01114                 * Calculate target factors from sin/cos and zoom 
01115                 */
01116                 sanglezoominv = sanglezoom;
01117                 canglezoominv = canglezoom;
01118                 sanglezoominv *= zoominv;
01119                 canglezoominv *= zoominv;
01120 
01121                 /* Calculate half size */
01122                 dstwidthhalf = dstwidth / 2;
01123                 dstheighthalf = dstheight / 2;
01124 
01125                 /*
01126                 * Alloc space to completely contain the rotated surface 
01127                 */
01128                 rz_dst = NULL;
01129                 if (is32bit) {
01130                         /*
01131                         * Target surface is 32bit with source RGBA/ABGR ordering 
01132                         */
01133                         rz_dst =
01134                                 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01135                                 rz_src->format->Rmask, rz_src->format->Gmask,
01136                                 rz_src->format->Bmask, rz_src->format->Amask);
01137                 } else {
01138                         /*
01139                         * Target surface is 8bit 
01140                         */
01141                         rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01142                 }
01143 
01144                 /* Check target */
01145                 if (rz_dst == NULL)
01146                         return NULL;
01147 
01148                 /* Adjust for guard rows */
01149                 rz_dst->h = dstheight;
01150 
01151                 /*
01152                 * Lock source surface 
01153                 */
01154                 if (SDL_MUSTLOCK(rz_src)) {
01155                         SDL_LockSurface(rz_src);
01156                 }
01157 
01158                 /*
01159                 * Check which kind of surface we have 
01160                 */
01161                 if (is32bit) {
01162                         /*
01163                         * Call the 32bit transformation routine to do the rotation (using alpha) 
01164                         */
01165                         _transformSurfaceRGBA(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
01166                                 (int) (sanglezoominv), (int) (canglezoominv), 
01167                                 flipx, flipy,
01168                                 smooth);
01169                 } else {
01170                         /*
01171                         * Copy palette and colorkey info 
01172                         */
01173                         for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01174                                 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01175                         }
01176                         rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01177                         /*
01178                         * Call the 8bit transformation routine to do the rotation 
01179                         */
01180                         transformSurfaceY(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
01181                                 (int) (sanglezoominv), (int) (canglezoominv),
01182                                 flipx, flipy);
01183                 }
01184                 /*
01185                 * Unlock source surface 
01186                 */
01187                 if (SDL_MUSTLOCK(rz_src)) {
01188                         SDL_UnlockSurface(rz_src);
01189                 }
01190 
01191         } else {
01192 
01193                 /*
01194                 * Angle=0: Just a zoom 
01195                 */
01196                 /*
01197                 * -------------------- 
01198                 */
01199 
01200                 /*
01201                 * Calculate target size
01202                 */
01203                 zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
01204 
01205                 /*
01206                 * Alloc space to completely contain the zoomed surface 
01207                 */
01208                 rz_dst = NULL;
01209                 if (is32bit) {
01210                         /*
01211                         * Target surface is 32bit with source RGBA/ABGR ordering 
01212                         */
01213                         rz_dst =
01214                                 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01215                                 rz_src->format->Rmask, rz_src->format->Gmask,
01216                                 rz_src->format->Bmask, rz_src->format->Amask);
01217                 } else {
01218                         /*
01219                         * Target surface is 8bit 
01220                         */
01221                         rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01222                 }
01223 
01224                 /* Check target */
01225                 if (rz_dst == NULL)
01226                         return NULL;
01227 
01228                 /* Adjust for guard rows */
01229                 rz_dst->h = dstheight;
01230 
01231                 /*
01232                 * Lock source surface 
01233                 */
01234                 if (SDL_MUSTLOCK(rz_src)) {
01235                         SDL_LockSurface(rz_src);
01236                 }
01237 
01238                 /*
01239                 * Check which kind of surface we have 
01240                 */
01241                 if (is32bit) {
01242                         /*
01243                         * Call the 32bit transformation routine to do the zooming (using alpha) 
01244                         */
01245                         _zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth);
01246 
01247                 } else {
01248                         /*
01249                         * Copy palette and colorkey info 
01250                         */
01251                         for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01252                                 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01253                         }
01254                         rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01255 
01256                         /*
01257                         * Call the 8bit transformation routine to do the zooming 
01258                         */
01259                         _zoomSurfaceY(rz_src, rz_dst, flipx, flipy);
01260                 }
01261 
01262                 /*
01263                 * Unlock source surface 
01264                 */
01265                 if (SDL_MUSTLOCK(rz_src)) {
01266                         SDL_UnlockSurface(rz_src);
01267                 }
01268         }
01269 
01270         /*
01271         * Cleanup temp surface 
01272         */
01273         if (src_converted) {
01274                 SDL_FreeSurface(rz_src);
01275         }
01276 
01277         /*
01278         * Return destination surface 
01279         */
01280         return (rz_dst);
01281 }
01282 
01295 void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
01296 {
01297         /*
01298         * Make zoom factors positive 
01299         */
01300         int flipx, flipy;
01301         flipx = (zoomx<0.0);
01302         if (flipx) zoomx = -zoomx;
01303         flipy = (zoomy<0.0);
01304         if (flipy) zoomy = -zoomy;
01305 
01306         /*
01307         * Sanity check zoom factors 
01308         */
01309         if (zoomx < VALUE_LIMIT) {
01310                 zoomx = VALUE_LIMIT;
01311         }
01312         if (zoomy < VALUE_LIMIT) {
01313                 zoomy = VALUE_LIMIT;
01314         }
01315 
01316         /*
01317         * Calculate target size 
01318         */
01319         *dstwidth = (int) floor(((double) width * zoomx) + 0.5);
01320         *dstheight = (int) floor(((double) height * zoomy) + 0.5);
01321         if (*dstwidth < 1) {
01322                 *dstwidth = 1;
01323         }
01324         if (*dstheight < 1) {
01325                 *dstheight = 1;
01326         }
01327 }
01328 
01345 SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth)
01346 {
01347         SDL_Surface *rz_src;
01348         SDL_Surface *rz_dst;
01349         int dstwidth, dstheight;
01350         int is32bit;
01351         int i, src_converted;
01352         int flipx, flipy;
01353 
01354         /*
01355         * Sanity check 
01356         */
01357         if (src == NULL)
01358                 return (NULL);
01359 
01360         /*
01361         * Determine if source surface is 32bit or 8bit 
01362         */
01363         is32bit = (src->format->BitsPerPixel == 32);
01364         if ((is32bit) || (src->format->BitsPerPixel == 8)) {
01365                 /*
01366                 * Use source surface 'as is' 
01367                 */
01368                 rz_src = src;
01369                 src_converted = 0;
01370         } else {
01371                 /*
01372                 * New source surface is 32bit with a defined RGBA ordering 
01373                 */
01374                 rz_src =
01375                         SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 
01376 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
01377                         0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
01378 #else
01379                         0xff000000,  0x00ff0000, 0x0000ff00, 0x000000ff
01380 #endif
01381                         );
01382                 if (rz_src == NULL) {
01383                         return NULL;
01384                 }
01385                 SDL_BlitSurface(src, NULL, rz_src, NULL);
01386                 src_converted = 1;
01387                 is32bit = 1;
01388         }
01389 
01390         flipx = (zoomx<0.0);
01391         if (flipx) zoomx = -zoomx;
01392         flipy = (zoomy<0.0);
01393         if (flipy) zoomy = -zoomy;
01394 
01395         /* Get size if target */
01396         zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
01397 
01398         /*
01399         * Alloc space to completely contain the zoomed surface 
01400         */
01401         rz_dst = NULL;
01402         if (is32bit) {
01403                 /*
01404                 * Target surface is 32bit with source RGBA/ABGR ordering 
01405                 */
01406                 rz_dst =
01407                         SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01408                         rz_src->format->Rmask, rz_src->format->Gmask,
01409                         rz_src->format->Bmask, rz_src->format->Amask);
01410         } else {
01411                 /*
01412                 * Target surface is 8bit 
01413                 */
01414                 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01415         }
01416 
01417         /* Check target */
01418         if (rz_dst == NULL) {
01419                 /*
01420                 * Cleanup temp surface 
01421                 */
01422                 if (src_converted) {
01423                         SDL_FreeSurface(rz_src);
01424                 }               
01425                 return NULL;
01426         }
01427 
01428         /* Adjust for guard rows */
01429         rz_dst->h = dstheight;
01430 
01431         /*
01432         * Lock source surface 
01433         */
01434         if (SDL_MUSTLOCK(rz_src)) {
01435                 SDL_LockSurface(rz_src);
01436         }
01437 
01438         /*
01439         * Check which kind of surface we have 
01440         */
01441         if (is32bit) {
01442                 /*
01443                 * Call the 32bit transformation routine to do the zooming (using alpha) 
01444                 */
01445                 _zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth);
01446         } else {
01447                 /*
01448                 * Copy palette and colorkey info 
01449                 */
01450                 for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01451                         rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01452                 }
01453                 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01454                 /*
01455                 * Call the 8bit transformation routine to do the zooming 
01456                 */
01457                 _zoomSurfaceY(rz_src, rz_dst, flipx, flipy);
01458         }
01459         /*
01460         * Unlock source surface 
01461         */
01462         if (SDL_MUSTLOCK(rz_src)) {
01463                 SDL_UnlockSurface(rz_src);
01464         }
01465 
01466         /*
01467         * Cleanup temp surface 
01468         */
01469         if (src_converted) {
01470                 SDL_FreeSurface(rz_src);
01471         }
01472 
01473         /*
01474         * Return destination surface 
01475         */
01476         return (rz_dst);
01477 }
01478 
01495 /*@null@*/ 
01496 SDL_Surface *shrinkSurface(SDL_Surface *src, int factorx, int factory)
01497 {
01498         int result;
01499         SDL_Surface *rz_src;
01500         SDL_Surface *rz_dst = NULL;
01501         int dstwidth, dstheight;
01502         int is32bit;
01503         int i, src_converted;
01504         int haveError = 0;
01505 
01506         /*
01507         * Sanity check 
01508         */
01509         if (src == NULL) {
01510                 return (NULL);
01511         }
01512 
01513         /*
01514         * Determine if source surface is 32bit or 8bit 
01515         */
01516         is32bit = (src->format->BitsPerPixel == 32);
01517         if ((is32bit) || (src->format->BitsPerPixel == 8)) {
01518                 /*
01519                 * Use source surface 'as is' 
01520                 */
01521                 rz_src = src;
01522                 src_converted = 0;
01523         } else {
01524                 /*
01525                 * New source surface is 32bit with a defined RGBA ordering 
01526                 */
01527                 rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 
01528 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
01529                         0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
01530 #else
01531                         0xff000000,  0x00ff0000, 0x0000ff00, 0x000000ff
01532 #endif
01533                         );
01534                 if (rz_src==NULL) {
01535                         haveError = 1;
01536                         goto exitShrinkSurface;
01537                 }
01538 
01539                 SDL_BlitSurface(src, NULL, rz_src, NULL);
01540                 src_converted = 1;
01541                 is32bit = 1;
01542         }
01543 
01544         /*
01545         * Lock the surface 
01546         */
01547         if (SDL_MUSTLOCK(rz_src)) {
01548                 if (SDL_LockSurface(rz_src) < 0) {
01549                         haveError = 1;
01550                         goto exitShrinkSurface;
01551                 }
01552         }
01553 
01554         /* Get size for target */
01555         dstwidth=rz_src->w/factorx;
01556         while (dstwidth*factorx>rz_src->w) { dstwidth--; }
01557         dstheight=rz_src->h/factory;
01558         while (dstheight*factory>rz_src->h) { dstheight--; }
01559 
01560         /*
01561         * Alloc space to completely contain the shrunken surface
01562         * (with added guard rows)
01563         */
01564         if (is32bit==1) {
01565                 /*
01566                 * Target surface is 32bit with source RGBA/ABGR ordering 
01567                 */
01568                 rz_dst =
01569                         SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01570                         rz_src->format->Rmask, rz_src->format->Gmask,
01571                         rz_src->format->Bmask, rz_src->format->Amask);
01572         } else {
01573                 /*
01574                 * Target surface is 8bit 
01575                 */
01576                 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01577         }
01578 
01579         /* Check target */
01580         if (rz_dst == NULL) {
01581                 haveError = 1;
01582                 goto exitShrinkSurface;
01583         }
01584 
01585         /* Adjust for guard rows */
01586         rz_dst->h = dstheight;
01587 
01588         /*
01589         * Check which kind of surface we have 
01590         */
01591         if (is32bit==1) {
01592                 /*
01593                 * Call the 32bit transformation routine to do the shrinking (using alpha) 
01594                 */
01595                 result = _shrinkSurfaceRGBA(rz_src, rz_dst, factorx, factory);          
01596                 if ((result!=0) || (rz_dst==NULL)) {
01597                         haveError = 1;
01598                         goto exitShrinkSurface;
01599                 }
01600         } else {
01601                 /*
01602                 * Copy palette and colorkey info 
01603                 */
01604                 for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01605                         rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01606                 }
01607                 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01608                 /*
01609                 * Call the 8bit transformation routine to do the shrinking 
01610                 */
01611                 result = _shrinkSurfaceY(rz_src, rz_dst, factorx, factory);
01612                 if (result!=0) {
01613                         haveError = 1;
01614                         goto exitShrinkSurface;
01615                 }
01616         }
01617 
01618 exitShrinkSurface:
01619         if (rz_src!=NULL) {
01620                 /*
01621                 * Unlock source surface 
01622                 */
01623                 if (SDL_MUSTLOCK(rz_src)) {
01624                         SDL_UnlockSurface(rz_src);
01625                 }
01626 
01627                 /*
01628                 * Cleanup temp surface 
01629                 */
01630                 if (src_converted==1) {
01631                         SDL_FreeSurface(rz_src);
01632                 }
01633         }
01634 
01635         /* Check error state; maybe need to cleanup destination */
01636         if (haveError==1) {
01637                 if (rz_dst!=NULL) {
01638                         SDL_FreeSurface(rz_dst);
01639                 }
01640                 rz_dst=NULL;
01641         } 
01642 
01643         /*
01644         * Return destination surface 
01645         */
01646         return (rz_dst);
01647 }
libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__rotozoom_8h.html000077500000000000000000001002631226521303400223610ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_rotozoom.h File Reference
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_rotozoom.h File Reference
#include <math.h>
#include "SDL.h"

Go to the source code of this file.

Defines

#define M_PI   3.1415926535897932384626433832795
#define SMOOTHING_OFF   0
 Disable anti-aliasing (no smoothing).
#define SMOOTHING_ON   1
 Enable anti-aliasing (smoothing).
#define SDL2_ROTOZOOM_SCOPE   extern

Functions

SDL2_ROTOZOOM_SCOPE SDL_Surface * rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth)
 Rotates and zooms a surface and optional anti-aliasing.
SDL2_ROTOZOOM_SCOPE SDL_Surface * rotozoomSurfaceXY (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)
 Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSize (int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurface() call.
SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.
SDL2_ROTOZOOM_SCOPE SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx, double zoomy, int smooth)
 Zoom a surface by independent horizontal and vertical factors with optional smoothing.
SDL2_ROTOZOOM_SCOPE void zoomSurfaceSize (int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Calculates the size of the target surface for a zoomSurface() call.
SDL2_ROTOZOOM_SCOPE SDL_Surface * shrinkSurface (SDL_Surface *src, int factorx, int factory)
 Shrink a surface by an integer ratio using averaging.
SDL2_ROTOZOOM_SCOPE SDL_Surface * rotateSurface90Degrees (SDL_Surface *src, int numClockwiseTurns)
 Rotates a 8/16/24/32 bit surface in increments of 90 degrees.

Define Documentation

#define M_PI   3.1415926535897932384626433832795

Definition at line 41 of file SDL2_rotozoom.h.

#define SDL2_ROTOZOOM_SCOPE   extern

Definition at line 70 of file SDL2_rotozoom.h.

#define SMOOTHING_OFF   0

Disable anti-aliasing (no smoothing).

Definition at line 51 of file SDL2_rotozoom.h.

#define SMOOTHING_ON   1

Enable anti-aliasing (smoothing).

Definition at line 56 of file SDL2_rotozoom.h.


Function Documentation

SDL2_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees ( SDL_Surface *  src,
int  numClockwiseTurns 
)

Rotates a 8/16/24/32 bit surface in increments of 90 degrees.

Specialized 90 degree rotator which rotates a 'src' surface in 90 degree increments clockwise returning a new surface. Faster than rotozoomer since no scanning or interpolation takes place. Input surface must be 8/16/24/32 bit. (code contributed by J. Schiller, improved by C. Allport and A. Schiffler)

Parameters:
srcSource surface to rotate.
numClockwiseTurnsNumber of clockwise 90 degree turns to apply to the source.
Returns:
The new, rotated surface; or NULL for surfaces with incorrect input format.

Definition at line 803 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE SDL_Surface* rotozoomSurface ( SDL_Surface *  src,
double  angle,
double  zoom,
int  smooth 
)

Rotates and zooms a surface and optional anti-aliasing.

Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1019 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSize ( int  width,
int  height,
double  angle,
double  zoom,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurface() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 997 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY ( int  width,
int  height,
double  angle,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 980 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE SDL_Surface* rotozoomSurfaceXY ( SDL_Surface *  src,
double  angle,
double  zoomx,
double  zoomy,
int  smooth 
)

Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.

Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1040 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE SDL_Surface* shrinkSurface ( SDL_Surface *  src,
int  factorx,
int  factory 
)

Shrink a surface by an integer ratio using averaging.

Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface. 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, 3=1/3 the size, etc.) The destination surface is antialiased by averaging the source box RGBA or Y information. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. The input surface is not modified. The output surface is newly allocated.

Parameters:
srcThe surface to shrink.
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
The new, shrunken surface.

Definition at line 1496 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE SDL_Surface* zoomSurface ( SDL_Surface *  src,
double  zoomx,
double  zoomy,
int  smooth 
)

Zoom a surface by independent horizontal and vertical factors with optional smoothing.

Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. If zoom factors are negative, the image is flipped on the axes.

Parameters:
srcThe surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new, zoomed surface.

Definition at line 1345 of file SDL2_rotozoom.c.

SDL2_ROTOZOOM_SCOPE void zoomSurfaceSize ( int  width,
int  height,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Calculates the size of the target surface for a zoomSurface() call.

The minimum size of the target surface is 1. The input factors can be positive or negative.

Parameters:
widthThe width of the source surface to zoom.
heightThe height of the source surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
dstwidthPointer to an integer to store the calculated width of the zoomed target surface.
dstheightPointer to an integer to store the calculated height of the zoomed target surface.

Definition at line 1295 of file SDL2_rotozoom.c.

libsdl2-gfx-1.0.0/Docs/html/_s_d_l2__rotozoom_8h_source.html000077500000000000000000000355051226521303400237470ustar00rootroot00000000000000 SDL2_gfx: I:/Sources/sdl2gfx/SDL2_rotozoom.h Source File
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_rotozoom.h
Go to the documentation of this file.
00001 /*  
00002 
00003 SDL2_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL2_rotozoom_h
00031 #define _SDL2_rotozoom_h
00032 
00033 #include <math.h>
00034 
00035 /* Set up for C function definitions, even when using C++ */
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #ifndef M_PI
00041 #define M_PI    3.1415926535897932384626433832795
00042 #endif
00043 
00044 #include "SDL.h"
00045 
00046         /* ---- Defines */
00047 
00051 #define SMOOTHING_OFF           0
00052 
00056 #define SMOOTHING_ON            1
00057 
00058         /* ---- Function Prototypes */
00059 
00060 #ifdef _MSC_VER
00061 #  if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)
00062 #    define SDL2_ROTOZOOM_SCOPE __declspec(dllexport)
00063 #  else
00064 #    ifdef LIBSDL2_GFX_DLL_IMPORT
00065 #      define SDL2_ROTOZOOM_SCOPE __declspec(dllimport)
00066 #    endif
00067 #  endif
00068 #endif
00069 #ifndef SDL2_ROTOZOOM_SCOPE
00070 #  define SDL2_ROTOZOOM_SCOPE extern
00071 #endif
00072 
00073         /* 
00074 
00075         Rotozoom functions
00076 
00077         */
00078 
00079         SDL2_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
00080 
00081         SDL2_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY
00082                 (SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth);
00083 
00084 
00085         SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
00086                 int *dstheight);
00087 
00088         SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY
00089                 (int width, int height, double angle, double zoomx, double zoomy, 
00090                 int *dstwidth, int *dstheight);
00091 
00092         /* 
00093 
00094         Zooming functions
00095 
00096         */
00097 
00098         SDL2_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
00099 
00100         SDL2_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
00101 
00102         /* 
00103 
00104         Shrinking functions
00105 
00106         */     
00107 
00108         SDL2_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory);
00109 
00110         /* 
00111 
00112         Specialized rotation functions
00113 
00114         */
00115 
00116         SDL2_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns);
00117 
00118         /* Ends C function definitions when using C++ */
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122 
00123 #endif                          /* _SDL2_rotozoom_h */
libsdl2-gfx-1.0.0/Docs/html/annotated.html000077500000000000000000000056121226521303400203310ustar00rootroot00000000000000 SDL2_gfx: Data Structures
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Data Structures
Here are the data structures with brief descriptions:
FPSmanagerStructure holding the state and timing information of the framerate controller
SDL2_gfxBresenhamIteratorThe structure passed to the internal Bresenham iterator
SDL2_gfxMurphyIteratorThe structure passed to the internal Murphy iterator
tColorRGBAA 32 bit RGBA pixel
tColorYA 8bit Y/palette pixel
libsdl2-gfx-1.0.0/Docs/html/bc_s.png000077500000000000000000000013011226521303400170710ustar00rootroot00000000000000‰PNG  IHDR /ð9ЈIDATxíÝÝK“Qðï9ÏÙö SDL2_gfx: Data Structure Index
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Data Structure Index
F | S | T
  F  
  S  
SDL2_gfxMurphyIterator   tColorY   
  T  
FPSmanager   SDL2_gfxBresenhamIterator   
tColorRGBA   
F | S | T
libsdl2-gfx-1.0.0/Docs/html/closed.png000077500000000000000000000001761226521303400174450ustar00rootroot00000000000000‰PNG  IHDR à‘EIDATxíÝA @! PŠ­iš/`Є.È?,!ƒu zlÞ–Jh1ߘ+výRLé§x@‘Ù (*79HÑ þl)¡ó²‰IEND®B`‚libsdl2-gfx-1.0.0/Docs/html/doxygen.css000077500000000000000000000374161226521303400176640ustar00rootroot00000000000000/* The standard CSS for doxygen */ body, table, div, p, dl { font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; font-size: 13px; line-height: 1.3; } /* @group Heading Levels */ h1 { font-size: 150%; } .title { font-size: 150%; font-weight: bold; margin: 10px 2px; } h2 { font-size: 120%; } h3 { font-size: 100%; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited { color: #4665A2; } a.codeRef, a.codeRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } .fragment { font-family: monospace, fixed; font-size: 105%; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 8px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memItemLeft, .memItemRight, .memTemplParams { border-top: 1px solid #C4CFE5; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; } .memname { white-space: nowrap; font-weight: bold; margin-left: 6px; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 8px; border-top-left-radius: 8px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 8px; -moz-border-radius-topleft: 8px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 8px; -webkit-border-top-left-radius: 8px; background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 2px 5px; background-color: #FBFCFD; border-top-width: 0; /* opera specific markup */ border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); /* webkit specific markup */ -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .params, .retval, .exception, .tparams { border-spacing: 6px 2px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } /* @end */ /* @group Directory (tree) */ /* for the tree view */ .ftvtree { font-family: sans-serif; margin: 0px; } /* these are for tree view when used as main index */ .directory { font-size: 9pt; font-weight: bold; margin: 5px; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } /* The following two styles can be used to replace the root node title with an image of your choice. Simply uncomment the next two styles, specify the name of your image and be sure to set 'height' to the proper pixel height of your image. */ /* .directory h3.swap { height: 61px; background-repeat: no-repeat; background-image: url("yourimage.gif"); } .directory h3.swap span { display: none; } */ .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { font-size: 100%; font-weight: bold; } .directory-alt h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory-alt > h3 { margin-top: 0; } .directory-alt p { margin: 0px; white-space: nowrap; } .directory-alt div { display: none; margin: 0px; } .directory-alt img { vertical-align: -30%; } /* @end */ div.dynheader { margin-top: 8px; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.ingroups { margin-left: 5px; font-size: 8pt; padding-left: 5px; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 7px; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { border-left:4px solid; padding: 0 0 0 6px; } dl.note { border-color: #D0C000; } dl.warning, dl.attention { border-color: #FF0000; } dl.pre, dl.post, dl.invariant { border-color: #00D000; } dl.deprecated { border-color: #505050; } dl.todo { border-color: #00C0E0; } dl.test { border-color: #3030E0; } dl.bug { border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } pre.fragment { overflow: visible; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ } } libsdl2-gfx-1.0.0/Docs/html/doxygen.png000077500000000000000000000075461226521303400176610ustar00rootroot00000000000000‰PNG  IHDRh ;ˆØ-IDATxí]{XŒyÿ¾sZ%Ê”NF:¨´FåЪքbÝè@;~ÓŽÃ"DH‘ÚZ•ð–m_Œéè4ÄÙÚ!ë-‡2«U«Ce[Š"§š_ñÌ3óLSìõ¾ï¾öº|®««y>§ïý¹ïïá_ ™L†öþZ·¼ß¦ajëñ®¹L•oñúþ}«.Íë2Þãû$Zöå);*.d¥~Ûìß³wˆ—·'ˆâ0³Ëâþ@áû!ZZeÊÿÁÞͺwÓøÏÔÚ‰ù?ØO =\Lâ[òg²dxr0Ð —€¤Rrj·Jž€‘*í.WJN5¨äÉqÈMªÔ[mºÞ•’Sb58™Ä¼RB5½¥•’SRus[2<ÙÄ %·˜˜•²V'˜ê+%§$fv˜ØÄºR»«Kó$ ¡¥C 4ã+xº˜£½sQÙ}f¶ðÀ[²vôZ €ç6c}”½!,Lt×ï<ÂÅ«µ°dx†H)/ÎÙfí襧¥C«1¶v£ôº[~– ÏÑåÅ9%DÏDKgžrN}M9úY««3*/Îi謷%ÓU^œ#¶vôr'p²=]ÌÑ_§7®ßy„ìS¸ª½ëkÊaÉð´-/Î!E²vôâà902œíÁÉ–FæŸ*¸Å,ý­– O!1k>QÓÓ³¦°dx¦X:ûð¼=GÃÂD×ï<ÂþÃ'¸fvRªKó‚UZjbóièþ¤`èõýˆtº9cùœ‘xÕÚªV W­­°sžabóièw1ó1x%îæhŒ¹Þ¶¸9׉>oÕ®hkG¯~¥—Nl°sž"^™ÀdŽ2%sw…ø¨•¼W­­‹ìœ§D¸z¯àí W †Æç˜8c>‚í1”ô‡m·Bvêî«ÖÖ8܉ÞAˆZò þT…u—r­½ª´th9kÂÖRêåŸSfÛþ/d§–°‰¾äœ1kçb„A.ܸ@ø“+;:j ÛÚÑË«ôÒ‰|#­Ýp4i®â¨]¼â߯óV~éØÇŒ…xfv$Õ¥y| S[ö;BOK‡V“ÅßÖàÎÌa 4x0¶Ï:ÂßDN54>Çgœõxp÷ªo;Z:´¬œÃÉ”º€ÕÇðë™ïbÛ‡ªöü|Ñ^TŠ7=$4)L!Ü/åuü’#)9/rqÃ%îØÅï¬~a”çŽÅ-à¸poE ‚”®,|gŽ¥m /9/ŠsÃâ˜Ø|šœ±c Ó/åu¨ü Êë€P\…aÁÂ’ó¢‡1,¦¥Ó¢Ã;ueòyªKó\ä…°üÃ"7-K!3>õ2ÊËËamm åÚÈr7M.(~[2ÓÝÉ„Œ]©¨C<¿í»b9Ç[)v[~Ñ,_º@\|î8ËqÜ´{· Ð}QÞ”ugr7àÛÈJ]|Úe¤ïÚ`ƒ–­æçÿ¤à™4s5Ü+µÕÒ¡•©Æ\§áéãû¶Ù•ýxàJ,ûÌudùùs&@yŽõI…eD…Ÿ;ç8nZÁž={ʘfóQU|X ÞØÚ)ض˜"ÞtîVÜ-ÏwÐo¨ãç¢ý‰œöJy>¶6è°¹ ÌFrÊf¥ÑÍú’ KbÏà¼(!@~»ó³) F¹{€í€Ave'3£Hÿ£¦˜î»Íu @³¯Aò±¬$èj÷"s&û…½&ób~¶t”»w¢ÿ¼¼¥þŠ·öQÓ J~Iå âJÚö½˜Ÿ]=ÊÝ;=|S{ºû™Éç‘“nçÊÜ9ôË¿ÈõË„.{ù®‰Ü´`Œb³ßÅÊå ÅâÚž)†j\Þ€ÔΕ›ÞY_ÂE_¸â.gÚ0uõ‹‘Ÿ‰2ݪiDàWËÐÜX'ÖìkÀÌÿº©ü–ñqýòV¶gDO³¯Ý„¦âÁÔôçE 6È ä1cZŒ¦ÄÄ—n£¹±NXxú(¿] ±ãgL_ºM!ÓÐb4Ü+e´´Ê¤âŽdüƒç62[é£]Am­ž,b÷@Jáé£Õ„ÿð‘Ü_Ù,Wºˆr€‘®Îèr_g8ÕÕ&(ÁQAäÛ4·­Ÿò.«ö—¯­ajëAïghS–öÝFJËÛhheg©‹³;Lýcs é/¼RƒÈõËÄ¢ì,‘—¾84†íõ‰9™óõ:n–œ`‰²³Ä,o_ï~†6YIqaÐÑî¥vÊèã¸v>=V”E¹æXÞ¾5™é=uu›^À/ °A”eD䆸ÍX¹j®S¬‘#§Ï^Ëžç3œŒÇì-ÂÙ£[Ã@µövmæÏ ’X ÊÎÊW¤×vú9šÚúѽµõQ_{ͽ3žäW\ø¦æØ:p¤ajëeIÉ)tšâîŽåáܱ8Iû£>xødÆöEóöëd:ÛŒ4µõk¾OŽƒNI¼‰¨½q>m•á1!)[©›Vàb47ýa @æšṉ̃ p…%5Pþ~üä¾Z‚æ¦?| 3³•0DN  á}® Unû¬@ú® » 3¹ÌÁÃ'‹Tç(,©ÁÏ—ïÂÁÊ^.ŠM¤ÄA8a?šUÙ¾äJ<§à2S÷ þ~…@=hjë3-GÍÄ|ŸÈ8Y.¯—¨®]XRƒèËIT9X²A€›¿ž$ÚéÇÛÈõ™hIPvã!ÀvHÿ°}Úo)Ͷ‡8rŠßš ¶=…Ч*^÷˜éiEïŸÂ«8‘"<˜Ìö Ht™¶œ·"Б²æ–͘á¿Êx.üZ‹˜M!b~ƒé Ã!c ’bwÀ·zëqT\È L*a.ˆŒÙÁP7:Û*(FÁñøpáÁô8¶O@â¿5<å9•17>yö“1z¸a‡zs{/Q†9æ‘ ´j}S¹vYD*n]Í!rÐhyakÔj ™Ê„«úgúÍ‘ d¦©­_¾*llé]^&}ˆ˜¨ÍhnúÃÛpȨèí[¨ä.Y»µ7..ÐÔÖOŽÚ²ÆµÉX|Úeœ%¤ÈL%äL¿9e ‰Étå¼ÇO^ (ˆÛp 3U±%ßär ‡ŒJŽ ›§vÎ2éCÊ Äzá2SãfúÍ1êÃ]Ïõ™@ÝÈ™¼€ÄÜn’èÛp%®Ö"nËJR µß2GÛ+Z™Š[¥?’@„½[PèâÙcÐWKþÂÕZìÛó=’â×Q÷ŸšiøÏäôîÓ?yê¬E`3‡ª+Wá‡ý;ñìÉÃŽöîÓ¿fóæHŠÛÒ%¸x2!%#Mì?;p)î°™*à²u;p_zÉ%#M !pˆ‚WÇR†Š«phϦÝi‚Eª8ügFôîÓ?ÔÁíKÈïü²ëp)_+Ç©XÀPÅž‘&ˆ#jðÌí&q=˜n˜0ÚLí¬×n>Dá•\Ê¢á÷J[ts»I¢è5³)¼&~J ¤:Úè´µAB„î@‹PKÆ´×doCú)ñÑaSteLgÓ.㦶襩›Àÿ?MàÙ¿|Ö¸bÙšs+s’¤Ÿ¸†ÑtïÙ›À@€<öòyÓ¶_=ï ‡žok®Ô‡Û¶½ÚžŸ¿x¾Œª¢Ã=ä_C?ÝlÐßB™«WŠp·òœ‰ÙcK3=hh(b%ùÐ7u@}mEû»ÃtØxØØØâRÁ)ÔUÿ¢%“2™ ݺ)©Ø™¢;¸œŸnÝ{†®ÃÆÎ†‰¡î_2Ÿ´úªŠ ý‘ýLKϲַÆöEe÷¡A(ô¤ù%ž?iÀÓÆßÓ¸›`N·zýàëÑ,ñðÞo´w¯ÊNõ{elЧ‡òÉ«}ð·êq¥ì&ªKsñüÉÃän=>º`á°±³Ýÿ*q:½âht§¿Õw_Z”ÞòòÙ^š:cå¾nÝ{âùÓ†‹Ýº÷Ì`N£;‘×›Üj*ÿµ½¥å¥K¯Þ}^4?&ý=zi¡—¦zkõCcýPBht'×ÿÑ|UE‡ä1 ý;ž&5v›øßõëÛµ]@kS}ðÿpŽªª¢ÃâÕ¥y &þ>Ø{fÝ>Pð~ÛÿÞžk˜^œIEND®B`‚libsdl2-gfx-1.0.0/Docs/html/files.html000077500000000000000000000077071226521303400174650ustar00rootroot00000000000000 SDL2_gfx: File List
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
File List
Here is a list of all files with brief descriptions:
I:/Sources/sdl2gfx/README [code]
I:/Sources/sdl2gfx/SDL2_framerate.c [code]
I:/Sources/sdl2gfx/SDL2_framerate.h [code]
I:/Sources/sdl2gfx/SDL2_gfxPrimitives.c [code]
I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h [code]
I:/Sources/sdl2gfx/SDL2_gfxPrimitives_font.h [code]
I:/Sources/sdl2gfx/SDL2_imageFilter.c [code]
I:/Sources/sdl2gfx/SDL2_imageFilter.h [code]
I:/Sources/sdl2gfx/SDL2_rotozoom.c [code]
I:/Sources/sdl2gfx/SDL2_rotozoom.h [code]
libsdl2-gfx-1.0.0/Docs/html/functions.html000077500000000000000000000222511226521303400203620ustar00rootroot00000000000000 SDL2_gfx: Data Fields
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- a -

- b -

- c -

- d -

- e -

- f -

- g -

- k -

- l -

- o -

- q -

- r -

- s -

- t -

- u -

- v -

- x -

- y -

libsdl2-gfx-1.0.0/Docs/html/functions_vars.html000077500000000000000000000220751226521303400214210ustar00rootroot00000000000000 SDL2_gfx: Data Fields - Variables
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals.html000077500000000000000000000135101226521303400177730ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- _ -

libsdl2-gfx-1.0.0/Docs/html/globals_0x61.html000077500000000000000000000151701226521303400205550ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- a -

libsdl2-gfx-1.0.0/Docs/html/globals_0x62.html000077500000000000000000000106001226521303400205470ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- b -

libsdl2-gfx-1.0.0/Docs/html/globals_0x63.html000077500000000000000000000106141226521303400205550ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- c -

libsdl2-gfx-1.0.0/Docs/html/globals_0x65.html000077500000000000000000000076211226521303400205630ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- e -

libsdl2-gfx-1.0.0/Docs/html/globals_0x66.html000077500000000000000000000146741226521303400205720ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- f -

libsdl2-gfx-1.0.0/Docs/html/globals_0x67.html000077500000000000000000000102751226521303400205640ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- g -

libsdl2-gfx-1.0.0/Docs/html/globals_0x68.html000077500000000000000000000102231226521303400205560ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- h -

libsdl2-gfx-1.0.0/Docs/html/globals_0x6c.html000077500000000000000000000100161226521303400206310ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- l -

libsdl2-gfx-1.0.0/Docs/html/globals_0x6d.html000077500000000000000000000073651226521303400206470ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- m -

libsdl2-gfx-1.0.0/Docs/html/globals_0x70.html000077500000000000000000000124171226521303400205560ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- p -

libsdl2-gfx-1.0.0/Docs/html/globals_0x72.html000077500000000000000000000141041226521303400205530ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- r -

libsdl2-gfx-1.0.0/Docs/html/globals_0x73.html000077500000000000000000000405111226521303400205550ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- s -

libsdl2-gfx-1.0.0/Docs/html/globals_0x74.html000077500000000000000000000122261226521303400205600ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- t -

libsdl2-gfx-1.0.0/Docs/html/globals_0x76.html000077500000000000000000000100121226521303400205510ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- v -

libsdl2-gfx-1.0.0/Docs/html/globals_0x7a.html000077500000000000000000000075501226521303400206410ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- z -

libsdl2-gfx-1.0.0/Docs/html/globals_defs.html000077500000000000000000000116151226521303400210000ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 
libsdl2-gfx-1.0.0/Docs/html/globals_func.html000077500000000000000000000133061226521303400210110ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- _ -

libsdl2-gfx-1.0.0/Docs/html/globals_func_0x61.html000077500000000000000000000143561226521303400215750ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x62.html000077500000000000000000000103761226521303400215740ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x63.html000077500000000000000000000104121226521303400215640ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x65.html000077500000000000000000000074171226521303400216010ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x66.html000077500000000000000000000136651226521303400216040ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- f -

libsdl2-gfx-1.0.0/Docs/html/globals_func_0x67.html000077500000000000000000000074501226521303400216000ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- g -

libsdl2-gfx-1.0.0/Docs/html/globals_func_0x68.html000077500000000000000000000076171226521303400216060ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x6c.html000077500000000000000000000076141226521303400216560ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x70.html000077500000000000000000000122151226521303400215650ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x72.html000077500000000000000000000137021226521303400215710ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- r -

libsdl2-gfx-1.0.0/Docs/html/globals_func_0x73.html000077500000000000000000000355321226521303400215770ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- s -

libsdl2-gfx-1.0.0/Docs/html/globals_func_0x74.html000077500000000000000000000114371226521303400215760ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- t -

libsdl2-gfx-1.0.0/Docs/html/globals_func_0x76.html000077500000000000000000000074131226521303400215770ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
libsdl2-gfx-1.0.0/Docs/html/globals_func_0x7a.html000077500000000000000000000073461226521303400216570ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 

- z -

libsdl2-gfx-1.0.0/Docs/html/globals_type.html000077500000000000000000000044311226521303400210360ustar00rootroot00000000000000 SDL2_gfx: Globals
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
 
libsdl2-gfx-1.0.0/Docs/html/index.html000077500000000000000000000065201226521303400174620ustar00rootroot00000000000000 SDL2_gfx: SDL2_gfx - Graphics primitives and surface functions for SDL2
SDL2_gfx  1.0.0
GraphicsprimitivesandsurfacefunctionsforSDL2
SDL2_gfx - Graphics primitives and surface functions for SDL2

Contact and License

Email aschiffler at ferzkopp dot net to contact the author or better check author's homepage at http://www.ferzkopp.net for the most up-to-date contact information.

This library is licenced under the zlib License, see the file LICENSE for details.

Introduction

The SDL2_gfx library provides the basic drawing functions such as lines, circles or polygons provided by SDL_gfx on SDL2 against renderers of SDL2.

The current components of the SDL2_gfx library are:

  • Graphic Primitives (SDL_gfxPrimitives.h, SDL_gfxPrimitives.c)
  • Surface Rotozoomer (SDL_rotozoom.h, SDL_rotozoom.c)
  • Framerate control (SDL_framerate.h, SDL_framerate.c)
  • MMX image filters (SDL_imageFilter.h, SDL_imageFilter.c)
  • Build-in 8x8 Font (SDL_gfxPrimitives_font.h)

Note that SDL2_gfx is compatible with SDL version 2.0 (not SDL 1.2).

Documentation

Please refer to the Doxygen-generated API documentation found in the Docs/html folder as well as the test programs in the test folder.

Change Log

SDL2_gfx ChangeLog

Mon, Oct 28, 2013  8:00:05 AM
- bugfix to _aaline special cases
- added image filter functions
- added to documentation
- updated readme and changelog
- updated solutions for VS2010 and VS2012

Tue, Sep 04, 2012  8:27:44 AM
- initial release of development version (partially finished)
libsdl2-gfx-1.0.0/Docs/html/jquery.js000077500000000000000000002506121226521303400173450ustar00rootroot00000000000000/* * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); /* * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) {I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() {G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); /* * jQuery hashchange event - v1.3 - 7/21/2010 * http://benalman.com/projects/jquery-hashchange-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('