add my 0.9.2+, a improved version of 0.9.2 rerecording (Unfortunately, I maintained only the windows port and core, because simply I don't use other ports)
This commit is contained in:
parent
908f4116a7
commit
937246f64c
|
@ -7,6 +7,11 @@ Current team
|
|||
Guillaume Duhamel
|
||||
Normmatt
|
||||
Bernat Muñoz (shash)
|
||||
thoduv
|
||||
Tim Seidel (Mighty Max)
|
||||
Pascal Giard (evilynux)
|
||||
Ben Jaques (masscat)
|
||||
Jeff Bland
|
||||
Riccardo Magliocchetti
|
||||
Max Tabachenko (CrazyMax)
|
||||
zeromus
|
||||
|
@ -14,7 +19,6 @@ Luigi__
|
|||
adelikat
|
||||
matusz
|
||||
pa__
|
||||
gocha
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
@ -27,17 +31,3 @@ delfare
|
|||
Romain Vallet
|
||||
snkmad
|
||||
Theo Berkau
|
||||
thoduv
|
||||
Tim Seidel (Mighty Max)
|
||||
Pascal Giard (evilynux)
|
||||
Ben Jaques (masscat)
|
||||
Jeff Bland
|
||||
Hicoder
|
||||
ldesnogue
|
||||
|
||||
Thanks to our super testers for this release
|
||||
------------
|
||||
nash679
|
||||
pokefan999
|
||||
dottorleo
|
||||
lbalbalba
|
|
@ -1,448 +1,367 @@
|
|||
0.9.4 -> ??? (r2437-r???)
|
||||
|
||||
??? introduces an entirely rewritten main emulation loop.
|
||||
This totally changes the timing, and totally breaks old savestates.
|
||||
|
||||
Highlights:
|
||||
* win32: lua engine, path configuration, 7z dearchiving support
|
||||
* rewritten main emulation loop
|
||||
|
||||
General/Core:
|
||||
bug: fix cflash directory support for non-windows
|
||||
bug: fix freeze in cart irq
|
||||
bug: correctly emulate dma to/from tcm
|
||||
enh: add guitar grip emulation
|
||||
enh: add more powerful antigrain-based drawing library and rewrite OSD system
|
||||
enh: ideas-style debugging prints
|
||||
|
||||
Graphics:
|
||||
bug: fixing of obj blending, bmp obj rendering, and some obj window cases
|
||||
bug: fix backdrop blending with garbage
|
||||
bug: fix 256B granularity sprite addressing for sub gpu
|
||||
bug: fix 128-wide captures
|
||||
bug: swrast: add clear image emulation
|
||||
bug: swrast: add edge marking
|
||||
|
||||
Windows:
|
||||
bug: improve map view tool to support more modes
|
||||
enh: added 2x resizing filters (hq2x, 2xsai, supereagle, scanlines)
|
||||
enh: soundview can now mute channels
|
||||
|
||||
Linux:
|
||||
enh: alsa microphone support
|
||||
|
||||
0.9.2 -> 0.9.4 (r1844->r2352->r2437)
|
||||
|
||||
0.9.3 was skipped due to emu news sites sneaking it out of our staging area and
|
||||
releasing it prematurely while it still had bugs. I was going to curse them
|
||||
individually, but then I decided that they would just like the publicity.
|
||||
|
||||
Highlights:
|
||||
* New save autodetection and save file format
|
||||
* Full rerecording support
|
||||
|
||||
General/Core:
|
||||
bug: fix many 64 bit and endian issues
|
||||
bug: fix mic input, which was nearly useless before
|
||||
bug: fix failures of large dmas
|
||||
bug: fix in ipc sync which broke devkitpro touch
|
||||
bug: screenshots now exclude hud and rotation
|
||||
bug: rewritten vram mapping (fixes corrupted or missing BG)
|
||||
enh: add universal commandline system (same commandline options on every port)
|
||||
enh: cheats: added Action Replay code parser
|
||||
enh: more reliable and useful frameskipping
|
||||
enh: SPU: speedup: add adpcm caching
|
||||
enh: SPU: speedup: interpolation is now optional
|
||||
enh: print svn build number so we can identify people's svn builds from screenshots
|
||||
|
||||
Graphics:
|
||||
bug: add polygon y-sorting (fixes 3d guis)
|
||||
bug: fix texcoordgen mode 3; fixes some ortho sprites and some entirely broken games
|
||||
bug: display capture fixes
|
||||
bug: fix a number of OBJ modes
|
||||
bug: fixes to affine BG modes
|
||||
bug: better emulate some translucent OBJ
|
||||
bug: more correct handling of color effect windows and backdrop colors
|
||||
bug: fix matrix stack overrun which crashed emulator
|
||||
bug: swrast: add clear depth image emulation and other fixes to depth buffering
|
||||
bug: swrast: fix some toon and highlight cases
|
||||
bug: fix bug in matrix stack, fixes some broken models
|
||||
enh: add alternate flush mode HACK 3d config toggle, fixes some entirely broken 3d games
|
||||
|
||||
Windows:
|
||||
bug: more robust cheats engine and dialog
|
||||
enh: more solid avi and wav recording
|
||||
enh: improved tools: memory viewer
|
||||
enh: added tools: spu viewer, ram watch, ram search
|
||||
enh: change build configuration system
|
||||
enh: speedup: add gpu core disabling to hide useless screens
|
||||
enh: add background pause feature (for when emulator loses focus)
|
||||
enh: add missing autohold for L and R
|
||||
enh: add chinese translation
|
||||
|
||||
Gtk frontend:
|
||||
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager
|
||||
enh: remove the gtglext 3d code
|
||||
enh: improve/speedup screen resize and final presentation logic in gtk frontend
|
||||
enh: minimal rerecording hookups
|
||||
|
||||
Cli frontend:
|
||||
enh: hooked the frameskip (szigor)
|
||||
enh: misc usability improvements: auto pause switch for pausing when focus is lost and exit on escape pressing (szigor)
|
||||
enh: hook the fake noise mic; use m to toggle
|
||||
|
||||
0.9.1 -> 0.9.2
|
||||
General/Core:
|
||||
bug: fix error in SBCS/RSCS flags; fixes many odd behaviors and crashes [zeromus]
|
||||
bug: add support for sleep mode and power registers [luigi__]
|
||||
bug: important fixes to RTC so correct time is actually told [luigi__]
|
||||
bug: fix card reads below 0x8000; fixes some game freezes [normatt]
|
||||
bug: fix 4 mbit save type; fix non-autodetect savefile dumping [zeromus, matusz]
|
||||
enh: add sram to GBA game addon emulation for importing savefiles [zeromus]
|
||||
enh: many improvements and feature hookups in linux ports [matusz, luigi__]
|
||||
|
||||
Graphics:
|
||||
bug: fix specular texture mapping mode [luigi__]
|
||||
bug: repairs to some capture modes and vram mapping [zeromus, CrazyMax]
|
||||
bug: viewports finally correctly handled [zeromus]
|
||||
enh: add software rasterizer. quirky, but on par with opengl [zeromus]
|
||||
|
||||
Windows:
|
||||
bug: mitigate bad frameskipper; default to old frameskipping mode [zeromus]
|
||||
bug: fixes with recent roms and zipfile loading [zeromus]
|
||||
bug: fix window position memory [zeromus]
|
||||
enh: bios and firmware may now be used and booted [luigi__]
|
||||
enh: many display, OSD, and input enhancements [luigi__]
|
||||
enh: brand new hotkey and controls binding system [zeromus]
|
||||
enh: configurable screen separation [luigi__]
|
||||
enh: fast forward key [pa__]
|
||||
enh: improvements to mic [luigi__]
|
||||
enh: faster updates in debug tools, up to once per frame [pa__]
|
||||
|
||||
Mac OS X Port:
|
||||
enh: added Italian translation thanks to Paolo Bernini [jeff]
|
||||
enh: resurrection of GDB stub [sigmaris]
|
||||
|
||||
0.9 -> 0.9.1
|
||||
General/Core:
|
||||
enh: GBA slot emulation [CrazyMax]
|
||||
- Rumble support (windows only)
|
||||
- GBA game
|
||||
enh: Mic support (windows only?) [luigi__]
|
||||
enh: Preliminary cheats system [CrazyMax]
|
||||
enh: Savestates invalidated, as more variables have been added.
|
||||
bug: Added PSG white noise [luigi__]
|
||||
bug: fix arm/thumb ROR [zeromus]
|
||||
bug: [ 2550645 ] Super Princess Peach: crash when starting a puzzle [zeromus]
|
||||
bug: win32: fix spu wav file writer (regression from 0.8) [zeromus,luigi__]
|
||||
bug: Much work on FIFOs, still not finished [CrazyMax]
|
||||
bug: Many fixes to dma [zeromus, CrazyMax]
|
||||
bug: bios WaitForVblank and WaitForInterrupt fixed [luigi__]
|
||||
|
||||
Graphics:
|
||||
bug: Added sprite blending [luigi__]
|
||||
bug: more correct mosaic effects, still imperfect [zeromus]
|
||||
bug: Many fixes to tile rendering; all graphics tests now pass [luigi__]
|
||||
bug: fix crashes in some affine BG [zeromus]
|
||||
bug: Implement some pos test function [luigi__]
|
||||
bug: fix texture mapping across texture and palette banks and to unmapped banks [zeromus]
|
||||
bug: fix texture handling for texels with MSB set (fixes some texture corruption) [zeromus]
|
||||
bug: fix texture coordinate generation, including environment mapping [zeromus]
|
||||
bug: texture cache invalidates when palettes change, prevents some texture corruption [zeromus]
|
||||
bug: fix display capturing from 2d+3d source when display mode is display-vram [zeromus]
|
||||
bug: [ 2488334 ].1 fixes to layer compositing [luigi__]
|
||||
bug: [ 2488334 ].3 fix bug in support for hdma affine bg parameters [zeromus]
|
||||
bug: Improvements to 3d h-scrolling [luigi__]
|
||||
bug: Fix some errors in rendering 512 tall BG [zeromus,CrazyMax] (still not fully resolved)
|
||||
bug: Add optional fragment shading pipeline (more precision) [luigi__]
|
||||
bug: Fix bug where some sprites got cut of on x=255 [zeromus]
|
||||
bug: Implement GXSTAT register [CrazyMax]
|
||||
|
||||
Windows:
|
||||
bug: resizing and rotating work in vista [luigi__]
|
||||
enh: 0 frameskip now lets emulator run at excess speed [zeromus]
|
||||
|
||||
Mac OS X Port:
|
||||
bug: left key setting no longer gets confused with the right key [jeff]
|
||||
enh: more keys can be mapped
|
||||
|
||||
0.8 -> 0.9
|
||||
There have been so many changes that this list can hardly be considered complete.
|
||||
For this release, we have formatted the list into a high level overview of big changes and bad bugs relative to the previous release. Hopefully what you're interested in.
|
||||
This list does not include items which are solely performance boosts, for let us just say that virtually every system has been speeded up.
|
||||
|
||||
* The savestate system is totally changed and incompatible with old savestates.
|
||||
* The 3d system should be considered rewritten.
|
||||
|
||||
General/Core:
|
||||
enh: Convert to c++
|
||||
enh: Add functions for a lid open/close. Holding key (default "Backspace" in Windows port) while game is freeze/non freeze. [CrazyMax]
|
||||
enh: Add secure area decryption from ndstool [zeromus]
|
||||
enh: Change savestate code to support loosely bound chunks and more easily other parts of the emu (GE, GPU).
|
||||
The savestate format is changed, but from now on it is in principle more resilient
|
||||
(though it will continue to break as we tinker with the internals) [zeromus]
|
||||
enh: Added SSE2 optimizations for matrices. Since we now make an SSE2 build, more optimizations can be made. [CrazyMax]
|
||||
enh: Add a preliminary GUI hud system [CrazyMax,zeromus]
|
||||
|
||||
CPU/MMU:
|
||||
bug: Many fixes in IPC and GE FIFOs. Fixes freezes in NSMB, dsracing, and others. [CrazyMax,luigi__,shash]
|
||||
bug: Fix ARM instructions SBC and RSC (likewise SBC in thumb) [normatt]
|
||||
bug: Fixed Thumb LDMIA (fixes ingame Dead'n'Furious) [shash]
|
||||
bug: Fix repeating DMA (fixes NSMB parallax BG) [zeromus]
|
||||
bug: Proper handling for unaligned CPU accesses [luigi__]
|
||||
bug: Proper handling for undefined instruction exceptions [Salva Peiró]
|
||||
bug: correctly return vram control register values (fixes homebrew 3d games) [zeromus]
|
||||
enh: Remove 16MB of WRAM at 0x01****** from arm9. Mapped to unused instead. Nobody knows what this was. [zeromus]
|
||||
enh: Changed instruction execution to 16 at a time blocks (tested and stable) [shash]
|
||||
|
||||
Hardware:
|
||||
bug: Newer and better sqrt and div emulation; makes SM64DS playable [luigi__,shash,zeromus]
|
||||
bug: Add preliminary RTC implementations [CrazyMax]
|
||||
enh: Add cosine interpolation in the SPU (conditionally compiled) [zeromus,luigi__]
|
||||
enh: Experimental: always one silent non-mixing SPU core at 44.1khz synched with emu, for more precision.
|
||||
The audible core runs with the host, causing music to slow down but not tear or pitch bend. [zeromus]
|
||||
|
||||
Graphics:
|
||||
- Overhaul 3d:
|
||||
. Move entire GE to core emu.
|
||||
. Move OpenGL renderer to emu core for optional use by platforms, removing ogl_collector. Now every platform shares the same 3d code.
|
||||
. Reorganize 3d code to defer rendering to after 3d vblank. Eliminates tearing, and texturing artifacts. [zeromus]
|
||||
. Add optional fragment shading pipeline (more precision) [luigi__]
|
||||
. Move lighting model to software instead of using opengl's fixed function model [zeromus]
|
||||
. Render shadow volumes; toon shading and highlight table [zeromus, luigi__]
|
||||
. Added texture caching! big speed up. [CrazyMax]
|
||||
|
||||
bug: Many assorted tweaks and improvements to 3d and 2d precision [zeromus,CrazyMax,luigi__]
|
||||
bug: Fixes to GE: command unpacking, projection and pos-vector mode matrix handling, mult and load commands [zeromus]
|
||||
bug: Fix a bug in texture transformation mode 1 [zeromus]
|
||||
bug: Fixed GPU rendering bugs in sprites and BG [CrazyMax]
|
||||
bug: Fixes to texture conversion [CrazyMax,zeromus]
|
||||
bug: Fixes in capture display (no blinking in many games with dual 3D) [CrazyMax]
|
||||
bug: Fixes in master brightness (this fixes some games with black screens) [CrazyMax]
|
||||
bug: Fixes in screen, backdrop, and sprite blending [luigi__]
|
||||
bug: Changed clear depths and how depth initial values are calculated (fixes SM64DS skybox, Castlevania) [shash,lugi__]
|
||||
bug: Add 3d layer h-scrolling [zeromus]
|
||||
bug: Added transparency and fixed material alpha support and alpha testing on the 3D core [shash]
|
||||
bug: Rewrite VRAM mapping control and rendering (more accurate) [CrazyMax,luigi__]
|
||||
|
||||
bug: convert colors to opengl better to prevent alpha=31 polys from being ever so slightly transparent [zeromus]
|
||||
enh: Add MMU->GPU signal for when vram mappings change to function as a texture cache invalidate signal [zeromus]
|
||||
enh: Make matrix 4x4 multiply routines use W-coordinate; carry w coord through pipeline [zeromus]
|
||||
|
||||
Mac OS X port:
|
||||
bug: Fixed: Filenames and paths with unicode characters now work. [Jeff]
|
||||
bug: Fixed: Load state from file button works again. [Jeff]
|
||||
enh: Save State panel now pauses emulation while the file selection box is open. [Jeff]
|
||||
bug: Fixed: Frozen video output (and/or messed 3d emulation) after loading a state. [Jeff]
|
||||
bug: Added option to load the most recent file upon launching the program. [Jeff]
|
||||
enh: Added French translation (thanks to Pierre Rudloff). [Jeff]
|
||||
enh: Added basic key mapping configuration to application preferences (thanks to Julio GorgŽ). [Jeff]
|
||||
enh: Added keyboard shortcuts for Execute, Pause and Reset command (thanks to Julio GorgŽ). [Jeff]
|
||||
enh: Default key mappings are no longer case sensitive. [Jeff]
|
||||
enh: Added ability to limit speed. [Jeff]
|
||||
enh: Fixed: Video output should work on software-only 3D renderers. [Jeff]
|
||||
|
||||
Windows port:
|
||||
bug: Fix a race condition in NDS_3D_Reset and NDS_glInit [zeromus]
|
||||
bug: Fix the buggy auto frameskip logic which made the emu slow to a crawl. Now it runs fast! [zeromus]
|
||||
bug: Fix resizing, rotate & aspect ration of main window. [CrazyMax,_zeromus]
|
||||
bug: Remove multithreading from user interface after finding several synchronization issues [zeromus]
|
||||
enh: recent roms menu [luigi_]
|
||||
enh: Changed graphics render core to DirectDraw (work faster) [CrazyMax]
|
||||
enh: Add an arm9 cpu load average calculator similar to no$. but I dont think it works right. [zeromus]
|
||||
enh: Rewrite all debug tools (autoupdate works now) [CrazyMax]
|
||||
enh: Rewrite input core & replace config input dialog [CrazyMax]
|
||||
enh: Add AVI output [zeromus]
|
||||
enh: Add pause toggle and frame advance hotkeys [adelikat]
|
||||
enh: Add frame counter display and hud messages framework [adelikat]
|
||||
enh: Main window remembers position, size, and a few other emu preferences [adelikat]
|
||||
enh: Removed directx sdk dependency for easier building. [zeromus]
|
||||
enh: Savestate doesnt unpause emu if it is already paused [adelikat]
|
||||
|
||||
0.7.3 -> 0.8
|
||||
Cocoa:
|
||||
- Save State As function now works. [Jeff B]
|
||||
- Recent Items menu now works. [Jeff B]
|
||||
- Opening NDS files from Finder now works. [Jeff B]
|
||||
- Added screenshot feature. [Jeff B]
|
||||
- Added preferences. [Jeff B]
|
||||
- Many more strings are translatable now. [Jeff B]
|
||||
- Default screen color is black (better represents being "off" and easier on eyes at night). [Jeff B]
|
||||
- Added sound. [Jeff B]
|
||||
- Now is a universal binary. [Jeff B]
|
||||
- Leopard resolution icon added. [Jeff B]
|
||||
- Added a Japanese translation. [Jeff B]
|
||||
- Added an optional status bar (resize handle no longer overlaps screen). [Jeff B]
|
||||
- New ROM Info and About DeSmuME windows have been added. [Jeff B]
|
||||
- Fixed several bugs in window resizing. [Jeff B]
|
||||
- Added FAT image support for homebrew games (thanks to TypeError). [Jeff B]
|
||||
- Key config can be changed on the command line. Save/load hotkeys changed (so expose doesn't override). [Jeff B]
|
||||
- Key bindings may work better on non-US keyboards now (needs testing). [Jeff B]
|
||||
general:
|
||||
- Encapsulate GDB debug stub to avoid certain problems [shash]
|
||||
- Fixed CPU LD*/ST* bugs [shash]
|
||||
- Fixed New SMB mini-games freeze [shash]
|
||||
- Fixed possible segfault in ROMReader on ia64 and amd64. [evilynux]
|
||||
- Fixed a crash bug with 2D background corrupting memory [shash]
|
||||
- Flag check optimization [carlo_bramini]
|
||||
- Applied some endian fixes in GPU (thanks to Phazz) [Jeff B]
|
||||
gtk-glade:
|
||||
- Added DeSmuME version in about dialog. [evilynux]
|
||||
- Updated website url in about dialog. [evilynux]
|
||||
- Added Brazilian Portuguese translation by Dreampeppers99. [evilynux]
|
||||
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
|
||||
gtk:
|
||||
- Updated website url in about dialog. [evilynux]
|
||||
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
|
||||
windows port:
|
||||
- Added an "about" box [shash]
|
||||
- DirectInput control interface with joystick support [CrazyMax]
|
||||
- Matrix and Light viewer [Acid Burn]
|
||||
|
||||
0.7.2 -> 0.7.3
|
||||
gtk-glade:
|
||||
- Full localization using intltool/gettext. [evilynux]
|
||||
general:
|
||||
- Added a README.TRANSLATION documenting the localization process. [evilynux]
|
||||
MacOS X:
|
||||
- Initial version of the Mac interface added. [Jeff B]
|
||||
|
||||
0.7.1 -> 0.7.2
|
||||
spu:
|
||||
- big endian fixes. [cyberwarriorx]
|
||||
gpu:
|
||||
- big endian fixes. [marcus_c]
|
||||
gtk-glade:
|
||||
- opengl improvements. [masscat]
|
||||
general:
|
||||
- Added support for setting NDS firmware language value. [masscat]
|
||||
- Function added for setting firmware language. [masscat]
|
||||
- Mac/msys compilation fixes. [cyberwarriorx]
|
||||
- Fix compilation when pkg-config macros are not available [evilynux]
|
||||
|
||||
0.7.0 -> 0.7.1
|
||||
general:
|
||||
- Added GDB debugger stub [masscat]
|
||||
- Added new/different GBAMP CFlash image reader/writer [masscat]
|
||||
gpu:
|
||||
- Major speedup to the 2D core [shash]
|
||||
gtk-glade:
|
||||
- Added command line options. [masscat]
|
||||
- Added FPS limiter [masscat]
|
||||
cli:
|
||||
- Added command line options. [masscat]
|
||||
- Added FPS limiter [masscat]
|
||||
- Added option to use OpenGl to render window (allows resizing). [masscat]
|
||||
windows port:
|
||||
- Added command line options. [masscat]
|
||||
- Added multiple language support [cyberwarriorx]
|
||||
- Added Danish language translation [thomas-2007]
|
||||
|
||||
0.6.0 -> 0.7.0
|
||||
general:
|
||||
- Added support for *.duc files [cyberwarriorx]
|
||||
gpu:
|
||||
- Added support for sprite rotation/scaling [shash]
|
||||
- Added support for the 3D core (openGL and null plugins) [shash]
|
||||
windows port:
|
||||
- A bunch of fixes [Dmitry Krutskih]
|
||||
- Fixed a bug in sound that was causing it to still not work for some
|
||||
people [cyberwarriorx]
|
||||
gtk:
|
||||
- Added 3D emulation
|
||||
- Added command line options.
|
||||
- Added option to use OpenGL to render window (allows resizing).
|
||||
gtk-glade:
|
||||
- Added 3D emulation
|
||||
|
||||
0.5.0 -> 0.6.0
|
||||
general:
|
||||
- Added zipped (based on zziplib) and gzipped (based on zlib) rom support.
|
||||
arm:
|
||||
- Added relocation interrupt vector.
|
||||
- Added region access right checks.
|
||||
- Enabled LDC/STC instructions.
|
||||
- Fixed powersave (cp15) IRQ wait.
|
||||
- Fixed MOV instructions
|
||||
gpu:
|
||||
- Added special color effects.
|
||||
- Added windowing feature.
|
||||
- Fixed transparent direct color backgrounds.
|
||||
- Fixed disabled sprites showing.
|
||||
- Fixed 8/32 bit access to gpu registers.
|
||||
- Fixed missing backgrounds
|
||||
- Support for master brightness
|
||||
wifi:
|
||||
- Added RF chip interface.
|
||||
- Added BB chip interface.
|
||||
windows port:
|
||||
- Fixed address calculation in disassembler.
|
||||
- Added Force Maintain Ratio option for window stretching
|
||||
linux port (cli, gtk and gtk-glade):
|
||||
all:
|
||||
- Added joystick support.
|
||||
- Fixed X and Y buttons.
|
||||
gtk-glade:
|
||||
- Added joystick configuration.
|
||||
- Improved I/O registers viewer tool.
|
||||
- Added save and load states support.
|
||||
|
||||
0.3.3 -> 0.5.0
|
||||
arm:
|
||||
- Fixed MSR with immediate value opcode.
|
||||
- Fixed LSR_0 thumb opcode (C flag is correctly set now).
|
||||
- Fixed LDR*/STR* opcodes.
|
||||
- Fixed unaligned memory access on THUMB Core.
|
||||
- Added relocating SWI routines.
|
||||
bios:
|
||||
- Added decompression functions.
|
||||
- Added GetPitchTable function.
|
||||
- Added GetVolumeTable function.
|
||||
- Added GetCRC16 function.
|
||||
- Added experimental SoundBias function.
|
||||
- Added GetSineTable function.
|
||||
cart:
|
||||
- Added CompactFlash/FAT emulation.
|
||||
- Added Get ROM chip ID Cartridge command.
|
||||
gpu:
|
||||
- Added framebuffer emulation.
|
||||
- Fixed a bug in GPU (xfin could be greater than LG causing a segfault).
|
||||
- Added support for Display Mode 0(Display Off).
|
||||
- Added the basic framework for Display Mode 3(Display from Main RAM).
|
||||
spu:
|
||||
- Added sound emulation.
|
||||
- Added sound core system.
|
||||
- Added WAV write core.
|
||||
- Added dummy core.
|
||||
- Added Direct Sound core.
|
||||
linux port:
|
||||
- Added GTK+ GUI.
|
||||
- Added command line interface.
|
||||
- Added stylus and arm9 keypad support in CLI version.
|
||||
- Added FPS display.
|
||||
- Added basic frameskip.
|
||||
windows port:
|
||||
- Fixed a bug when displaying a ROM's information.
|
||||
- Added key configuration.
|
||||
- Removed the debug key.
|
||||
- Added new experimental auto frameskip/frame limit code.
|
||||
- Added sound settings dialog.
|
||||
- Added a few menu options for accessing the website, forums, and for
|
||||
submitting bugs.
|
||||
general:
|
||||
- Rewrote code in C.
|
||||
- Fixed warnings.
|
||||
- Used defines and typedef's to make things more portable and easier to
|
||||
read.
|
||||
- Added autotools stuff.
|
||||
- Changes to logging system.
|
||||
- Added screenshot function.
|
||||
- Translated most french to english.
|
||||
- Added savestate support.
|
||||
- Added firmware reading support(needs work).
|
||||
- Added Backup Memory support with autodetection.
|
||||
- Fixed some endianess issues.
|
||||
- Fixed things so Visual C++ can compile code.
|
||||
- Added bsd support.
|
||||
- Reworked ROM loading so you can load a different rom without any problems.
|
||||
- Finished NDS_Reset. Now the emulation can be reset even while running.
|
||||
0.9.2 -> 0.9.3
|
||||
General/Core:
|
||||
bug: fixed 64 bit issues and misc integer types usage cleanup [ldesnogues, rm]
|
||||
enh: added Action Replay code parser [CrazyMax]
|
||||
Gtk frontend:
|
||||
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager [matusz]
|
||||
enh: remove the gtglext 3d code [rm]
|
||||
enh: fix screen resize in gtk frontend, just resize the window [matusz]
|
||||
|
||||
Windows:
|
||||
bug: fixed many bugs in Cheats [CrazyMax]
|
||||
|
||||
0.9.1 -> 0.9.2
|
||||
General/Core:
|
||||
bug: fix error in SBCS/RSCS flags; fixes many odd behaviors and crashes [zeromus]
|
||||
bug: add support for sleep mode and power registers [luigi__]
|
||||
bug: important fixes to RTC so correct time is actually told [luigi__]
|
||||
bug: fix card reads below 0x8000; fixes some game freezes [normatt]
|
||||
bug: fix 4 mbit save type; fix non-autodetect savefile dumping [zeromus, matusz]
|
||||
enh: add sram to GBA game addon emulation for importing savefiles [zeromus]
|
||||
enh: many improvements and feature hookups in linux ports [matusz, luigi__]
|
||||
|
||||
Graphics:
|
||||
bug: fix specular texture mapping mode [luigi__]
|
||||
bug: repairs to some capture modes and vram mapping [zeromus, CrazyMax]
|
||||
bug: viewports finally correctly handled [zeromus]
|
||||
enh: add software rasterizer. quirky, but on par with opengl [zeromus]
|
||||
|
||||
Windows:
|
||||
bug: mitigate bad frameskipper; default to old frameskipping mode [zeromus]
|
||||
bug: fixes with recent roms and zipfile loading [zeromus]
|
||||
bug: fix window position memory [zeromus]
|
||||
enh: bios and firmware may now be used and booted [luigi__]
|
||||
enh: many display, OSD, and input enhancements [luigi__]
|
||||
enh: brand new hotkey and controls binding system [zeromus]
|
||||
enh: configurable screen separation [luigi__]
|
||||
enh: fast forward key [pa__]
|
||||
enh: improvements to mic [luigi__]
|
||||
enh: faster updates in debug tools, up to once per frame [pa__]
|
||||
|
||||
Mac OS X Port:
|
||||
enh: added Italian translation thanks to Paolo Bernini [jeff]
|
||||
enh: resurrection of GDB stub [sigmaris]
|
||||
|
||||
0.9 -> 0.9.1
|
||||
General/Core:
|
||||
enh: GBA slot emulation [CrazyMax]
|
||||
- Rumble support (windows only)
|
||||
- GBA game
|
||||
enh: Mic support (windows only?) [luigi__]
|
||||
enh: Preliminary cheats system [CrazyMax]
|
||||
enh: Savestates invalidated, as more variables have been added.
|
||||
bug: Added PSG white noise [luigi__]
|
||||
bug: fix arm/thumb ROR [zeromus]
|
||||
bug: [ 2550645 ] Super Princess Peach: crash when starting a puzzle [zeromus]
|
||||
bug: win32: fix spu wav file writer (regression from 0.8) [zeromus,luigi__]
|
||||
bug: Much work on FIFOs, still not finished [CrazyMax]
|
||||
bug: Many fixes to dma [zeromus, CrazyMax]
|
||||
bug: bios WaitForVblank and WaitForInterrupt fixed [luigi__]
|
||||
|
||||
Graphics:
|
||||
bug: Added sprite blending [luigi__]
|
||||
bug: more correct mosaic effects, still imperfect [zeromus]
|
||||
bug: Many fixes to tile rendering; all graphics tests now pass [luigi__]
|
||||
bug: fix crashes in some affine BG [zeromus]
|
||||
bug: Implement some pos test function [luigi__]
|
||||
bug: fix texture mapping across texture and palette banks and to unmapped banks [zeromus]
|
||||
bug: fix texture handling for texels with MSB set (fixes some texture corruption) [zeromus]
|
||||
bug: fix texture coordinate generation, including environment mapping [zeromus]
|
||||
bug: texture cache invalidates when palettes change, prevents some texture corruption [zeromus]
|
||||
bug: fix display capturing from 2d+3d source when display mode is display-vram [zeromus]
|
||||
bug: [ 2488334 ].1 fixes to layer compositing [luigi__]
|
||||
bug: [ 2488334 ].3 fix bug in support for hdma affine bg parameters [zeromus]
|
||||
bug: Improvements to 3d h-scrolling [luigi__]
|
||||
bug: Fix some errors in rendering 512 tall BG [zeromus,CrazyMax] (still not fully resolved)
|
||||
bug: Add optional fragment shading pipeline (more precision) [luigi__]
|
||||
bug: Fix bug where some sprites got cut of on x=255 [zeromus]
|
||||
bug: Implement GXSTAT register [CrazyMax]
|
||||
|
||||
Windows:
|
||||
bug: resizing and rotating work in vista [luigi__]
|
||||
enh: 0 frameskip now lets emulator run at excess speed [zeromus]
|
||||
|
||||
Mac OS X Port:
|
||||
bug: left key setting no longer gets confused with the right key [jeff]
|
||||
enh: more keys can be mapped
|
||||
|
||||
0.8 -> 0.9
|
||||
There have been so many changes that this list can hardly be considered complete.
|
||||
For this release, we have formatted the list into a high level overview of big changes and bad bugs relative to the previous release. Hopefully what you're interested in.
|
||||
This list does not include items which are solely performance boosts, for let us just say that virtually every system has been speeded up.
|
||||
|
||||
* The savestate system is totally changed and incompatible with old savestates.
|
||||
* The 3d system should be considered rewritten.
|
||||
|
||||
General/Core:
|
||||
enh: Convert to c++
|
||||
enh: Add functions for a lid open/close. Holding key (default "Backspace" in Windows port) while game is freeze/non freeze. [CrazyMax]
|
||||
enh: Add secure area decryption from ndstool [zeromus]
|
||||
enh: Change savestate code to support loosely bound chunks and more easily other parts of the emu (GE, GPU).
|
||||
The savestate format is changed, but from now on it is in principle more resilient
|
||||
(though it will continue to break as we tinker with the internals) [zeromus]
|
||||
enh: Added SSE2 optimizations for matrices. Since we now make an SSE2 build, more optimizations can be made. [CrazyMax]
|
||||
enh: Add a preliminary GUI hud system [CrazyMax,zeromus]
|
||||
|
||||
CPU/MMU:
|
||||
bug: Many fixes in IPC and GE FIFOs. Fixes freezes in NSMB, dsracing, and others. [CrazyMax,luigi__,shash]
|
||||
bug: Fix ARM instructions SBC and RSC (likewise SBC in thumb) [normatt]
|
||||
bug: Fixed Thumb LDMIA (fixes ingame Dead'n'Furious) [shash]
|
||||
bug: Fix repeating DMA (fixes NSMB parallax BG) [zeromus]
|
||||
bug: Proper handling for unaligned CPU accesses [luigi__]
|
||||
bug: Proper handling for undefined instruction exceptions [Salva Peiró]
|
||||
bug: correctly return vram control register values (fixes homebrew 3d games) [zeromus]
|
||||
enh: Remove 16MB of WRAM at 0x01****** from arm9. Mapped to unused instead. Nobody knows what this was. [zeromus]
|
||||
enh: Changed instruction execution to 16 at a time blocks (tested and stable) [shash]
|
||||
|
||||
Hardware:
|
||||
bug: Newer and better sqrt and div emulation; makes SM64DS playable [luigi__,shash,zeromus]
|
||||
bug: Add preliminary RTC implementations [CrazyMax]
|
||||
enh: Add cosine interpolation in the SPU (conditionally compiled) [zeromus,luigi__]
|
||||
enh: Experimental: always one silent non-mixing SPU core at 44.1khz synched with emu, for more precision.
|
||||
The audible core runs with the host, causing music to slow down but not tear or pitch bend. [zeromus]
|
||||
|
||||
Graphics:
|
||||
- Overhaul 3d:
|
||||
. Move entire GE to core emu.
|
||||
. Move OpenGL renderer to emu core for optional use by platforms, removing ogl_collector. Now every platform shares the same 3d code.
|
||||
. Reorganize 3d code to defer rendering to after 3d vblank. Eliminates tearing, and texturing artifacts. [zeromus]
|
||||
. Add optional fragment shading pipeline (more precision) [luigi__]
|
||||
. Move lighting model to software instead of using opengl's fixed function model [zeromus]
|
||||
. Render shadow volumes; toon shading and highlight table [zeromus, luigi__]
|
||||
. Added texture caching! big speed up. [CrazyMax]
|
||||
|
||||
bug: Many assorted tweaks and improvements to 3d and 2d precision [zeromus,CrazyMax,luigi__]
|
||||
bug: Fixes to GE: command unpacking, projection and pos-vector mode matrix handling, mult and load commands [zeromus]
|
||||
bug: Fix a bug in texture transformation mode 1 [zeromus]
|
||||
bug: Fixed GPU rendering bugs in sprites and BG [CrazyMax]
|
||||
bug: Fixes to texture conversion [CrazyMax,zeromus]
|
||||
bug: Fixes in capture display (no blinking in many games with dual 3D) [CrazyMax]
|
||||
bug: Fixes in master brightness (this fixes some games with black screens) [CrazyMax]
|
||||
bug: Fixes in screen, backdrop, and sprite blending [luigi__]
|
||||
bug: Changed clear depths and how depth initial values are calculated (fixes SM64DS skybox, Castlevania) [shash,lugi__]
|
||||
bug: Add 3d layer h-scrolling [zeromus]
|
||||
bug: Added transparency and fixed material alpha support and alpha testing on the 3D core [shash]
|
||||
bug: Rewrite VRAM mapping control and rendering (more accurate) [CrazyMax,luigi__]
|
||||
|
||||
bug: convert colors to opengl better to prevent alpha=31 polys from being ever so slightly transparent [zeromus]
|
||||
enh: Add MMU->GPU signal for when vram mappings change to function as a texture cache invalidate signal [zeromus]
|
||||
enh: Make matrix 4x4 multiply routines use W-coordinate; carry w coord through pipeline [zeromus]
|
||||
|
||||
Mac OS X port:
|
||||
bug: Fixed: Filenames and paths with unicode characters now work. [Jeff]
|
||||
bug: Fixed: Load state from file button works again. [Jeff]
|
||||
enh: Save State panel now pauses emulation while the file selection box is open. [Jeff]
|
||||
bug: Fixed: Frozen video output (and/or messed 3d emulation) after loading a state. [Jeff]
|
||||
bug: Added option to load the most recent file upon launching the program. [Jeff]
|
||||
enh: Added French translation (thanks to Pierre Rudloff). [Jeff]
|
||||
enh: Added basic key mapping configuration to application preferences (thanks to Julio GorgŽ). [Jeff]
|
||||
enh: Added keyboard shortcuts for Execute, Pause and Reset command (thanks to Julio GorgŽ). [Jeff]
|
||||
enh: Default key mappings are no longer case sensitive. [Jeff]
|
||||
enh: Added ability to limit speed. [Jeff]
|
||||
enh: Fixed: Video output should work on software-only 3D renderers. [Jeff]
|
||||
|
||||
Windows port:
|
||||
bug: Fix a race condition in NDS_3D_Reset and NDS_glInit [zeromus]
|
||||
bug: Fix the buggy auto frameskip logic which made the emu slow to a crawl. Now it runs fast! [zeromus]
|
||||
bug: Fix resizing, rotate & aspect ration of main window. [CrazyMax,_zeromus]
|
||||
bug: Remove multithreading from user interface after finding several synchronization issues [zeromus]
|
||||
enh: recent roms menu [luigi_]
|
||||
enh: Changed graphics render core to DirectDraw (work faster) [CrazyMax]
|
||||
enh: Add an arm9 cpu load average calculator similar to no$. but I dont think it works right. [zeromus]
|
||||
enh: Rewrite all debug tools (autoupdate works now) [CrazyMax]
|
||||
enh: Rewrite input core & replace config input dialog [CrazyMax]
|
||||
enh: Add AVI output [zeromus]
|
||||
enh: Add pause toggle and frame advance hotkeys [adelikat]
|
||||
enh: Add frame counter display and hud messages framework [adelikat]
|
||||
enh: Main window remembers position, size, and a few other emu preferences [adelikat]
|
||||
enh: Removed directx sdk dependency for easier building. [zeromus]
|
||||
enh: Savestate doesnt unpause emu if it is already paused [adelikat]
|
||||
|
||||
0.7.3 -> 0.8
|
||||
Cocoa:
|
||||
- Save State As function now works. [Jeff B]
|
||||
- Recent Items menu now works. [Jeff B]
|
||||
- Opening NDS files from Finder now works. [Jeff B]
|
||||
- Added screenshot feature. [Jeff B]
|
||||
- Added preferences. [Jeff B]
|
||||
- Many more strings are translatable now. [Jeff B]
|
||||
- Default screen color is black (better represents being "off" and easier on eyes at night). [Jeff B]
|
||||
- Added sound. [Jeff B]
|
||||
- Now is a universal binary. [Jeff B]
|
||||
- Leopard resolution icon added. [Jeff B]
|
||||
- Added a Japanese translation. [Jeff B]
|
||||
- Added an optional status bar (resize handle no longer overlaps screen). [Jeff B]
|
||||
- New ROM Info and About DeSmuME windows have been added. [Jeff B]
|
||||
- Fixed several bugs in window resizing. [Jeff B]
|
||||
- Added FAT image support for homebrew games (thanks to TypeError). [Jeff B]
|
||||
- Key config can be changed on the command line. Save/load hotkeys changed (so expose doesn't override). [Jeff B]
|
||||
- Key bindings may work better on non-US keyboards now (needs testing). [Jeff B]
|
||||
general:
|
||||
- Encapsulate GDB debug stub to avoid certain problems [shash]
|
||||
- Fixed CPU LD*/ST* bugs [shash]
|
||||
- Fixed New SMB mini-games freeze [shash]
|
||||
- Fixed possible segfault in ROMReader on ia64 and amd64. [evilynux]
|
||||
- Fixed a crash bug with 2D background corrupting memory [shash]
|
||||
- Flag check optimization [carlo_bramini]
|
||||
- Applied some endian fixes in GPU (thanks to Phazz) [Jeff B]
|
||||
gtk-glade:
|
||||
- Added DeSmuME version in about dialog. [evilynux]
|
||||
- Updated website url in about dialog. [evilynux]
|
||||
- Added Brazilian Portuguese translation by Dreampeppers99. [evilynux]
|
||||
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
|
||||
gtk:
|
||||
- Updated website url in about dialog. [evilynux]
|
||||
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
|
||||
windows port:
|
||||
- Added an "about" box [shash]
|
||||
- DirectInput control interface with joystick support [CrazyMax]
|
||||
- Matrix and Light viewer [Acid Burn]
|
||||
|
||||
0.7.2 -> 0.7.3
|
||||
gtk-glade:
|
||||
- Full localization using intltool/gettext. [evilynux]
|
||||
general:
|
||||
- Added a README.TRANSLATION documenting the localization process. [evilynux]
|
||||
MacOS X:
|
||||
- Initial version of the Mac interface added. [Jeff B]
|
||||
|
||||
0.7.1 -> 0.7.2
|
||||
spu:
|
||||
- big endian fixes. [cyberwarriorx]
|
||||
gpu:
|
||||
- big endian fixes. [marcus_c]
|
||||
gtk-glade:
|
||||
- opengl improvements. [masscat]
|
||||
general:
|
||||
- Added support for setting NDS firmware language value. [masscat]
|
||||
- Function added for setting firmware language. [masscat]
|
||||
- Mac/msys compilation fixes. [cyberwarriorx]
|
||||
- Fix compilation when pkg-config macros are not available [evilynux]
|
||||
|
||||
0.7.0 -> 0.7.1
|
||||
general:
|
||||
- Added GDB debugger stub [masscat]
|
||||
- Added new/different GBAMP CFlash image reader/writer [masscat]
|
||||
gpu:
|
||||
- Major speedup to the 2D core [shash]
|
||||
gtk-glade:
|
||||
- Added command line options. [masscat]
|
||||
- Added FPS limiter [masscat]
|
||||
cli:
|
||||
- Added command line options. [masscat]
|
||||
- Added FPS limiter [masscat]
|
||||
- Added option to use OpenGl to render window (allows resizing). [masscat]
|
||||
windows port:
|
||||
- Added command line options. [masscat]
|
||||
- Added multiple language support [cyberwarriorx]
|
||||
- Added Danish language translation [thomas-2007]
|
||||
|
||||
0.6.0 -> 0.7.0
|
||||
general:
|
||||
- Added support for *.duc files [cyberwarriorx]
|
||||
gpu:
|
||||
- Added support for sprite rotation/scaling [shash]
|
||||
- Added support for the 3D core (openGL and null plugins) [shash]
|
||||
windows port:
|
||||
- A bunch of fixes [Dmitry Krutskih]
|
||||
- Fixed a bug in sound that was causing it to still not work for some
|
||||
people [cyberwarriorx]
|
||||
gtk:
|
||||
- Added 3D emulation
|
||||
- Added command line options.
|
||||
- Added option to use OpenGL to render window (allows resizing).
|
||||
gtk-glade:
|
||||
- Added 3D emulation
|
||||
|
||||
0.5.0 -> 0.6.0
|
||||
general:
|
||||
- Added zipped (based on zziplib) and gzipped (based on zlib) rom support.
|
||||
arm:
|
||||
- Added relocation interrupt vector.
|
||||
- Added region access right checks.
|
||||
- Enabled LDC/STC instructions.
|
||||
- Fixed powersave (cp15) IRQ wait.
|
||||
- Fixed MOV instructions
|
||||
gpu:
|
||||
- Added special color effects.
|
||||
- Added windowing feature.
|
||||
- Fixed transparent direct color backgrounds.
|
||||
- Fixed disabled sprites showing.
|
||||
- Fixed 8/32 bit access to gpu registers.
|
||||
- Fixed missing backgrounds
|
||||
- Support for master brightness
|
||||
wifi:
|
||||
- Added RF chip interface.
|
||||
- Added BB chip interface.
|
||||
windows port:
|
||||
- Fixed address calculation in disassembler.
|
||||
- Added Force Maintain Ratio option for window stretching
|
||||
linux port (cli, gtk and gtk-glade):
|
||||
all:
|
||||
- Added joystick support.
|
||||
- Fixed X and Y buttons.
|
||||
gtk-glade:
|
||||
- Added joystick configuration.
|
||||
- Improved I/O registers viewer tool.
|
||||
- Added save and load states support.
|
||||
|
||||
0.3.3 -> 0.5.0
|
||||
arm:
|
||||
- Fixed MSR with immediate value opcode.
|
||||
- Fixed LSR_0 thumb opcode (C flag is correctly set now).
|
||||
- Fixed LDR*/STR* opcodes.
|
||||
- Fixed unaligned memory access on THUMB Core.
|
||||
- Added relocating SWI routines.
|
||||
bios:
|
||||
- Added decompression functions.
|
||||
- Added GetPitchTable function.
|
||||
- Added GetVolumeTable function.
|
||||
- Added GetCRC16 function.
|
||||
- Added experimental SoundBias function.
|
||||
- Added GetSineTable function.
|
||||
cart:
|
||||
- Added CompactFlash/FAT emulation.
|
||||
- Added Get ROM chip ID Cartridge command.
|
||||
gpu:
|
||||
- Added framebuffer emulation.
|
||||
- Fixed a bug in GPU (xfin could be greater than LG causing a segfault).
|
||||
- Added support for Display Mode 0(Display Off).
|
||||
- Added the basic framework for Display Mode 3(Display from Main RAM).
|
||||
spu:
|
||||
- Added sound emulation.
|
||||
- Added sound core system.
|
||||
- Added WAV write core.
|
||||
- Added dummy core.
|
||||
- Added Direct Sound core.
|
||||
linux port:
|
||||
- Added GTK+ GUI.
|
||||
- Added command line interface.
|
||||
- Added stylus and arm9 keypad support in CLI version.
|
||||
- Added FPS display.
|
||||
- Added basic frameskip.
|
||||
windows port:
|
||||
- Fixed a bug when displaying a ROM's information.
|
||||
- Added key configuration.
|
||||
- Removed the debug key.
|
||||
- Added new experimental auto frameskip/frame limit code.
|
||||
- Added sound settings dialog.
|
||||
- Added a few menu options for accessing the website, forums, and for
|
||||
submitting bugs.
|
||||
general:
|
||||
- Rewrote code in C.
|
||||
- Fixed warnings.
|
||||
- Used defines and typedef's to make things more portable and easier to
|
||||
read.
|
||||
- Added autotools stuff.
|
||||
- Changes to logging system.
|
||||
- Added screenshot function.
|
||||
- Translated most french to english.
|
||||
- Added savestate support.
|
||||
- Added firmware reading support(needs work).
|
||||
- Added Backup Memory support with autodetection.
|
||||
- Fixed some endianess issues.
|
||||
- Fixed things so Visual C++ can compile code.
|
||||
- Added bsd support.
|
||||
- Reworked ROM loading so you can load a different rom without any problems.
|
||||
- Finished NDS_Reset. Now the emulation can be reset even while running.
|
|
@ -0,0 +1,503 @@
|
|||
|
||||
|
||||
DeSmuME Manual for the Windows port
|
||||
|
||||
1 Quick Getting Started Guide
|
||||
1.1 Menu Layout
|
||||
1.1.1 File Menu
|
||||
1.1.1.1 File | Open Rom
|
||||
1.1.1.2 File | Recent Rom
|
||||
1.1.1.3 File | Rom Info
|
||||
1.1.1.4 File | Save State As...
|
||||
1.1.1.5 File | Load State As...
|
||||
1.1.1.6 File | Save State
|
||||
1.1.1.7 File | Load State
|
||||
1.1.1.8 File | Import Backup Memory
|
||||
1.1.1.9 File | Save Screenshot As...
|
||||
1.1.1.10 File | Quick Screenshot
|
||||
1.1.1.11 File | Record AVI
|
||||
1.1.1.12 File | Stop AVI
|
||||
1.1.1.13 File | Quit
|
||||
1.1.2 Emulation Menu
|
||||
1.1.2.1 Emulation | Pause
|
||||
1.1.2.2 Emulation | Reset
|
||||
1.1.2.3 Emulation | Shut Up
|
||||
1.1.2.4 Emulation | GBA Slot
|
||||
1.1.2.5 Emulation | Cheats
|
||||
1.1.2.6 Emulation | Cheats | List
|
||||
1.1.2.7 Emulation | Cheats | Search
|
||||
1.1.3 View Menu
|
||||
1.1.3.1 View | Rotation
|
||||
1.1.3.2 View | Window size
|
||||
1.1.3.3 View | Screen Separation
|
||||
1.1.3.4 View | Force Maintain Ratio
|
||||
1.1.3.5 View | Display Frame Counter
|
||||
1.1.3.6 View | Display FPS
|
||||
1.1.3.7 View | Display Input
|
||||
1.1.3.8 View | Display Lag Counter
|
||||
1.1.3.9 View | HUD Editing Mode
|
||||
1.1.4 Config Menu
|
||||
1.1.4.1 Config | Save Type
|
||||
1.1.4.2 Config | 3D Settings
|
||||
1.1.4.3 Config | Control Config
|
||||
1.1.4.4 Config | Hotkey Config
|
||||
1.1.4.5 Config | Sound Settings
|
||||
1.1.4.6 Config | WIFI Settings
|
||||
1.1.4.7 Config | Firmware Settings
|
||||
1.1.4.8 Config | Emulation Settings
|
||||
1.1.4.9 Config | Frame Skip
|
||||
1.1.4.10 Config | Language
|
||||
1.1.5 Tools Menu
|
||||
1.1.5.1 Tools | Disassembler
|
||||
1.1.5.2 Tools | View Memory
|
||||
1.1.5.3 Tools | View Registers
|
||||
1.1.5.4 Tools | View Palette
|
||||
1.1.5.5 Tools | View Tiles
|
||||
1.1.5.6 Tools | View Maps
|
||||
1.1.5.7 Tools | View OAM
|
||||
1.1.5.8 Tools | View Matrices
|
||||
1.1.5.9 Tools | View Lights
|
||||
1.1.5.10 Tools | View Layers
|
||||
1.1.6 Help Menu
|
||||
1.1.6.1 Help | Website
|
||||
1.1.6.2 Help | Forums
|
||||
1.1.6.3 Help | Submit a bug report
|
||||
1.1.6.4 Help | About
|
||||
|
||||
|
||||
Quick Getting Started Guide
|
||||
When you start the emulator for the first time, you probably just want to play a certain game. You can do this by going to 'File' in the menu, and selecting 'Open Rom'. This will open up an explorer window, within which you can browse to the rom (nds file) that you wish to play. Once the game has finished loading (and this should only take a few seconds at most), your game will automatically start running. But if you want, you can also compile from source. See the article Installing DeSmuME from source on Windows for details.
|
||||
|
||||
Menu Layout
|
||||
The rest of this manual will be spend on explaining all the other options in the menu.
|
||||
|
||||
|
||||
|
||||
|
||||
File Menu
|
||||
File | Open Rom
|
||||
This option is for loading games. A game is typically called a rom file. Just use the explorer window to browse to the file, and click on open. The game should just load and start. The desmume windows port is also able to load some compressed formats, like zip, rar, and 7-zip. Just as long as there is a valid game (rom) file in the compressed archive ending with an .nds extension, it should load fine.
|
||||
|
||||
File | Recent Rom
|
||||
This menu option contains a list of the roms that you have most recently loaded. You can quickly access a game that way, without having browse to the right directory with the 'Open Rom' option.
|
||||
|
||||
File | Rom Info
|
||||
This option offers some information about the internals of the rom file, like name, code, manufacturer, and size. This should not concern the casual gamer, but may come in handy for developers.
|
||||
|
||||
File | Save State As...
|
||||
Imagine you have gotten to a certian point in a game, and you need to do something else. The emulator let's you save the current state of the game, so that you can continue the game later at precisely the same point somewhere in the future.
|
||||
|
||||
File | Load State As...
|
||||
Once you have saved a game's position, or 'state', you can load it again with this option.
|
||||
|
||||
File | Save State
|
||||
This option works fairly similair to the 'Save As' option, altough it let's you save numbers instead os specifying a chosen name. Also, All the states saved via this option end up with a pre-determined name of 'game (rom) name'.dsx. So if the game is called MyGame, the first savefile will be called MyGame.ds0, the second one MyGame.ds1, etc.
|
||||
|
||||
File | Load State
|
||||
This option let's you load the states that you saved via the 'File | Save State' option
|
||||
|
||||
File | Import Backup Memory
|
||||
Backup Memory is the data the game uses to remember its own state. It is stored on the cart in a normal game. The file format is '.duc'. .duc is the same thing as .sav but a different format. People use pro action replays to capture it from their card and post it online without using emulators. Go to gamefaqs.com and find a '.duc' save file for a game you can use that function to import it into desmume. Its the save file. save ram. where your saved game goes. desmume calls it .sav file
|
||||
|
||||
File | Save Screenshot As...
|
||||
This lets you take a screenshot of the current view of the emulator, and specify it's name to save as a bitmap (.bmp) file.
|
||||
|
||||
File | Quick Screenshot
|
||||
This option also dumps a screencapture, but it has a pre-determied filename and location. It will be called printscreen.bmp, and located in the current directory. In Windows, this is probably the same folder as where your desmume binary is located.
|
||||
|
||||
File | Record AVI
|
||||
This option lets you capture what's going on in the emulator, and save it in an avi file.
|
||||
|
||||
File | Stop AVI
|
||||
The 'Record AVI' option continues to record the game, untill you press the 'Stop Avi' option.
|
||||
|
||||
File | Quit
|
||||
Choosing this option exits the emulator.
|
||||
|
||||
|
||||
|
||||
|
||||
Emulation Menu
|
||||
Emulation | Pause
|
||||
This option will pause the emulation, freezing it at the current moment of execution. Selecting it again will resume the execution of the ROM at the exact moment where you paused it.
|
||||
|
||||
Emulation | Reset
|
||||
This option will reset the ROM that is currently loaded to the very start of the ROM, just as if you chose 'File | Open Rom' again.
|
||||
|
||||
Emulation | Shut Up
|
||||
This option turns off all the sound.
|
||||
|
||||
Emulation | GBA Slot
|
||||
This menu option pop-ups a new window, which lets you specirfy what to do with the GBA slot of the Nintendo DS. It has the following choices : NONE, Compact Flash, Rumble Pack, GBA Game. Rumble pack allows some games to use vibration. Memory extension... Extends memory. And some DS games can have bonuses, unlockable by GBA cart. For example in Megaman ZX you can fight some Megaman Zero Bosses when correct cartridge is inserted. There are also other GBA slot extensions, like... a Guitar hero controller. But these are currently not emulated by desmume. Flash Cartridge is used for homebrew software emulation, for example that uses DLDI ( Dynamically Linked Device Interface).
|
||||
|
||||
Emulation | Cheats
|
||||
This option pulls down a drop-down menu, and presents the options list and search. Be aware though, that cheats are sort of half baked right now. If you are not having luck, wait for some news on an improved cheat system.
|
||||
|
||||
Emulation | Cheats | List
|
||||
Choosing 'list' will list all the currently known cheats. Please refer to the article Using Cheats in DeSmuMe for further details on how to use the cheat mechanism in desmume.
|
||||
|
||||
Emulation | Cheats | Search
|
||||
Choosing 'search' will let you search for cheats. Please refer to the article Using Cheats in DeSmuMe for further details on how to use the cheat mechanism in desmume.
|
||||
|
||||
View Menu
|
||||
View | Rotation
|
||||
This option will let you rotate the screen a pre-determined amount of degrees in order to adjust the angle of the display. Some programs require that you normally turn the DS on its side. You can set it up in that manner using this. The options are 0 (no rotation),90 ,180, and 270.
|
||||
|
||||
View | Window size
|
||||
This option will let you enlarge the windows a pre-determined size. The resize options are: 1x, 1.5x, 2x, 3x, and 4x the default size. You can also adjust the window size by clicking on the edge of the window, and dragging the mouse.
|
||||
|
||||
View | Screen Separation
|
||||
This option controls how far the two windows should be apart of each other, in other words: how big the border between them should be. Valid choices are: None (which is the default), narrow border (which is slightly larger), DS (which is about the wsame amount of room there is on a real Nintendo DS).
|
||||
|
||||
View | Force Maintain Ratio
|
||||
Here you can choose, when re-sizing the windows, if you wan to maintain the ratio of the windows. Sometimes when the window size is changed it doesn't look correct on the screen. This option forces the window to maintain a correct ratio so it looks correct. You can select or de-select this option.
|
||||
|
||||
View | Display Frame Counter
|
||||
Selecting this option causes a counter to run, that counts all the frames that have been displayed.
|
||||
|
||||
View | Display FPS
|
||||
Selecting this option causes the 'frames-per-second' (or 'fps', for short) to be displayed.
|
||||
|
||||
View | Display Input
|
||||
Selecting this option displays the keys you press on the keyboard, which is the input
|
||||
|
||||
View | Display Lag Counter
|
||||
This option causes a counter to display that counts frames where the game doesn't poll input.
|
||||
|
||||
View | HUD Editing Mode
|
||||
This option will let you drag around hud elements to pick their position.
|
||||
|
||||
|
||||
|
||||
|
||||
Config Menu
|
||||
Config | Save Type
|
||||
This option lets you specify the save type of a particular game. The default is 'automatic'. However, this is not fail-safe in all cases, so you might need to manually select one of the other savetypes.
|
||||
|
||||
Config | 3D Settings
|
||||
This option lets you select the method that is used to draw the screen. You can choose between OpenGL (an open standard) or SoftRasterizer (a desmume specific method).
|
||||
|
||||
Config | Control Config
|
||||
This option lets you configure keyboard keys or a joystick. The joystick support is implemented using a DirectInput control interface.
|
||||
|
||||
Config | Hotkey Config
|
||||
This menu option lets you define keys, that can be used to quickly select other options without having to go through the entire menu structure. Some examples are A hotkey for 'pause', or a hotkey for loading a specific savestate.
|
||||
|
||||
Config | Sound Settings
|
||||
This option lets you choose between different sound generating methods, which currectly are 'Direct Sound Interface' and 'WAV Write sound Interface'. it also let's you specify the size of the buffer to buffer the sound.
|
||||
|
||||
Config | WIFI Settings
|
||||
WIFI support is currently under heavy development, but it is not deemed ready for inclusion in the general public releases yet. Therefore, you may find this option missing, or simply 'greyed-out' for now.
|
||||
|
||||
Config | Firmware Settings
|
||||
This option provides you with the same set of options that a real Nintendo DS firmware does. The most important here is the language, for multi-langual games will often look at how this option is set.
|
||||
|
||||
Config | Emulation Settings
|
||||
These options let you boot from the extracted BIOS and Firmware of a real Nintendo DS. unless you have extracted/downloaded the firmware or bios from a Nintendo DS that you actually own yourself, these settings have no value for you qas desmume does not require them to run correctly.
|
||||
|
||||
Config | Frame Skip
|
||||
This option lets you select how many frames should not be displayed, in order to gain speed improvements. The default is 'Auto'. If you have speed problems, you could decide to skip (not display) one or more frames in order to improve the speed. 'Limit Frameskip' let's you limit the frame rate to 60fps maximum. 60fps is essentially the speed that the game plays at on the actual console itself. So by selecting this option, you're limiting the framerate to the actual speed of the actual console.
|
||||
|
||||
Config | Language
|
||||
This lets you set the langguage the emulator displays it's menu's and options in.
|
||||
|
||||
Tools Menu
|
||||
Tools | Disassembler
|
||||
This option displays the ARM9 and ARM7 disassembler. Be aware though, that the windows are drawn exactly on top of each other, so that you have to move (drag n drop) the first windows before the second window shows.
|
||||
|
||||
Tools | View Memory
|
||||
This tool displays the ARM7 and ARM9 memory. Be aware though, that the windows are drawn exactly on top of each other, so that you have to move (drag n drop) the first windows before the second window shows.
|
||||
|
||||
The "View mode" radio buttons allow you to choose how the memory will be shown:
|
||||
|
||||
8-bit : shows the memory as bytes
|
||||
16-bit : shows the memory as words
|
||||
32-bit : shows the memory as dwords
|
||||
The "View address" textbox and button allow you to jump to a different address:
|
||||
|
||||
Enter an hexadecimal address without 0x prefix, with up to 8 digits
|
||||
Click "Go" to jump to the entered address
|
||||
The "View dump" buttons allow you to dump the current view:
|
||||
|
||||
Text dump : dumps the view to a text file, in an human-readable form
|
||||
Raw dump : dumps the memory directly to a binary file which can be read with an hex editor
|
||||
Note that if you dump memory to a file already containing (a) dump(s), the new dump will be appended to the existing one(s).
|
||||
|
||||
The scrollbar... well, you surely know how a scrollbar works.
|
||||
|
||||
The viewers additionally allow to edit the memory. For it, click on the value you want to edit, then type the new value. The new value is applied only once you've entirely entered it.
|
||||
|
||||
Tools | View Registers
|
||||
This option lets you view the ARM7 and ARM9 I/O registers.
|
||||
|
||||
Tools | View Palette
|
||||
This option lets you view the palette in detail.
|
||||
|
||||
Tools | View Tiles
|
||||
This option lets you view the tiles in detail.
|
||||
|
||||
Tools | View Maps
|
||||
This option lets you view the maps in detail.
|
||||
|
||||
Tools | View OAM
|
||||
This option lets you view the OAM layer in detail.
|
||||
|
||||
Tools | View Matrices
|
||||
This option lets you view the matrices in detail.
|
||||
|
||||
Tools | View Lights
|
||||
This option lets you view the lights in detail.
|
||||
|
||||
Tools | View Layers
|
||||
This option lets you view the Layers one by one.
|
||||
|
||||
|
||||
|
||||
|
||||
Help Menu
|
||||
Help | Website
|
||||
This option directs your browser to the desmume homepage.
|
||||
|
||||
Help | Forums
|
||||
This option directs your browser to the desmume forums.
|
||||
|
||||
Help | Submit a bug report
|
||||
This option directs your browser to the SourceForge bugtracker for desmume.
|
||||
|
||||
Help | About
|
||||
This option displays the authors of the emulator.
|
||||
|
||||
Retrieved from "http://wiki.desmume.org/index.php?title=DeSmuME_Manual_for_the_Windows_port
|
||||
|
||||
This page was last modified on 20 April 2009, at 10:45.
|
||||
|
||||
====================================================================
|
||||
|
||||
Faq
|
||||
|
||||
If the FAQ is unable to answer your question(s), then please make sure that you also consult the manual.
|
||||
|
||||
Contents [hide]
|
||||
1 General Questions
|
||||
1.1 What does desmume emulate and on what systems?
|
||||
1.2 What does DeSmuME mean?
|
||||
1.3 Why doesn't my desmume play this game?
|
||||
1.4 Why does this game fail to save?
|
||||
1.5 Can I use my savefile's acrosss versions ?
|
||||
1.6 Why can't I find a mac binary?
|
||||
1.7 Why does my mac binary say something about being unsupported?
|
||||
1.8 Where can I report bugs?
|
||||
1.9 Can I attach files to bug reports I did not create myself ?
|
||||
1.10 How do I get the latest svn code and build desmume myself?
|
||||
1.11 Whats 'svn' ?
|
||||
1.12 What compilers are supported for building desmume from source ?
|
||||
1.13 Im a developer, and would like to contribute to the codebase. What can I do ?
|
||||
1.14 Im not a developer, but would like to help out anyway. What can I do ?
|
||||
1.15 It is hard to zoom in on a widescreen display due to the weird aspect ratio of the DS.
|
||||
1.16 Why doesn't my openGL 3d work in linux?
|
||||
1.17 Why doesn't my openGL 3d work in windows?
|
||||
1.18 Why doesn't a menu option or tool exist in my linux or mac build?
|
||||
1.19 Why does music sound bad sometimes?
|
||||
1.20 Why doesn't my game boot or progress into the main game engine?
|
||||
1.21 What hardware features are emulated?
|
||||
1.22 Does the GDB stub still work?
|
||||
1.23 Where/what is IRC?
|
||||
1.24 Where is the manual?
|
||||
1.25 How do I enter 'cheat codes' in desmume ?
|
||||
1.26 Why is the emulator slow?
|
||||
1.27 What are the minimum hardware requirements for desmume ?
|
||||
1.28 What are the recommended hardware requirements for desmume ?
|
||||
1.29 Does desmume support wifi ?
|
||||
1.30 Why do I get an assert in wifi.cpp which keeps me from playing a game?
|
||||
1.31 OK, then why does it make my firewall alert since 0.9.2 ?
|
||||
1.32 Does desmume support the microphone ?
|
||||
1.33 Where can I find technical details on the Nintendo DS and GBA ?
|
||||
1.34 Does the 'GBA slot' option let me play GBA games ?
|
||||
1.35 What is DLDI ?
|
||||
1.36 I get the error: Data could not be accessed. Turn off the power and reinsert the DS card.
|
||||
1.37 How can I post a screenshot file on the desmume forum ?
|
||||
1.38 How can I post a savefile or avi capture on the desmume forum ?
|
||||
1.39 How can I post a large log or other text file on the desmume IRC chat room ?
|
||||
1.40 My display is incorrect or corrupted
|
||||
1.41 What are the origins of DeSmuME ?
|
||||
|
||||
|
||||
General Questions
|
||||
What does desmume emulate and on what systems?
|
||||
Desmume attempts to emulate, as faithfully as possible, the Nintendo DS and Nintendo DS Lite handheld game consoles (nds). It currently runs on Windows, Linux, and mac OSX. DSi is not supported.
|
||||
|
||||
What does DeSmuME mean?
|
||||
DeSmuME is a Nintendo DS emulator and the name is a play of words - DS Emu + ME (like FlashMe - firmware hack and PassMe mod-chip for DS) The name DeSmuME derives from the popular use of ME in Nintendo DS products by homebrew developers. So DeSmuME would equal DSemuMe. Other popular uses of ME include:
|
||||
|
||||
LoadMe - a generic patcher for commercial DS roms that works with any GBA Flash Card
|
||||
PassMe - "mod-chip" using which takes authentication from an original DS card an allows execution of unauthenticated DS rom code - from the GBA cartridge slot / GBA flash card.
|
||||
FlashMe - a hacked firmware for DS that allows you to start code in DS mode from a flash card in the GBA slot.
|
||||
WifiMe - are a set of a custom drivers and software by FireFly for RALink based wireless network cards enabling to boot homebrew code on DS via Nintendo Wireless Multiboot method.
|
||||
Why doesn't my desmume play this game?
|
||||
Go to desmume.org and make sure you are using the latest version. Hint: desmume 0.8 and 0.3.4 are very old. Older versions will not be supported, under any circumstances.
|
||||
Why does this game fail to save?
|
||||
Desmume's autodetection for save types is not very good. For now, you need to manually specify the correct save type for your game. Consult the manual for details on how to do this for your platform. We want to fix this, but there are no specific plans so far. You may also consult http://www.advanscene.com/ to easily identify the save type for your game.
|
||||
Can I use my savefile's acrosss versions ?
|
||||
Probably not. Due to the constant internal changes sin desmume, it is unlikely that a savefile created with one version will work with another version of desmume
|
||||
Why can't I find a mac binary?
|
||||
We have an 0.9.2 mac binary which might not be linked to from the downloads page yet. Go to https://sourceforge.net/project/showfiles.php?group_id=164579&package_id=186413
|
||||
Why does my mac binary say something about being unsupported?
|
||||
There is no universal mac binary. Only i386 is supported. I blame the big endians. If you don't like this, better volunteer yourself to fix endian issues in the code (every day, I see something new that makes me say 'hmmmm that doesnt look endian safe')
|
||||
Where can I report bugs?
|
||||
In the official bug tracker; you may also request features around the same location, too, but in the other trackers.
|
||||
Can I attach files to bug reports I did not create myself ?
|
||||
SourceForge likes for folks to only respond on items they submit. If you see a ticket that represents something you are encountering, SourceForge doesn't necessarily want you commenting on that. The reasoning for this given by SourceForge is that they feel it is best to open your own ticket, which helps appreciate the extent of issues in many cases. The authors of desmume may or may not agree with this point of view from SourceForge.
|
||||
How do I get the latest svn code and build desmume myself?
|
||||
Please check out the instructions related to your platform, over at Installing DeSmuME from source
|
||||
Whats 'svn' ?
|
||||
svn is a developers tool. It's used to let multiple developers work on the same codebase without conflicts. If youre an end-user, don't worry about it. And if you're a developer, see the question on how to get the latest svn code and build desmume yourself. See wikipedia for more info
|
||||
|
||||
What compilers are supported for building desmume from source ?
|
||||
At the moment, for Windows Microsoft Visual C++ 2005 and 2008 are the only supported compilers. Dev-c++ is not supported. Why won't you just download visual c++ express?
|
||||
For Linux, any recent version of GCC and toolchain should work.
|
||||
Im a developer, and would like to contribute to the codebase. What can I do ?
|
||||
To start you off in the right direction, the best thing you can do is join the developer team on IRC and discuss your intentions with the developers.
|
||||
|
||||
Im not a developer, but would like to help out anyway. What can I do ?
|
||||
The most helpful thing you can do is use it, learn its ins and outs, and learn how to compile svn builds. Then monitor it for regressions and report bugs. You can patrol the bug tracker for bugs which could use elucidation or which, based on your awareness of how the emulator is changing, might be fixed without us having specifically addressed the bug. Basically, be a super user. And hang out on irc. Also, adding to or perfecting the documentation in the wiki is usefull. You could also watch for and answer questions placed on the desmume forum.
|
||||
|
||||
It is hard to zoom in on a widescreen display due to the weird aspect ratio of the DS.
|
||||
In fact it is hard to zoom in on a 4:3 screen, too. Proposals involve tearing apart windows and floating them side by side or separately or something. This may happen one day, in the form of side by side windows.
|
||||
|
||||
Why doesn't my openGL 3d work in linux?
|
||||
Blame nvidia and ati for putting out shoddy drivers. Then switch to software rasterizer.
|
||||
|
||||
Why doesn't my openGL 3d work in windows?
|
||||
You are probably using an ATI video card. ATI driver support of OpenGL is known to be poor. Get an nvidia. Do not argue with that, we are professional programmers and know what we're talking about. Or, switch to software rasterizer
|
||||
|
||||
Why doesn't a menu option or tool exist in my linux or mac build?
|
||||
Because making portable tools and platform harnesses are not our cup of tea and so a developer puts a feature into whichever ports he cares about. This policy is never going to change, although some features might migrate to other platforms over time. Better check the manual.
|
||||
|
||||
Why does music sound bad sometimes?
|
||||
Most DS music is sequenced music, loaded from the cart to the ARM7 entirely when the level loads. This works fine. Your music that doesn't work is probably streaming music, which loads from the cart on the fly and goes straight to the speakers. This is much harder to emulate as it requires correct timing, which is not one of desmume's strengths right now. This may not be fixed for a while.
|
||||
|
||||
Why doesn't my game boot or progress into the main game engine?
|
||||
Desmume is not perfect yet. Some games may fail due to wifi emulation. Apparently if you search the web correctly you can find ways to patch games to work better on emulators.
|
||||
|
||||
What hardware features are emulated?
|
||||
All known 2d graphics features are correct. Mosaics work but are imperfect. There may be small issues with colors as the correct color bit depths are not used at all points in the pipeline.
|
||||
All 3d features are emulated, except for: tests, wireframes, edge marking, fog, and antialising. The opengl engine is near its limit and renders some things incorrectly. Eventually the software rasterizer (will support more features and be far more precise in the basic features. Both engines have trouble with some shadows, but software rasterizer is better. Software rasterizer has some noticeable texturing issues right now, especially in 2d games. Software rasterizer supports more correct lighting interpolation than opengl ever will (e.g. glitches at the edge of the screen while scrolling.) In software rasterizer, there are issues similar to 2d with incorrect bit depth being used in the pipeline. There are inaccurate edge conditions in each renderer; in opengl, textures tend to get overdrawn; in software rasterizer, edges of textures tend to be jittery.
|
||||
One last thing -- if buttons and labels and menus rendering on the 3d screen are obscured (for example, a button but no label is on it) then you may need to use the software rasterizer.
|
||||
|
||||
All sound features are emulated. The microphone support is new and the manual should be consulted, where you will find out, among other things, that it is only supported in windows right now.
|
||||
Wifi is not supported. It is currently under slow and incomplete development. Therefore, you may find this option missing, or simply 'greyed-out' for now. Also, since WIFI support does not work yet, don't ask any questions about it's functioning because it still is unfinished and does not work yet.
|
||||
We are unaware of any outstanding issues in the core system hardware (cpu, dma, mmu) but there are certainly still some. The instruction and memory timings are quite incorrect; however, this seems not to hurt most softwares.
|
||||
DLDI does anybody know if this still works?
|
||||
Dynamically Linked Driver Interface, commonly known as DLDI, is a driver framework that allows NDS and GBA homebrew to easily read and write to any number of different devices, just by substituting a driver file.
|
||||
RTC (real-time clock) works; This is what makes the time in your games stay at 00:00:00, and what makes your random number values always come up the same.
|
||||
Does the GDB stub still work?
|
||||
This has not been built into the public releases, nor has the feature been tested in a while. If you want to be a test user, please hop on IRC and coordinate with us.
|
||||
|
||||
Where/what is IRC?
|
||||
IRC is an on-line communication system.
|
||||
|
||||
data you need:
|
||||
|
||||
server: irc.freenode.net
|
||||
port: 6667
|
||||
channel: #desmume
|
||||
what to use:
|
||||
|
||||
mIRC - windows
|
||||
ChatZilla - FireFox add-on
|
||||
xchat - X
|
||||
plenty other, see wikipedia
|
||||
Where is the manual?
|
||||
A manual for desmume is over at http://wiki.desmume.org/index.php?title=Manual. It may not have the information that other entries in this FAQ promised that it would.
|
||||
|
||||
How do I enter 'cheat codes' in desmume ?
|
||||
It is impossible yet to use "commercial" codes, such as Action Replay and Codebreaker, so what you'll have to do is manually search for, and alter the memory positions to your advantage. There's an excellent article in the wiki on Using Cheats in DeSmuMe
|
||||
|
||||
Why is the emulator slow?
|
||||
Because nobody pays us to work on it full time and it runs fast enough for us to be happy. Well, almost. The cheapest way to get 60fps is to buy the cart. Buying a newer, faster computer is somewhat more expensive, and it has other side benefits. Also, if you are in Windows, make sure you have tried the SSE build which helps a little bit. Additionally, if you are using someone else's interim build it might not be fully optimized since we make our Windows releases using some profiler-guided optimization which helps by several FPS. You could try turning off the sound. And one last thing: try a new video card. But only as long as it is an nvidia. Also, a faster CPU is more helpfull than a bleeding edge graphics card. desmume is more CPU intensive than it is GPU intensive. It just needs a graphics card that is glitch-free, and currently the nvidia cards have a better track record.
|
||||
|
||||
What are the minimum hardware requirements for desmume ?
|
||||
From a purely technical viewpoint, there are no minimum requirements. However, for 'real-world' playable speeds, you would need at least the following :
|
||||
|
||||
Windows OS: Windows XP or Vista
|
||||
Linux OS: Any recent Linux distribution with a 2.6 kernel.
|
||||
2 GHz Processor
|
||||
512 MB Available System Memory
|
||||
Available Hard Drive Space: A few MB for desmume, and several GB for the nds files.
|
||||
128 MB 3D Video Card (Nvidia GeForce 6800 or better), ATI cards are not recommended.
|
||||
Optional: Sound Card, if you want sound support
|
||||
Optional: Microphone, if you wish to make use the Windows Microphone feature
|
||||
What are the recommended hardware requirements for desmume ?
|
||||
From a purely technical viewpoint, there are no recommended requirements. However, for 'real-world' playable speeds, the following gives you good performance:
|
||||
|
||||
Windows OS: Windows XP or Vista
|
||||
Linux OS: Any recent Linux distribution with a 2.6 kernel.
|
||||
3 GHz Processor
|
||||
1 GB Available System Memory
|
||||
Available Hard Drive Space: A few MB for desmume, and lots of GB's for the nds files.
|
||||
512 MB 3D Video Card (Nvidia GeForce), ATI cards are not recommended.
|
||||
Sound Card.
|
||||
Microphone.
|
||||
Does desmume support wifi ?
|
||||
Wifi is not supported. It is currently under slow and incomplete development. Therefore, you may find this option missing, or simply 'greyed-out' for now. Also, since WIFI support does not work yet, don't ask any questions about it's functioning because it still is unfinished and does not work yet. Furthermore, current development activities focus mainly on the Windows build.
|
||||
|
||||
Why do I get an assert in wifi.cpp which keeps me from playing a game?
|
||||
This was a glitch in 0.9.2 release. The download package has been replaced. Download it again and check the changelog to see if you have the fixed version.
|
||||
|
||||
OK, then why does it make my firewall alert since 0.9.2 ?
|
||||
Your firewall is stupid, or winsock is stupid, (I am not sure which yet) for alerting just when winsock gets initialized. The emulator hasnt actually tried to connect to the internet yet. How could it? There isn't any wifi. All we are doing is some network initialization code. For those of you who are still not satisfied, then I will admit that there is actually some wifi code--but it doesnt actually do anything yet! Except alert your firewall. Sorry. Also, maybe that is actually a good, unobtrusive time for firewalls to alert. But I am not sorry for calling them stupid. They are hyperactive crybabies.
|
||||
|
||||
Does desmume support the microphone ?
|
||||
Yes, but only on the Windows port. You do have to have an actual microphone attached to your PC, though. And perhaps somewhat confusing, the Linux ports do report 'Microphone successfully initialized' on startup of the emulator - but currently this is just a piece of stub (dummy) code used only to correctly start the emulator.
|
||||
|
||||
Where can I find technical details on the Nintendo DS and GBA ?
|
||||
http://nocash.emubase.de/gbatek.htm
|
||||
|
||||
Does the 'GBA slot' option let me play GBA games ?
|
||||
No. A 'real' Nintendo DS can use the gba slot to play gba games, but desmume does not emulate this. But a 'real' Nintnedo DS can also use the gba slot to access gba roms and sram so that ds games can import savefiles, and that part is emulated by desmume. If you are looking for a Game Boy Advance (GBA) emulator, perhaps you can try mednafen or visualboy advance.
|
||||
|
||||
What is DLDI ?
|
||||
let me give you an overview on DLDI. You should know that there are many various flash cartridges for DS. They use different file allocation systems, different storages, etc. They are used for launching homebrew. So to make one proram run on all cards. You’d have to write support for each and every card so that it worked for everyone. But none needs support for other cards than their And then genial solution was found. There was an universal IO unit made that’s just interface to IO operations. If you don't have a DS, why do you bother with desmume ? You surely don't have bought any game to run on it. And compiled program does not know how to handle file system etc. And then user can append IO routines for his own card. “DLDI patch”. So, now when I have an M3 cart. I download rom, patch it with m3 DLDI patch. And it works on my cart. Say you had Supercard instead. You’d have to download very same rom and apply Supercart DLDI patch to it. DLDI patch is the same for all roms. So it’s easy for both developper and end user.
|
||||
|
||||
I get the error: Data could not be accessed. Turn off the power and reinsert the DS card.
|
||||
The automatic savetype detection probably failed to detect the correct savetype, and you have to set it manually to the correct type. If you are lucky, information about your game (and the corresponding savetype) can be found on a website such as http://www.advanscene.com/. And if you're not as lucky, you'll just have to try them all out until you find the correct type.
|
||||
|
||||
How can I post a screenshot file on the desmume forum ?
|
||||
You can create a screenshot, and then upload it to a free external service provider like ImageShack (http://imageshack.us/), and then put the provided links to the page in the message you post on the forum.
|
||||
|
||||
How can I post a savefile or avi capture on the desmume forum ?
|
||||
After you created it, yo can upload it to a free external service provider like MediaFire (http://www.mediafire.com/), and then put the provided links to the page in the message you post on the forum.
|
||||
|
||||
How can I post a large log or other text file on the desmume IRC chat room ?
|
||||
Make use of the external service provider 'pastebin' (http://pastebin.com/), and post the url to it on the IRC channel.
|
||||
|
||||
My display is incorrect or corrupted
|
||||
Try switching the 3D Renderer from opengl or SoftRasterizer, or vice versa, to see if that resolves the bug. In windows, the default hotkey to do this quickly is numpad minus.
|
||||
|
||||
What are the origins of DeSmuME ?
|
||||
DeSmuME is a freeware emulator for the Nintendo DS created by YopYop156.
|
||||
|
||||
Due to change in French laws regarding emulation YopYop has decided to stop development of DeSmuME Nintendo DS emulator but that doesn't mean that DeSmuME is obsolete - programmers in this project have picked up where Yopyop left off. The original website was http://yopyop156.ifrance.com/.
|
||||
|
||||
Yopyop said:
|
||||
|
||||
It’s release under GPL. I have just removed the new 3D engine because it’s too much bugged. Hopefully it will be helpful for some of you.
|
||||
|
||||
The latest statement heard from yopyop was :
|
||||
|
||||
DeSmuMe project is over.
|
||||
You may don’t know but there are a new law in France that could put me in big trouble.
|
||||
With DeSmuMe, I have closed the doors of game company but I can not offer to pay for it.
|
||||
The worst thing is that I have found the bad coded instructions.
|
||||
For those how have download the sources you have to look in sbc, rsbc instructions the Carry flag updating is wrong.
|
||||
Sorry for the home brew programmers.
|
||||
For the illegality the demonstration seemed to me convincing thus without proof clarify I prefer to stick to this decision.
|
||||
It is also the fact that few people seem interested by the project. Put besides some people who sent demonstrations to me which did not go, I received only malls to wonder to make function such or such plays or to ask me why moved is in French .
|
||||
Thus I will not do something of useless and illegal.
|
||||
For the site it would not obstruct me if there were not the bond on the left which does nothing but add to confusion on the goal of the project.
|
||||
And for the sources it is the same problem as for the project.
|
||||
good week end
|
||||
yopyop
|
||||
edit the law relates to the royalties and the rights close, not?
|
||||
|
||||
Retrieved from "http://wiki.desmume.org/index.php?title=Faq"
|
|
@ -24,15 +24,6 @@ AC_PROG_RANLIB
|
|||
dnl -- check for endianess
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
# took this from geany, hope it works
|
||||
REVISION="r0"
|
||||
SVN=`which svn 2>/dev/null`
|
||||
if test -d ".svn" -a "x${SVN}" != "x" -a -x "${SVN}" ; then
|
||||
REVISION=r`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4`
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([SVN_REV], "$REVISION", [subversion revision number])
|
||||
|
||||
|
||||
dnl --- Other prerequisites ---
|
||||
dnl - Check for pkg-config macros
|
||||
m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG])
|
||||
|
@ -88,8 +79,6 @@ if test "x$osmesa" = "xyes" ; then
|
|||
fi
|
||||
|
||||
dnl - Check for GTK and/or libglade
|
||||
FOUND_GLIB=no
|
||||
HAVE_ALSA=no
|
||||
GLIB_VER=2.8
|
||||
GTK_VER=2.6
|
||||
AC_CHECK_TOOL(HAVE_PKG, pkg-config)
|
||||
|
@ -97,8 +86,8 @@ AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [
|
|||
if test ! "x$HAVE_PKG" = "x" ; then
|
||||
PKG_CHECK_MODULES(GLIB,
|
||||
glib-2.0 >= $GLIB_VER,
|
||||
FOUND_GLIB=yes,
|
||||
FOUND_GLIB=no)
|
||||
HAVE_GLIB=yes,
|
||||
HAVE_GLIB=no)
|
||||
|
||||
PKG_CHECK_MODULES(GTK,
|
||||
gtk+-2.0 >= $GTK_VER,
|
||||
|
@ -143,16 +132,6 @@ AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [
|
|||
HAVE_LUA=no)
|
||||
AC_SUBST(LUA_CFLAGS)
|
||||
AC_SUBST(LUA_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(ALSA, alsa >= 1.0, HAVE_ALSA=yes, HAVE_ALSA=no)
|
||||
AC_SUBST(ALSA_CFLAGS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(LIBAGG, libagg >= 2.5.0, HAVE_LIBAGG=yes, HAVE_LIBAGG=no)
|
||||
AC_SUBST(LIBAGG_CFLAGS)
|
||||
AC_SUBST(LIBAGG_LIBS)
|
||||
|
||||
AC_PATH_PROG(UPDATEDESKTOP, [update-desktop-database])
|
||||
fi
|
||||
],[
|
||||
echo "WARNING: pkg-config is not available therefore gtk, gtk-glade UIs and lua scripting are not available either."
|
||||
|
@ -161,21 +140,6 @@ AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [
|
|||
dnl -- force lua disabled
|
||||
AM_CONDITIONAL([HAVE_LUA], [test "${HAVE_LUA}x" = "yes"])
|
||||
|
||||
AM_CONDITIONAL([HAVE_ALSA], [test "${HAVE_ALSA}" = "yes"])
|
||||
if test "x$HAVE_ALSA" = "xno"; then
|
||||
AC_DEFINE([FAKE_MIC])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_LIBAGG], [test "${HAVE_LIBAGG}" = "yes"])
|
||||
if test "x$HAVE_LIBAGG" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBAGG])
|
||||
else
|
||||
AC_MSG_ERROR([Antigrain library is required to build desmume])
|
||||
fi
|
||||
|
||||
dnl - set conditional for glib, needed to avoid commandline.cpp compilation for cli frontend since it depends on glib
|
||||
AM_CONDITIONAL([HAVE_GLIB], [test "${FOUND_GLIB}" = "yes"])
|
||||
|
||||
dnl - If the gtkGLext package is available define the corresponding C macro
|
||||
if test "x$HAVE_GTKGLEXT" = "xyes"; then
|
||||
AC_DEFINE([GTKGLEXT_AVAILABLE], [1])
|
||||
|
@ -202,7 +166,7 @@ if test "x$HAVE_SDL" = "xyes"; then
|
|||
GETTEXT_PACKAGE=desmume
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the gettext package name])
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
ALL_LINGUAS="fr pt_BR zh_CN"
|
||||
ALL_LINGUAS="fr pt_BR"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
PO_DIR="po"
|
||||
PO_FILES="intltool-extract intltool-merge intltool-update"
|
||||
|
@ -214,16 +178,6 @@ if test "x$HAVE_SDL" = "xyes"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl - wifi support
|
||||
AC_ARG_ENABLE(wifi,
|
||||
[AC_HELP_STRING(--enable-wifi, enable experimental wifi support)],
|
||||
[
|
||||
AC_CHECK_LIB(pcap, main,[
|
||||
AC_DEFINE(EXPERIMENTAL_WIFI)
|
||||
LIBS="$LIBS -lpcap"
|
||||
])
|
||||
])
|
||||
|
||||
dnl Set compiler library flags per target.
|
||||
case $target in
|
||||
*linux* | *bsd*)
|
||||
|
@ -235,8 +189,6 @@ case $target in
|
|||
;;
|
||||
*darwin*)
|
||||
LIBS="$LIBS -framework OpenGL"
|
||||
dnl - extra hackery needed for X includes
|
||||
AC_PATH_XTRA
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -275,8 +227,7 @@ if test "x[$]ENABLE_HARDCORE" = "x1"; then
|
|||
dnl - only valid for C with newer gcc's
|
||||
CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
|
||||
fi
|
||||
dnl - -Wshadow
|
||||
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
|
||||
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wshadow -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
|
||||
fi
|
||||
|
||||
dnl - Enable debug mode
|
|
@ -1,672 +0,0 @@
|
|||
DeSmuME Manual for the Windows port
|
||||
Contents
|
||||
* 1 Quick Getting Started Guide
|
||||
o 1.1 Menu Layout
|
||||
+ 1.1.1 File Menu
|
||||
# 1.1.1.1 File | Open Rom
|
||||
# 1.1.1.2 File | Recent Rom
|
||||
# 1.1.1.3 File | Rom Info
|
||||
# 1.1.1.4 File | Save State As...
|
||||
# 1.1.1.5 File | Load State As...
|
||||
# 1.1.1.6 File | Save State
|
||||
# 1.1.1.7 File | Load State
|
||||
# 1.1.1.8 File | Import Backup Memory
|
||||
# 1.1.1.9 File | Export Backup Memory
|
||||
# 1.1.1.10 File | Save Screenshot As...
|
||||
# 1.1.1.11 File | Quick Screenshot
|
||||
# 1.1.1.12 File | Record AVI
|
||||
# 1.1.1.13 File | Stop AVI
|
||||
# 1.1.1.14 File | Record WAV
|
||||
# 1.1.1.15 File | Record Movie
|
||||
# 1.1.1.16 File | Play Movie
|
||||
# 1.1.1.17 File | Stop Movie
|
||||
# 1.1.1.18 File | Quit
|
||||
+ 1.1.2 Emulation Menu
|
||||
# 1.1.2.1 Emulation | Pause
|
||||
# 1.1.2.2 Emulation | Reset
|
||||
# 1.1.2.3 Emulation | Clear Sound
|
||||
# 1.1.2.4 Emulation | GBA Slot
|
||||
# 1.1.2.5 Emulation | Cheats
|
||||
# 1.1.2.6 Emulation | Cheats | List
|
||||
# 1.1.2.7 Emulation | Cheats | Search
|
||||
+ 1.1.3 View Menu
|
||||
# 1.1.3.1 View | Rotation
|
||||
# 1.1.3.2 View | Window size
|
||||
# 1.1.3.3 View | Screen Separation
|
||||
# 1.1.3.4 View | Force Maintain Ratio
|
||||
# 1.1.3.5 View | Display Frame Counter
|
||||
# 1.1.3.6 View | Display FPS
|
||||
# 1.1.3.7 View | Display Input
|
||||
# 1.1.3.8 View | Display Lag Counter
|
||||
# 1.1.3.9 View | HUD Editing Mode
|
||||
+ 1.1.4 Config Menu
|
||||
# 1.1.4.1 Config | Save Type
|
||||
# 1.1.4.2 Config | 3D Settings
|
||||
# 1.1.4.3 Config | Control Config
|
||||
# 1.1.4.4 Config | Hotkey Config
|
||||
# 1.1.4.5 Config | Sound Settings
|
||||
# 1.1.4.6 Config | WIFI Settings
|
||||
# 1.1.4.7 Config | Firmware Settings
|
||||
# 1.1.4.8 Config | Emulation Settings
|
||||
# 1.1.4.9 Config | Frame Skip
|
||||
# 1.1.4.10 Config | Language
|
||||
+ 1.1.5 Tools Menu
|
||||
# 1.1.5.1 Tools | Disassembler
|
||||
# 1.1.5.2 Tools | View Memory
|
||||
# 1.1.5.3 Tools | View Registers
|
||||
# 1.1.5.4 Tools | View Palette
|
||||
# 1.1.5.5 Tools | View Tiles
|
||||
# 1.1.5.6 Tools | View Maps
|
||||
# 1.1.5.7 Tools | View OAM
|
||||
# 1.1.5.8 Tools | View Matrices
|
||||
# 1.1.5.9 Tools | View Lights
|
||||
# 1.1.5.10 Tools | View Sound State
|
||||
# 1.1.5.11 View | RAM Watch
|
||||
# 1.1.5.12 View | RAM Search
|
||||
# 1.1.5.13 Tools | View Layers
|
||||
+ 1.1.6 Help Menu
|
||||
# 1.1.6.1 Help | Website
|
||||
# 1.1.6.2 Help | Forums
|
||||
# 1.1.6.3 Help | Submit a bug report
|
||||
# 1.1.6.4 Help | About
|
||||
|
||||
Quick Getting Started Guide
|
||||
|
||||
When you start the emulator for the first time, you probably just want to play a certain game. You can do this by going to 'File' in the menu, and selecting 'Open Rom'. This will open up an explorer window, within which you can browse to the rom (nds file) that you wish to play. Once the game has finished loading (and this should only take a few seconds at most), your game will automatically start running. But if you want, you can also compile from source. See the article Installing DeSmuME from source on Windows for details.
|
||||
Menu Layout
|
||||
|
||||
The rest of this manual will be spend on explaining all the other options in the menu.
|
||||
|
||||
|
||||
File Menu
|
||||
File | Open Rom
|
||||
|
||||
This option is for loading games. A game is typically called a rom file. Just use the explorer window to browse to the file, and click on open. The game should just load and start. The desmume windows port is also able to load some compressed formats, like zip and gz. Just as long as there is a valid game (rom) file in the compressed archive ending with an .nds extension, it should load fine.
|
||||
File | Recent Rom
|
||||
|
||||
This menu option contains a list of the roms that you have most recently loaded. You can quickly access a game that way, without having browse to the right directory with the 'Open Rom' option.
|
||||
File | Rom Info
|
||||
|
||||
This option offers some information about the internals of the rom file, like name, code, manufacturer, and size. This should not concern the casual gamer, but may come in handy for developers.
|
||||
File | Save State As...
|
||||
|
||||
Imagine you have gotten to a certian point in a game, and you need to do something else. The emulator let's you save the current state of the game, so that you can continue the game later at precisely the same point somewhere in the future.
|
||||
|
||||
Please note that the use of SAVESTATES is discouraged, as these are likely to break between emulator versions. Instead use SAVE FILES. These are likely to survive between emulator versions. This means that you will have to use save points within the game. SAVE FILES are stored in .sav files.
|
||||
File | Load State As...
|
||||
|
||||
Once you have saved a game's position, or 'state', you can load it again with this option.
|
||||
File | Save State
|
||||
|
||||
This option works fairly similair to the 'Save As' option, altough it let's you save numbers instead os specifying a chosen name. Also, All the states saved via this option end up with a pre-determined name of 'game (rom) name'.dsx. So if the game is called MyGame, the first savefile will be called MyGame.ds0, the second one MyGame.ds1, etc.
|
||||
File | Load State
|
||||
|
||||
This option let's you load the states that you saved via the 'File | Save State' option
|
||||
File | Import Backup Memory
|
||||
|
||||
Backup Memory is the data the game uses to remember its own state. It is stored on the cart in a normal game. Desmume uses the .dsv extension and file format; other formats which can be imported are .duc and raw .sav. People use pro action replays to capture duc files from their card and post it online without using emulators. These are frequently found on gamefaqs.com. See the faq for details on how to use this function, where it has been documented better.
|
||||
File | Export Backup Memory
|
||||
|
||||
This lets you export the game's state for use in other Nintendo DS Emulators. It will write a 'raw' sav file.
|
||||
File | Save Screenshot As...
|
||||
|
||||
This lets you take a screenshot of the current view of the emulator, and specify it's name to save as a bitmap (.bmp) file.
|
||||
File | Quick Screenshot
|
||||
|
||||
This option also dumps a screencapture, but it has a pre-determied filename and location. It will be called printscreen.bmp, and located in the current directory. In Windows, this is probably the same folder as where your desmume binary is located.
|
||||
File | Record AVI
|
||||
|
||||
This option lets you capture what's going on in the emulator, and save it in an avi file.
|
||||
File | Stop AVI
|
||||
|
||||
The 'Record AVI' option continues to record the game, untill you press the 'Stop Avi' option.
|
||||
File | Record WAV
|
||||
|
||||
This option lets you capture the sound played in the emulator, and save it in a wav file.
|
||||
File | Record Movie
|
||||
|
||||
This option lets you record the gameplay in TAS format, see http://tasvideos.org for details on TAS (tool-assisted speedruns).
|
||||
File | Play Movie
|
||||
|
||||
This option lets you playback a pre-recorded TAS movie.
|
||||
File | Stop Movie
|
||||
|
||||
This options lets you stop recording a TAS movie.
|
||||
File | Quit
|
||||
|
||||
Choosing this option exits the emulator.
|
||||
Emulation Menu
|
||||
Emulation | Pause
|
||||
|
||||
This option will pause the emulation, freezing it at the current moment of execution. Selecting it again will resume the execution of the ROM at the exact moment where you paused it.
|
||||
Emulation | Reset
|
||||
|
||||
This option will reset the ROM that is currently loaded to the very start of the ROM, just as if you chose 'File | Open Rom' again.
|
||||
Emulation | Clear Sound
|
||||
|
||||
This option turns off all the sound.
|
||||
Emulation | GBA Slot
|
||||
|
||||
This menu option pop-ups a new window, which lets you specirfy what to do with the GBA slot of the Nintendo DS. It has the following choices : NONE, Compact Flash, Rumble Pack, GBA Game. Rumble pack allows some games to use vibration. Memory extension... Extends memory. And some DS games can have bonuses, unlockable by GBA cart. For example in Megaman ZX you can fight some Megaman Zero Bosses when correct cartridge is inserted. There are also other GBA slot extensions, like... a Guitar hero controller. But these are currently not emulated by desmume. Flash Cartridge is used for homebrew software emulation, for example that uses DLDI ( Dynamically Linked Device Interface).
|
||||
Emulation | Cheats
|
||||
|
||||
This option pulls down a drop-down menu, and presents the options list and search. Be aware though, that cheats are sort of half baked right now. If you are not having luck, wait for some news on an improved cheat system. Also, it is impossible yet to use "commercial" codes, such as Action Replay and Codebreaker, so what you'll have to do is manually search for, and alter the memory positions to your advantage. They are called 'raw' or 'internal' cheats. There's an excellent article in the wiki on Using Cheats in DeSmuMe . In post-0.9.2 development builds, there is also the support for Action Replay cheat codes.
|
||||
Emulation | Cheats | List
|
||||
|
||||
Choosing 'list' will list all the currently known cheats. Please refer to the article Using Cheats in DeSmuMe for further details on how to use the cheat mechanism in desmume.
|
||||
Emulation | Cheats | Search
|
||||
|
||||
Choosing 'search' will let you search for cheats. Please refer to the article Using Cheats in DeSmuMe for further details on how to use the cheat mechanism in desmume.
|
||||
View Menu
|
||||
View | Rotation
|
||||
|
||||
This option will let you rotate the screen a pre-determined amount of degrees in order to adjust the angle of the display. Some programs require that you normally turn the DS on its side. You can set it up in that manner using this. The options are 0 (no rotation),90 ,180, and 270.
|
||||
View | Window size
|
||||
|
||||
This option will let you enlarge the windows a pre-determined size. The resize options are: 1x, 1.5x, 2x, 3x, and 4x the default size. You can also adjust the window size by clicking on the edge of the window, and dragging the mouse.
|
||||
View | Screen Separation
|
||||
|
||||
This option controls how far the two windows should be apart of each other, in other words: how big the border between them should be. Valid choices are: None (which is the default), narrow border (which is slightly larger), DS (which is about the wsame amount of room there is on a real Nintendo DS).
|
||||
View | Force Maintain Ratio
|
||||
|
||||
Here you can choose, when re-sizing the windows, if you wan to maintain the ratio of the windows. Sometimes when the window size is changed it doesn't look correct on the screen. This option forces the window to maintain a correct ratio so it looks correct. You can select or de-select this option.
|
||||
View | Display Frame Counter
|
||||
|
||||
Selecting this option causes a counter to run, that counts all the frames that have been displayed.
|
||||
View | Display FPS
|
||||
|
||||
Selecting this option causes the 'frames-per-second' (or 'fps', for short) to be displayed. It also displays an additional '3D' counter, which tells how frequently the game is updating its 3d graphics. But unlike the fps counter, the 3d counter has nothing to do with the power of your system. If it is low, then the game is running slow on a retail cart, and so it runs slow in an emulator.
|
||||
View | Display Input
|
||||
|
||||
Selecting this option displays the keys you press on the keyboard, which is the input
|
||||
View | Display Lag Counter
|
||||
|
||||
This option causes a counter to display that counts frames where the game doesn't poll input.
|
||||
View | HUD Editing Mode
|
||||
|
||||
This option will let you drag around hud elements to pick their position.
|
||||
Config Menu
|
||||
Config | Save Type
|
||||
|
||||
This option lets you specify the save type of a particular game. The default is 'automatic'. However, this is not fail-safe in all cases, so you might need to manually select one of the other savetypes.
|
||||
Config | 3D Settings
|
||||
|
||||
This option lets you select the method that is used to draw the screen. You can choose between OpenGL (an open standard) or SoftRasterizer (a desmume specific method).
|
||||
|
||||
Furthermore, you have two checkboxes that you can either enable or disable:
|
||||
|
||||
* Unrealistically High-Precision Color Interpolation. Presently only effective for SoftRasterizer.
|
||||
* Alternate Flush Mode. This fixes some games with flickering graphics. This is apllicable to both the OpenGl and the SoftRasterizer.
|
||||
|
||||
Config | Control Config
|
||||
|
||||
This option lets you configure keyboard keys or a joystick. The joystick support is implemented using a DirectInput control interface.
|
||||
|
||||
Here are the default key mappings (they may be subject to change):
|
||||
|
||||
Up arrow - Up
|
||||
Left arrow - Left
|
||||
Down arrow - Down
|
||||
Right arrow - Right
|
||||
x - A button
|
||||
z - B button
|
||||
s - X button
|
||||
a - Y button
|
||||
q - Left Trigger
|
||||
w - Right Trigger
|
||||
Enter - Start button
|
||||
Right Shift - Select button
|
||||
Backspace - Lid fold/unfold
|
||||
|
||||
n - Frame advance
|
||||
Space - Pause/Unpause
|
||||
p - Load current state
|
||||
1,2,3,4,5,6,7,8,9,0 - Select current state
|
||||
F1-F10 - Load relevant state
|
||||
Shift+F1-F10 - Save relevant state
|
||||
|
||||
Config | Hotkey Config
|
||||
|
||||
This menu option lets you define keys, that can be used to quickly select other options without having to go through the entire menu structure. Some examples are a hotkey for 'pause', or a hotkey for loading a specific savestate.
|
||||
Config | Sound Settings
|
||||
|
||||
This option lets you choose between different sound generating methods, which currectly are 'Direct Sound Interface' and 'WAV Write sound Interface'. You can set the interpolation to choose between better quality and faster emulation. It also let's you specify the size of the buffer to buffer the sound. For performance improvements, you can turn on the sound option "ADPCM Caching". 'ADPCM' is a type of sound compression which is supposed to be fast to decode. This is new and experimental, and will break some things, but it should offer a substantial speedup in some cases. And lastly, you can also set the sound volume in this dialog.
|
||||
Config | WIFI Settings
|
||||
|
||||
WIFI support is currently under heavy development, but it is not useful yet. Therefore, you may find this option missing, or simply 'greyed-out' for now. Even if you can fiddle with it, it won't do anything useful.
|
||||
Config | Firmware Settings
|
||||
|
||||
This option provides you with the same set of options that a real Nintendo DS firmware does. The most important here is the language, because multi-lingual games will often look at how this option is set.
|
||||
Config | Emulation Settings
|
||||
|
||||
These options let you boot from the extracted BIOS and Firmware of a real Nintendo DS. unless you have extracted/downloaded the firmware or bios from a Nintendo DS that you actually own yourself, these settings have no value for you qas desmume does not require them to run correctly.
|
||||
Config | Frame Skip
|
||||
|
||||
This option lets you select how many frames should not be displayed, in order to gain speed improvements. The default is 'Auto'. If you have speed problems, you could decide to skip (not display) one or more frames in order to improve the speed. 'Limit Frameskip' let's you limit the frame rate to 60fps maximum. 60fps is essentially the speed that the game plays at on the actual console itself. So by selecting this option, you're limiting the framerate to the actual speed of the actual console.
|
||||
Config | Language
|
||||
|
||||
This lets you set the langguage the emulator displays it's menu's and options in.
|
||||
Tools Menu
|
||||
Tools | Disassembler
|
||||
|
||||
This option displays the ARM9 and ARM7 disassembler. Be aware though, that the windows are drawn exactly on top of each other, so that you have to move (drag n drop) the first windows before the second window shows.
|
||||
Tools | View Memory
|
||||
|
||||
This tool displays the ARM7 and ARM9 memory. Be aware though, that the windows are drawn exactly on top of each other, so that you have to move (drag n drop) the first windows before the second window shows.
|
||||
|
||||
The "View mode" radio buttons allow you to choose how the memory will be shown:
|
||||
|
||||
* 8-bit : shows the memory as bytes
|
||||
* 16-bit : shows the memory as words
|
||||
* 32-bit : shows the memory as dwords
|
||||
|
||||
The "View address" textbox and button allow you to jump to a different address:
|
||||
|
||||
* Enter an hexadecimal address without 0x prefix, with up to 8 digits
|
||||
* Click "Go" to jump to the entered address
|
||||
|
||||
The "View dump" buttons allow you to dump the current view:
|
||||
|
||||
* Text dump : dumps the view to a text file, in an human-readable form
|
||||
* Raw dump : dumps the memory directly to a binary file which can be read with an hex editor
|
||||
|
||||
Note that if you dump memory to a file already containing (a) dump(s), the new dump will be appended to the existing one(s).
|
||||
|
||||
The scrollbar... well, you surely know how a scrollbar works.
|
||||
|
||||
The viewers additionally allow to edit the memory. For it, click on the value you want to edit, then type the new value. The new value is applied only once you've entirely entered it.
|
||||
Tools | View Registers
|
||||
|
||||
This option lets you view the ARM7 and ARM9 I/O registers.
|
||||
Tools | View Palette
|
||||
|
||||
This option lets you view the palette in detail.
|
||||
Tools | View Tiles
|
||||
|
||||
This option lets you view the tiles in detail.
|
||||
Tools | View Maps
|
||||
|
||||
This option lets you view the maps in detail.
|
||||
Tools | View OAM
|
||||
|
||||
This option lets you view the OAM layer in detail.
|
||||
Tools | View Matrices
|
||||
|
||||
This option lets you view the matrices in detail.
|
||||
Tools | View Lights
|
||||
|
||||
This option lets you view the lights in detail.
|
||||
Tools | View Sound State
|
||||
|
||||
This option displays the sound output.
|
||||
View | RAM Watch
|
||||
|
||||
This option will pop-up a new window, with extensive and advanced features to watch the emulated RAM memory.
|
||||
View | RAM Search
|
||||
|
||||
This option will pop-up a new window, with extensive and advanced features to search through the emulated RAM memory.
|
||||
Tools | View Layers
|
||||
|
||||
This option lets you view the Layers one by one.
|
||||
|
||||
|
||||
Help Menu
|
||||
Help | Website
|
||||
|
||||
This option directs your browser to the desmume homepage.
|
||||
Help | Forums
|
||||
|
||||
This option directs your browser to the desmume forums.
|
||||
Help | Submit a bug report
|
||||
|
||||
This option directs your browser to the SourceForge bugtracker for desmume.
|
||||
Help | About
|
||||
|
||||
This option displays the authors of the emulator.
|
||||
Retrieved from "http://wiki.desmume.org/index.php?title=DeSmuME_Manual_for_the_Windows_port"
|
||||
This page was last modified on 17 June 2009, at 04:59.
|
||||
|
||||
====================================================================
|
||||
|
||||
DesMuMe Faq
|
||||
|
||||
If the FAQ is unable to answer your question(s), then please make sure that you also consult the manual.
|
||||
Contents
|
||||
* 1 General Questions
|
||||
o 1.1 What does desmume emulate and on what systems?
|
||||
o 1.2 What does DeSmuME mean?
|
||||
o 1.3 Under what license is desmume distributed ?
|
||||
o 1.4 Can I freely copy desmume ?
|
||||
o 1.5 Why doesn't my desmume play this game?
|
||||
o 1.6 Why does this game fail to save? or, I get the error: "Data could not be accessed. Turn off the power and reinsert the DS card."
|
||||
o 1.7 I get the error: "Unable to write data. Please turn off the power and reinsert the game card."
|
||||
o 1.8 Why did you change the save file format and extension from .sav to .dsv ?
|
||||
o 1.9 Can I use my save states across versions ?
|
||||
o 1.10 Can I convert an ideas or no$gba nocash .sav savefile to desmume .dsv ?
|
||||
o 1.11 Why can't I find a mac binary?
|
||||
o 1.12 Why does my mac binary say something about being unsupported?
|
||||
o 1.13 Where can I report bugs?
|
||||
o 1.14 Can I attach files to bug reports I did not create myself ?
|
||||
o 1.15 How do I get the latest svn code and build desmume myself?
|
||||
o 1.16 Whats 'svn' ?
|
||||
o 1.17 What compilers are supported for building desmume from source ?
|
||||
o 1.18 Im Compiling using MSVC Express On Windows, and I get the error : "ml.exe" not found.
|
||||
o 1.19 Im a developer, and would like to contribute to the codebase. What can I do ?
|
||||
o 1.20 Im not a developer, but would like to help out anyway. What can I do ?
|
||||
o 1.21 It is hard to zoom in on a widescreen display due to the weird aspect ratio of the DS.
|
||||
o 1.22 Why doesn't my openGL 3d work in linux?
|
||||
o 1.23 Why doesn't my openGL 3d work in windows?
|
||||
o 1.24 Why doesn't a menu option or tool exist in my linux or mac build?
|
||||
o 1.25 Why does music sound bad sometimes?
|
||||
o 1.26 Why doesn't my game boot or progress into the main game engine?
|
||||
o 1.27 What hardware features are emulated?
|
||||
o 1.28 Does the GDB stub still work?
|
||||
o 1.29 How do I enable the GDB stub on the Windows port ?
|
||||
o 1.30 Where/what is IRC?
|
||||
o 1.31 Where is the manual?
|
||||
o 1.32 How do I enter 'cheat codes' in desmume ?
|
||||
o 1.33 Why is the emulator slow?
|
||||
o 1.34 What does the number/percentage in the desmume title bar mean ?
|
||||
o 1.35 What's the difference between the the Windows 'desmume' and 'desmume_nosse' versions ?
|
||||
o 1.36 Does desmume make use of multiple CPU's or multiple cores ?
|
||||
o 1.37 What are the minimum hardware requirements for desmume ?
|
||||
o 1.38 What are the recommended hardware requirements for desmume ?
|
||||
o 1.39 Does desmume support wifi ?
|
||||
o 1.40 Why do I get an assert in wifi.cpp which keeps me from playing a game?
|
||||
o 1.41 OK, then why does it make my firewall alert since 0.9.2 ?
|
||||
o 1.42 OK, so then why did my build come with winpcap.dll? Or why do I get crashes when I run desmume on vista which mumble something about winpcap?
|
||||
o 1.43 What is WFC / WIFI Connection
|
||||
o 1.44 Does desmume support the microphone ?
|
||||
o 1.45 Where can I find technical details on the Nintendo DS and GBA ?
|
||||
o 1.46 Does the 'GBA slot' option let me play GBA games ?
|
||||
o 1.47 What is DLDI ?
|
||||
o 1.48 How can I post a savefile or avi capture on the desmume forum ?
|
||||
o 1.49 How can I post a large log or other text file on the desmume IRC chat room ?
|
||||
o 1.50 My display is incorrect or corrupted
|
||||
o 1.51 My display has flickering graphics in a certain game
|
||||
o 1.52 How do I easily capture the ASM code for troubleshooting purposes ?
|
||||
o 1.53 How do I make pokemon save?
|
||||
o 1.54 I got a gameplay related question
|
||||
o 1.55 What are the origins of DeSmuME ?
|
||||
|
||||
General Questions
|
||||
|
||||
What does desmume emulate and on what systems?
|
||||
Desmume attempts to emulate, as faithfully as possible, the Nintendo DS and Nintendo DS Lite handheld game consoles (nds). It currently runs on Windows, Linux, and mac OSX. DSi is not supported.
|
||||
|
||||
What does DeSmuME mean?
|
||||
DeSmuME is a Nintendo DS emulator and the name is a play of words - DS Emu + ME (like FlashMe - firmware hack and PassMe mod-chip for DS) The name DeSmuME derives from the popular use of ME in Nintendo DS products by homebrew developers. So DeSmuME would equal DSemuMe. Other popular uses of ME include:
|
||||
|
||||
* LoadMe - a generic patcher for commercial DS roms that works with any GBA Flash Card
|
||||
* PassMe - "mod-chip" using which takes authentication from an original DS card an allows execution of unauthenticated DS rom code - from the GBA cartridge slot / GBA flash card.
|
||||
* FlashMe - a hacked firmware for DS that allows you to start code in DS mode from a flash card in the GBA slot.
|
||||
* WifiMe - are a set of a custom drivers and software by FireFly for RALink based wireless network cards enabling to boot homebrew code on DS via Nintendo Wireless Multiboot method.
|
||||
|
||||
Its name is derived from emu which is short for emulator, DS and me. It's possibly supposed to mean "DS emulator for me".
|
||||
|
||||
Under what license is desmume distributed ?
|
||||
Desmume is distributed under the Gnu General Public License, or GPL: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
Can I freely copy desmume ?
|
||||
Yes you can, as long as you adhere to the license as specified in the GNU GPL.
|
||||
|
||||
Why doesn't my desmume play this game?
|
||||
Go to desmume.org and make sure you are using the latest version. The latest version is 0.9.3. Hint: desmume 0.8 and 0.3.4 are very old, being numbers smaller than the latest version. Older versions will not be supported, under any circumstances.
|
||||
|
||||
Why does this game fail to save? or, I get the error: "Data could not be accessed. Turn off the power and reinsert the DS card."
|
||||
Until version 0.9.3 desmume's save size autodetection was poor. With 0.9.3, autodetection should work almost all the time. In fact, here is the entire list of games we know of that fail to autodetect correctly:
|
||||
|
||||
* Spider-Man 3
|
||||
|
||||
If you find any other game for which automatic savetype detection does not work, please let the developers know by posting on the forum or submitting a bug. If you want to fix it yourself, you may need to manually specify the correct save type for your game. Consult the manual for details on how to do this for your platform. You may also consult http://www.advanscene.com/ to easily identify the save type for your game.
|
||||
|
||||
I get the error: "Unable to write data. Please turn off the power and reinsert the game card."
|
||||
Same problem and resolution as the previous question.
|
||||
|
||||
Why did you change the save file format and extension from .sav to .dsv ?
|
||||
Because it is better now. These raw save files that everyone uses aren't good enough and were causing problems with autodetection. See our bug tracker or forum for more details; the dsv format has been documented in the svn source tree as dsv.txt and if you don't like the degree of interoperability with other emulators, then go tell the other emulators to support our format.
|
||||
|
||||
Can I use my save states across versions ?
|
||||
Maybe, maybe not. Due to constant internal changes in desmume, it is possible that a save state created with one version may not work with another version of desmume. Savestate compatibility is preserved wherever possible, but it is not always possible. Please note that for easily confused gamers, the use of SAVESTATES is discouraged, as these are likely to break between emulator versions. Instead use SAVE FILES. These are likely to survive between emulator versions. This means that you will have to use save points within the game. SAVE FILES are stored in .dsv files. Also, see this article for further details : Savefile or savestate
|
||||
|
||||
Can I convert an ideas or no$gba nocash .sav savefile to desmume .dsv ?
|
||||
|
||||
1. Convert the save file using http://shunyweb.info/convert.php ; the target format should be "Acekard RPG | EZFlash V | RAW Format [Autodetection] (.sav)" 2. Load the game. Let it get to the main menu 3. Select the correct backup size*, as specified by advanscene.com (which is not always right, by the way) 4. Use File > Import Backup Memory and pick the converted save file 5. Reset the game
|
||||
|
||||
* Step 3 is not always necessary, if you are smart, however, it will never hurt to do it.
|
||||
|
||||
Why can't I find a mac binary?
|
||||
Maybe we haven't made it yet. There arent a lot of people willing to compile mac software. Just to be sure, go to https://sourceforge.net/project/showfiles.php?group_id=164579&package_id=186413
|
||||
|
||||
Why does my mac binary say something about being unsupported?
|
||||
You have probably downloaded the i386 version of desmume for MAC, and are running on the PPC platform (or the other way around). Please verify if you're running on Intel (i386) hardware, or on PPC (G4, G5) hardware, and download the appropriate binary.
|
||||
|
||||
Where can I report bugs?
|
||||
In the official bug tracker. Feel free to post to the bug tracker as long as you are willing to take ownership of testing that bug and letting the developers know when it is resolved to your satisfaction. Just don't submit a bug report and run. You may also request features around the same location, too, but in the other trackers.
|
||||
|
||||
Can I attach files to bug reports I did not create myself ?
|
||||
SourceForge likes for folks to only respond on items they submit. If you see a ticket that represents something you are encountering, SourceForge doesn't necessarily want you commenting on that. The reasoning for this given by SourceForge is that they feel it is best to open your own ticket, which helps appreciate the extent of issues in many cases. The authors of desmume may or may not agree with this point of view from SourceForge.
|
||||
|
||||
How do I get the latest svn code and build desmume myself?
|
||||
Please check out the instructions related to your platform, over at Installing DeSmuME from source
|
||||
|
||||
Whats 'svn' ?
|
||||
svn is a developers tool. It's used to let multiple developers work on the same codebase without conflicts. If youre an end-user, don't worry about it. And if you're a developer, see the question on how to get the latest svn code and build desmume yourself. See wikipedia for more info
|
||||
What compilers are supported for building desmume from source ?
|
||||
|
||||
* At the moment, for Windows Microsoft Visual C++ 2005 and 2008 are the only supported compilers. Dev-c++ is not supported. Why won't you just download visual c++ express?
|
||||
* For Linux, any recent version of GCC and toolchain should work.
|
||||
|
||||
Im Compiling using MSVC Express On Windows, and I get the error : "ml.exe" not found.
|
||||
ml.exe was not included in earlier downloads of MSVC++ 2008 Express Edition. Uninstall, redownload and install again. See http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=326875 for details. ml.exe shoud be located in the "Microsoft Visual Studio 9.0\VC\bin" directory.
|
||||
|
||||
Im a developer, and would like to contribute to the codebase. What can I do ?
|
||||
To start you off in the right direction, the best thing you can do is join the developer team on IRC and discuss your intentions with the developers.
|
||||
|
||||
Im not a developer, but would like to help out anyway. What can I do ?
|
||||
The most helpful thing you can do is use desmume, learn its ins and outs, and learn how to compile svn builds. Then monitor it for regressions and report bugs. You can patrol the bug tracker for bugs which could use elucidation or which, based on your awareness of how the emulator is changing, might be fixed without us having specifically addressed the bug. Basically, be a super user. And hang out on irc. Also, adding to or perfecting the documentation in the wiki is useful. You could also watch for and answer questions placed on the desmume forum.
|
||||
|
||||
It is hard to zoom in on a widescreen display due to the weird aspect ratio of the DS.
|
||||
In fact it is hard to zoom in on a 4:3 screen, too. Proposals involve tearing apart windows and floating them side by side or separately or something. This may happen one day, in the form of side by side windows.
|
||||
|
||||
Why doesn't my openGL 3d work in linux?
|
||||
Blame nvidia and ati for putting out shoddy and/or closed source drivers. Then switch to software rasterizer.
|
||||
|
||||
Why doesn't my openGL 3d work in windows?
|
||||
You are probably using an ATI video card. ATI driver support of OpenGL is known to be poor. Get an nvidia. Do not argue with that, we are professional programmers and know what we're talking about. Or, switch to software rasterizer
|
||||
|
||||
Why doesn't a menu option or tool exist in my linux or mac build?
|
||||
Because making portable tools and platform harnesses are not our cup of tea and so a developer puts a feature into whichever ports he cares about. This policy is never going to change, although some features might migrate to other platforms over time. Better check the manual.
|
||||
|
||||
Why does music sound bad sometimes?
|
||||
Most DS music is sequenced music, loaded from the cart entirely when the level loads. This works fine. Your music that doesn't work is probably streaming music, which loads from the cart on the fly and goes straight to the speakers. This is much harder to emulate as it requires correct timing, which is not one of desmume's strengths right now. This may not be fixed for a while.
|
||||
|
||||
Why doesn't my game boot or progress into the main game engine?
|
||||
Desmume is not perfect yet. Some games may fail due to wifi emulation. Apparently if you search the web correctly you can find ways to patch games to work better on emulators. Your mileage may vary. If it really doesn't boot up, you can submit a bug report for the game on the sourceforge bugtracker.
|
||||
What hardware features are emulated?
|
||||
|
||||
* All known 2d graphics features are correct. Mosaics work but are imperfect. There may be small issues with colors as the correct color bit depths are not used at all points in the pipeline.
|
||||
|
||||
* All 3d features are emulated, except for: tests, wireframes, edge marking, fog, and antialising. The opengl engine is near its limit and renders some things incorrectly. Eventually the software rasterizer (will support more features and be far more precise in the basic features. Both engines have trouble with some shadows, but software rasterizer is better. Software rasterizer has some noticeable texturing issues right now, especially in 2d games. Software rasterizer supports more correct lighting interpolation than opengl ever will (e.g. glitches at the edge of the screen while scrolling.) In software rasterizer, there are issues similar to 2d with incorrect bit depth being used in the pipeline. There are inaccurate edge conditions in each renderer; in opengl, textures tend to get overdrawn; in software rasterizer, edges of textures tend to be jittery.
|
||||
|
||||
One last thing -- if buttons and labels and menus rendering on the 3d screen are obscured (for example, a button but no label is on it) then you may need to use the software rasterizer. Or you may need to use openGL instead. Each renderer has strengths and weaknesses, which is why both are provided.
|
||||
|
||||
* All sound features are emulated. The microphone support is new and the manual should be consulted, where you will find out, among other things, that it is only supported in windows right now.
|
||||
|
||||
* Wifi is not supported. It is currently under slow and incomplete development. Therefore, you may find this option missing, or simply 'greyed-out' for now. Also, since WIFI support does not work yet, don't ask any questions about it's functioning because it still is unfinished and does not work yet.
|
||||
|
||||
* We are unaware of any outstanding issues in the core system hardware (cpu, dma, mmu) but there are certainly still some. The instruction and memory timings are quite incorrect; however, this seems not to hurt most softwares.
|
||||
|
||||
* DLDI (does anybody know if this still works?)
|
||||
|
||||
Dynamically Linked Driver Interface, commonly known as DLDI, is a driver framework that allows NDS and GBA homebrew to easily read and write to any number of different devices, just by substituting a driver file.
|
||||
|
||||
* RTC (real-time clock) works; If it didnt, then the time in your games stays at 00:00:00, and your random number values always come up the same.
|
||||
|
||||
Does the GDB stub still work?
|
||||
It seems as if it works in 0.9.3, tested with the Insight GDB variant on windows with a recent devkitpro. This support has been compiled into the dev+ build.
|
||||
|
||||
How do I enable the GDB stub on the Windows port ?
|
||||
Add #define GDB_STUB to src/windows/userconfig/userconfig.h which you have created according to the instructions in src/windows/defaultconfig/userconfig.h ; sorry for this confusing system, but that's how it is for now.
|
||||
|
||||
Where/what is IRC?
|
||||
IRC is an on-line communication system.
|
||||
|
||||
data you need:
|
||||
|
||||
* server: irc.freenode.net
|
||||
* port: 6667
|
||||
* channel: #desmume
|
||||
|
||||
what to use:
|
||||
|
||||
* mIRC - windows
|
||||
* ChatZilla - FireFox add-on
|
||||
* xchat - X
|
||||
* plenty other, see wikipedia
|
||||
|
||||
Where is the manual?
|
||||
A manual for desmume is over at http://wiki.desmume.org/index.php?title=Manual. It may not have the information that other entries in this FAQ promised that it would.
|
||||
|
||||
How do I enter 'cheat codes' in desmume ?
|
||||
Action Replay and 'raw' or 'internal' cheats work as of 0.9.3. There are also cheat-finding facilities where you may manually search for and alter the memory positions which work to your advantage. There's an excellent article in the wiki on Using Cheats in DeSmuMe .
|
||||
|
||||
Why is the emulator slow?
|
||||
Because nobody pays us to work on it full time and it runs fast enough for us to be happy. Well, almost.
|
||||
|
||||
0.9.3 May be a step backwards in some (or many) cases from 0.9.2 in terms of speed. The development between these versions focused on compatibility and bugfixes. Once we better understand how some things need to be emulated, then some speed can return. However, in order to mitigate some of this backsliding, we have introduced a few speed hacks which you may find helpful.
|
||||
|
||||
* The cheapest way to get 60fps is to buy the cart.
|
||||
* If you are in Windows, make sure you have tried the SSE build which helps a little bit.
|
||||
* If you are using someone else's unofficial "svn" build it probably is not fully optimized since we make our Windows releases using some profiler-guided optimization which helps by several FPS. For all I know they are also carriers of viruses, and lately they tend to crash on vista.
|
||||
* If you can handle it, turn off the sound.
|
||||
* Use frame skip. Even frameskipping 1 will help and many games will stay playable. Frameskipping was improved in 0.9.3 to get more bang for the buck, but beware that dual screen 3d games may not work well under frameskip.
|
||||
* (0.9.3+) In the sound options, set interpolation to none which should help a little bit.
|
||||
* (0.9.3+) Turn on the sound option "ADPCM Caching"; this is new and experimental, and will break some things, but it should offer a substantial speedup in some cases.
|
||||
* (0.9.3+) There is now the option of disabling an entire screen. (Tools > View Layers > Main GPU, etc) Consider disabling a screen which is useless in the game you are playing.
|
||||
* Try the software rasterizer. In many cases, especially games which make only light use of the 3d hardware, this will actually run faster, by as many as 10 FPS. But it might also run slower, again, by as many as 10 FPS.
|
||||
* Buying a newer, faster computer is somewhat more expensive, but it has other side benefits.
|
||||
* A faster CPU is more helpful than a bleeding edge graphics card. Desmume is more CPU intensive than it is GPU intensive. It just needs a graphics card that is glitch-free, and currently the nvidia cards have a better track record. A newer graphics card has a slim possibility of increasing speed.
|
||||
|
||||
What does the number/percentage in the desmume title bar mean ?
|
||||
|
||||
* For the windows port, the percentage is the emulated arm9 CPU load average. The CPU in an actual Nintendo DS is an ARM9 CPU. The percentage shows us how busy the emulated CPU is. This number isnt really for you. We really ought to just take it out.
|
||||
* For the Linux GTK and Glade ports, it's frames per second (fps).
|
||||
|
||||
What's the difference between the the Windows 'desmume' and 'desmume_nosse' versions ?
|
||||
desmume uses some SSE2 optimizations for 3D matrix calculations. If your CPU supports SSE2, better use this version. Otherwise use desmume_nosse. Any modern Intel CPU (AMD or intel) will support SSE2.
|
||||
|
||||
Does desmume make use of multiple CPU's or multiple cores ?
|
||||
Currently, there are no multi core optimizations. Everything runs in a single thread. You benefit MUCH more from a single greater Ghz cpu than from multiple cores or from multiple CPU's.
|
||||
What are the minimum hardware requirements for desmume ?
|
||||
|
||||
From a purely technical viewpoint, there are no minimum requirements. However, for 'real-world' playable speeds, you would need at least the following :
|
||||
|
||||
* Windows OS: Windows XP or Vista
|
||||
* Linux OS: Any recent Linux distribution with a 2.6 kernel.
|
||||
* 2 GHz Processor
|
||||
* 512 MB Available System Memory
|
||||
* Available Hard Drive Space: A few MB for the emulator
|
||||
* 128 MB 3D Video Card (Nvidia GeForce 6800 or better), ATI cards are not recommended.
|
||||
* Optional: Sound Card, if you want sound support
|
||||
* Optional: Microphone, if you wish to make use the Windows Microphone feature
|
||||
|
||||
What are the recommended hardware requirements for desmume ?
|
||||
|
||||
From a purely technical viewpoint, there are no recommended requirements. However, for 'real-world' playable speeds, the following gives you good performance:
|
||||
|
||||
* Windows OS: Windows XP or Vista
|
||||
* Linux OS: Any recent Linux distribution with a 2.6 kernel.
|
||||
* 3 GHz Processor
|
||||
* 1 GB Available System Memory
|
||||
* Available Hard Drive Space: A few MB for desmume, 100MB or so for a bunch of savestates and savefiles.
|
||||
* 512 MB 3D Video Card (Nvidia GeForce), ATI cards are not recommended.
|
||||
* Sound Card.
|
||||
* Microphone.
|
||||
|
||||
In general, the more Ghz, the better. The faster memory, the better. Desmume currently won't benefit from multiple cores. Desmume currently is, unfortunately, slower than no$gba.
|
||||
Does desmume support wifi ?
|
||||
|
||||
Wifi is not supported. It is currently under slow and incomplete development. Therefore, you may find this option missing, or simply 'greyed-out' for now. Also, since WIFI support does not work yet, don't ask any questions about it's functioning because it still is unfinished and does not work yet. Furthermore, current development activities focus mainly on the Windows build.
|
||||
Why do I get an assert in wifi.cpp which keeps me from playing a game?
|
||||
|
||||
This was a glitch in 0.9.2 release. Why arent you using 0.9.3?
|
||||
OK, then why does it make my firewall alert since 0.9.2 ?
|
||||
|
||||
Your firewall is stupid, or winsock is stupid, (I am not sure which yet) for alerting just when winsock gets initialized. The emulator hasnt actually tried to connect to the internet yet. How could it? There isn't any wifi. All we are doing is some network initialization code. For those of you who are still not satisfied, then I will admit that there is actually some wifi code--but it doesnt actually do anything yet! Except alert your firewall. Sorry. Also, maybe that is actually a good, unobtrusive time for firewalls to alert. But I am not sorry for calling them stupid. They are hyperactive crybabies.
|
||||
OK, so then why did my build come with winpcap.dll? Or why do I get crashes when I run desmume on vista which mumble something about winpcap?
|
||||
|
||||
Because you are running an unofficial build, from dubious origins, made by unknown people. The desmume team cannot support builds it did not create itself. Therefore, you are advised to stop using unofficial builds, as you can expect no support from the desmume team or on the desmume forums. Only use builds you downloaded from the desmume website.
|
||||
What is WFC / WIFI Connection
|
||||
|
||||
See the article Nintendo wifi config utility
|
||||
Does desmume support the microphone ?
|
||||
|
||||
Yes, but only on the Windows port. You do have to have an actual microphone attached to your PC, though. And perhaps somewhat confusing, the Linux ports do report 'Microphone successfully initialized' on startup of the emulator - but currently this is just a piece of stub (dummy) code used only to correctly start the emulator. In 0.9.2 the microphone in windows really only works for noise, but this was fixed in 0.9.3; it still hasn't been tested very well.
|
||||
Where can I find technical details on the Nintendo DS and GBA ?
|
||||
|
||||
http://nocash.emubase.de/gbatek.htm
|
||||
Does the 'GBA slot' option let me play GBA games ?
|
||||
|
||||
No. A 'real' DS can use the gba slot to play gba games, but desmume does not emulate this. But a 'real' DS can also use the gba slot to access gba roms and sram so that ds games can import savefiles, and that part is emulated by desmume. (please note that this is reportedly buggy for some games, including pokemon) If you are looking for a Game Boy Advance (GBA) emulator, perhaps you can try mednafen or visualboy advance.
|
||||
What is DLDI ?
|
||||
|
||||
let me give you an overview on DLDI. You should know that there are many various flash cartridges for DS. They use different file allocation systems, different storage's, etc. They are used for launching homebrew. So to make one program run on all cards. You’d have to write support for each and every card so that it worked for everyone. But none needs support for other cards than their own. And then a genial solution was found. There was an universal IO unit made that’s just interface to IO operations. And compiled program does not know how to handle file system etc. And then user can append IO routines for his own card. “DLDI patch”. So, now when I have an M3 cart, I download rom, patch it with m3 DLDI patch, and it works on my cart. Say you had Supercard instead. You’d have to download very same rom and apply Supercart DLDI patch to it. DLDI patch is the same for all roms. So it’s easy for both developer and end user.
|
||||
How can I post a savefile or avi capture on the desmume forum ?
|
||||
|
||||
After you created it, you can upload it to a free external service provider like MediaFire (http://www.mediafire.com/), and then put the provided links to the page in the message you post on the forum.
|
||||
How can I post a large log or other text file on the desmume IRC chat room ?
|
||||
|
||||
Make use of the external service provider 'pastebin' (http://pastebin.com/), and post the url to it on the IRC channel.
|
||||
My display is incorrect or corrupted
|
||||
|
||||
Try switching the 3D Renderer from opengl or SoftRasterizer, or vice versa, to see if that resolves the bug. In windows, the default hotkey to do this quickly is numpad minus.
|
||||
My display has flickering graphics in a certain game
|
||||
|
||||
In the Windows port, you can choose 'Alternate Flush Mode' in the 'Config | 3D Settings' menu. This fixes some games with flickering graphics.
|
||||
How do I easily capture the ASM code for troubleshooting purposes ?
|
||||
|
||||
Savestate during the problem or just before your problem occurs, and #define WANTASMLISTING in armcpu.cpp. Recompile. Then redirect stdout to a file. I know it aint easy but its what we got for now.
|
||||
How do I make pokemon save?
|
||||
Use 0.9.3 where this works correctly without you having to perform rituals beyond your capabilities or comprehension.
|
||||
|
||||
I got a gameplay related question
|
||||
Please check a site like http://www.gamefaqs.com, and dont post gameplay related questions on the forum or IRC *unless* you believe there is a bug in the emulation of desmume.
|
||||
|
||||
What are the origins of DeSmuME ?
|
||||
DeSmuME is a freeware emulator for the Nintendo DS originally created by YopYop156. The original website was http://yopyop156.ifrance.com
|
||||
|
||||
Due to change in French laws regarding emulation YopYop decided to stop development of DeSmuME. However, he released the source under the GPL, and other programmers have picked it up and kept it under active development.
|
||||
|
||||
Yopyop said:
|
||||
|
||||
It’s release under GPL. I have just removed the new 3D engine because it’s too much bugged. Hopefully it will be helpful for some of you.
|
||||
|
||||
|
||||
The latest statement heard from yopyop was :
|
||||
|
||||
DeSmuMe project is over.
|
||||
You may don’t know but there are a new law in France that could put me in big trouble.
|
||||
With DeSmuMe, I have closed the doors of game company but I can not offer to pay for it.
|
||||
|
||||
The worst thing is that I have found the bad coded instructions.
|
||||
For those how have download the sources you have to look in sbc, rsbc instructions the Carry flag updating is wrong.
|
||||
Sorry for the home brew programmers.
|
||||
|
||||
For the illegality the demonstration seemed to me convincing thus without proof clarify I prefer to stick to this decision.
|
||||
|
||||
It is also the fact that few people seem interested by the project. Put besides some people who sent demonstrations to me which did not go, I received only malls to wonder to make function such or such plays or to ask me why moved is in French .
|
||||
Thus I will not do something of useless and illegal.
|
||||
|
||||
For the site it would not obstruct me if there were not the bond on the left which does nothing but add to confusion on the goal of the project.
|
||||
|
||||
And for the sources it is the same problem as for the project.
|
||||
|
||||
good week end
|
||||
|
||||
yopyop
|
||||
|
||||
edit the law relates to the royalties and the rights close, not?
|
||||
|
||||
Retrieved from "http://wiki.desmume.org/index.php?title=Faq_093"
|
||||
This page was last modified on 17 June 2009, at 04:30.
|
|
@ -1,39 +0,0 @@
|
|||
The desmume save file format is merely a raw save file with a FOOTER.
|
||||
|
||||
This was chosen in order to maximize compatibility with other emulators,
|
||||
which tend load the savefile as-is and let the game read out of whatever range
|
||||
it is expecting. To assist with this, before writing the save file, desmume
|
||||
will pad the raw save file out to the next highest known length. Note that this
|
||||
may sometimes be incorrect if the savefile hasnt been written through to the end
|
||||
during initialization. This could cause other emulators to fail to recognize the
|
||||
save file.
|
||||
|
||||
Additionally, the footer makes it easier to analyze save files, because the
|
||||
game's data will be at the correct addresses starting at offset 0x0000.
|
||||
|
||||
The footer format can be identified by locating the 16Byte ascii string
|
||||
"|-DESMUME SAVE-|"
|
||||
at the end of the file. This corresponds with the following save structure:
|
||||
|
||||
struct Footer {
|
||||
u32 actually_written_size;
|
||||
u32 padded_size;
|
||||
u32 save_type; //(not currently used)
|
||||
u32 address_size; //address bus size
|
||||
u32 save_size; //size parameter of the save type (not currently used)
|
||||
u32 version_number; //should be 0
|
||||
char cookie[16];
|
||||
};
|
||||
|
||||
note that padded_size should be where you see the end of the raw save data
|
||||
and the beginning of desmume-specific information, including some junk before
|
||||
the actual footer.
|
||||
|
||||
actually_written_size is the highest address (plus one) written to by the game.
|
||||
|
||||
The new desmume savefile system tries to make as few decisions as possible,
|
||||
which is the reason for the behavior of actually_written_size and the disuse
|
||||
of save_type and save_size. If few decisions are made, then few mistakes can
|
||||
be made. That is the idea, anyway. We'll make decisions later if we need to.
|
||||
save_type and save_size are reserved in case we do.
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
# French translation for the desmume windows UI.
|
||||
# Copyright (C) 2009 The DeSmuME Team.
|
||||
# F.E.Nebula, 2009.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-07-17 01:38-0400\n"
|
||||
"PO-Revision-Date: 2009-06-24 11:00+0800\n"
|
||||
"Last-Translator: F.E.Nebula <FENebula@gmail.com>\n"
|
||||
"Language-Team: DeSmuME Team <desmume-devel@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Chinese\n"
|
||||
"X-Poedit-Country: CHINA\n"
|
||||
|
||||
#: File menu
|
||||
#, c-format
|
||||
msgid "File"
|
||||
msgstr "文件"
|
||||
|
||||
msgid "Open ROM..."
|
||||
msgstr "打开ROM..."
|
||||
|
||||
msgid "Recent ROM"
|
||||
msgstr "最近的ROM"
|
||||
|
||||
msgid "None"
|
||||
msgstr "空"
|
||||
|
||||
msgid "Clear"
|
||||
msgstr "清空"
|
||||
|
||||
msgid "ROM info"
|
||||
msgstr "ROM信息"
|
||||
|
||||
msgid "Save state as..."
|
||||
msgstr "即时存档为..."
|
||||
|
||||
msgid "Load state as..."
|
||||
msgstr "即时读档为..."
|
||||
|
||||
msgid "Save state"
|
||||
msgstr "即时存档"
|
||||
|
||||
msgid "Load state"
|
||||
msgstr "即时读档"
|
||||
|
||||
msgid "Import backup memory"
|
||||
msgstr "导入后备内存"
|
||||
|
||||
msgid "Save screenshot as..."
|
||||
msgstr "另存屏幕截图为"
|
||||
|
||||
msgid "Quick screenshot"
|
||||
msgstr "快速截图"
|
||||
|
||||
msgid "Record AVI"
|
||||
msgstr "录制AVI"
|
||||
|
||||
msgid "Stop AVI"
|
||||
msgstr "停止录制AVI"
|
||||
|
||||
msgid "Quit"
|
||||
msgstr "退出"
|
||||
|
||||
#: Emulation menu
|
||||
msgid "Emulation"
|
||||
msgstr "模拟"
|
||||
|
||||
msgid "Pause"
|
||||
msgstr "暂停"
|
||||
|
||||
msgid "Reset"
|
||||
msgstr "复位"
|
||||
|
||||
msgid "Shut up"
|
||||
msgstr "静音"
|
||||
|
||||
msgid "GBA slot"
|
||||
msgstr "GBA插槽"
|
||||
|
||||
msgid "Cheats"
|
||||
msgstr "金手指"
|
||||
|
||||
msgid "List"
|
||||
msgstr "列表"
|
||||
|
||||
msgid "Search"
|
||||
msgstr "搜索"
|
||||
|
||||
#: View menu
|
||||
msgid "View"
|
||||
msgstr "查看"
|
||||
|
||||
msgid "Rotation"
|
||||
msgstr "旋转"
|
||||
|
||||
msgid "Window size"
|
||||
msgstr "窗口大小"
|
||||
|
||||
msgid "Screen separation"
|
||||
msgstr "分割窗口"
|
||||
|
||||
msgid "None\t(0 px)"
|
||||
msgstr "无\t(0 px)"
|
||||
|
||||
msgid "Narrow border\t(5 px)"
|
||||
msgstr "窄线\t(5 px)"
|
||||
|
||||
msgid "DS\t(64 px)"
|
||||
msgstr "DS实际宽度\t(64 px)"
|
||||
|
||||
msgid "Force maintain ratio"
|
||||
msgstr "强制保持比例"
|
||||
|
||||
msgid "Default size"
|
||||
msgstr "默认大小"
|
||||
|
||||
msgid "Display frame counter"
|
||||
msgstr "显示帧计数器"
|
||||
|
||||
msgid "Display FPS"
|
||||
msgstr "显示FPS"
|
||||
|
||||
msgid "Display input"
|
||||
msgstr "显示输入"
|
||||
|
||||
msgid "Display lag counter"
|
||||
msgstr "显示标志计数器"
|
||||
|
||||
#: Config menu
|
||||
msgid "Config"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Save type"
|
||||
msgstr "存档类型"
|
||||
|
||||
msgid "Autodetect"
|
||||
msgstr "自动选择"
|
||||
|
||||
msgid "EEPROM 4kbit"
|
||||
msgstr ""
|
||||
|
||||
msgid "EEPROM 64kbit"
|
||||
msgstr ""
|
||||
|
||||
msgid "EEPROM 512kbit"
|
||||
msgstr ""
|
||||
|
||||
msgid "FRAM 256kbit"
|
||||
msgstr ""
|
||||
|
||||
msgid "FLASH 2mbit"
|
||||
msgstr ""
|
||||
|
||||
msgid "FLASH 4mbit"
|
||||
msgstr ""
|
||||
|
||||
msgid "3D settings"
|
||||
msgstr "3D设置"
|
||||
|
||||
msgid "Control config"
|
||||
msgstr "控制器设置"
|
||||
|
||||
msgid "Hotkey config"
|
||||
msgstr "热键设置"
|
||||
|
||||
msgid "Sound settings"
|
||||
msgstr "声音设置"
|
||||
|
||||
msgid "Wifi settings"
|
||||
msgstr "Wifi设置"
|
||||
|
||||
msgid "Firmware settings"
|
||||
msgstr "固件设置"
|
||||
|
||||
msgid "Emulation settings"
|
||||
msgstr "模拟选项设置"
|
||||
|
||||
msgid "Frameskip"
|
||||
msgstr "跳帧"
|
||||
|
||||
msgid "Limit framerate"
|
||||
msgstr "限制帧率"
|
||||
|
||||
msgid "Auto"
|
||||
msgstr "自动"
|
||||
|
||||
msgid "Language"
|
||||
msgstr "语言"
|
||||
|
||||
#: Tools menu
|
||||
msgid "Disassembler"
|
||||
msgstr "反汇编"
|
||||
|
||||
msgid "View memory"
|
||||
msgstr "查看内存"
|
||||
|
||||
msgid "View registers"
|
||||
msgstr "查看寄存器"
|
||||
|
||||
msgid "View palettes"
|
||||
msgstr "查看调色板"
|
||||
|
||||
msgid "View tiles"
|
||||
msgstr "查看Tile"
|
||||
|
||||
msgid "View maps"
|
||||
msgstr "查看映射"
|
||||
|
||||
msgid "View OAMs"
|
||||
msgstr "产看OAM"
|
||||
|
||||
msgid "View matrices"
|
||||
msgstr "查看矩阵"
|
||||
|
||||
msgid "View lights"
|
||||
msgstr "查看光照"
|
||||
|
||||
msgid "View layers"
|
||||
msgstr "查看图层"
|
||||
|
||||
msgid "Main BG 0"
|
||||
msgstr ""
|
||||
|
||||
msgid "Main BG 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Main BG 2"
|
||||
msgstr ""
|
||||
|
||||
msgid "Main BG 3"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sub BG 0"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sub BG 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sub BG 2"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sub BG 3"
|
||||
msgstr ""
|
||||
|
||||
#: Help menu
|
||||
msgid "Help"
|
||||
msgstr "帮助"
|
||||
|
||||
msgid "Website"
|
||||
msgstr "主页"
|
||||
|
||||
msgid "Forums"
|
||||
msgstr "论坛"
|
||||
|
||||
msgid "Submit a bug report"
|
||||
msgstr "提交BUG报告"
|
||||
|
||||
msgid "About"
|
||||
msgstr "关于"
|
||||
|
|
@ -1,429 +0,0 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "GPU_osd.h"
|
||||
#include "GPU.h"
|
||||
#include "mem.h"
|
||||
#include <string.h> //mem funcs
|
||||
#include <stdarg.h> //va_start, etc
|
||||
#include <sstream>
|
||||
#include <time.h>
|
||||
#include "debug.h"
|
||||
|
||||
#include "aggdraw.h"
|
||||
#include "movie.h"
|
||||
#include "NDSSystem.h"
|
||||
#include "mic.h"
|
||||
#include "saves.h"
|
||||
|
||||
|
||||
OSDCLASS *osd = NULL;
|
||||
HudStruct Hud;
|
||||
|
||||
static void SetHudDummy (HudCoordinates *hud)
|
||||
{
|
||||
hud->x=666;
|
||||
hud->y=666;
|
||||
}
|
||||
|
||||
static bool IsHudDummy (HudCoordinates *hud)
|
||||
{
|
||||
return (hud->x == 666 && hud->y == 666);
|
||||
}
|
||||
|
||||
void EditHud(s32 x, s32 y, HudStruct *hudstruct) {
|
||||
|
||||
u32 i = 0;
|
||||
|
||||
while (!IsHudDummy(&hudstruct->hud(i))) {
|
||||
HudCoordinates &hud = hudstruct->hud(i);
|
||||
|
||||
//reset
|
||||
if(!hud.clicked) {
|
||||
hud.storedx=0;
|
||||
hud.storedy=0;
|
||||
}
|
||||
|
||||
if((x >= hud.x && x <= hud.x + hud.xsize) &&
|
||||
(y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) {
|
||||
|
||||
hud.clicked=1;
|
||||
hud.storedx = x - hud.x;
|
||||
hud.storedy = y - hud.y;
|
||||
}
|
||||
|
||||
if(hud.clicked) {
|
||||
hud.x = x - hud.storedx;
|
||||
hud.y = y - hud.storedy;
|
||||
}
|
||||
|
||||
//sanity checks
|
||||
if(hud.x < 0) hud.x = 0;
|
||||
if(hud.y < 0) hud.y = 0;
|
||||
if(hud.x > 245)hud.x = 245; //margins
|
||||
if(hud.y > 180)hud.y = 180;
|
||||
|
||||
if(hud.clicked)
|
||||
break;//prevent items from grouping together
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void HudClickRelease(HudStruct *hudstruct) {
|
||||
|
||||
u32 i = 0;
|
||||
|
||||
while (!IsHudDummy(&hudstruct->hud(i))) {
|
||||
HudCoordinates &hud = hudstruct->hud(i);
|
||||
hud.clicked=0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetHud(HudStruct *hudstruct) {
|
||||
|
||||
hudstruct->FpsDisplay.x=0;
|
||||
hudstruct->FpsDisplay.y=5;
|
||||
hudstruct->FpsDisplay.xsize=120;
|
||||
hudstruct->FpsDisplay.ysize=10;
|
||||
|
||||
hudstruct->FrameCounter.x=0;
|
||||
hudstruct->FrameCounter.y=25;
|
||||
hudstruct->FrameCounter.xsize=60;
|
||||
hudstruct->FrameCounter.ysize=10;
|
||||
|
||||
hudstruct->InputDisplay.x=0;
|
||||
hudstruct->InputDisplay.y=45;
|
||||
hudstruct->InputDisplay.xsize=120;
|
||||
hudstruct->InputDisplay.ysize=10;
|
||||
|
||||
hudstruct->LagFrameCounter.x=0;
|
||||
hudstruct->LagFrameCounter.y=65;
|
||||
hudstruct->LagFrameCounter.xsize=30;
|
||||
hudstruct->LagFrameCounter.ysize=10;
|
||||
|
||||
hudstruct->Microphone.x=0;
|
||||
hudstruct->Microphone.y=85;
|
||||
hudstruct->Microphone.xsize=20;
|
||||
hudstruct->Microphone.ysize=10;
|
||||
|
||||
SetHudDummy(&hudstruct->Dummy);
|
||||
}
|
||||
|
||||
|
||||
struct TouchInfo{
|
||||
u16 X;
|
||||
u16 Y;
|
||||
};
|
||||
static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255};
|
||||
static TouchInfo temptouch;
|
||||
bool touchshadow = true;
|
||||
static std::vector<TouchInfo> touch (8);
|
||||
|
||||
|
||||
static void TouchDisplay() {
|
||||
aggDraw.hud->lineWidth(1.0);
|
||||
|
||||
temptouch.X = nds.touchX >> 4;
|
||||
temptouch.Y = nds.touchY >> 4;
|
||||
touch.push_back(temptouch);
|
||||
|
||||
if(touch.size() > 8) touch.erase(touch.begin());
|
||||
|
||||
if(touchshadow) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
temptouch = touch[i];
|
||||
if(temptouch.X != 0 || temptouch.Y != 0) {
|
||||
aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]);
|
||||
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
|
||||
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
|
||||
aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]);
|
||||
aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if(nds.isTouch) {
|
||||
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
|
||||
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
|
||||
}
|
||||
}
|
||||
|
||||
static int yheight;
|
||||
static int xpos;
|
||||
static int previousslot = 0;
|
||||
static int fadecounter;
|
||||
static char number[10];
|
||||
|
||||
static void DrawStateSlots(){
|
||||
|
||||
aggDraw.hud->lineWidth(1.0);
|
||||
aggDraw.hud->lineColor(0, 0, 0, fadecounter);
|
||||
aggDraw.hud->fillColor(255, 255, 255, fadecounter);
|
||||
|
||||
for ( int i = 0; i < 10; xpos=xpos+24) {
|
||||
|
||||
aggDraw.hud->fillLinearGradient(8 + xpos, 160 - yheight, 30 + xpos, 180 + yheight+20, agg::rgba8(100,200,255,fadecounter), agg::rgba8(255,255,255,0));
|
||||
|
||||
if(lastSaveState == i) {
|
||||
yheight = 5;
|
||||
aggDraw.hud->fillLinearGradient(8 + xpos, 160 - yheight, 30 + xpos, 180 + yheight+20, agg::rgba8(100,255,255,fadecounter), agg::rgba8(255,255,255,0));
|
||||
}
|
||||
|
||||
aggDraw.hud->rectangle(8 + xpos , 160 - yheight, 30 + xpos , 180 + yheight);
|
||||
snprintf(number, 10, "%d", i);
|
||||
aggDraw.hud->renderText(9 + xpos + 4, 164, std::string(number));
|
||||
i++;
|
||||
yheight=0;
|
||||
}
|
||||
|
||||
if(lastSaveState != previousslot) fadecounter = 256;
|
||||
previousslot = lastSaveState;
|
||||
fadecounter--;
|
||||
|
||||
if(fadecounter < 1) fadecounter = 0;
|
||||
|
||||
xpos = 0;
|
||||
}
|
||||
#ifdef WIN32
|
||||
#include "lua-engine.h"
|
||||
#endif
|
||||
void DrawHUD()
|
||||
{
|
||||
if (CommonSettings.hud.ShowInputDisplay)
|
||||
{
|
||||
std::stringstream ss;
|
||||
if(nds.isTouch)
|
||||
ss << (nds.touchX >> 4) << " " << (nds.touchY >> 4);
|
||||
osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",(InputDisplayString += ss.str()).c_str());
|
||||
TouchDisplay();
|
||||
}
|
||||
|
||||
if (CommonSettings.hud.FpsDisplay)
|
||||
{
|
||||
osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", Hud.fps, Hud.fps3d);
|
||||
}
|
||||
|
||||
if (CommonSettings.hud.FrameCounterDisplay)
|
||||
{
|
||||
if (movieMode == MOVIEMODE_PLAY)
|
||||
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size());
|
||||
else if(movieMode == MOVIEMODE_RECORD)
|
||||
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter);
|
||||
else
|
||||
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter);
|
||||
}
|
||||
|
||||
if (CommonSettings.hud.ShowLagFrameCounter)
|
||||
{
|
||||
osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (CommonSettings.hud.ShowMicrophone)
|
||||
{
|
||||
osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay);
|
||||
}
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
CallRegisteredLuaFunctions(LUACALL_AFTEREMULATIONGUI);
|
||||
#endif
|
||||
DrawStateSlots();
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSDCLASS::OSDCLASS(u8 core)
|
||||
{
|
||||
memset(name,0,7);
|
||||
|
||||
mode=core;
|
||||
offset=0;
|
||||
|
||||
lastLineText=0;
|
||||
lineText_x = 5;
|
||||
lineText_y = 120;
|
||||
lineText_color = AggColor(255, 255, 255);
|
||||
for (int i=0; i < OSD_MAX_LINES+1; i++)
|
||||
{
|
||||
lineText[i] = new char[1024];
|
||||
memset(lineText[i], 0, 1024);
|
||||
lineTimer[i] = 0;
|
||||
lineColor[i] = lineText_color;
|
||||
}
|
||||
|
||||
rotAngle = 0;
|
||||
|
||||
needUpdate = false;
|
||||
|
||||
if (core==0)
|
||||
strcpy(name,"Core A");
|
||||
else
|
||||
if (core==1)
|
||||
strcpy(name,"Core B");
|
||||
else
|
||||
{
|
||||
strcpy(name,"Main");
|
||||
mode=255;
|
||||
}
|
||||
|
||||
//border(false);
|
||||
|
||||
LOG("OSD_Init (%s)\n",name);
|
||||
}
|
||||
|
||||
OSDCLASS::~OSDCLASS()
|
||||
{
|
||||
LOG("OSD_Deinit (%s)\n",name);
|
||||
|
||||
for (int i=0; i < OSD_MAX_LINES+1; i++)
|
||||
{
|
||||
if (lineText[i])
|
||||
delete [] lineText[i];
|
||||
lineText[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void OSDCLASS::setOffset(u16 ofs)
|
||||
{
|
||||
offset=ofs;
|
||||
}
|
||||
|
||||
void OSDCLASS::setRotate(u16 angle)
|
||||
{
|
||||
rotAngle = angle;
|
||||
}
|
||||
|
||||
void OSDCLASS::clear()
|
||||
{
|
||||
needUpdate=false;
|
||||
}
|
||||
|
||||
bool OSDCLASS::checkTimers()
|
||||
{
|
||||
if (lastLineText == 0) return false;
|
||||
|
||||
time_t tmp_time = time(NULL);
|
||||
|
||||
for (int i=0; i < lastLineText; i++)
|
||||
{
|
||||
if (tmp_time > (lineTimer[i] + OSD_TIMER_SECS) )
|
||||
{
|
||||
if (i < lastLineText)
|
||||
{
|
||||
for (int j=i; j < lastLineText; j++)
|
||||
{
|
||||
strcpy(lineText[j], lineText[j+1]);
|
||||
lineTimer[j] = lineTimer[j+1];
|
||||
lineColor[j] = lineColor[j+1];
|
||||
}
|
||||
}
|
||||
lineTimer[lastLineText] = 0;
|
||||
lastLineText--;
|
||||
if (lastLineText == 0) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OSDCLASS::update()
|
||||
{
|
||||
if ( (!needUpdate) && (!lastLineText) ) return; // don't update if buffer empty (speed up)
|
||||
if (lastLineText)
|
||||
{
|
||||
if (checkTimers())
|
||||
{
|
||||
for (int i=0; i < lastLineText; i++)
|
||||
{
|
||||
aggDraw.hud->lineColor(lineColor[i]);
|
||||
aggDraw.hud->renderTextDropshadowed(lineText_x,lineText_y+(i*16),lineText[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!needUpdate) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OSDCLASS::setListCoord(u16 x, u16 y)
|
||||
{
|
||||
lineText_x = x;
|
||||
lineText_y = y;
|
||||
}
|
||||
|
||||
void OSDCLASS::setLineColor(u8 r=255, u8 b=255, u8 g=255)
|
||||
{
|
||||
lineText_color = AggColor(r,g,b);
|
||||
}
|
||||
|
||||
void OSDCLASS::addLine(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (lastLineText > OSD_MAX_LINES) lastLineText = OSD_MAX_LINES;
|
||||
if (lastLineText == OSD_MAX_LINES) // full
|
||||
{
|
||||
lastLineText--;
|
||||
for (int j=0; j < lastLineText; j++)
|
||||
{
|
||||
strcpy(lineText[j], lineText[j+1]);
|
||||
lineTimer[j] = lineTimer[j+1];
|
||||
lineColor[j] = lineColor[j+1];
|
||||
}
|
||||
}
|
||||
|
||||
va_start(list,fmt);
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
_vsnprintf(lineText[lastLineText],1023,fmt,list);
|
||||
#else
|
||||
vsnprintf(lineText[lastLineText],1023,fmt,list);
|
||||
#endif
|
||||
va_end(list);
|
||||
lineColor[lastLineText] = lineText_color;
|
||||
lineTimer[lastLineText] = time(NULL);
|
||||
needUpdate = true;
|
||||
|
||||
lastLineText++;
|
||||
}
|
||||
|
||||
void OSDCLASS::addFixed(u16 x, u16 y, const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[1024];
|
||||
|
||||
va_start(list,fmt);
|
||||
vsnprintf(msg,1023,fmt,list);
|
||||
va_end(list);
|
||||
|
||||
aggDraw.hud->lineColor(255,255,255);
|
||||
aggDraw.hud->renderTextDropshadowed(x,y,msg);
|
||||
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
void OSDCLASS::border(bool enabled)
|
||||
{
|
||||
//render51.setTextBoxBorder(enabled);
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
#ifndef __GNUC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
Copyright (C) 2009 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include <string.h>
|
||||
|
||||
static u8 guitarKeyStatus = 0;
|
||||
|
||||
static BOOL guitarGrip_init(void) { return (TRUE); }
|
||||
static void guitarGrip_reset(void)
|
||||
{
|
||||
//INFO("GuitarGrip: Reset\n");
|
||||
guitarKeyStatus = 0;
|
||||
}
|
||||
static void guitarGrip_close(void) {}
|
||||
static void guitarGrip_config(void) {}
|
||||
static void guitarGrip_write08(u32 adr, u8 val) {}
|
||||
static void guitarGrip_write16(u32 adr, u16 val) {}
|
||||
static void guitarGrip_write32(u32 adr, u32 val) {}
|
||||
static u8 guitarGrip_read08(u32 adr)
|
||||
{
|
||||
//INFO("GuitarGrip: read 08 at 0x%08X\n", adr);
|
||||
if (adr == 0x0A000000) return (~guitarKeyStatus);
|
||||
return (0x0);
|
||||
}
|
||||
static u16 guitarGrip_read16(u32 adr)
|
||||
{
|
||||
//INFO("GuitarGrip: read 16 at 0x%08X\n", adr);
|
||||
if (adr == 0x080000BE) return (0xF9FF);
|
||||
if (adr == 0x0801FFFE) return (0xF9FF);
|
||||
|
||||
return (0);
|
||||
}
|
||||
static u32 guitarGrip_read32(u32 adr)
|
||||
{
|
||||
//INFO("GuitarGrip: read 32 at 0x%08X\n", adr);
|
||||
return (0);
|
||||
}
|
||||
static void guitarGrip_info(char *info) { strcpy(info, "Guitar Grip for Guitar Hero games"); }
|
||||
|
||||
void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue)
|
||||
{
|
||||
guitarKeyStatus = 0 | (green << 6) | (red << 5) | (yellow << 4) | (blue << 3);
|
||||
}
|
||||
|
||||
ADDONINTERFACE addonGuitarGrip = {
|
||||
"Guitar Grip",
|
||||
guitarGrip_init,
|
||||
guitarGrip_reset,
|
||||
guitarGrip_close,
|
||||
guitarGrip_config,
|
||||
guitarGrip_write08,
|
||||
guitarGrip_write16,
|
||||
guitarGrip_write32,
|
||||
guitarGrip_read08,
|
||||
guitarGrip_read16,
|
||||
guitarGrip_read32,
|
||||
guitarGrip_info};
|
|
@ -1,929 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Agg2D - Version 1.0
|
||||
// Based on Anti-Grain Geometry
|
||||
// Copyright (C) 2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all copies.
|
||||
// This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://www.antigrain.com
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// 25 Jan 2007 - Ported to AGG 2.4 Jerry Evans (jerry@novadsp.com)
|
||||
// 11 Jul 2009 - significant refactors for introduction to desmume
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG2D_INCLUDED
|
||||
#define AGG2D_INCLUDED
|
||||
|
||||
//we're not using vector fonts right now.
|
||||
//#define AGG2D_USE_VECTORFONTS
|
||||
|
||||
#ifdef AGG2D_USE_VECTORFONTS
|
||||
#if defined(UNDER_CE) || not defined(WIN32)
|
||||
#define AGG2D_USE_FREETYPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
// JME
|
||||
#include "agg_basics.h"
|
||||
#include "agg_math_stroke.h"
|
||||
#include "agg_trans_affine.h"
|
||||
#include "agg_trans_viewport.h"
|
||||
#include "agg_path_storage.h"
|
||||
#include "agg_conv_stroke.h"
|
||||
#include "agg_conv_transform.h"
|
||||
#include "agg_conv_curve.h"
|
||||
#include "agg_rendering_buffer.h"
|
||||
#include "agg_renderer_base.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
#include "agg_span_gradient.h"
|
||||
#include "agg_span_image_filter_rgba.h"
|
||||
|
||||
//+ JME
|
||||
#include "agg_span_allocator.h"
|
||||
#include "agg_span_converter.h"
|
||||
#include "agg_span_interpolator_linear.h"
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
#include "agg_gamma_functions.h"
|
||||
#include "agg_scanline_u.h"
|
||||
#include "agg_bezier_arc.h"
|
||||
#include "agg_rounded_rect.h"
|
||||
#include "agg_font_cache_manager.h"
|
||||
|
||||
#include "agg_glyph_raster_bin.h"
|
||||
#include "agg_renderer_raster_text.h"
|
||||
#include "agg_embedded_raster_fonts.h"
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef AGG2D_USE_VECTORFONTS
|
||||
#ifdef AGG2D_USE_FREETYPE
|
||||
#ifndef WIN32
|
||||
#include "agg_font_freetype.h"
|
||||
#else
|
||||
#include "../font_freetype/agg_font_freetype.h"
|
||||
#endif
|
||||
#else
|
||||
#include "../font_win32_tt/agg_font_win32_tt.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
//+ JME
|
||||
#include "agg_image_accessors.h"
|
||||
|
||||
#define AGG2D_TEMPLATE template<typename PixFormatSet>
|
||||
#define AGG2D_TEMPLATE_WITH_IMAGE template<typename PixFormatSet, typename ImagePixFormatSet>
|
||||
#define AGG2D_TEMPLATE_ARG <PixFormatSet>
|
||||
#define AGG2D_IMAGE_TEMPLATE template<typename ImagePixFormatSet>
|
||||
#define AGG2D_IMAGE_TEMPLATE_ARG <ImagePixFormatSet>
|
||||
#define TIMAGE Agg2DBase :: Image AGG2D_IMAGE_TEMPLATE_ARG
|
||||
|
||||
|
||||
template<typename Main, typename Pre>
|
||||
class PixFormatSetDeclaration
|
||||
{
|
||||
public:
|
||||
typedef Main PixFormat;
|
||||
typedef Pre PixFormatPre;
|
||||
};
|
||||
|
||||
class Agg2DBase
|
||||
{
|
||||
public:
|
||||
// JME
|
||||
//typedef agg::rect Rect;
|
||||
typedef agg::rect_i Rect;
|
||||
typedef agg::rect_d RectD;
|
||||
typedef agg::trans_affine Affine;
|
||||
|
||||
enum LineJoin
|
||||
{
|
||||
JOIN_MITER = agg::miter_join,
|
||||
JOIN_ROUND = agg::round_join,
|
||||
JOIN_BEVEL = agg::bevel_join
|
||||
};
|
||||
|
||||
enum LineCap
|
||||
{
|
||||
CAP_BUTT = agg::butt_cap,
|
||||
CAP_SQUARE = agg::square_cap,
|
||||
CAP_ROUND = agg::round_cap
|
||||
};
|
||||
|
||||
enum TextAlignment
|
||||
{
|
||||
AlignLeft,
|
||||
AlignRight,
|
||||
AlignCenter,
|
||||
AlignBaseline,
|
||||
AlignTop = AlignRight,
|
||||
AlignBottom = AlignLeft
|
||||
};
|
||||
|
||||
|
||||
enum DrawPathFlag
|
||||
{
|
||||
FillOnly,
|
||||
StrokeOnly,
|
||||
FillAndStroke,
|
||||
FillWithLineColor
|
||||
};
|
||||
|
||||
enum ViewportOption
|
||||
{
|
||||
Anisotropic,
|
||||
XMinYMin,
|
||||
XMidYMin,
|
||||
XMaxYMin,
|
||||
XMinYMid,
|
||||
XMidYMid,
|
||||
XMaxYMid,
|
||||
XMinYMax,
|
||||
XMidYMax,
|
||||
XMaxYMax
|
||||
};
|
||||
|
||||
enum WindowFitLogic
|
||||
{
|
||||
WindowFitLogic_meet,
|
||||
WindowFitLogic_slice
|
||||
};
|
||||
|
||||
struct Transformations
|
||||
{
|
||||
double affineMatrix[6];
|
||||
};
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE struct Image
|
||||
{
|
||||
agg::rendering_buffer renBuf;
|
||||
|
||||
Image(const agg::rendering_buffer& srcBuf)
|
||||
: renBuf(srcBuf)
|
||||
{}
|
||||
Image(unsigned char* buf, unsigned width, unsigned height, int stride) :
|
||||
renBuf(buf, width, height, stride) {}
|
||||
void attach(unsigned char* buf, unsigned width, unsigned height, int stride)
|
||||
{
|
||||
renBuf.attach(buf, width, height, stride);
|
||||
}
|
||||
int width() const { return renBuf.width(); }
|
||||
int height() const { return renBuf.height(); }
|
||||
|
||||
AGG2D_TEMPLATE void premultiply()
|
||||
{
|
||||
typename PixFormatSet::PixFormat pixf(renBuf);
|
||||
pixf.premultiply();
|
||||
}
|
||||
|
||||
AGG2D_TEMPLATE void demultiply()
|
||||
{
|
||||
typename PixFormatSet::PixFormat pixf(renBuf);
|
||||
pixf.demultiply();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
enum ImageFilter
|
||||
{
|
||||
NoFilter,
|
||||
Bilinear,
|
||||
Hanning,
|
||||
Hermite,
|
||||
Quadric,
|
||||
Bicubic,
|
||||
Catrom,
|
||||
Spline16,
|
||||
Spline36,
|
||||
Blackman144
|
||||
};
|
||||
|
||||
enum ImageResample
|
||||
{
|
||||
NoResample,
|
||||
ResampleAlways,
|
||||
ResampleOnZoomOut
|
||||
};
|
||||
|
||||
enum FontCacheType
|
||||
{
|
||||
RasterFontCache,
|
||||
VectorFontCache
|
||||
};
|
||||
|
||||
enum BlendMode
|
||||
{
|
||||
BlendAlpha = agg::end_of_comp_op_e,
|
||||
BlendClear = agg::comp_op_clear,
|
||||
BlendSrc = agg::comp_op_src,
|
||||
BlendDst = agg::comp_op_dst,
|
||||
BlendSrcOver = agg::comp_op_src_over,
|
||||
BlendDstOver = agg::comp_op_dst_over,
|
||||
BlendSrcIn = agg::comp_op_src_in,
|
||||
BlendDstIn = agg::comp_op_dst_in,
|
||||
BlendSrcOut = agg::comp_op_src_out,
|
||||
BlendDstOut = agg::comp_op_dst_out,
|
||||
BlendSrcAtop = agg::comp_op_src_atop,
|
||||
BlendDstAtop = agg::comp_op_dst_atop,
|
||||
BlendXor = agg::comp_op_xor,
|
||||
BlendAdd = agg::comp_op_plus,
|
||||
BlendSub = agg::comp_op_minus,
|
||||
BlendMultiply = agg::comp_op_multiply,
|
||||
BlendScreen = agg::comp_op_screen,
|
||||
BlendOverlay = agg::comp_op_overlay,
|
||||
BlendDarken = agg::comp_op_darken,
|
||||
BlendLighten = agg::comp_op_lighten,
|
||||
BlendColorDodge = agg::comp_op_color_dodge,
|
||||
BlendColorBurn = agg::comp_op_color_burn,
|
||||
BlendHardLight = agg::comp_op_hard_light,
|
||||
BlendSoftLight = agg::comp_op_soft_light,
|
||||
BlendDifference = agg::comp_op_difference,
|
||||
BlendExclusion = agg::comp_op_exclusion,
|
||||
BlendContrast = agg::comp_op_contrast
|
||||
};
|
||||
|
||||
enum Direction
|
||||
{
|
||||
CW, CCW
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
template<typename,typename> class Agg2DRenderer;
|
||||
|
||||
template<typename PixFormatSet> class Agg2D : public Agg2DBase
|
||||
{
|
||||
public:
|
||||
typedef typename PixFormatSet::PixFormat PixFormat;
|
||||
typedef Image<PixFormatSet> MyImage;
|
||||
typedef agg::order_bgra ComponentOrder; // Platform dependent!
|
||||
|
||||
typedef agg::rgba8 ColorType;
|
||||
typedef agg::blender_rgba<ColorType, ComponentOrder> Blender;
|
||||
typedef agg::comp_op_adaptor_rgba<ColorType, ComponentOrder> BlenderComp;
|
||||
typedef agg::blender_rgba_pre<ColorType, ComponentOrder> BlenderPre;
|
||||
typedef agg::comp_op_adaptor_rgba_pre<ColorType, ComponentOrder> BlenderCompPre;
|
||||
|
||||
// JME
|
||||
//typedef agg::pixel_formats_rgba<Blender, agg::pixel32_type> PixFormat;
|
||||
//typedef agg::pixfmt_bgra32 PixFormat;
|
||||
// JME
|
||||
//typedef agg::pixfmt_custom_blend_rgba<BlenderComp,> PixFormatComp;
|
||||
typedef agg::pixfmt_custom_blend_rgba<BlenderComp,agg::rendering_buffer> PixFormatComp;
|
||||
// JME
|
||||
//typedef agg::pixel_formats_rgba<BlenderPre, agg::pixel32_type> PixFormatPre;
|
||||
typedef typename PixFormatSet::PixFormatPre PixFormatPre;
|
||||
// JME
|
||||
//typedef agg::pixfmt_custom_blend_rgba<BlenderCompPre> PixFormatCompPre;
|
||||
typedef agg::pixfmt_custom_blend_rgba<BlenderCompPre,agg::rendering_buffer> PixFormatCompPre;
|
||||
|
||||
typedef agg::renderer_base<PixFormat> RendererBase;
|
||||
typedef agg::renderer_base<PixFormatComp> RendererBaseComp;
|
||||
typedef agg::renderer_base<PixFormatPre> RendererBasePre;
|
||||
typedef agg::renderer_base<PixFormatCompPre> RendererBaseCompPre;
|
||||
|
||||
typedef agg::renderer_scanline_aa_solid<RendererBase> RendererSolid;
|
||||
typedef agg::renderer_scanline_aa_solid<RendererBaseComp> RendererSolidComp;
|
||||
|
||||
typedef agg::span_allocator<ColorType> SpanAllocator;
|
||||
typedef agg::pod_auto_array<ColorType, 256> GradientArray;
|
||||
|
||||
typedef agg::span_gradient<ColorType, agg::span_interpolator_linear<>, agg::gradient_x, GradientArray> LinearGradientSpan;
|
||||
typedef agg::span_gradient<ColorType, agg::span_interpolator_linear<>, agg::gradient_circle, GradientArray> RadialGradientSpan;
|
||||
|
||||
#ifdef AGG2D_USE_VECTORFONTS
|
||||
#ifdef AGG2D_USE_FREETYPE
|
||||
typedef agg::font_engine_freetype_int32 FontEngine;
|
||||
#else
|
||||
typedef agg::font_engine_win32_tt_int32 FontEngine;
|
||||
#endif
|
||||
|
||||
typedef agg::font_cache_manager<FontEngine> FontCacheManager;
|
||||
typedef FontCacheManager::gray8_adaptor_type FontRasterizer;
|
||||
typedef FontCacheManager::gray8_scanline_type FontScanline;
|
||||
#endif
|
||||
|
||||
typedef agg::conv_curve<agg::path_storage> ConvCurve;
|
||||
typedef agg::conv_stroke<ConvCurve> ConvStroke;
|
||||
typedef agg::conv_transform<ConvCurve> PathTransform;
|
||||
typedef agg::conv_transform<ConvStroke> StrokeTransform;
|
||||
enum Gradient
|
||||
{
|
||||
Solid,
|
||||
Linear,
|
||||
Radial
|
||||
};
|
||||
|
||||
public:
|
||||
template<typename,typename> friend class Agg2DRenderer;
|
||||
|
||||
typedef ColorType Color;
|
||||
|
||||
|
||||
|
||||
struct State
|
||||
{
|
||||
RectD m_clipBox;
|
||||
|
||||
BlendMode m_blendMode;
|
||||
BlendMode m_imageBlendMode;
|
||||
Color m_imageBlendColor;
|
||||
|
||||
double m_masterAlpha;
|
||||
double m_antiAliasGamma;
|
||||
|
||||
const agg::int8u* m_font;
|
||||
|
||||
Color m_fillColor;
|
||||
Color m_lineColor;
|
||||
GradientArray m_fillGradient;
|
||||
GradientArray m_lineGradient;
|
||||
|
||||
LineCap m_lineCap;
|
||||
LineJoin m_lineJoin;
|
||||
|
||||
Gradient m_fillGradientFlag;
|
||||
Gradient m_lineGradientFlag;
|
||||
agg::trans_affine m_fillGradientMatrix;
|
||||
agg::trans_affine m_lineGradientMatrix;
|
||||
double m_fillGradientD1;
|
||||
double m_lineGradientD1;
|
||||
double m_fillGradientD2;
|
||||
double m_lineGradientD2;
|
||||
|
||||
double m_textAngle;
|
||||
TextAlignment m_textAlignX;
|
||||
TextAlignment m_textAlignY;
|
||||
bool m_textHints;
|
||||
double m_fontHeight;
|
||||
double m_fontAscent;
|
||||
double m_fontDescent;
|
||||
FontCacheType m_fontCacheType;
|
||||
|
||||
double m_lineWidth;
|
||||
bool m_evenOddFlag;
|
||||
|
||||
agg::trans_affine m_transform;
|
||||
agg::trans_affine m_affine;
|
||||
|
||||
};
|
||||
|
||||
|
||||
~Agg2D();
|
||||
Agg2D();
|
||||
|
||||
// Setup
|
||||
//-----------------------
|
||||
void attach(unsigned char* buf, unsigned width, unsigned height, int stride);
|
||||
void attach(MyImage& img);
|
||||
|
||||
void clipBox(double x1, double y1, double x2, double y2);
|
||||
RectD clipBox() const;
|
||||
|
||||
void clearAll(Color c);
|
||||
void clearAll(unsigned r, unsigned g, unsigned b, unsigned a = 255);
|
||||
|
||||
void clearClipBox(Color c);
|
||||
void clearClipBox(unsigned r, unsigned g, unsigned b, unsigned a = 255);
|
||||
|
||||
unsigned width() const { return m_rbuf.width(); }
|
||||
unsigned height() const { return m_rbuf.height(); }
|
||||
unsigned stride() const { return m_rbuf.stride(); }
|
||||
|
||||
// Conversions
|
||||
//-----------------------
|
||||
void worldToScreen(double& x, double& y) const;
|
||||
void screenToWorld(double& x, double& y) const;
|
||||
double worldToScreen(double scalar) const;
|
||||
double screenToWorld(double scalar) const;
|
||||
void alignPoint(double& x, double& y) const;
|
||||
bool inBox(double worldX, double worldY) const;
|
||||
|
||||
// General Attributes
|
||||
//-----------------------
|
||||
void blendMode(BlendMode m);
|
||||
BlendMode blendMode() const;
|
||||
|
||||
void imageBlendMode(BlendMode m);
|
||||
BlendMode imageBlendMode() const;
|
||||
|
||||
void imageBlendColor(Color c);
|
||||
void imageBlendColor(unsigned r, unsigned g, unsigned b, unsigned a = 255);
|
||||
Color imageBlendColor() const;
|
||||
|
||||
void masterAlpha(double a);
|
||||
double masterAlpha() const;
|
||||
|
||||
void antiAliasGamma(double g);
|
||||
double antiAliasGamma() const;
|
||||
|
||||
void font(const agg::int8u* font) { m_font = font; }
|
||||
const agg::int8u* font() { return m_font; }
|
||||
|
||||
void fillColor(Color c);
|
||||
void fillColor(unsigned r, unsigned g, unsigned b, unsigned a = 255);
|
||||
void noFill();
|
||||
|
||||
void lineColor(Color c);
|
||||
void lineColor(unsigned r, unsigned g, unsigned b, unsigned a = 255);
|
||||
void noLine();
|
||||
|
||||
Color fillColor() const;
|
||||
Color lineColor() const;
|
||||
|
||||
void fillLinearGradient(double x1, double y1, double x2, double y2, Color c1, Color c2, double profile=1.0);
|
||||
void lineLinearGradient(double x1, double y1, double x2, double y2, Color c1, Color c2, double profile=1.0);
|
||||
|
||||
void fillRadialGradient(double x, double y, double r, Color c1, Color c2, double profile=1.0);
|
||||
void lineRadialGradient(double x, double y, double r, Color c1, Color c2, double profile=1.0);
|
||||
|
||||
void fillRadialGradient(double x, double y, double r, Color c1, Color c2, Color c3);
|
||||
void lineRadialGradient(double x, double y, double r, Color c1, Color c2, Color c3);
|
||||
|
||||
void fillRadialGradient(double x, double y, double r);
|
||||
void lineRadialGradient(double x, double y, double r);
|
||||
|
||||
void lineWidth(double w);
|
||||
double lineWidth() const;
|
||||
|
||||
void lineCap(LineCap cap);
|
||||
LineCap lineCap() const;
|
||||
|
||||
void lineJoin(LineJoin join);
|
||||
LineJoin lineJoin() const;
|
||||
|
||||
void fillEvenOdd(bool evenOddFlag);
|
||||
bool fillEvenOdd() const;
|
||||
|
||||
// Transformations
|
||||
//-----------------------
|
||||
Transformations transformations() const;
|
||||
void transformations(const Transformations& tr);
|
||||
|
||||
const Affine& affine() const;
|
||||
void affine(const Affine&);
|
||||
|
||||
void resetTransformations();
|
||||
void matrix(const Affine& tr);
|
||||
void matrix(const Transformations& tr);
|
||||
void rotate(double angle);
|
||||
void rotate(double angle, double cx, double cy);
|
||||
void scale(double s);
|
||||
void scale(double sx, double sy);
|
||||
void skew(double sx, double sy);
|
||||
void translate(double x, double y);
|
||||
void parallelogram(double x1, double y1, double x2, double y2, const double* para);
|
||||
void viewport(double worldX1, double worldY1, double worldX2, double worldY2,
|
||||
double screenX1, double screenY1, double screenX2, double screenY2,
|
||||
ViewportOption opt=XMidYMid, WindowFitLogic fl = WindowFitLogic_meet);
|
||||
|
||||
// Basic Shapes
|
||||
//-----------------------
|
||||
void line(double x1, double y1, double x2, double y2);
|
||||
void triangle(double x1, double y1, double x2, double y2, double x3, double y3);
|
||||
void rectangle(double x1, double y1, double x2, double y2);
|
||||
void roundedRect(double x1, double y1, double x2, double y2, double r);
|
||||
void roundedRect(double x1, double y1, double x2, double y2, double rx, double ry);
|
||||
void roundedRect(double x1, double y1, double x2, double y2,
|
||||
double rxBottom, double ryBottom,
|
||||
double rxTop, double ryTop);
|
||||
void ellipse(double cx, double cy, double rx, double ry);
|
||||
void arc(double cx, double cy, double rx, double ry, double start, double sweep);
|
||||
void star(double cx, double cy, double r1, double r2, double startAngle, int numRays);
|
||||
void curve(double x1, double y1, double x2, double y2, double x3, double y3);
|
||||
void curve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4);
|
||||
void polygon(double* xy, int numPoints);
|
||||
void polyline(double* xy, int numPoints);
|
||||
|
||||
|
||||
// Text
|
||||
//-----------------------
|
||||
#ifdef AGG2D_USE_VECTORFONTS
|
||||
void flipText(bool flip);
|
||||
void font(const char* fileName, double height,
|
||||
bool bold = false,
|
||||
bool italic = false,
|
||||
FontCacheType ch = RasterFontCache,
|
||||
double angle = 0.0);
|
||||
double fontHeight() const;
|
||||
double fontAscent() const;
|
||||
|
||||
void textAlignment(TextAlignment alignX, TextAlignment alignY);
|
||||
bool textHints() const;
|
||||
void textHints(bool hints);
|
||||
double textWidth(const char* str, unsigned int len);
|
||||
double textWidth(const wchar_t* str, unsigned int len);
|
||||
void text(double x, double y, const char* str, unsigned int len, bool roundOff=false, double dx=0.0, double dy=0.0);
|
||||
void text(double x, double y, const wchar_t* str, unsigned int len, bool roundOff=false, double dx=0.0, double dy=0.0);
|
||||
|
||||
double textWidth(const char* str);
|
||||
void text(double x, double y, const char* str, bool roundOff=false, double dx=0.0, double dy=0.0);
|
||||
#endif
|
||||
|
||||
// Path commands
|
||||
//-----------------------
|
||||
void resetPath();
|
||||
|
||||
void moveTo(double x, double y);
|
||||
void moveRel(double dx, double dy);
|
||||
|
||||
void lineTo(double x, double y);
|
||||
void lineRel(double dx, double dy);
|
||||
|
||||
void horLineTo(double x);
|
||||
void horLineRel(double dx);
|
||||
|
||||
void verLineTo(double y);
|
||||
void verLineRel(double dy);
|
||||
|
||||
void arcTo(double rx, double ry,
|
||||
double angle,
|
||||
bool largeArcFlag,
|
||||
bool sweepFlag,
|
||||
double x, double y);
|
||||
|
||||
void arcRel(double rx, double ry,
|
||||
double angle,
|
||||
bool largeArcFlag,
|
||||
bool sweepFlag,
|
||||
double dx, double dy);
|
||||
|
||||
void quadricCurveTo(double xCtrl, double yCtrl,
|
||||
double xTo, double yTo);
|
||||
void quadricCurveRel(double dxCtrl, double dyCtrl,
|
||||
double dxTo, double dyTo);
|
||||
void quadricCurveTo(double xTo, double yTo);
|
||||
void quadricCurveRel(double dxTo, double dyTo);
|
||||
|
||||
void cubicCurveTo(double xCtrl1, double yCtrl1,
|
||||
double xCtrl2, double yCtrl2,
|
||||
double xTo, double yTo);
|
||||
|
||||
void cubicCurveRel(double dxCtrl1, double dyCtrl1,
|
||||
double dxCtrl2, double dyCtrl2,
|
||||
double dxTo, double dyTo);
|
||||
|
||||
void cubicCurveTo(double xCtrl2, double yCtrl2,
|
||||
double xTo, double yTo);
|
||||
|
||||
void cubicCurveRel(double xCtrl2, double yCtrl2,
|
||||
double xTo, double yTo);
|
||||
|
||||
void addEllipse(double cx, double cy, double rx, double ry, Direction dir);
|
||||
void closePolygon();
|
||||
|
||||
void drawPath(DrawPathFlag flag = FillAndStroke);
|
||||
void drawPathNoTransform(DrawPathFlag flag = FillAndStroke);
|
||||
|
||||
|
||||
// Image Transformations
|
||||
//-----------------------
|
||||
void imageFilter(ImageFilter f);
|
||||
ImageFilter imageFilter() const;
|
||||
|
||||
void imageResample(ImageResample f);
|
||||
ImageResample imageResample() const;
|
||||
|
||||
//---------
|
||||
//if anyone can figure out how to put these in the .inl file, theyre more than welcome to. I couldnt declare them correctly to match
|
||||
//the .h file declaration
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImage(const TIMAGE& img,
|
||||
int imgX1, int imgY1, int imgX2, int imgY2,
|
||||
double dstX1, double dstY1, double dstX2, double dstY2)
|
||||
{
|
||||
resetPath();
|
||||
moveTo(dstX1, dstY1);
|
||||
lineTo(dstX2, dstY1);
|
||||
lineTo(dstX2, dstY2);
|
||||
lineTo(dstX1, dstY2);
|
||||
closePolygon();
|
||||
double parallelogram[6] = { dstX1, dstY1, dstX2, dstY1, dstX2, dstY2 };
|
||||
renderImage <typename ImagePixFormatSet::ImagePixFormat> (img, imgX1, imgY1, imgX2, imgY2, parallelogram);
|
||||
}
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImage(const TIMAGE& img,
|
||||
double dstX1, double dstY1, double dstX2, double dstY2)
|
||||
{
|
||||
resetPath();
|
||||
moveTo(dstX1, dstY1);
|
||||
lineTo(dstX2, dstY1);
|
||||
lineTo(dstX2, dstY2);
|
||||
lineTo(dstX1, dstY2);
|
||||
closePolygon();
|
||||
double parallelogram[6] = { dstX1, dstY1, dstX2, dstY1, dstX2, dstY2 };
|
||||
renderImage(img, 0, 0, img.renBuf.width(), img.renBuf.height(), parallelogram);
|
||||
}
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImage(const TIMAGE& img,
|
||||
int imgX1, int imgY1, int imgX2, int imgY2,
|
||||
const double* parallelogram)
|
||||
{
|
||||
resetPath();
|
||||
moveTo(parallelogram[0], parallelogram[1]);
|
||||
lineTo(parallelogram[2], parallelogram[3]);
|
||||
lineTo(parallelogram[4], parallelogram[5]);
|
||||
lineTo(parallelogram[0] + parallelogram[4] - parallelogram[2],
|
||||
parallelogram[1] + parallelogram[5] - parallelogram[3]);
|
||||
closePolygon();
|
||||
renderImage(img, imgX1, imgY1, imgX2, imgY2, parallelogram);
|
||||
}
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImage(const TIMAGE& img, const double* parallelogram)
|
||||
{
|
||||
resetPath();
|
||||
moveTo(parallelogram[0], parallelogram[1]);
|
||||
lineTo(parallelogram[2], parallelogram[3]);
|
||||
lineTo(parallelogram[4], parallelogram[5]);
|
||||
lineTo(parallelogram[0] + parallelogram[4] - parallelogram[2],
|
||||
parallelogram[1] + parallelogram[5] - parallelogram[3]);
|
||||
closePolygon();
|
||||
renderImage(img, 0, 0, img.renBuf.width(), img.renBuf.height(), parallelogram);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImagePath(const TIMAGE& img,
|
||||
int imgX1, int imgY1, int imgX2, int imgY2,
|
||||
double dstX1, double dstY1, double dstX2, double dstY2)
|
||||
{
|
||||
double parallelogram[6] = { dstX1, dstY1, dstX2, dstY1, dstX2, dstY2 };
|
||||
renderImage(img, imgX1, imgY1, imgX2, imgY2, parallelogram);
|
||||
}
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImagePath(const TIMAGE& img,
|
||||
double dstX1, double dstY1, double dstX2, double dstY2)
|
||||
{
|
||||
double parallelogram[6] = { dstX1, dstY1, dstX2, dstY1, dstX2, dstY2 };
|
||||
renderImage(img, 0, 0, img.renBuf.width(), img.renBuf.height(), parallelogram);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImagePath(const TIMAGE& img,
|
||||
int imgX1, int imgY1, int imgX2, int imgY2,
|
||||
const double* parallelogram)
|
||||
{
|
||||
renderImage(img, imgX1, imgY1, imgX2, imgY2, parallelogram);
|
||||
}
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void transformImagePath(const TIMAGE& img, const double* parallelogram)
|
||||
{
|
||||
renderImage(img, 0, 0, img.renBuf.width(), img.renBuf.height(), parallelogram);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Image Blending (no transformations available)
|
||||
AGG2D_IMAGE_TEMPLATE void blendImage(TIMAGE& img,
|
||||
int imgX1, int imgY1, int imgX2, int imgY2,
|
||||
double dstX, double dstY, unsigned alpha=255)
|
||||
{
|
||||
worldToScreen(dstX, dstY);
|
||||
PixFormat pixF(img.renBuf);
|
||||
// JME
|
||||
//agg::rect r(imgX1, imgY1, imgX2, imgY2);
|
||||
Rect r(imgX1, imgY1, imgX2, imgY2);
|
||||
if(m_blendMode == BlendAlpha)
|
||||
{
|
||||
m_renBasePre.blend_from(pixF, &r, int(dstX)-imgX1, int(dstY)-imgY1, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renBaseCompPre.blend_from(pixF, &r, int(dstX)-imgX1, int(dstY)-imgY1, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void renderText(double dstX, double dstY, const std::string& str)
|
||||
{
|
||||
worldToScreen(dstX, dstY);
|
||||
PixFormat pixF(m_rbuf);
|
||||
//Rect r(imgX1, imgY1, imgX2, imgY2);
|
||||
|
||||
typedef agg::glyph_raster_bin<agg::rgba8> glyph_gen;
|
||||
glyph_gen glyph(0);
|
||||
|
||||
if(m_blendMode == BlendAlpha)
|
||||
{
|
||||
typedef agg::renderer_base<PixFormatPre> ren_base;
|
||||
agg::renderer_raster_htext_solid<ren_base, glyph_gen> rt(m_renBasePre,glyph);
|
||||
rt.color(m_lineColor);
|
||||
glyph.font(m_font);
|
||||
rt.render_text(dstX, dstY, str.c_str(), true); //flipy
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef agg::renderer_base<PixFormatCompPre> ren_base;
|
||||
agg::renderer_raster_htext_solid<ren_base, glyph_gen> rt(m_renBaseCompPre,glyph);
|
||||
rt.color(m_lineColor);
|
||||
glyph.font(m_font);
|
||||
rt.render_text(dstX, dstY, str.c_str(), true); //flipy
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void blendImage(TIMAGE& img, double dstX, double dstY, unsigned alpha=255)
|
||||
{
|
||||
worldToScreen(dstX, dstY);
|
||||
PixFormat pixF(img.renBuf);
|
||||
m_renBasePre.blend_from(pixF, 0, int(dstX), int(dstY), alpha);
|
||||
if(m_blendMode == BlendAlpha)
|
||||
{
|
||||
m_renBasePre.blend_from(pixF, 0, int(dstX), int(dstY), alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renBaseCompPre.blend_from(pixF, 0, int(dstX), int(dstY), alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Copy image directly, together with alpha-channel
|
||||
AGG2D_IMAGE_TEMPLATE void copyImage(TIMAGE& img,
|
||||
int imgX1, int imgY1, int imgX2, int imgY2,
|
||||
double dstX, double dstY)
|
||||
{
|
||||
worldToScreen(dstX, dstY);
|
||||
// JME
|
||||
//agg::rect r(imgX1, imgY1, imgX2, imgY2);
|
||||
Rect r(imgX1, imgY1, imgX2, imgY2);
|
||||
m_renBase.copy_from(img.renBuf, &r, int(dstX)-imgX1, int(dstY)-imgY1);
|
||||
}
|
||||
|
||||
AGG2D_IMAGE_TEMPLATE void copyImage(TIMAGE& img, double dstX, double dstY)
|
||||
{
|
||||
worldToScreen(dstX, dstY);
|
||||
m_renBase.copy_from(img.renBuf, 0, int(dstX), int(dstY));
|
||||
}
|
||||
|
||||
// State
|
||||
//-----------------------
|
||||
|
||||
void saveStateTo(State& st);
|
||||
void restoreStateFrom(const State& st);
|
||||
|
||||
|
||||
|
||||
// Auxiliary
|
||||
//-----------------------
|
||||
static double pi() { return agg::pi; }
|
||||
static double deg2Rad(double v) { return v * agg::pi / 180.0; }
|
||||
static double rad2Deg(double v) { return v * 180.0 / agg::pi; }
|
||||
|
||||
PixFormat & pixFormat() { return m_pixFormat; }
|
||||
agg::rendering_buffer & buf() { return m_rbuf; }
|
||||
|
||||
private:
|
||||
void render(bool fillColor);
|
||||
|
||||
#ifdef AGG2D_USE_VECTORFONTS
|
||||
#if !defined( UNDER_CE )
|
||||
void render(FontRasterizer& ras, FontScanline& sl);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void addLine(double x1, double y1, double x2, double y2);
|
||||
void updateRasterizerGamma();
|
||||
AGG2D_IMAGE_TEMPLATE void renderImage(const TIMAGE& img, int x1, int y1, int x2, int y2, const double* parl)
|
||||
{
|
||||
agg::trans_affine mtx((double)x1,
|
||||
(double)y1,
|
||||
(double)x2,
|
||||
(double)y2,
|
||||
parl);
|
||||
mtx *= m_transform;
|
||||
mtx.invert();
|
||||
|
||||
m_rasterizer.reset();
|
||||
m_rasterizer.add_path(m_pathTransform);
|
||||
|
||||
typedef agg::span_interpolator_linear<agg::trans_affine> Interpolator;
|
||||
Interpolator interpolator(mtx);
|
||||
|
||||
if(m_blendMode == BlendAlpha)
|
||||
{
|
||||
// JME audit -
|
||||
Agg2DRenderer<PixFormatSet,ImagePixFormatSet>::renderImage(*this, img, m_renBasePre, interpolator);
|
||||
}
|
||||
else
|
||||
{
|
||||
Agg2DRenderer<PixFormatSet,ImagePixFormatSet>::renderImage(*this, img, m_renBaseCompPre, interpolator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updateTransformations();
|
||||
|
||||
agg::rendering_buffer m_rbuf;
|
||||
PixFormat m_pixFormat;
|
||||
PixFormatComp m_pixFormatComp;
|
||||
PixFormatPre m_pixFormatPre;
|
||||
PixFormatCompPre m_pixFormatCompPre;
|
||||
RendererBase m_renBase;
|
||||
RendererBaseComp m_renBaseComp;
|
||||
RendererBasePre m_renBasePre;
|
||||
RendererBaseCompPre m_renBaseCompPre;
|
||||
RendererSolid m_renSolid;
|
||||
RendererSolidComp m_renSolidComp;
|
||||
|
||||
SpanAllocator m_allocator;
|
||||
RectD m_clipBox;
|
||||
|
||||
BlendMode m_blendMode;
|
||||
BlendMode m_imageBlendMode;
|
||||
Color m_imageBlendColor;
|
||||
|
||||
agg::scanline_u8 m_scanline;
|
||||
agg::rasterizer_scanline_aa<> m_rasterizer;
|
||||
|
||||
double m_masterAlpha;
|
||||
double m_antiAliasGamma;
|
||||
|
||||
const agg::int8u* m_font;
|
||||
|
||||
Color m_fillColor;
|
||||
Color m_lineColor;
|
||||
GradientArray m_fillGradient;
|
||||
GradientArray m_lineGradient;
|
||||
|
||||
LineCap m_lineCap;
|
||||
LineJoin m_lineJoin;
|
||||
|
||||
Gradient m_fillGradientFlag;
|
||||
Gradient m_lineGradientFlag;
|
||||
agg::trans_affine m_fillGradientMatrix;
|
||||
agg::trans_affine m_lineGradientMatrix;
|
||||
double m_fillGradientD1;
|
||||
double m_lineGradientD1;
|
||||
double m_fillGradientD2;
|
||||
double m_lineGradientD2;
|
||||
|
||||
double m_textAngle;
|
||||
TextAlignment m_textAlignX;
|
||||
TextAlignment m_textAlignY;
|
||||
bool m_textHints;
|
||||
double m_fontHeight;
|
||||
double m_fontAscent;
|
||||
double m_fontDescent;
|
||||
FontCacheType m_fontCacheType;
|
||||
|
||||
ImageFilter m_imageFilter;
|
||||
ImageResample m_imageResample;
|
||||
agg::image_filter_lut m_imageFilterLut;
|
||||
|
||||
agg::span_interpolator_linear<> m_fillGradientInterpolator;
|
||||
agg::span_interpolator_linear<> m_lineGradientInterpolator;
|
||||
|
||||
agg::gradient_x m_linearGradientFunction;
|
||||
agg::gradient_circle m_radialGradientFunction;
|
||||
|
||||
double m_lineWidth;
|
||||
bool m_evenOddFlag;
|
||||
|
||||
double m_start_x;
|
||||
double m_start_y;
|
||||
|
||||
agg::path_storage m_path;
|
||||
agg::trans_affine m_transform;
|
||||
|
||||
agg::trans_affine m_viewport;
|
||||
agg::trans_affine m_affine;
|
||||
|
||||
ConvCurve m_convCurve;
|
||||
ConvStroke m_convStroke;
|
||||
|
||||
PathTransform m_pathTransform;
|
||||
StrokeTransform m_strokeTransform;
|
||||
|
||||
#ifdef AGG2D_USE_VECTORFONTS
|
||||
#ifndef AGG2D_USE_FREETYPE
|
||||
HDC m_fontDC;
|
||||
#endif
|
||||
FontEngine m_fontEngine;
|
||||
FontCacheManager m_fontCacheManager;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include "agg2d.inl"
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,699 +0,0 @@
|
|||
//The MIT License
|
||||
//
|
||||
//Copyright (c) 2009 DeSmuME team
|
||||
//
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//The above copyright notice and this permission notice shall be included in
|
||||
//all copies or substantial portions of the Software.
|
||||
//
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
//THE SOFTWARE.
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "GPU.h"
|
||||
#include "NDSSystem.h"
|
||||
|
||||
#include "aggdraw.h"
|
||||
|
||||
#include "agg_renderer_base.h"
|
||||
#include "agg_renderer_primitives.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
#include "agg_bounding_rect.h"
|
||||
#include "agg_trans_affine.h"
|
||||
#include "agg_path_storage.h"
|
||||
#include "agg_color_rgba.h"
|
||||
|
||||
#include "agg_pixfmt_rgb.h"
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
#include "agg_scanline_u.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
#include "agg_scanline_p.h"
|
||||
|
||||
//raster text
|
||||
#include "agg_glyph_raster_bin.h"
|
||||
#include "agg_embedded_raster_fonts.h"
|
||||
#include "agg_renderer_raster_text.h"
|
||||
|
||||
#include "ctrl/agg_bezier_ctrl.h"
|
||||
#include "platform/agg_platform_support.h"
|
||||
#include "agg_pattern_filters_rgba.h"
|
||||
#include "agg_renderer_outline_image.h"
|
||||
#include "agg_rasterizer_outline_aa.h"
|
||||
|
||||
#include "agg_image_accessors.h"
|
||||
#include "agg_span_interpolator_linear.h"
|
||||
#include "agg_span_image_filter_rgb.h"
|
||||
#include "agg_span_image_filter_rgba.h"
|
||||
#include "agg_span_image_filter_gray.h"
|
||||
|
||||
#include "agg_span_allocator.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//NOTE - these blenders are necessary to change the rgb order from the defaults, which are incorrect for us
|
||||
|
||||
//this custom blender does more correct blending math than the default
|
||||
//which is necessary or else drawing transparent pixels on (31,31,31) will yield (30,30,30)
|
||||
struct my_blender_rgb555_pre
|
||||
{
|
||||
typedef rgba8 color_type;
|
||||
typedef color_type::value_type value_type;
|
||||
typedef color_type::calc_type calc_type;
|
||||
typedef int16u pixel_type;
|
||||
|
||||
static AGG_INLINE void blend_pix(pixel_type* p,
|
||||
unsigned cr, unsigned cg, unsigned cb,
|
||||
unsigned alpha,
|
||||
unsigned cover)
|
||||
{
|
||||
//not sure whether this is right...
|
||||
alpha = color_type::base_mask - alpha;
|
||||
pixel_type rgb = *p;
|
||||
calc_type b = (rgb >> 10) & 31;
|
||||
calc_type g = (rgb >> 5) & 31;
|
||||
calc_type r = (rgb ) & 31;
|
||||
b = ((b+1)*(alpha+1) + (cb)*(cover)-1)>>8;
|
||||
g = ((g+1)*(alpha+1) + (cg)*(cover)-1)>>8;
|
||||
r = ((r+1)*(alpha+1) + (cr)*(cover)-1)>>8;
|
||||
*p = (b<<10)|(g<<5)|r;
|
||||
}
|
||||
|
||||
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
|
||||
{
|
||||
return (pixel_type)(((b & 0xF8) << 7) |
|
||||
((g & 0xF8) << 2) |
|
||||
(r >> 3) | 0x8000);
|
||||
}
|
||||
|
||||
static AGG_INLINE color_type make_color(pixel_type p)
|
||||
{
|
||||
return color_type((p << 3) & 0xF8,
|
||||
(p >> 2) & 0xF8,
|
||||
(p >> 7) & 0xF8);
|
||||
}
|
||||
};
|
||||
|
||||
struct my_blender_rgb555
|
||||
{
|
||||
typedef rgba8 color_type;
|
||||
typedef color_type::value_type value_type;
|
||||
typedef color_type::calc_type calc_type;
|
||||
typedef int16u pixel_type;
|
||||
|
||||
static AGG_INLINE void blend_pix(pixel_type* p,
|
||||
unsigned cr, unsigned cg, unsigned cb,
|
||||
unsigned alpha,
|
||||
unsigned)
|
||||
{
|
||||
pixel_type rgb = *p;
|
||||
calc_type b = (rgb >> 7) & 0xF8;
|
||||
calc_type g = (rgb >> 2) & 0xF8;
|
||||
calc_type r = (rgb << 3) & 0xF8;
|
||||
*p = (pixel_type)
|
||||
(((((cb - b) * alpha + (b << 8)) >> 1) & 0x7C00) |
|
||||
((((cg - g) * alpha + (g << 8)) >> 6) & 0x03E0) |
|
||||
(((cr - r) * alpha + (r << 8)) >> 11) | 0x8000);
|
||||
}
|
||||
|
||||
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
|
||||
{
|
||||
return (pixel_type)(((b & 0xF8) << 7) |
|
||||
((g & 0xF8) << 2) |
|
||||
(r >> 3) | 0x8000);
|
||||
}
|
||||
|
||||
static AGG_INLINE color_type make_color(pixel_type p)
|
||||
{
|
||||
return color_type((p << 3) & 0xF8,
|
||||
(p >> 2) & 0xF8,
|
||||
(p >> 7) & 0xF8);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef pixfmt_alpha_blend_rgb_packed<my_blender_rgb555_pre, rendering_buffer> my_pixfmt_rgb555_pre; //----pixfmt_rgb555_pre
|
||||
|
||||
typedef pixfmt_alpha_blend_rgb_packed<my_blender_rgb555, rendering_buffer> my_pixfmt_rgb555; //----pixfmt_rgb555_pre
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
typedef std::map<std::string, const agg::int8u*> TAgg_Font_Table;
|
||||
static TAgg_Font_Table font_table;
|
||||
|
||||
const agg::int8u* AggDrawTarget::lookupFont(const std::string& name)
|
||||
{
|
||||
TAgg_Font_Table::iterator it(font_table.find(name));
|
||||
if(it == font_table.end()) return NULL;
|
||||
else return it->second;
|
||||
}
|
||||
|
||||
static void Agg_init_fonts()
|
||||
{
|
||||
struct font_type
|
||||
{
|
||||
const agg::int8u* font;
|
||||
const char* name;
|
||||
}
|
||||
fonts[] =
|
||||
{
|
||||
{ agg::gse4x6, "gse4x6" },
|
||||
{ agg::gse4x8, "gse4x8" },
|
||||
{ agg::gse5x7, "gse5x7" },
|
||||
{ agg::gse5x9, "gse5x9" },
|
||||
{ agg::gse6x9, "gse6x9" },
|
||||
{ agg::gse6x12, "gse6x12" },
|
||||
{ agg::gse7x11, "gse7x11" },
|
||||
{ agg::gse7x11_bold, "gse7x11_bold" },
|
||||
{ agg::gse7x15, "gse7x15" },
|
||||
{ agg::gse7x15_bold, "gse7x15_bold" },
|
||||
{ agg::gse8x16, "gse8x16" },
|
||||
{ agg::gse8x16_bold, "gse8x16_bold" },
|
||||
{ agg::mcs11_prop, "mcs11_prop" },
|
||||
{ agg::mcs11_prop_condensed, "mcs11_prop_condensed" },
|
||||
{ agg::mcs12_prop, "mcs12_prop" },
|
||||
{ agg::mcs13_prop, "mcs13_prop" },
|
||||
{ agg::mcs5x10_mono, "mcs5x10_mono" },
|
||||
{ agg::mcs5x11_mono, "mcs5x11_mono" },
|
||||
{ agg::mcs6x10_mono, "mcs6x10_mono" },
|
||||
{ agg::mcs6x11_mono, "mcs6x11_mono" },
|
||||
{ agg::mcs7x12_mono_high, "mcs7x12_mono_high" },
|
||||
{ agg::mcs7x12_mono_low, "mcs7x12_mono_low" },
|
||||
{ agg::verdana12, "verdana12" },
|
||||
{ agg::verdana12_bold, "verdana12_bold" },
|
||||
{ agg::verdana13, "verdana13" },
|
||||
{ agg::verdana13_bold, "verdana13_bold" },
|
||||
{ agg::verdana14, "verdana14" },
|
||||
{ agg::verdana14_bold, "verdana14_bold" },
|
||||
{ agg::verdana16, "verdana16" },
|
||||
{ agg::verdana16_bold, "verdana16_bold" },
|
||||
{ agg::verdana17, "verdana17" },
|
||||
{ agg::verdana17_bold, "verdana17_bold" },
|
||||
{ agg::verdana18, "verdana18" },
|
||||
{ agg::verdana18_bold, "verdana18_bold" },
|
||||
};
|
||||
|
||||
for(int i=0;i<ARRAY_SIZE(fonts);i++)
|
||||
font_table[fonts[i].name] = fonts[i].font;
|
||||
}
|
||||
|
||||
AggDraw_Desmume aggDraw;
|
||||
|
||||
|
||||
typedef AggDrawTargetImplementation<PixFormatSetDeclaration<agg::my_pixfmt_rgb555,agg::my_pixfmt_rgb555_pre> > T_AGG_RGB555;
|
||||
typedef AggDrawTargetImplementation<PixFormatSetDeclaration<agg::pixfmt_bgra32,agg::pixfmt_bgra32_pre> > T_AGG_RGBA;
|
||||
|
||||
T_AGG_RGB555 agg_targetScreen(GPU_screen, 256, 384, 512);
|
||||
|
||||
static u32 luaBuffer[256*192*2];
|
||||
T_AGG_RGBA agg_targetLua((u8*)luaBuffer, 256, 384, 1024);
|
||||
|
||||
static u32 hudBuffer[256*192*2];
|
||||
T_AGG_RGBA agg_targetHud((u8*)hudBuffer, 256, 384, 1024);
|
||||
|
||||
static AggDrawTarget* targets[] = {
|
||||
&agg_targetScreen,
|
||||
&agg_targetScreen, //THATS RIGHT! for now, hud maps to screen
|
||||
&agg_targetLua,
|
||||
};
|
||||
|
||||
void Agg_init()
|
||||
{
|
||||
Agg_init_fonts();
|
||||
aggDraw.target = targets[0];
|
||||
aggDraw.screen = targets[0];
|
||||
aggDraw.hud = targets[1];
|
||||
aggDraw.lua = targets[2];
|
||||
|
||||
aggDraw.hud->setFont("verdana18_bold");
|
||||
}
|
||||
|
||||
void AggDraw_Desmume::setTarget(AggTarget newTarget)
|
||||
{
|
||||
target = targets[newTarget];
|
||||
}
|
||||
|
||||
//this code would do compositing.. and maybe it will.. one day. but not for now.
|
||||
//void AggDraw_Desmume::composite(void* dest)
|
||||
//{
|
||||
// T_AGG_RGB555 target((u8*)dest, 256, 384, 512);
|
||||
//
|
||||
// ctr = 0;
|
||||
//
|
||||
// //if lua is nonempty, blend it
|
||||
// if(!agg_targetLua.empty)
|
||||
// {
|
||||
// T_AGG_RGBA::MyImage luaImage(agg_targetLua.buf());
|
||||
// target.transformImage(luaImage, 0,40,256-1,384-1);
|
||||
// }
|
||||
//
|
||||
// //if hud is nonempty, blend it
|
||||
// if(!agg_targetHud.empty)
|
||||
// {
|
||||
// T_AGG_RGBA::MyImage hudImage(agg_targetHud.buf());
|
||||
// target.transformImage(hudImage, 0,0,256-1,384-1);
|
||||
// }
|
||||
//}
|
||||
|
||||
////temporary, just for testing the lib
|
||||
//void AGGDraw() {
|
||||
////
|
||||
// aggDraw.setTarget(AggTarget_Screen);
|
||||
//
|
||||
//// aggDraw.target->clear();
|
||||
////
|
||||
//// aggDraw.target->clipBox(0,0,255,383);
|
||||
////
|
||||
// aggDraw.target->lineColor(0, 0, 255, 128);
|
||||
// aggDraw.target->fillColor(0, 0, 255, 128);
|
||||
//// //aggDraw.target->noFill();
|
||||
// aggDraw.target->lineWidth(1.0);
|
||||
// aggDraw.target->roundedRect(10,30,256-10,192-10,4);
|
||||
////
|
||||
//// aggDraw.target->setFont("verdana18_bold");
|
||||
//// aggDraw.target->renderText(60,60, "testing testing testing");
|
||||
////
|
||||
//// // Gradients (Aqua Buttons)
|
||||
//// //=======================================
|
||||
////// m_graphics.font("Verdana", 20.0, false, false, TAGG2D::VectorFontCache);
|
||||
//// double xb1 = 10;
|
||||
//// double yb1 = 80;
|
||||
//// double xb2 = xb1 + 150;
|
||||
//// double yb2 = yb1 + 36;
|
||||
////
|
||||
//// aggDraw.target->fillColor(0,50,180,180);
|
||||
//// aggDraw.target->lineColor(0,0,80, 255);
|
||||
//// aggDraw.target->lineWidth(1.0);
|
||||
//// aggDraw.target->roundedRect(xb1, yb1, xb2, yb2, 12, 18);
|
||||
////
|
||||
//// aggDraw.target->lineColor(0,0,0,0);
|
||||
//// aggDraw.target->fillLinearGradient(xb1, yb1, xb1, yb1+30,
|
||||
//// agg::rgba8(100,200,255,255),
|
||||
//// agg::rgba8(255,255,255,0));
|
||||
//// aggDraw.target->roundedRect(xb1+3, yb1+2.5, xb2-3, yb1+30, 9, 18, 1, 1);
|
||||
////
|
||||
//// aggDraw.target->fillColor(0,0,50, 200);
|
||||
//// aggDraw.target->noLine();
|
||||
/////* m_graphics.textAlignment(TAGG2D::AlignCenter, TAGG2D::AlignCenter);
|
||||
//// m_graphics.text((xb1 + xb2) / 2.0, (yb1 + yb2) / 2.0, "Aqua Button", true, 0.0, 0.0);
|
||||
////*/
|
||||
//// aggDraw.target->fillLinearGradient(xb1, yb2-20, xb1, yb2-3,
|
||||
//// agg::rgba8(0, 0, 255,0),
|
||||
//// agg::rgba8(100,255,255,255));
|
||||
//// aggDraw.target->roundedRect(xb1+3, yb2-20, xb2-3, yb2-2, 1, 1, 9, 18);
|
||||
////
|
||||
//// // Basic Shapes -- Ellipse
|
||||
//// //===========================================
|
||||
//// aggDraw.target->lineWidth(3.5);
|
||||
//// aggDraw.target->lineColor(20, 80, 80);
|
||||
//// aggDraw.target->fillColor(200, 255, 80, 200);
|
||||
//// aggDraw.target->ellipse(150, 200, 50, 90);
|
||||
////
|
||||
//// // Paths
|
||||
//// //===========================================
|
||||
//// aggDraw.target->resetPath();
|
||||
//// aggDraw.target->fillColor(255, 0, 0, 100);
|
||||
//// aggDraw.target->lineColor(0, 0, 255, 100);
|
||||
//// aggDraw.target->lineWidth(2);
|
||||
//// aggDraw.target->moveTo(300/2, 200/2);
|
||||
//// aggDraw.target->horLineRel(-150/2);
|
||||
//// aggDraw.target->arcRel(150/2, 150/2, 0, 1, 0, 150/2, -150/2);
|
||||
//// aggDraw.target->closePolygon();
|
||||
//// aggDraw.target->drawPath();
|
||||
////
|
||||
//// aggDraw.target->resetPath();
|
||||
//// aggDraw.target->fillColor(255, 255, 0, 100);
|
||||
//// aggDraw.target->lineColor(0, 0, 255, 100);
|
||||
//// aggDraw.target->lineWidth(2);
|
||||
//// aggDraw.target->moveTo(275/2, 175/2);
|
||||
//// aggDraw.target->verLineRel(-150/2);
|
||||
//// aggDraw.target->arcRel(150/2, 150/2, 0, 0, 0, -150/2, 150/2);
|
||||
//// aggDraw.target->closePolygon();
|
||||
//// aggDraw.target->drawPath();
|
||||
////
|
||||
//// aggDraw.target->resetPath();
|
||||
//// aggDraw.target->noFill();
|
||||
//// aggDraw.target->lineColor(127, 0, 0);
|
||||
//// aggDraw.target->lineWidth(5);
|
||||
//// aggDraw.target->moveTo(600/2, 350/2);
|
||||
//// aggDraw.target->lineRel(50/2, -25/2);
|
||||
//// aggDraw.target->arcRel(25/2, 25/2, aggDraw.target->deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
//// aggDraw.target->lineRel(50/2, -25/2);
|
||||
//// aggDraw.target->arcRel(25/2, 50/2, aggDraw.target->deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
//// aggDraw.target->lineRel(50/2, -25/2);
|
||||
//// aggDraw.target->arcRel(25/2, 75/2, aggDraw.target->deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
//// aggDraw.target->lineRel(50, -25);
|
||||
//// aggDraw.target->arcRel(25/2, 100/2, aggDraw.target->deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
//// aggDraw.target->lineRel(50/2, -25/2);
|
||||
//// aggDraw.target->drawPath();
|
||||
//}
|
||||
////
|
||||
|
||||
|
||||
//
|
||||
////========================
|
||||
////testing stufff
|
||||
//
|
||||
//int width = 256;
|
||||
//int height = 384;
|
||||
//
|
||||
//Agg2D m_graphics;
|
||||
//
|
||||
//void AGGDraw(unsigned char * buffer)
|
||||
// {
|
||||
// m_graphics.attach(buffer,
|
||||
// 256,
|
||||
// 384,
|
||||
// 512);
|
||||
//
|
||||
// m_graphics.clearAll(255, 255, 255);
|
||||
// //m_graphics.clearAll(0, 0, 0);
|
||||
//
|
||||
// //m_graphics.blendMode(TAGG2D::BlendSub);
|
||||
// //m_graphics.blendMode(TAGG2D::BlendAdd);
|
||||
//
|
||||
// m_graphics.antiAliasGamma(1.4);
|
||||
//
|
||||
// // Set flipText(true) if you have the Y axis upside down.
|
||||
// //m_graphics.flipText(true);
|
||||
//
|
||||
//
|
||||
// // ClipBox.
|
||||
// //m_graphics.clipBox(50, 50, rbuf_window().width() - 50, rbuf_window().height() - 50);
|
||||
//
|
||||
// // Transfornations - Rotate around (300,300) to 5 degree
|
||||
// //m_graphics.translate(-300, -300);
|
||||
// //m_graphics.rotate(TAGG2D::deg2Rad(5.0));
|
||||
// //m_graphics.translate(300, 300);
|
||||
//
|
||||
// // Viewport - set 0,0,600,600 to the actual window size
|
||||
// // preserving aspect ratio and placing the viewport in the center.
|
||||
// // To ignore aspect ratio use TAGG2D::Anisotropic
|
||||
// // Note that the viewport just adds transformations to the current
|
||||
// // affine matrix. So that, set the viewport *after* all transformations!
|
||||
// m_graphics.viewport(0, 0, 600, 600,
|
||||
// 0, 0, width, height,
|
||||
// //TAGG2D::Anisotropic);
|
||||
// TAGG2D::XMidYMid);
|
||||
//
|
||||
//
|
||||
// // Rounded Rect
|
||||
// m_graphics.lineColor(0, 0, 0);
|
||||
// m_graphics.noFill();
|
||||
// m_graphics.roundedRect(0.5, 0.5, 600-0.5, 600-0.5, 20.0);
|
||||
///*
|
||||
//
|
||||
// // Reglar Text
|
||||
// m_graphics.font("Times New Roman", 14.0, false, false);
|
||||
// m_graphics.fillColor(0, 0, 0);
|
||||
// m_graphics.noLine();
|
||||
// m_graphics.text(100, 20, "Regular Raster Text -- Fast, but can't be rotated");
|
||||
//
|
||||
// // Outlined Text
|
||||
// m_graphics.font("Times New Roman", 50.0, false, false, TAGG2D::VectorFontCache);
|
||||
// m_graphics.lineColor(50, 0, 0);
|
||||
// m_graphics.fillColor(180, 200, 100);
|
||||
// m_graphics.lineWidth(1.0);
|
||||
// m_graphics.text(100.5, 50.5, "Outlined Text");
|
||||
//
|
||||
// // Text Alignment
|
||||
// m_graphics.line(250.5-150, 150.5, 250.5+150, 150.5);
|
||||
// m_graphics.line(250.5, 150.5-20, 250.5, 150.5+20);
|
||||
// m_graphics.line(250.5-150, 200.5, 250.5+150, 200.5);
|
||||
// m_graphics.line(250.5, 200.5-20, 250.5, 200.5+20);
|
||||
// m_graphics.line(250.5-150, 250.5, 250.5+150, 250.5);
|
||||
// m_graphics.line(250.5, 250.5-20, 250.5, 250.5+20);
|
||||
// m_graphics.line(250.5-150, 300.5, 250.5+150, 300.5);
|
||||
// m_graphics.line(250.5, 300.5-20, 250.5, 300.5+20);
|
||||
// m_graphics.line(250.5-150, 350.5, 250.5+150, 350.5);
|
||||
// m_graphics.line(250.5, 350.5-20, 250.5, 350.5+20);
|
||||
// m_graphics.line(250.5-150, 400.5, 250.5+150, 400.5);
|
||||
// m_graphics.line(250.5, 400.5-20, 250.5, 400.5+20);
|
||||
// m_graphics.line(250.5-150, 450.5, 250.5+150, 450.5);
|
||||
// m_graphics.line(250.5, 450.5-20, 250.5, 450.5+20);
|
||||
// m_graphics.line(250.5-150, 500.5, 250.5+150, 500.5);
|
||||
// m_graphics.line(250.5, 500.5-20, 250.5, 500.5+20);
|
||||
// m_graphics.line(250.5-150, 550.5, 250.5+150, 550.5);
|
||||
// m_graphics.line(250.5, 550.5-20, 250.5, 550.5+20);
|
||||
//*/
|
||||
///*
|
||||
// m_graphics.fillColor(100, 50, 50);
|
||||
// m_graphics.noLine();
|
||||
// //m_graphics.textHints(false);
|
||||
// m_graphics.font("Times New Roman", 40.0, false, false, TAGG2D::VectorFontCache);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignLeft, TAGG2D::AlignBottom);
|
||||
// m_graphics.text(250.0, 150.0, "Left-Bottom", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignCenter, TAGG2D::AlignBottom);
|
||||
// m_graphics.text(250.0, 200.0, "Center-Bottom", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignRight, TAGG2D::AlignBottom);
|
||||
// m_graphics.text(250.0, 250.0, "Right-Bottom", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignLeft, TAGG2D::AlignCenter);
|
||||
// m_graphics.text(250.0, 300.0, "Left-Center", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignCenter, TAGG2D::AlignCenter);
|
||||
// m_graphics.text(250.0, 350.0, "Center-Center", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignRight, TAGG2D::AlignCenter);
|
||||
// m_graphics.text(250.0, 400.0, "Right-Center", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignLeft, TAGG2D::AlignTop);
|
||||
// m_graphics.text(250.0, 450.0, "Left-Top", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignCenter, TAGG2D::AlignTop);
|
||||
// m_graphics.text(250.0, 500.0, "Center-Top", true, 0, 0);
|
||||
//
|
||||
// m_graphics.textAlignment(TAGG2D::AlignRight, TAGG2D::AlignTop);
|
||||
// m_graphics.text(250.0, 550.0, "Right-Top", true, 0, 0);
|
||||
//
|
||||
//*/
|
||||
// // Gradients (Aqua Buttons)
|
||||
// //=======================================
|
||||
// m_graphics.font("Verdana", 20.0, false, false, TAGG2D::VectorFontCache);
|
||||
// double xb1 = 400;
|
||||
// double yb1 = 80;
|
||||
// double xb2 = xb1 + 150;
|
||||
// double yb2 = yb1 + 36;
|
||||
//
|
||||
// m_graphics.fillColor(TAGG2D::Color(0,50,180,180));
|
||||
// m_graphics.lineColor(TAGG2D::Color(0,0,80, 255));
|
||||
// m_graphics.lineWidth(1.0);
|
||||
// m_graphics.roundedRect(xb1, yb1, xb2, yb2, 12, 18);
|
||||
//
|
||||
// m_graphics.lineColor(TAGG2D::Color(0,0,0,0));
|
||||
// m_graphics.fillLinearGradient(xb1, yb1, xb1, yb1+30,
|
||||
// TAGG2D::Color(100,200,255,255),
|
||||
// TAGG2D::Color(255,255,255,0));
|
||||
// m_graphics.roundedRect(xb1+3, yb1+2.5, xb2-3, yb1+30, 9, 18, 1, 1);
|
||||
//
|
||||
// m_graphics.fillColor(TAGG2D::Color(0,0,50, 200));
|
||||
// m_graphics.noLine();
|
||||
///* m_graphics.textAlignment(TAGG2D::AlignCenter, TAGG2D::AlignCenter);
|
||||
// m_graphics.text((xb1 + xb2) / 2.0, (yb1 + yb2) / 2.0, "Aqua Button", true, 0.0, 0.0);
|
||||
//*/
|
||||
// m_graphics.fillLinearGradient(xb1, yb2-20, xb1, yb2-3,
|
||||
// TAGG2D::Color(0, 0, 255,0),
|
||||
// TAGG2D::Color(100,255,255,255));
|
||||
// m_graphics.roundedRect(xb1+3, yb2-20, xb2-3, yb2-2, 1, 1, 9, 18);
|
||||
//
|
||||
//
|
||||
// // Aqua Button Pressed
|
||||
// xb1 = 400;
|
||||
// yb1 = 30;
|
||||
// xb2 = xb1 + 150;
|
||||
// yb2 = yb1 + 36;
|
||||
//
|
||||
// m_graphics.fillColor(TAGG2D::Color(0,50,180,180));
|
||||
// m_graphics.lineColor(TAGG2D::Color(0,0,0, 255));
|
||||
// m_graphics.lineWidth(2.0);
|
||||
// m_graphics.roundedRect(xb1, yb1, xb2, yb2, 12, 18);
|
||||
//
|
||||
// m_graphics.lineColor(TAGG2D::Color(0,0,0,0));
|
||||
// m_graphics.fillLinearGradient(xb1, yb1+2, xb1, yb1+25,
|
||||
// TAGG2D::Color(60, 160,255,255),
|
||||
// TAGG2D::Color(100,255,255,0));
|
||||
// m_graphics.roundedRect(xb1+3, yb1+2.5, xb2-3, yb1+30, 9, 18, 1, 1);
|
||||
//
|
||||
// m_graphics.fillColor(TAGG2D::Color(0,0,50, 255));
|
||||
// m_graphics.noLine();
|
||||
///* m_graphics.textAlignment(TAGG2D::AlignCenter, TAGG2D::AlignCenter);
|
||||
// m_graphics.text((xb1 + xb2) / 2.0, (yb1 + yb2) / 2.0, "Aqua Pressed", 0.0, 0.0);
|
||||
//*/
|
||||
// m_graphics.fillLinearGradient(xb1, yb2-25, xb1, yb2-5,
|
||||
// TAGG2D::Color(0, 180,255,0),
|
||||
// TAGG2D::Color(0, 200,255,255));
|
||||
// m_graphics.roundedRect(xb1+3, yb2-25, xb2-3, yb2-2, 1, 1, 9, 18);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Basic Shapes -- Ellipse
|
||||
// //===========================================
|
||||
// m_graphics.lineWidth(3.5);
|
||||
// m_graphics.lineColor(20, 80, 80);
|
||||
// m_graphics.fillColor(200, 255, 80, 200);
|
||||
// m_graphics.ellipse(450, 200, 50, 90);
|
||||
//
|
||||
//
|
||||
// // Paths
|
||||
// //===========================================
|
||||
// m_graphics.resetPath();
|
||||
// m_graphics.fillColor(255, 0, 0, 100);
|
||||
// m_graphics.lineColor(0, 0, 255, 100);
|
||||
// m_graphics.lineWidth(2);
|
||||
// m_graphics.moveTo(300/2, 200/2);
|
||||
// m_graphics.horLineRel(-150/2);
|
||||
// m_graphics.arcRel(150/2, 150/2, 0, 1, 0, 150/2, -150/2);
|
||||
// m_graphics.closePolygon();
|
||||
// m_graphics.drawPath();
|
||||
//
|
||||
// m_graphics.resetPath();
|
||||
// m_graphics.fillColor(255, 255, 0, 100);
|
||||
// m_graphics.lineColor(0, 0, 255, 100);
|
||||
// m_graphics.lineWidth(2);
|
||||
// m_graphics.moveTo(275/2, 175/2);
|
||||
// m_graphics.verLineRel(-150/2);
|
||||
// m_graphics.arcRel(150/2, 150/2, 0, 0, 0, -150/2, 150/2);
|
||||
// m_graphics.closePolygon();
|
||||
// m_graphics.drawPath();
|
||||
//
|
||||
//
|
||||
// m_graphics.resetPath();
|
||||
// m_graphics.noFill();
|
||||
// m_graphics.lineColor(127, 0, 0);
|
||||
// m_graphics.lineWidth(5);
|
||||
// m_graphics.moveTo(600/2, 350/2);
|
||||
// m_graphics.lineRel(50/2, -25/2);
|
||||
// m_graphics.arcRel(25/2, 25/2, TAGG2D::deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
// m_graphics.lineRel(50/2, -25/2);
|
||||
// m_graphics.arcRel(25/2, 50/2, TAGG2D::deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
// m_graphics.lineRel(50/2, -25/2);
|
||||
// m_graphics.arcRel(25/2, 75/2, TAGG2D::deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
// m_graphics.lineRel(50, -25);
|
||||
// m_graphics.arcRel(25/2, 100/2, TAGG2D::deg2Rad(-30), 0, 1, 50/2, -25/2);
|
||||
// m_graphics.lineRel(50/2, -25/2);
|
||||
// m_graphics.drawPath();
|
||||
//
|
||||
//
|
||||
// // Master Alpha. From now on everything will be translucent
|
||||
// //===========================================
|
||||
// m_graphics.masterAlpha(0.85);
|
||||
//
|
||||
//
|
||||
// // Image Transformations
|
||||
// //===========================================
|
||||
///* TAGG2D::Image img(rbuf_img(0).buf(),
|
||||
// rbuf_img(0).width(),
|
||||
// rbuf_img(0).height(),
|
||||
// rbuf_img(0).stride());
|
||||
// m_graphics.imageFilter(TAGG2D::Bilinear);
|
||||
//
|
||||
// //m_graphics.imageResample(TAGG2D::NoResample);
|
||||
// //m_graphics.imageResample(TAGG2D::ResampleAlways);
|
||||
// m_graphics.imageResample(TAGG2D::ResampleOnZoomOut);
|
||||
//
|
||||
// // Set the initial image blending operation as BlendDst, that actually
|
||||
// // does nothing.
|
||||
// //-----------------
|
||||
// m_graphics.imageBlendMode(TAGG2D::BlendDst);
|
||||
//
|
||||
//
|
||||
// // Transform the whole image to the destination rectangle
|
||||
// //-----------------
|
||||
// //m_graphics.transformImage(img, 450, 200, 595, 350);
|
||||
//
|
||||
// // Transform the rectangular part of the image to the destination rectangle
|
||||
// //-----------------
|
||||
// //m_graphics.transformImage(img, 60, 60, img.width()-60, img.height()-60,
|
||||
// // 450, 200, 595, 350);
|
||||
//
|
||||
// // Transform the whole image to the destination parallelogram
|
||||
// //-----------------
|
||||
// //double parl[6] = { 450, 200, 595, 220, 575, 350 };
|
||||
// //m_graphics.transformImage(img, parl);
|
||||
//
|
||||
// // Transform the rectangular part of the image to the destination parallelogram
|
||||
// //-----------------
|
||||
// //double parl[6] = { 450, 200, 595, 220, 575, 350 };
|
||||
// //m_graphics.transformImage(img, 60, 60, img.width()-60, img.height()-60, parl);
|
||||
//
|
||||
// // Transform image to the destination path. The scale is determined by a rectangle
|
||||
// //-----------------
|
||||
// //m_graphics.resetPath();
|
||||
// //m_graphics.moveTo(450, 200);
|
||||
// //m_graphics.cubicCurveTo(595, 220, 575, 350, 595, 350);
|
||||
// //m_graphics.lineTo(470, 340);
|
||||
// //m_graphics.transformImagePath(img, 450, 200, 595, 350);
|
||||
//
|
||||
//
|
||||
// // Transform image to the destination path.
|
||||
// // The scale is determined by a rectangle
|
||||
// //-----------------
|
||||
// m_graphics.resetPath();
|
||||
// m_graphics.moveTo(450, 200);
|
||||
// m_graphics.cubicCurveTo(595, 220, 575, 350, 595, 350);
|
||||
// m_graphics.lineTo(470, 340);
|
||||
// m_graphics.transformImagePath(img, 60, 60, img.width()-60, img.height()-60,
|
||||
// 450, 200, 595, 350);
|
||||
//
|
||||
// // Transform image to the destination path.
|
||||
// // The transformation is determined by a parallelogram
|
||||
// //m_graphics.resetPath();
|
||||
// //m_graphics.moveTo(450, 200);
|
||||
// //m_graphics.cubicCurveTo(595, 220, 575, 350, 595, 350);
|
||||
// //m_graphics.lineTo(470, 340);
|
||||
// //double parl[6] = { 450, 200, 595, 220, 575, 350 };
|
||||
// //m_graphics.transformImagePath(img, parl);
|
||||
//
|
||||
// // Transform the rectangular part of the image to the destination path.
|
||||
// // The transformation is determined by a parallelogram
|
||||
// //m_graphics.resetPath();
|
||||
// //m_graphics.moveTo(450, 200);
|
||||
// //m_graphics.cubicCurveTo(595, 220, 575, 350, 595, 350);
|
||||
// //m_graphics.lineTo(470, 340);
|
||||
// //double parl[6] = { 450, 200, 595, 220, 575, 350 };
|
||||
// //m_graphics.transformImagePath(img, 60, 60, img.width()-60, img.height()-60, parl);
|
||||
//*/
|
||||
//
|
||||
// // Add/Sub/Contrast Blending Modes
|
||||
// m_graphics.noLine();
|
||||
// m_graphics.fillColor(70, 70, 0);
|
||||
// m_graphics.blendMode(TAGG2D::BlendAdd);
|
||||
// m_graphics.ellipse(500, 280, 20, 40);
|
||||
//
|
||||
// m_graphics.fillColor(255, 255, 255);
|
||||
// m_graphics.blendMode(TAGG2D::BlendContrast);
|
||||
// m_graphics.ellipse(500+40, 280, 20, 40);
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Radial gradient.
|
||||
// m_graphics.blendMode(TAGG2D::BlendAlpha);
|
||||
// m_graphics.fillRadialGradient(400, 500, 40,
|
||||
// TAGG2D::Color(255, 255, 0, 0),
|
||||
// TAGG2D::Color(0, 0, 127),
|
||||
// TAGG2D::Color(0, 255, 0, 0));
|
||||
// m_graphics.ellipse(400, 500, 40, 40);
|
||||
//
|
||||
// }
|
||||
//
|
|
@ -1,468 +0,0 @@
|
|||
//The MIT License
|
||||
//
|
||||
//Copyright (c) 2009 DeSmuME team
|
||||
//
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//The above copyright notice and this permission notice shall be included in
|
||||
//all copies or substantial portions of the Software.
|
||||
//
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
//THE SOFTWARE.
|
||||
|
||||
|
||||
//This file contains code designed to be used by hud and lua systems in any emulator
|
||||
|
||||
|
||||
#ifndef _AGGDRAW_H_
|
||||
#define _AGGDRAW_H_
|
||||
|
||||
#include "agg_color_rgba.h"
|
||||
#include "agg_rendering_buffer.h"
|
||||
|
||||
#include "agg_renderer_base.h"
|
||||
#include "agg_renderer_primitives.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
#include "agg_bounding_rect.h"
|
||||
|
||||
#include "agg_renderer_mclip.h"
|
||||
#include "agg_renderer_outline_aa.h"
|
||||
#include "agg_renderer_markers.h"
|
||||
|
||||
#include "agg2d.h"
|
||||
|
||||
typedef agg::rgba8 AggColor;
|
||||
|
||||
class AggDrawTarget
|
||||
{
|
||||
public:
|
||||
AggDrawTarget()
|
||||
: empty(true)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void dirty() { empty = false; }
|
||||
void undirty() { empty = true; }
|
||||
|
||||
public:
|
||||
|
||||
bool empty;
|
||||
|
||||
virtual void clear() = 0;
|
||||
|
||||
// Setup
|
||||
virtual void attach(unsigned char* buf, unsigned width, unsigned height, int stride) = 0;
|
||||
// virtual void attach(Agg2DBase::Image& img) {attach(img);};
|
||||
|
||||
virtual void clipBox(double x1, double y1, double x2, double y2) = 0;
|
||||
virtual Agg2DBase::RectD clipBox() const = 0;
|
||||
|
||||
virtual void clearAll(AggColor c) = 0;
|
||||
virtual void clearAll(unsigned r, unsigned g, unsigned b, unsigned a = 255) = 0;
|
||||
|
||||
virtual void clearClipBox(AggColor c) = 0;
|
||||
virtual void clearClipBox(unsigned r, unsigned g, unsigned b, unsigned a = 255) = 0;
|
||||
|
||||
// virtual unsigned width() const { return Agg2DBase::m_rbuf.width(); }
|
||||
// virtual unsigned height() const { return Agg2DBase::m_rbuf.height(); }
|
||||
|
||||
// Conversions
|
||||
virtual void worldToScreen(double& x, double& y) const = 0;
|
||||
virtual void screenToWorld(double& x, double& y) const = 0;
|
||||
virtual double worldToScreen(double scalar) const = 0;
|
||||
virtual double screenToWorld(double scalar) const = 0;
|
||||
virtual void alignPoint(double& x, double& y) const = 0;
|
||||
virtual bool inBox(double worldX, double worldY) const = 0;
|
||||
|
||||
// General Attributes
|
||||
virtual void blendMode(Agg2DBase::BlendMode m) = 0;
|
||||
virtual Agg2DBase::BlendMode blendMode() = 0;
|
||||
|
||||
virtual void imageBlendMode(Agg2DBase::BlendMode m) = 0;
|
||||
virtual Agg2DBase::BlendMode imageBlendMode() = 0;
|
||||
|
||||
virtual void imageBlendColor(AggColor c) = 0;
|
||||
virtual void imageBlendColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) = 0;
|
||||
virtual AggColor imageBlendColor() = 0;
|
||||
|
||||
virtual void masterAlpha(double a) = 0;
|
||||
virtual double masterAlpha() = 0;
|
||||
|
||||
virtual void antiAliasGamma(double g) = 0;
|
||||
virtual double antiAliasGamma() = 0;
|
||||
|
||||
// virtual void font(const agg::int8u* font) { m_font = font; }
|
||||
// const agg::int8u* font() { return m_font; }
|
||||
|
||||
virtual void fillColor(AggColor c) = 0;
|
||||
virtual void fillColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) = 0;
|
||||
virtual void noFill() = 0;
|
||||
|
||||
virtual void lineColor(AggColor c) = 0;
|
||||
virtual void lineColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) = 0;
|
||||
virtual void noLine() = 0;
|
||||
|
||||
virtual AggColor fillColor() = 0;
|
||||
virtual AggColor lineColor() = 0;
|
||||
|
||||
virtual void fillLinearGradient(double x1, double y1, double x2, double y2, AggColor c1, AggColor c2, double profile=1.0) = 0;
|
||||
virtual void lineLinearGradient(double x1, double y1, double x2, double y2, AggColor c1, AggColor c2, double profile=1.0) = 0;
|
||||
|
||||
virtual void fillRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, double profile=1.0) = 0;
|
||||
virtual void lineRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, double profile=1.0) = 0;
|
||||
|
||||
virtual void fillRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, AggColor c3) = 0;
|
||||
virtual void lineRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, AggColor c3) = 0;
|
||||
|
||||
virtual void fillRadialGradient(double x, double y, double r) = 0;
|
||||
virtual void lineRadialGradient(double x, double y, double r) = 0;
|
||||
|
||||
virtual void lineWidth(double w) = 0;
|
||||
virtual double lineWidth() = 0;
|
||||
|
||||
virtual void lineCap(Agg2DBase::LineCap cap) = 0;
|
||||
virtual Agg2DBase::LineCap lineCap() = 0;
|
||||
|
||||
virtual void lineJoin(Agg2DBase::LineJoin join) = 0;
|
||||
virtual Agg2DBase::LineJoin lineJoin() = 0;
|
||||
|
||||
virtual void fillEvenOdd(bool evenOddFlag) = 0;
|
||||
virtual bool fillEvenOdd() = 0;
|
||||
|
||||
// Transformations
|
||||
virtual Agg2DBase::Transformations transformations() = 0;
|
||||
virtual void transformations(const Agg2DBase::Transformations& tr) = 0;
|
||||
|
||||
virtual const Agg2DBase::Affine& affine() = 0;
|
||||
// virtual void affine(const Agg2DBase::Affine&) = 0;
|
||||
|
||||
virtual void resetTransformations() = 0;
|
||||
virtual void matrix(const Agg2DBase::Affine& tr) = 0;
|
||||
virtual void matrix(const Agg2DBase::Transformations& tr) = 0;
|
||||
virtual void rotate(double angle) = 0;
|
||||
virtual void rotate(double angle, double cx, double cy) = 0;
|
||||
virtual void scale(double s) = 0;
|
||||
virtual void scale(double sx, double sy) = 0;
|
||||
virtual void skew(double sx, double sy) = 0;
|
||||
virtual void translate(double x, double y) = 0;
|
||||
virtual void parallelogram(double x1, double y1, double x2, double y2, const double* para) = 0;
|
||||
virtual void viewport(double worldX1, double worldY1, double worldX2, double worldY2, double screenX1, double screenY1, double screenX2, double screenY2, Agg2DBase::ViewportOption opt=Agg2DBase::XMidYMid, Agg2DBase::WindowFitLogic fl = Agg2DBase::WindowFitLogic_meet) = 0;
|
||||
|
||||
// Basic Shapes
|
||||
virtual void line(double x1, double y1, double x2, double y2) = 0;
|
||||
virtual void triangle(double x1, double y1, double x2, double y2, double x3, double y3) = 0;
|
||||
virtual void rectangle(double x1, double y1, double x2, double y2) = 0;
|
||||
virtual void roundedRect(double x1, double y1, double x2, double y2, double r) = 0;
|
||||
virtual void roundedRect(double x1, double y1, double x2, double y2, double rx, double ry) = 0;
|
||||
virtual void roundedRect(double x1, double y1, double x2, double y2, double rxBottom, double ryBottom, double rxTop, double ryTop) = 0;
|
||||
virtual void ellipse(double cx, double cy, double rx, double ry) = 0;
|
||||
virtual void arc(double cx, double cy, double rx, double ry, double start, double sweep) = 0;
|
||||
virtual void star(double cx, double cy, double r1, double r2, double startAngle, int numRays) = 0;
|
||||
virtual void curve(double x1, double y1, double x2, double y2, double x3, double y3) = 0;
|
||||
virtual void curve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) = 0;
|
||||
virtual void polygon(double* xy, int numPoints) = 0;
|
||||
virtual void polyline(double* xy, int numPoints) = 0;
|
||||
|
||||
// Path commands
|
||||
virtual void resetPath() = 0;
|
||||
|
||||
virtual void moveTo(double x, double y)= 0;
|
||||
virtual void moveRel(double dx, double dy) = 0;
|
||||
|
||||
virtual void lineTo(double x, double y) = 0;
|
||||
virtual void lineRel(double dx, double dy) = 0;
|
||||
|
||||
virtual void horLineTo(double x) = 0;
|
||||
virtual void horLineRel(double dx) = 0;
|
||||
|
||||
virtual void verLineTo(double y) = 0;
|
||||
virtual void verLineRel(double dy) = 0;
|
||||
|
||||
virtual void arcTo(double rx, double ry,double angle, bool largeArcFlag,bool sweepFlag,double x, double y) = 0;
|
||||
|
||||
virtual void arcRel(double rx, double ry,double angle, bool largeArcFlag,bool sweepFlag,double dx, double dy) = 0;
|
||||
|
||||
virtual void quadricCurveTo(double xCtrl, double yCtrl,double xTo, double yTo) = 0;
|
||||
virtual void quadricCurveRel(double dxCtrl, double dyCtrl,double dxTo, double dyTo) = 0;
|
||||
virtual void quadricCurveTo(double xTo, double yTo) = 0;
|
||||
virtual void quadricCurveRel(double dxTo, double dyTo) = 0;
|
||||
|
||||
virtual void cubicCurveTo(double xCtrl1, double yCtrl1,double xCtrl2, double yCtrl2,double xTo, double yTo) = 0;
|
||||
virtual void cubicCurveRel(double dxCtrl1, double dyCtrl1,double dxCtrl2, double dyCtrl2,double dxTo, double dyTo) = 0;
|
||||
virtual void cubicCurveTo(double xCtrl2, double yCtrl2,double xTo, double yTo) = 0;
|
||||
virtual void cubicCurveRel(double xCtrl2, double yCtrl2,double xTo, double yTo) = 0;
|
||||
|
||||
virtual void addEllipse(double cx, double cy, double rx, double ry, Agg2DBase::Direction dir) = 0;
|
||||
virtual void closePolygon() = 0;
|
||||
|
||||
virtual void drawPath(Agg2DBase::DrawPathFlag flag = Agg2DBase::FillAndStroke) = 0;
|
||||
// virtual void drawPathNoTransform(Agg2DBase::DrawPathFlag flag = Agg2DBase::FillAndStroke) = 0;
|
||||
|
||||
// Image Transformations
|
||||
virtual void imageFilter(Agg2DBase::ImageFilter f) = 0;
|
||||
virtual Agg2DBase::ImageFilter imageFilter() = 0;
|
||||
|
||||
virtual void imageResample(Agg2DBase::ImageResample f) = 0;
|
||||
virtual Agg2DBase::ImageResample imageResample() = 0;
|
||||
static const agg::int8u* lookupFont(const std::string& name);
|
||||
virtual void setFont(const std::string& name) = 0;
|
||||
virtual void renderText(double dstX, double dstY, const std::string& str) = 0;
|
||||
virtual void renderTextDropshadowed(double dstX, double dstY, const std::string& str)
|
||||
{
|
||||
AggColor lineColorOld = lineColor();
|
||||
lineColor(255-lineColorOld.r,255-lineColorOld.g,255-lineColorOld.b);
|
||||
renderText(dstX-1,dstY-1,str);
|
||||
renderText(dstX,dstY-1,str);
|
||||
renderText(dstX+1,dstY-1,str);
|
||||
renderText(dstX-1,dstY,str);
|
||||
renderText(dstX+1,dstY,str);
|
||||
renderText(dstX-1,dstY+1,str);
|
||||
renderText(dstX,dstY+1,str);
|
||||
renderText(dstX+1,dstY+1,str);
|
||||
lineColor(lineColorOld);
|
||||
renderText(dstX,dstY,str);
|
||||
}
|
||||
|
||||
|
||||
// Auxiliary
|
||||
virtual double pi() { return agg::pi; }
|
||||
virtual double deg2Rad(double v) { return v * agg::pi / 180.0; }
|
||||
virtual double rad2Deg(double v) { return v * 180.0 / agg::pi; }
|
||||
};
|
||||
|
||||
|
||||
template<typename PixFormatSet>
|
||||
class AggDrawTargetImplementation : public AggDrawTarget, public Agg2D<PixFormatSet>
|
||||
{
|
||||
public:
|
||||
typedef typename PixFormatSet::PixFormat pixfmt;
|
||||
typedef typename pixfmt::color_type color_type;
|
||||
|
||||
typedef Agg2D<PixFormatSet> BASE;
|
||||
AggDrawTargetImplementation(agg::int8u* buf, int width, int height, int stride)
|
||||
{
|
||||
BASE::attach(buf,width,height,stride);
|
||||
|
||||
BASE::viewport(0, 0, width-1, height-1, 0, 0, width-1, height-1, TAGG2D::Anisotropic);
|
||||
}
|
||||
|
||||
virtual void clear() {
|
||||
if(!empty)
|
||||
{
|
||||
BASE::clearAll(0,0,0,0);
|
||||
undirty();
|
||||
}
|
||||
}
|
||||
|
||||
// Setup
|
||||
virtual void attach(unsigned char* buf, unsigned width, unsigned height, int stride) {BASE::attach(buf, width, height, stride);};
|
||||
// virtual void attach(Agg2DBase::Image& img) {attach(img);};
|
||||
|
||||
virtual void clipBox(double x1, double y1, double x2, double y2) { BASE::clipBox(x1,y1,x2,y2); }
|
||||
virtual Agg2DBase::RectD clipBox() const {return BASE::clipBox();};
|
||||
|
||||
virtual void clearAll(AggColor c) {BASE::clearAll(c);};
|
||||
virtual void clearAll(unsigned r, unsigned g, unsigned b, unsigned a = 255) {BASE::clearAll(r, g, b, a);};
|
||||
|
||||
virtual void clearClipBox(AggColor c) {BASE::clearClipBox(c);};
|
||||
virtual void clearClipBox(unsigned r, unsigned g, unsigned b, unsigned a = 255) {BASE::clearClipBox(r, g, b, a);};
|
||||
|
||||
// virtual unsigned width() const { return Agg2DBase::m_rbuf.width(); }
|
||||
// virtual unsigned height() const { return Agg2DBase::m_rbuf.height(); }
|
||||
|
||||
// Conversions
|
||||
virtual void worldToScreen(double& x, double& y) const {BASE::worldToScreen(x, y);};
|
||||
virtual void screenToWorld(double& x, double& y) const {BASE::screenToWorld(x, y);};
|
||||
virtual double worldToScreen(double scalar) const {return BASE::worldToScreen(scalar);};
|
||||
virtual double screenToWorld(double scalar) const {return BASE::screenToWorld(scalar);};
|
||||
virtual void alignPoint(double& x, double& y) const {BASE::alignPoint(x, y);};
|
||||
virtual bool inBox(double worldX, double worldY) const {return BASE::inBox(worldX, worldY);};
|
||||
|
||||
// General Attributes
|
||||
virtual void blendMode(Agg2DBase::BlendMode m) {BASE::blendMode(m);};
|
||||
virtual Agg2DBase::BlendMode blendMode() {return BASE::blendMode();};
|
||||
|
||||
virtual void imageBlendMode(Agg2DBase::BlendMode m) {BASE::imageBlendMode(m);};
|
||||
virtual Agg2DBase::BlendMode imageBlendMode() {return BASE::imageBlendMode();};
|
||||
|
||||
virtual void imageBlendColor(AggColor c) {BASE::imageBlendColor(c);};
|
||||
virtual void imageBlendColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) {BASE::imageBlendColor(r, g, b, a);};
|
||||
virtual AggColor imageBlendColor() {return BASE::imageBlendColor();};
|
||||
|
||||
virtual void masterAlpha(double a) {BASE::masterAlpha(a);};
|
||||
virtual double masterAlpha() {return BASE::masterAlpha();};
|
||||
|
||||
virtual void antiAliasGamma(double g) {BASE::antiAliasGamma(g);};
|
||||
virtual double antiAliasGamma() {return BASE::antiAliasGamma();};
|
||||
|
||||
// virtual void font(const agg::int8u* font) { m_font = font; }
|
||||
// const agg::int8u* font() { return m_font; }
|
||||
|
||||
virtual void fillColor(AggColor c) {BASE::fillColor(c);};
|
||||
virtual void fillColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) {BASE::fillColor(r,g,b,a);};
|
||||
virtual void noFill() {BASE::noFill();};
|
||||
|
||||
virtual void lineColor(AggColor c) {BASE::lineColor(c);};
|
||||
virtual void lineColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) {BASE::lineColor(r,g,b,a);};
|
||||
virtual void noLine() {BASE::noLine();};
|
||||
|
||||
virtual AggColor fillColor() {return BASE::fillColor();};
|
||||
virtual AggColor lineColor() {return BASE::lineColor();};
|
||||
|
||||
virtual void fillLinearGradient(double x1, double y1, double x2, double y2, AggColor c1, AggColor c2, double profile=1.0) {BASE::fillLinearGradient(x1, y1, x2, y2, c1, c2, profile);};
|
||||
virtual void lineLinearGradient(double x1, double y1, double x2, double y2, AggColor c1, AggColor c2, double profile=1.0) {BASE::lineLinearGradient(x1, y1, x2, y2, c1, c2, profile);};
|
||||
|
||||
virtual void fillRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, double profile=1.0) {BASE::fillRadialGradient(x, y, r, c1, c2, profile);};
|
||||
virtual void lineRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, double profile=1.0) {BASE::lineRadialGradient(x, y, r, c1, c2, profile);};
|
||||
|
||||
virtual void fillRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, AggColor c3) {BASE::fillRadialGradient(x, y, r, c1, c2, c3);};
|
||||
virtual void lineRadialGradient(double x, double y, double r, AggColor c1, AggColor c2, AggColor c3) {BASE::lineRadialGradient(x, y, r, c1, c2, c3);};
|
||||
virtual void fillRadialGradient(double x, double y, double r) {BASE::fillRadialGradient(x, y, r);};
|
||||
virtual void lineRadialGradient(double x, double y, double r) {BASE::lineRadialGradient(x, y, r);};
|
||||
|
||||
virtual void lineWidth(double w) {BASE::lineWidth(w);};
|
||||
virtual double lineWidth() {return BASE::lineWidth();};
|
||||
|
||||
virtual void lineCap(Agg2DBase::LineCap cap) {BASE::lineCap(cap);};
|
||||
virtual Agg2DBase::LineCap lineCap() {return BASE::lineCap();};
|
||||
|
||||
virtual void lineJoin(Agg2DBase::LineJoin join) {BASE::lineJoin(join);};
|
||||
virtual Agg2DBase::LineJoin lineJoin() {return BASE::lineJoin();};
|
||||
|
||||
virtual void fillEvenOdd(bool evenOddFlag) {BASE::fillEvenOdd(evenOddFlag);};
|
||||
virtual bool fillEvenOdd() {return BASE::fillEvenOdd();};
|
||||
|
||||
// Transformations
|
||||
virtual Agg2DBase::Transformations transformations() {return BASE::transformations();};
|
||||
virtual void transformations(const Agg2DBase::Transformations& tr) {BASE::transformations(tr);};
|
||||
|
||||
virtual const Agg2DBase::Affine& affine() {return BASE::affine();};
|
||||
// virtual void affine(const Agg2DBase::Affine&) {BASE::affine();};
|
||||
|
||||
virtual void resetTransformations() {BASE::resetTransformations();};
|
||||
virtual void matrix(const Agg2DBase::Affine& tr) {BASE::matrix(tr);};
|
||||
virtual void matrix(const Agg2DBase::Transformations& tr) {BASE::matrix(tr);};
|
||||
virtual void rotate(double angle) {BASE::rotate(angle);};
|
||||
virtual void rotate(double angle, double cx, double cy) {BASE::rotate(angle, cx, cy);};
|
||||
virtual void scale(double s) {BASE::scale(s);};
|
||||
virtual void scale(double sx, double sy) {BASE::scale(sx, sy);};
|
||||
virtual void skew(double sx, double sy) {BASE::skew(sx, sy);};
|
||||
virtual void translate(double x, double y) {BASE::translate(x, y);};
|
||||
virtual void parallelogram(double x1, double y1, double x2, double y2, const double* para) {BASE::parallelogram(x1, y1, x2, y2, para);};
|
||||
virtual void viewport(double worldX1, double worldY1, double worldX2, double worldY2, double screenX1, double screenY1, double screenX2, double screenY2, Agg2DBase::ViewportOption opt=Agg2DBase::XMidYMid, Agg2DBase::WindowFitLogic fl = Agg2DBase::WindowFitLogic_meet) {BASE::viewport(worldX1, worldY1, worldX2, worldY2, screenX1, screenY1, screenX2, screenY2, opt, fl);};
|
||||
|
||||
// Basic Shapes
|
||||
virtual void line(double x1, double y1, double x2, double y2) {BASE::line(x1, y1, x2, y2);};
|
||||
virtual void triangle(double x1, double y1, double x2, double y2, double x3, double y3) {BASE::triangle(x1, y1, x2, y2, x3, y3);};
|
||||
virtual void rectangle(double x1, double y1, double x2, double y2) {BASE::rectangle(x1, y1, x2, y2);};
|
||||
virtual void roundedRect(double x1, double y1, double x2, double y2, double r) { dirty(); BASE::roundedRect(x1,y1,x2,y2,r); }
|
||||
virtual void roundedRect(double x1, double y1, double x2, double y2, double rx, double ry) { dirty(); BASE::roundedRect(x1,y1,x2,y2,rx,ry); }
|
||||
virtual void roundedRect(double x1, double y1, double x2, double y2,double rx_bottom, double ry_bottom,double rx_top,double ry_top) { dirty(); BASE::roundedRect(x1,y1,x2,y2,rx_bottom,ry_bottom,rx_top,ry_top); }
|
||||
virtual void ellipse(double cx, double cy, double rx, double ry) {BASE::ellipse(cx, cy, rx, ry);}
|
||||
virtual void arc(double cx, double cy, double rx, double ry, double start, double sweep) {BASE::arc(cx, cy, rx, ry, start, sweep);};
|
||||
virtual void star(double cx, double cy, double r1, double r2, double startAngle, int numRays) {BASE::star(cx, cy, r1, r2, startAngle, numRays);};
|
||||
virtual void curve(double x1, double y1, double x2, double y2, double x3, double y3) {BASE::curve(x1, y1, x2, y2, x3, y3);};
|
||||
virtual void curve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {BASE::curve(x1, y1, x2, y2, x3, y3, x4, y4);};
|
||||
virtual void polygon(double* xy, int numPoints) {BASE::polygon(xy, numPoints);};
|
||||
virtual void polyline(double* xy, int numPoints) {BASE::polyline(xy, numPoints);};
|
||||
|
||||
virtual void setFont(const std::string& name) { BASE::font(lookupFont(name)); }
|
||||
virtual void renderText(double dstX, double dstY, const std::string& str) {
|
||||
dirty();
|
||||
int height = BASE::font()[0];
|
||||
int base = BASE::font()[1];
|
||||
int offset = height-base*2;
|
||||
BASE::renderText(dstX, dstY + offset, str);
|
||||
}
|
||||
|
||||
// Path commands
|
||||
virtual void resetPath() {BASE::resetPath();};
|
||||
|
||||
virtual void moveTo(double x, double y) {BASE::moveTo(x, y);}
|
||||
virtual void moveRel(double dx, double dy) {BASE::moveRel(dx,dy);};
|
||||
|
||||
virtual void lineTo(double x, double y) {BASE::lineTo(x, y);};
|
||||
virtual void lineRel(double dx, double dy) {BASE::lineRel(dx, dy);};
|
||||
|
||||
virtual void horLineTo(double x) {BASE::horLineTo(x);};
|
||||
virtual void horLineRel(double dx) {BASE::horLineRel(dx);};
|
||||
|
||||
virtual void verLineTo(double y) {BASE::verLineTo(y);};
|
||||
virtual void verLineRel(double dy) {BASE::verLineRel(dy);};
|
||||
|
||||
virtual void arcTo(double rx, double ry, double angle, bool largeArcFlag, bool sweepFlag, double x, double y) {BASE::arcTo(rx, ry, angle, largeArcFlag, sweepFlag, x, y);};
|
||||
|
||||
virtual void arcRel(double rx, double ry, double angle, bool largeArcFlag, bool sweepFlag, double dx, double dy) {BASE::arcRel(rx, ry, angle, largeArcFlag, sweepFlag, dx, dy);};
|
||||
|
||||
virtual void quadricCurveTo(double xCtrl, double yCtrl, double xTo, double yTo) {BASE::quadricCurveTo(xCtrl, yCtrl, xTo, yTo);};
|
||||
virtual void quadricCurveRel(double dxCtrl, double dyCtrl, double dxTo, double dyTo) {BASE::quadricCurveRel(dxCtrl, dyCtrl, dxTo, dyTo);};
|
||||
virtual void quadricCurveTo(double xTo, double yTo) {BASE::quadricCurveTo(xTo, yTo);};
|
||||
virtual void quadricCurveRel(double dxTo, double dyTo) {BASE::quadricCurveRel(dxTo, dyTo);};
|
||||
|
||||
virtual void cubicCurveTo(double xCtrl1, double yCtrl1, double xCtrl2, double yCtrl2, double xTo, double yTo) {BASE::cubicCurveTo(xCtrl1, yCtrl1, xCtrl2, yCtrl2, xTo, yTo);};
|
||||
virtual void cubicCurveRel(double dxCtrl1, double dyCtrl1, double dxCtrl2, double dyCtrl2, double dxTo, double dyTo) {BASE::cubicCurveRel(dxCtrl1, dyCtrl1, dxCtrl2, dyCtrl2, dxTo, dyTo);};
|
||||
virtual void cubicCurveTo(double xCtrl2, double yCtrl2, double xTo, double yTo) {BASE::cubicCurveTo(xCtrl2, yCtrl2, xTo, yTo);};
|
||||
virtual void cubicCurveRel(double xCtrl2, double yCtrl2, double xTo, double yTo) {BASE::cubicCurveRel(xCtrl2, yCtrl2, xTo, yTo);};
|
||||
|
||||
virtual void addEllipse(double cx, double cy, double rx, double ry, Agg2DBase::Direction dir) {BASE::addEllipse(cx, cy, rx, ry, dir);};
|
||||
virtual void closePolygon() {BASE::closePolygon();};
|
||||
|
||||
virtual void drawPath(Agg2DBase::DrawPathFlag flag = Agg2DBase::FillAndStroke) {BASE::drawPath(flag);};
|
||||
// virtual void drawPathNoTransform(DrawPathFlag flag = FillAndStroke) {BASE::drawPathNoTransform(flag);};
|
||||
|
||||
// Image Transformations
|
||||
virtual void imageFilter(Agg2DBase::ImageFilter f) {BASE::imageFilter(f);};
|
||||
virtual Agg2DBase::ImageFilter imageFilter() {return BASE::imageFilter();};
|
||||
|
||||
virtual void imageResample(Agg2DBase::ImageResample f) {BASE::imageResample(f);};
|
||||
virtual Agg2DBase::ImageResample imageResample() {return BASE::imageResample();};
|
||||
|
||||
// Auxiliary
|
||||
virtual double pi() { return agg::pi; }
|
||||
virtual double deg2Rad(double v) { return v * agg::pi / 180.0; }
|
||||
virtual double rad2Deg(double v) { return v * 180.0 / agg::pi; }
|
||||
};
|
||||
|
||||
class AggDraw
|
||||
{
|
||||
public:
|
||||
AggDraw()
|
||||
: target(NULL)
|
||||
{}
|
||||
AggDrawTarget *target;
|
||||
};
|
||||
|
||||
enum AggTarget
|
||||
{
|
||||
AggTarget_Screen = 0,
|
||||
AggTarget_Hud = 1,
|
||||
AggTarget_Lua = 2,
|
||||
};
|
||||
|
||||
//specialized instance for desmume; should eventually move to another file
|
||||
class AggDraw_Desmume : public AggDraw
|
||||
{
|
||||
public:
|
||||
void setTarget(AggTarget newTarget);
|
||||
//void composite(void* dest);
|
||||
|
||||
AggDrawTarget *screen, *hud, *lua;
|
||||
};
|
||||
|
||||
extern AggDraw_Desmume aggDraw;
|
||||
|
||||
void Agg_init();
|
||||
|
||||
|
||||
#endif
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>677</string>
|
||||
<key>IBOldestOS</key>
|
||||
<integer>5</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array/>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9J61</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCocoaFramework</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBClasses</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>FirstResponder</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>IBVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
FAT.H
|
||||
Mic, 2006
|
||||
Structures taken from Michael Chisholm's FAT library
|
||||
*/
|
||||
|
||||
#ifndef __FAT_H__
|
||||
#define __FAT_H__
|
||||
|
||||
#include "types.h"
|
||||
#include "PACKED.h"
|
||||
#include "PACKED_END.h"
|
||||
|
||||
#define ATTRIB_DIR 0x10
|
||||
#define ATTRIB_LFN 0x0F
|
||||
|
||||
#define FILE_FREE 0xE5
|
||||
/* Name and extension maximum length */
|
||||
#define NAME_LEN 8
|
||||
#define EXT_LEN 3
|
||||
|
||||
// Boot Sector - must be packed
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define DIR_SEP "\\"
|
||||
#else
|
||||
#define DIR_SEP "/"
|
||||
#endif
|
||||
|
||||
#include "PACKED.h"
|
||||
typedef struct
|
||||
{
|
||||
u8 jmpBoot[3] __PACKED;
|
||||
u8 OEMName[8] __PACKED;
|
||||
// BIOS Parameter Block
|
||||
u16 bytesPerSector __PACKED;
|
||||
u8 sectorsPerCluster __PACKED;
|
||||
u16 reservedSectors __PACKED;
|
||||
u8 numFATs __PACKED;
|
||||
u16 rootEntries __PACKED;
|
||||
u16 numSectorsSmall __PACKED;
|
||||
u8 mediaDesc __PACKED;
|
||||
u16 sectorsPerFAT __PACKED;
|
||||
u16 sectorsPerTrk __PACKED;
|
||||
u16 numHeads __PACKED;
|
||||
u32 numHiddenSectors __PACKED;
|
||||
u32 numSectors __PACKED;
|
||||
|
||||
struct
|
||||
{
|
||||
// Ext BIOS Parameter Block for FAT16
|
||||
u8 driveNumber __PACKED;
|
||||
u8 reserved1 __PACKED;
|
||||
u8 extBootSig __PACKED;
|
||||
u32 volumeID __PACKED;
|
||||
u8 volumeLabel[11] __PACKED;
|
||||
u8 fileSysType[8] __PACKED;
|
||||
// Bootcode
|
||||
u8 bootCode[448] __PACKED;
|
||||
u16 signature __PACKED;
|
||||
} __PACKED fat16;
|
||||
|
||||
} __PACKED BOOT_RECORD;
|
||||
#include "PACKED_END.h"
|
||||
|
||||
// Directory entry - must be packed
|
||||
#include "PACKED.h"
|
||||
typedef struct
|
||||
{
|
||||
u8 name[NAME_LEN] __PACKED;
|
||||
u8 ext[EXT_LEN] __PACKED;
|
||||
u8 attrib __PACKED;
|
||||
u8 reserved __PACKED;
|
||||
u8 cTime_ms __PACKED;
|
||||
u16 cTime __PACKED;
|
||||
u16 cDate __PACKED;
|
||||
u16 aDate __PACKED;
|
||||
u16 startClusterHigh __PACKED;
|
||||
u16 mTime __PACKED;
|
||||
u16 mDate __PACKED;
|
||||
u16 startCluster __PACKED;
|
||||
u32 fileSize __PACKED;
|
||||
} __PACKED DIR_ENT;
|
||||
#include "PACKED_END.h"
|
||||
|
||||
#endif //
|
|
@ -1,437 +0,0 @@
|
|||
/* cheats.cpp - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2006-2009 DeSmuME Team
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "cheatsGTK.h"
|
||||
#include "cheatSystem.h"
|
||||
#include "main.h"
|
||||
#include "desmume.h"
|
||||
|
||||
enum {
|
||||
COLUMN_ENABLED,
|
||||
COLUMN_SIZE,
|
||||
COLUMN_HI,
|
||||
COLUMN_LO,
|
||||
COLUMN_DESC,
|
||||
NUM_COL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_SIZE_TEXT,
|
||||
NUM_SIZE_COLUMNS
|
||||
};
|
||||
|
||||
enum {
|
||||
TYPE_TOGGLE,
|
||||
TYPE_COMBO,
|
||||
TYPE_STRING
|
||||
};
|
||||
|
||||
static struct {
|
||||
const gchar *caption;
|
||||
gint type;
|
||||
gint column;
|
||||
} columnTable[]={
|
||||
{ "Enabled", TYPE_TOGGLE, COLUMN_ENABLED},
|
||||
{ "Size", TYPE_COMBO, COLUMN_SIZE},
|
||||
{ "Offset", TYPE_STRING, COLUMN_HI},
|
||||
{ "Value", TYPE_STRING, COLUMN_LO},
|
||||
{ "Description", TYPE_STRING, COLUMN_DESC}
|
||||
};
|
||||
|
||||
static GtkWidget *win = NULL;
|
||||
static BOOL shouldBeRunning = FALSE;
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// SEARCH
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
enabled_toggled(GtkCellRendererToggle * cell,
|
||||
gchar * path_str, gpointer data)
|
||||
{
|
||||
GtkTreeModel *model = (GtkTreeModel *) data;
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
|
||||
gboolean enabled;
|
||||
|
||||
gtk_tree_model_get_iter(model, &iter, path);
|
||||
gtk_tree_model_get(model, &iter, COLUMN_ENABLED, &enabled, -1);
|
||||
|
||||
enabled ^= 1;
|
||||
CHEATS_LIST cheat;
|
||||
u32 ii;
|
||||
GtkTreePath *path1;
|
||||
|
||||
path1 = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
cheatsGet(&cheat, ii);
|
||||
|
||||
cheatsUpdate(cheat.size, cheat.hi[0], cheat.lo[0], cheat.description,
|
||||
enabled, ii);
|
||||
|
||||
gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_ENABLED, enabled, -1);
|
||||
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
||||
static void cheat_list_modify_cheat(GtkCellRendererText * cell,
|
||||
const gchar * path_string,
|
||||
const gchar * new_text, gpointer data)
|
||||
{
|
||||
GtkTreeModel *model = (GtkTreeModel *) data;
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string(path_string);
|
||||
GtkTreeIter iter;
|
||||
|
||||
gint column =
|
||||
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), "column"));
|
||||
|
||||
gtk_tree_model_get_iter(model, &iter, path);
|
||||
|
||||
{
|
||||
u32 ii;
|
||||
GtkTreePath *path1;
|
||||
CHEATS_LIST cheat;
|
||||
|
||||
path1 = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
cheatsGet(&cheat, ii);
|
||||
|
||||
gtk_tree_path_free (path1);
|
||||
|
||||
if (column == COLUMN_LO || column == COLUMN_HI
|
||||
|| column == COLUMN_SIZE) {
|
||||
u32 v = atoi(new_text);
|
||||
switch (column) {
|
||||
case COLUMN_SIZE:
|
||||
cheatsUpdate(v-1, cheat.hi[0], cheat.lo[0],
|
||||
cheat.description, cheat.enabled, ii);
|
||||
break;
|
||||
case COLUMN_HI:
|
||||
cheatsUpdate(cheat.size, v, cheat.lo[0], cheat.description,
|
||||
cheat.enabled, ii);
|
||||
break;
|
||||
case COLUMN_LO:
|
||||
cheatsUpdate(cheat.size, cheat.hi[0], v, cheat.description,
|
||||
cheat.enabled, ii);
|
||||
break;
|
||||
}
|
||||
gtk_list_store_set(GTK_LIST_STORE(model), &iter, column,
|
||||
atoi(new_text), -1);
|
||||
} else if (column == COLUMN_DESC){
|
||||
cheatsUpdate(cheat.size, cheat.hi[0], cheat.lo[0],
|
||||
g_strdup(new_text), cheat.enabled, ii);
|
||||
gtk_list_store_set(GTK_LIST_STORE(model), &iter, column,
|
||||
g_strdup(new_text), -1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_list_remove_cheat(GtkWidget * widget, gpointer data)
|
||||
{
|
||||
GtkTreeView *tree = (GtkTreeView *) data;
|
||||
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree);
|
||||
GtkTreeModel *model = gtk_tree_view_get_model (tree);
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter)){
|
||||
u32 ii;
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
|
||||
cheatsRemove(ii);
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_list_add_cheat(GtkWidget * widget, gpointer data)
|
||||
{
|
||||
#define NEW_DESC "New cheat"
|
||||
GtkListStore *store = (GtkListStore *) data;
|
||||
GtkTreeIter iter;
|
||||
cheatsAdd(1, 0, 0, g_strdup(NEW_DESC), FALSE);
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
COLUMN_ENABLED, FALSE,
|
||||
COLUMN_SIZE, 1,
|
||||
COLUMN_HI, 0,
|
||||
COLUMN_LO, 0, COLUMN_DESC, NEW_DESC, -1);
|
||||
|
||||
#undef NEW_DESC
|
||||
}
|
||||
|
||||
static GtkTreeModel * create_numbers_model (void)
|
||||
{
|
||||
#define N_NUMBERS 4
|
||||
gint i = 0;
|
||||
GtkListStore *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
/* create list store */
|
||||
model = gtk_list_store_new (NUM_SIZE_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
||||
|
||||
/* add numbers */
|
||||
for (i = 1; i < N_NUMBERS+1; i++)
|
||||
{
|
||||
char str[2];
|
||||
|
||||
str[0] = '0' + i;
|
||||
str[1] = '\0';
|
||||
|
||||
gtk_list_store_append (model, &iter);
|
||||
|
||||
gtk_list_store_set (model, &iter,
|
||||
COLUMN_SIZE_TEXT, str,
|
||||
-1);
|
||||
}
|
||||
|
||||
return GTK_TREE_MODEL (model);
|
||||
|
||||
#undef N_NUMBERS
|
||||
}
|
||||
|
||||
static void cheat_list_add_columns(GtkTreeView * tree, GtkListStore * store)
|
||||
{
|
||||
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
|
||||
static GtkTreeModel * size_model;
|
||||
|
||||
for (u32 ii = 0; ii < sizeof(columnTable) / sizeof(columnTable[0]); ii++) {
|
||||
GtkCellRenderer *renderer = NULL;
|
||||
GtkTreeViewColumn *column;
|
||||
const gchar *attrib = NULL;
|
||||
switch (columnTable[ii].type) {
|
||||
case TYPE_TOGGLE:
|
||||
renderer = gtk_cell_renderer_toggle_new();
|
||||
g_signal_connect(renderer, "toggled",
|
||||
G_CALLBACK(enabled_toggled), model);
|
||||
attrib = "active";
|
||||
break;
|
||||
case TYPE_STRING:
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
g_object_set(renderer, "editable", TRUE, NULL);
|
||||
g_signal_connect(renderer, "edited",
|
||||
G_CALLBACK(cheat_list_modify_cheat), store);
|
||||
attrib = "text";
|
||||
break;
|
||||
case TYPE_COMBO:
|
||||
renderer = gtk_cell_renderer_combo_new();
|
||||
size_model = create_numbers_model();
|
||||
g_object_set(renderer,
|
||||
"model", size_model,
|
||||
"text-column", COLUMN_SIZE_TEXT,
|
||||
"editable", TRUE,
|
||||
"has-entry", FALSE,
|
||||
NULL);
|
||||
g_object_unref(size_model);
|
||||
g_signal_connect(renderer, "edited",
|
||||
G_CALLBACK(cheat_list_modify_cheat), store);
|
||||
attrib = "text";
|
||||
break;
|
||||
}
|
||||
column =
|
||||
gtk_tree_view_column_new_with_attributes(columnTable[ii].
|
||||
caption, renderer,
|
||||
attrib, columnTable[ii].column,
|
||||
NULL);
|
||||
g_object_set_data(G_OBJECT(renderer), "column",
|
||||
GINT_TO_POINTER(columnTable[ii].column));
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void cheatListEnd()
|
||||
{
|
||||
cheatsSave();
|
||||
if(shouldBeRunning)
|
||||
Launch();
|
||||
}
|
||||
|
||||
static GtkListStore *cheat_list_populate()
|
||||
{
|
||||
GtkListStore *store = gtk_list_store_new (5, G_TYPE_BOOLEAN,
|
||||
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING);
|
||||
|
||||
CHEATS_LIST cheat;
|
||||
u32 chsize = cheatsGetSize();
|
||||
for(u32 ii = 0; ii < chsize; ii++){
|
||||
GtkTreeIter iter;
|
||||
cheatsGet(&cheat, ii);
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
COLUMN_ENABLED, cheat.enabled,
|
||||
COLUMN_SIZE, cheat.size+1,
|
||||
COLUMN_HI, cheat.hi[0],
|
||||
COLUMN_LO, cheat.lo[0],
|
||||
COLUMN_DESC, cheat.description,
|
||||
-1);
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
static GtkWidget *cheat_list_create_ui()
|
||||
{
|
||||
GtkListStore *store = cheat_list_populate();
|
||||
GtkWidget *tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
|
||||
GtkWidget *vbox = gtk_vbox_new(FALSE, 1);
|
||||
GtkWidget *hbbox = gtk_hbutton_box_new();
|
||||
GtkWidget *button;
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(tree));
|
||||
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(hbbox));
|
||||
gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(vbox));
|
||||
|
||||
button = gtk_button_new_with_label("add cheat");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (cheat_list_add_cheat), store);
|
||||
gtk_container_add(GTK_CONTAINER(hbbox),button);
|
||||
|
||||
button = gtk_button_new_with_label("Remove cheat");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (cheat_list_remove_cheat), tree);
|
||||
gtk_container_add(GTK_CONTAINER(hbbox),button);
|
||||
|
||||
cheat_list_add_columns(GTK_TREE_VIEW(tree), store);
|
||||
|
||||
/* Setup the selection handler */
|
||||
GtkTreeSelection *select;
|
||||
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
|
||||
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
void CheatList ()
|
||||
{
|
||||
shouldBeRunning = desmume_running();
|
||||
Pause();
|
||||
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(win),"Cheat List");
|
||||
gtk_window_set_modal(GTK_WINDOW(win), TRUE);
|
||||
g_signal_connect(G_OBJECT(win), "destroy", cheatListEnd, NULL);
|
||||
|
||||
cheat_list_create_ui();
|
||||
|
||||
gtk_widget_show_all(win);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// SEARCH
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
static void cheat_search_create_ui()
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox = gtk_vbox_new(FALSE, 1);
|
||||
GtkWidget *hbbox = gtk_hbutton_box_new();
|
||||
GtkWidget *b;
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(vbox));
|
||||
|
||||
{
|
||||
b = gtk_hbox_new(FALSE, 1);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(b));
|
||||
|
||||
{
|
||||
GtkTreeModel * size_model;
|
||||
GtkWidget *w;
|
||||
w = gtk_label_new("size");
|
||||
gtk_container_add(GTK_CONTAINER(b), w);
|
||||
|
||||
size_model = create_numbers_model();
|
||||
|
||||
w = gtk_combo_box_new_with_model(size_model);
|
||||
g_object_unref(size_model);
|
||||
GtkCellRenderer * renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), renderer,
|
||||
"text", COLUMN_SIZE_TEXT,
|
||||
NULL);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (w), 0);
|
||||
gtk_container_add(GTK_CONTAINER(b), w);
|
||||
}
|
||||
|
||||
b = gtk_hbox_new(FALSE, 1);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(b));
|
||||
|
||||
{
|
||||
GtkWidget *w;
|
||||
w = gtk_label_new("signedness");
|
||||
gtk_container_add(GTK_CONTAINER(b), w);
|
||||
|
||||
// m = create_sign_model();
|
||||
|
||||
w = gtk_combo_box_new();
|
||||
// w = gtk_combo_box_new_with_model(size_model);
|
||||
// g_object_unref(size_model);
|
||||
// size_model = NULL;
|
||||
GtkCellRenderer * renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, TRUE);
|
||||
// gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), renderer,
|
||||
// "text", COLUMN_SIZE_TEXT,
|
||||
// NULL);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (w), 0);
|
||||
gtk_container_add(GTK_CONTAINER(b), w);
|
||||
}
|
||||
}
|
||||
|
||||
// BUTTONS:
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(hbbox));
|
||||
|
||||
button = gtk_button_new_with_label("add cheats");
|
||||
// g_signal_connect (button, "clicked", g_callback (cheat_list_add_cheat), store);
|
||||
gtk_container_add(GTK_CONTAINER(hbbox),button);
|
||||
|
||||
button = gtk_button_new_with_label("search");
|
||||
// g_signal_connect (button, "clicked", g_callback (cheat_list_add_cheat), store);
|
||||
gtk_container_add(GTK_CONTAINER(hbbox),button);
|
||||
|
||||
// GtkWidget *vbox = gtk_vbox_new(FALSE, 1);
|
||||
// gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(vbox));
|
||||
}
|
||||
|
||||
static void cheatSearchEnd()
|
||||
{
|
||||
}
|
||||
|
||||
void CheatSearch ()
|
||||
{
|
||||
shouldBeRunning = desmume_running();
|
||||
Pause();
|
||||
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(win),"Cheat Search");
|
||||
gtk_window_set_modal(GTK_WINDOW(win), TRUE);
|
||||
g_signal_connect(G_OBJECT(win), "destroy", cheatSearchEnd, NULL);
|
||||
|
||||
cheat_search_create_ui();
|
||||
|
||||
gtk_widget_show_all(win);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/* desmume.h - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2006,2007 DeSmuME Team
|
||||
* Copyright (C) 2007 Pascal Giard (evilynux)
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CHEATS_H__
|
||||
#define __CHEATS_H__
|
||||
|
||||
void CheatSearch ();
|
||||
void CheatList ();
|
||||
|
||||
#endif /*__CHEATS_H__*/
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef __DESMUME_GTK_MAIN_H__
|
||||
#define __DESMUME_GTK_MAIN_H__
|
||||
|
||||
void Pause();
|
||||
void Launch();
|
||||
|
||||
#endif
|
|
@ -1,317 +0,0 @@
|
|||
/* Copyright (C) 2006-2007 shash
|
||||
Copyright (C) 2009 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef MATRIX_H
|
||||
#define MATRIX_H
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "mem.h"
|
||||
|
||||
#ifdef ENABLE_SSE
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SSE2
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
struct MatrixStack
|
||||
{
|
||||
MatrixStack(int size);
|
||||
float *matrix;
|
||||
int position;
|
||||
int size;
|
||||
};
|
||||
|
||||
void MatrixInit (float *matrix);
|
||||
|
||||
//In order to conditionally use these asm optimized functions in visual studio
|
||||
//without having to make new build types to exclude the assembly files.
|
||||
//a bit sloppy, but there aint much to it
|
||||
|
||||
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
||||
void MatrixSet (float *matrix, int x, int y, float value);
|
||||
void MatrixCopy (float * matrixDST, const float * matrixSRC);
|
||||
int MatrixCompare (const float * matrixDST, const float * matrixSRC);
|
||||
void MatrixIdentity (float *matrix);
|
||||
|
||||
void MatrixTranspose (float *matrix);
|
||||
void MatrixStackInit (MatrixStack *stack);
|
||||
void MatrixStackSetMaxSize (MatrixStack *stack, int size);
|
||||
void MatrixStackSetStackPosition (MatrixStack *stack, int pos);
|
||||
void MatrixStackPushMatrix (MatrixStack *stack, const float *ptr);
|
||||
float* MatrixStackPopMatrix (MatrixStack *stack, int size);
|
||||
float* MatrixStackGetPos (MatrixStack *stack, int pos);
|
||||
float* MatrixStackGet (MatrixStack *stack);
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const float *ptr);
|
||||
|
||||
void Vector2Copy(float *dst, const float *src);
|
||||
void Vector2Add(float *dst, const float *src);
|
||||
void Vector2Subtract(float *dst, const float *src);
|
||||
float Vector2Dot(const float *a, const float *b);
|
||||
float Vector2Cross(const float *a, const float *b);
|
||||
|
||||
float Vector3Dot(const float *a, const float *b);
|
||||
void Vector3Cross(float* dst, const float *a, const float *b);
|
||||
float Vector3Length(const float *a);
|
||||
void Vector3Add(float *dst, const float *src);
|
||||
void Vector3Subtract(float *dst, const float *src);
|
||||
void Vector3Scale(float *dst, const float scale);
|
||||
void Vector3Copy(float *dst, const float *src);
|
||||
void Vector3Normalize(float *dst);
|
||||
|
||||
void Vector4Copy(float *dst, const float *src);
|
||||
|
||||
//these functions are an unreliable, inaccurate floor.
|
||||
//it should only be used for positive numbers
|
||||
//this isnt as fast as it could be if we used a visual c++ intrinsic, but those appear not to be universally available
|
||||
FORCEINLINE u32 u32floor(float f)
|
||||
{
|
||||
#ifdef ENABLE_SSE2
|
||||
return (u32)_mm_cvtt_ss2si(_mm_set_ss(f));
|
||||
#else
|
||||
return (u32)f;
|
||||
#endif
|
||||
}
|
||||
FORCEINLINE u32 u32floor(double d)
|
||||
{
|
||||
#ifdef ENABLE_SSE2
|
||||
return (u32)_mm_cvttsd_si32(_mm_set_sd(d));
|
||||
#else
|
||||
return (u32)d;
|
||||
#endif
|
||||
}
|
||||
|
||||
//same as above but works for negative values too.
|
||||
//be sure that the results are the same thing as floorf!
|
||||
FORCEINLINE s32 s32floor(float f)
|
||||
{
|
||||
#ifdef ENABLE_SSE2
|
||||
return _mm_cvtss_si32( _mm_add_ss(_mm_set_ss(-0.5f),_mm_add_ss(_mm_set_ss(f), _mm_set_ss(f))) ) >> 1;
|
||||
#else
|
||||
return (s32)floorf(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
//switched SSE2 functions
|
||||
//-------------
|
||||
#ifdef ENABLE_SSE
|
||||
|
||||
template<int NUM>
|
||||
FORCEINLINE void memset_u16_le(void* dst, u16 val)
|
||||
{
|
||||
u32 u32val;
|
||||
//just for the endian safety
|
||||
T1WriteWord((u8*)&u32val,0,val);
|
||||
T1WriteWord((u8*)&u32val,2,val);
|
||||
////const __m128i temp = _mm_set_epi32(u32val,u32val,u32val,u32val);
|
||||
__m128 temp; temp.m128_i32[0] = u32val;
|
||||
//MACRODO_N(NUM/8,_mm_store_si128((__m128i*)((u8*)dst+(X)*16), temp));
|
||||
MACRODO_N(NUM/8,_mm_store_ps1((float*)((u8*)dst+(X)*16), temp));
|
||||
}
|
||||
|
||||
#else //no sse2
|
||||
|
||||
template<int NUM>
|
||||
static FORCEINLINE void memset_u16_le(void* dst, u16 val)
|
||||
{
|
||||
for(int i=0;i<NUM;i++)
|
||||
T1WriteWord((u8*)dst,i<<1,val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//---------------------------
|
||||
//switched SSE functions
|
||||
#ifdef ENABLE_SSE
|
||||
|
||||
struct SSE_MATRIX
|
||||
{
|
||||
SSE_MATRIX(const float *matrix)
|
||||
: row0(_mm_load_ps(matrix))
|
||||
, row1(_mm_load_ps(matrix+4))
|
||||
, row2(_mm_load_ps(matrix+8))
|
||||
, row3(_mm_load_ps(matrix+12))
|
||||
{}
|
||||
|
||||
union {
|
||||
__m128 rows[4];
|
||||
struct { __m128 row0; __m128 row1; __m128 row2; __m128 row3; };
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
FORCEINLINE __m128 _util_MatrixMultVec4x4_(const SSE_MATRIX &mat, __m128 vec)
|
||||
{
|
||||
__m128 xmm5 = _mm_shuffle_ps(vec, vec, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(vec, vec, B8(10101010));
|
||||
__m128 xmm7 = _mm_shuffle_ps(vec, vec, B8(11111111));
|
||||
__m128 xmm4 = _mm_shuffle_ps(vec, vec, B8(00000000));
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,mat.row0);
|
||||
xmm5 = _mm_mul_ps(xmm5,mat.row1);
|
||||
xmm6 = _mm_mul_ps(xmm6,mat.row2);
|
||||
xmm7 = _mm_mul_ps(xmm7,mat.row3);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm5);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm6);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm7);
|
||||
return xmm4;
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixMultiply(float * matrix, const float * rightMatrix)
|
||||
{
|
||||
//this seems to generate larger code, including many movaps, but maybe it is less harsh on the registers than the
|
||||
//more hand-tailored approach
|
||||
__m128 row0 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix));
|
||||
__m128 row1 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+4));
|
||||
__m128 row2 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+8));
|
||||
__m128 row3 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+12));
|
||||
_mm_store_ps(matrix,row0);
|
||||
_mm_store_ps(matrix+4,row1);
|
||||
_mm_store_ps(matrix+8,row2);
|
||||
_mm_store_ps(matrix+12,row3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
FORCEINLINE void MatrixMultVec4x4(const float *matrix, float *vecPtr)
|
||||
{
|
||||
_mm_store_ps(vecPtr,_util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(vecPtr)));
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixMultVec4x4_M2(const float *matrix, float *vecPtr)
|
||||
{
|
||||
//there are hardly any gains from merging these manually
|
||||
MatrixMultVec4x4(matrix+16,vecPtr);
|
||||
MatrixMultVec4x4(matrix,vecPtr);
|
||||
}
|
||||
|
||||
|
||||
FORCEINLINE void MatrixMultVec3x3(const float * matrix, float * vecPtr)
|
||||
{
|
||||
const __m128 vec = _mm_load_ps(vecPtr);
|
||||
|
||||
__m128 xmm5 = _mm_shuffle_ps(vec, vec, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(vec, vec, B8(10101010));
|
||||
__m128 xmm4 = _mm_shuffle_ps(vec, vec, B8(00000000));
|
||||
|
||||
const SSE_MATRIX mat(matrix);
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,mat.row0);
|
||||
xmm5 = _mm_mul_ps(xmm5,mat.row1);
|
||||
xmm6 = _mm_mul_ps(xmm6,mat.row2);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm5);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm6);
|
||||
|
||||
_mm_store_ps(vecPtr,xmm4);
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixTranslate(float *matrix, const float *ptr)
|
||||
{
|
||||
__m128 xmm4 = _mm_load_ps(ptr);
|
||||
__m128 xmm5 = _mm_shuffle_ps(xmm4, xmm4, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(xmm4, xmm4, B8(10101010));
|
||||
xmm4 = _mm_shuffle_ps(xmm4, xmm4, B8(00000000));
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,_mm_load_ps(matrix));
|
||||
xmm5 = _mm_mul_ps(xmm5,_mm_load_ps(matrix+4));
|
||||
xmm6 = _mm_mul_ps(xmm6,_mm_load_ps(matrix+8));
|
||||
xmm4 = _mm_add_ps(xmm4,xmm5);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm6);
|
||||
xmm4 = _mm_add_ps(xmm4,_mm_load_ps(matrix+12));
|
||||
_mm_store_ps(matrix+12,xmm4);
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixScale(float *matrix, const float *ptr)
|
||||
{
|
||||
__m128 xmm4 = _mm_load_ps(ptr);
|
||||
__m128 xmm5 = _mm_shuffle_ps(xmm4, xmm4, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(xmm4, xmm4, B8(10101010));
|
||||
xmm4 = _mm_shuffle_ps(xmm4, xmm4, B8(00000000));
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,_mm_load_ps(matrix));
|
||||
xmm5 = _mm_mul_ps(xmm5,_mm_load_ps(matrix+4));
|
||||
xmm6 = _mm_mul_ps(xmm6,_mm_load_ps(matrix+8));
|
||||
_mm_store_ps(matrix,xmm4);
|
||||
_mm_store_ps(matrix+4,xmm5);
|
||||
_mm_store_ps(matrix+8,xmm6);
|
||||
}
|
||||
|
||||
template<int NUM_ROWS>
|
||||
FORCEINLINE void vector_fix2float(float* matrix, const float divisor)
|
||||
{
|
||||
CTASSERT(NUM_ROWS==3 || NUM_ROWS==4);
|
||||
|
||||
const __m128 val = _mm_set_ps1(divisor);
|
||||
|
||||
_mm_store_ps(matrix,_mm_div_ps(_mm_load_ps(matrix),val));
|
||||
_mm_store_ps(matrix+4,_mm_div_ps(_mm_load_ps(matrix+4),val));
|
||||
_mm_store_ps(matrix+8,_mm_div_ps(_mm_load_ps(matrix+8),val));
|
||||
if(NUM_ROWS==4)
|
||||
_mm_store_ps(matrix+12,_mm_div_ps(_mm_load_ps(matrix+12),val));
|
||||
}
|
||||
|
||||
//WARNING: I do not think this is as fast as a memset, for some reason.
|
||||
//at least in vc2005 with sse enabled. better figure out why before using it
|
||||
template<int NUM>
|
||||
static FORCEINLINE void memset_u8(void* _dst, u8 val)
|
||||
{
|
||||
memset(_dst,val,NUM);
|
||||
//const u8* dst = (u8*)_dst;
|
||||
//u32 u32val = (val<<24)|(val<<16)|(val<<8)|val;
|
||||
//const __m128i temp = _mm_set_epi32(u32val,u32val,u32val,u32val);
|
||||
//MACRODO_N(NUM/16,_mm_store_si128((__m128i*)(dst+(X)*16), temp));
|
||||
}
|
||||
|
||||
#else //no sse
|
||||
|
||||
void MatrixMultVec4x4 (const float *matrix, float *vecPtr);
|
||||
void MatrixMultVec3x3(const float * matrix, float * vecPtr);
|
||||
void MatrixMultiply(float * matrix, const float * rightMatrix);
|
||||
void MatrixTranslate(float *matrix, const float *ptr);
|
||||
void MatrixScale(float * matrix, const float * ptr);
|
||||
|
||||
FORCEINLINE void MatrixMultVec4x4_M2(const float *matrix, float *vecPtr)
|
||||
{
|
||||
//there are hardly any gains from merging these manually
|
||||
MatrixMultVec4x4(matrix+16,vecPtr);
|
||||
MatrixMultVec4x4(matrix,vecPtr);
|
||||
}
|
||||
|
||||
template<int NUM_ROWS>
|
||||
FORCEINLINE void vector_fix2float(float* matrix, const float divisor)
|
||||
{
|
||||
for(int i=0;i<NUM_ROWS*4;i++)
|
||||
matrix[i] /= divisor;
|
||||
}
|
||||
|
||||
template<int NUM>
|
||||
static FORCEINLINE void memset_u8(void* dst, u8 val)
|
||||
{
|
||||
memset(dst,val,NUM);
|
||||
}
|
||||
|
||||
#endif //switched SSE functions
|
||||
|
||||
|
||||
#endif
|
|
@ -1,817 +0,0 @@
|
|||
/* Copyright (C) 2006 thoduv
|
||||
Copyright (C) 2006-2007 Theo Berkau
|
||||
Copyright (C) 2008-2009 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
#include "mc.h"
|
||||
#include "movie.h"
|
||||
#include "readwrite.h"
|
||||
#include "NDSSystem.h"
|
||||
|
||||
//temporary hack until we have better error reporting facilities
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define FW_CMD_READ 0x3
|
||||
#define FW_CMD_WRITEDISABLE 0x4
|
||||
#define FW_CMD_READSTATUS 0x5
|
||||
#define FW_CMD_WRITEENABLE 0x6
|
||||
#define FW_CMD_PAGEWRITE 0xA
|
||||
|
||||
#define BM_CMD_AUTODETECT 0xFF
|
||||
#define BM_CMD_WRITESTATUS 0x1
|
||||
#define BM_CMD_WRITELOW 0x2
|
||||
#define BM_CMD_READLOW 0x3
|
||||
#define BM_CMD_WRITEDISABLE 0x4
|
||||
#define BM_CMD_READSTATUS 0x5
|
||||
#define BM_CMD_WRITEENABLE 0x6
|
||||
#define BM_CMD_WRITEHIGH 0xA
|
||||
#define BM_CMD_READHIGH 0xB
|
||||
|
||||
/* FLASH*/
|
||||
#define COMM_PAGE_WRITE 0x0A
|
||||
#define COMM_PAGE_ERASE 0xDB
|
||||
#define COMM_SECTOR_ERASE 0xD8
|
||||
#define COMM_CHIP_ERASE 0xC7
|
||||
#define CARDFLASH_READ_BYTES_FAST 0x0B /* Not used*/
|
||||
#define CARDFLASH_DEEP_POWDOWN 0xB9 /* Not used*/
|
||||
#define CARDFLASH_WAKEUP 0xAB /* Not used*/
|
||||
|
||||
//this should probably be 0xFF but we're using 0x00 until we find out otherwise
|
||||
//(no$ appears definitely to initialized to 0xFF)
|
||||
static const u8 kUninitializedSaveDataValue = 0x00;
|
||||
|
||||
static const char* kDesmumeSaveCookie = "|-DESMUME SAVE-|";
|
||||
|
||||
static const u32 saveSizes[] = {512,8*1024,32*1024,64*1024,256*1024,512*1024,0xFFFFFFFF};
|
||||
static const u32 saveSizes_count = ARRAY_SIZE(saveSizes);
|
||||
|
||||
//the lookup table from user save types to save parameters
|
||||
static const int save_types[7][2] = {
|
||||
{MC_TYPE_AUTODETECT,1},
|
||||
{MC_TYPE_EEPROM1,MC_SIZE_4KBITS},
|
||||
{MC_TYPE_EEPROM2,MC_SIZE_64KBITS},
|
||||
{MC_TYPE_EEPROM2,MC_SIZE_512KBITS},
|
||||
{MC_TYPE_FRAM,MC_SIZE_256KBITS},
|
||||
{MC_TYPE_FLASH,MC_SIZE_2MBITS},
|
||||
{MC_TYPE_FLASH,MC_SIZE_4MBITS}
|
||||
};
|
||||
|
||||
void backup_setManualBackupType(int type)
|
||||
{
|
||||
CommonSettings.manualBackupType = type;
|
||||
}
|
||||
|
||||
void mc_init(memory_chip_t *mc, int type)
|
||||
{
|
||||
mc->com = 0;
|
||||
mc->addr = 0;
|
||||
mc->addr_shift = 0;
|
||||
mc->data = NULL;
|
||||
mc->size = 0;
|
||||
mc->write_enable = FALSE;
|
||||
mc->writeable_buffer = FALSE;
|
||||
mc->type = type;
|
||||
mc->autodetectsize = 0;
|
||||
|
||||
switch(mc->type)
|
||||
{
|
||||
case MC_TYPE_EEPROM1:
|
||||
mc->addr_size = 1;
|
||||
break;
|
||||
case MC_TYPE_EEPROM2:
|
||||
case MC_TYPE_FRAM:
|
||||
mc->addr_size = 2;
|
||||
break;
|
||||
case MC_TYPE_FLASH:
|
||||
mc->addr_size = 3;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
u8 *mc_alloc(memory_chip_t *mc, u32 size)
|
||||
{
|
||||
u8 *buffer;
|
||||
buffer = new u8[size];
|
||||
memset(buffer,0,size);
|
||||
|
||||
mc->data = buffer;
|
||||
if(!buffer) { return NULL; }
|
||||
mc->size = size;
|
||||
mc->writeable_buffer = TRUE;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void mc_free(memory_chip_t *mc)
|
||||
{
|
||||
if(mc->data) delete[] mc->data;
|
||||
mc_init(mc, 0);
|
||||
}
|
||||
|
||||
void fw_reset_com(memory_chip_t *mc)
|
||||
{
|
||||
if(mc->com == FW_CMD_PAGEWRITE)
|
||||
{
|
||||
if (mc->fp)
|
||||
{
|
||||
fseek(mc->fp, 0, SEEK_SET);
|
||||
fwrite(mc->data, mc->size, 1, mc->fp);
|
||||
}
|
||||
|
||||
mc->write_enable = FALSE;
|
||||
}
|
||||
|
||||
mc->com = 0;
|
||||
}
|
||||
|
||||
u8 fw_transfer(memory_chip_t *mc, u8 data)
|
||||
{
|
||||
if(mc->com == FW_CMD_READ || mc->com == FW_CMD_PAGEWRITE) /* check if we are in a command that needs 3 bytes address */
|
||||
{
|
||||
if(mc->addr_shift > 0) /* if we got a complete address */
|
||||
{
|
||||
mc->addr_shift--;
|
||||
mc->addr |= data << (mc->addr_shift * 8); /* argument is a byte of address */
|
||||
}
|
||||
else /* if we have received 3 bytes of address, proceed command */
|
||||
{
|
||||
switch(mc->com)
|
||||
{
|
||||
case FW_CMD_READ:
|
||||
if(mc->addr < mc->size) /* check if we can read */
|
||||
{
|
||||
data = mc->data[mc->addr]; /* return byte */
|
||||
mc->addr++; /* then increment address */
|
||||
}
|
||||
break;
|
||||
|
||||
case FW_CMD_PAGEWRITE:
|
||||
if(mc->addr < mc->size)
|
||||
{
|
||||
mc->data[mc->addr] = data; /* write byte */
|
||||
mc->addr++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if(mc->com == FW_CMD_READSTATUS)
|
||||
{
|
||||
return (mc->write_enable ? 0x02 : 0x00);
|
||||
}
|
||||
else /* finally, check if it's a new command */
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
case 0: break; /* nothing */
|
||||
|
||||
case FW_CMD_READ: /* read command */
|
||||
mc->addr = 0;
|
||||
mc->addr_shift = 3;
|
||||
mc->com = FW_CMD_READ;
|
||||
break;
|
||||
|
||||
case FW_CMD_WRITEENABLE: /* enable writing */
|
||||
if(mc->writeable_buffer) { mc->write_enable = TRUE; }
|
||||
break;
|
||||
|
||||
case FW_CMD_WRITEDISABLE: /* disable writing */
|
||||
mc->write_enable = FALSE;
|
||||
break;
|
||||
|
||||
case FW_CMD_PAGEWRITE: /* write command */
|
||||
if(mc->write_enable)
|
||||
{
|
||||
mc->addr = 0;
|
||||
mc->addr_shift = 3;
|
||||
mc->com = FW_CMD_PAGEWRITE;
|
||||
}
|
||||
else { data = 0; }
|
||||
break;
|
||||
|
||||
case FW_CMD_READSTATUS: /* status register command */
|
||||
mc->com = FW_CMD_READSTATUS;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unhandled FW command: %02X\n", data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool BackupDevice::save_state(std::ostream* os)
|
||||
{
|
||||
int version = 0;
|
||||
write32le(version,os);
|
||||
write32le(write_enable,os);
|
||||
write32le(com,os);
|
||||
write32le(addr_size,os);
|
||||
write32le(addr_counter,os);
|
||||
write32le((u32)state,os);
|
||||
writebuffer(data,os);
|
||||
writebuffer(data_autodetect,os);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BackupDevice::load_state(std::istream* is)
|
||||
{
|
||||
int version;
|
||||
if(read32le(&version,is)!=1) return false;
|
||||
if(version==0) {
|
||||
read32le(&write_enable,is);
|
||||
read32le(&com,is);
|
||||
read32le(&addr_size,is);
|
||||
read32le(&addr_counter,is);
|
||||
u32 temp;
|
||||
read32le(&temp,is);
|
||||
state = (STATE)temp;
|
||||
readbuffer(data,is);
|
||||
readbuffer(data_autodetect,is);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
BackupDevice::BackupDevice()
|
||||
{
|
||||
}
|
||||
|
||||
//due to unfortunate shortcomings in the emulator architecture,
|
||||
//at reset-time, we won't have a filename to the .dsv file.
|
||||
//so the only difference between load_rom (init) and reset is that
|
||||
//one of them saves the filename
|
||||
void BackupDevice::load_rom(const char* filename)
|
||||
{
|
||||
isMovieMode = false;
|
||||
this->filename = filename;
|
||||
reset();
|
||||
}
|
||||
|
||||
void BackupDevice::movie_mode()
|
||||
{
|
||||
isMovieMode = true;
|
||||
reset();
|
||||
}
|
||||
|
||||
void BackupDevice::reset()
|
||||
{
|
||||
com = 0;
|
||||
addr = addr_counter = 0;
|
||||
flushPending = false;
|
||||
lazyFlushPending = false;
|
||||
data.resize(0);
|
||||
write_enable = FALSE;
|
||||
data_autodetect.resize(0);
|
||||
|
||||
state = DETECTING;
|
||||
addr_size = 0;
|
||||
loadfile();
|
||||
|
||||
//if the user has requested a manual choice for backup type, and we havent imported a raw save file, then apply it now
|
||||
if(state == DETECTING && CommonSettings.manualBackupType != MC_TYPE_AUTODETECT)
|
||||
{
|
||||
state = RUNNING;
|
||||
int savetype = save_types[CommonSettings.manualBackupType][0];
|
||||
int savesize = save_types[CommonSettings.manualBackupType][1];
|
||||
ensure((u32)savesize); //expand properly if necessary
|
||||
data.resize(savesize); //truncate if necessary
|
||||
addr_size = addr_size_for_old_save_type(savetype);
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
void BackupDevice::close_rom()
|
||||
{
|
||||
flush();
|
||||
}
|
||||
|
||||
void BackupDevice::reset_command()
|
||||
{
|
||||
//for a performance hack, save files are only flushed after each reset command
|
||||
//(hopefully, after each page)
|
||||
if(flushPending)
|
||||
{
|
||||
flush();
|
||||
flushPending = false;
|
||||
lazyFlushPending = false;
|
||||
}
|
||||
|
||||
if(state == DETECTING && data_autodetect.size()>0)
|
||||
{
|
||||
//we can now safely detect the save address size
|
||||
u32 autodetect_size = data_autodetect.size();
|
||||
|
||||
printf("Autodetecting with autodetect_size=%d\n",autodetect_size);
|
||||
|
||||
const u8 sm64_sig[] = {0x01,0x80,0x00,0x00};
|
||||
if(autodetect_size == 4 && !memcmp(&data_autodetect[0],sm64_sig,4))
|
||||
{
|
||||
addr_size = 2;
|
||||
}
|
||||
else //detect based on rules
|
||||
switch(autodetect_size)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
printf("Catastrophic error while autodetecting save type.\nIt will need to be specified manually\n");
|
||||
#ifdef _MSC_VER
|
||||
MessageBox(0,"Catastrophic Error Code: Camel;\nyour save type has not been autodetected correctly;\nplease report to developers",0,0);
|
||||
#endif
|
||||
addr_size = 1; //choose 1 just to keep the busted savefile from growing too big
|
||||
break;
|
||||
case 2:
|
||||
//the modern typical case for small eeproms
|
||||
addr_size = 1;
|
||||
break;
|
||||
case 3:
|
||||
//another modern typical case..
|
||||
//but unfortunately we select this case for spider-man 3, when what it meant to do was
|
||||
//present the archaic 1+2 case
|
||||
addr_size = 2;
|
||||
break;
|
||||
case 4:
|
||||
//a modern typical case
|
||||
addr_size = 3;
|
||||
break;
|
||||
default:
|
||||
//the archaic case: write the address and then some modulo-4 number of bytes
|
||||
//why modulo 4? who knows.
|
||||
addr_size = autodetect_size & 3;
|
||||
break;
|
||||
}
|
||||
|
||||
state = RUNNING;
|
||||
data_autodetect.resize(0);
|
||||
flush();
|
||||
}
|
||||
|
||||
com = 0;
|
||||
}
|
||||
u8 BackupDevice::data_command(u8 val)
|
||||
{
|
||||
if(com == BM_CMD_READLOW || com == BM_CMD_WRITELOW)
|
||||
{
|
||||
//handle data or address
|
||||
if(state == DETECTING)
|
||||
{
|
||||
if(com == BM_CMD_WRITELOW)
|
||||
{
|
||||
printf("Unexpected backup device initialization sequence using writes!\n");
|
||||
}
|
||||
|
||||
//just buffer the data until we're no longer detecting
|
||||
data_autodetect.push_back(val);
|
||||
val = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(addr_counter<addr_size)
|
||||
{
|
||||
//continue building address
|
||||
addr <<= 8;
|
||||
addr |= val;
|
||||
addr_counter++;
|
||||
//if(addr_counter==addr_size) printf("ADR: %08X\n",addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
//why does tomb raider underworld access 0x180 and go clear through to 0x280?
|
||||
//should this wrap around at 0 or at 0x100?
|
||||
if(addr_size == 1) addr &= 0x1FF;
|
||||
|
||||
//address is complete
|
||||
ensure(addr+1);
|
||||
if(com == BM_CMD_READLOW)
|
||||
{
|
||||
val = data[addr];
|
||||
//flushPending = true; //is this a good idea? it may slow stuff down, but it is helpful for debugging
|
||||
lazyFlushPending = true; //lets do this instead
|
||||
//printf("read: %08X\n",addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
data[addr] = val;
|
||||
flushPending = true;
|
||||
//printf("writ: %08X\n",addr);
|
||||
}
|
||||
addr++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(com == BM_CMD_READSTATUS)
|
||||
{
|
||||
//handle request to read status
|
||||
//LOG("Backup Memory Read Status: %02X\n", mc->write_enable << 1);
|
||||
return (write_enable << 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//there is no current command. receive one
|
||||
switch(val)
|
||||
{
|
||||
case 0: break; //??
|
||||
|
||||
case BM_CMD_WRITEDISABLE:
|
||||
write_enable = FALSE;
|
||||
break;
|
||||
|
||||
case BM_CMD_READSTATUS:
|
||||
com = BM_CMD_READSTATUS;
|
||||
break;
|
||||
|
||||
case BM_CMD_WRITEENABLE:
|
||||
write_enable = TRUE;
|
||||
break;
|
||||
|
||||
case BM_CMD_WRITELOW:
|
||||
case BM_CMD_READLOW:
|
||||
//printf("XLO: %08X\n",addr);
|
||||
com = val;
|
||||
addr_counter = 0;
|
||||
addr = 0;
|
||||
break;
|
||||
|
||||
case BM_CMD_WRITEHIGH:
|
||||
case BM_CMD_READHIGH:
|
||||
//printf("XHI: %08X\n",addr);
|
||||
if(val == BM_CMD_WRITEHIGH) val = BM_CMD_WRITELOW;
|
||||
if(val == BM_CMD_READHIGH) val = BM_CMD_READLOW;
|
||||
com = val;
|
||||
addr_counter = 0;
|
||||
addr = 0;
|
||||
if(addr_size==1) {
|
||||
//"write command that's only available on ST M95040-W that I know of"
|
||||
//this makes sense, since this device would only have a 256 bytes address space with writelow
|
||||
//and writehigh would allow access to the upper 256 bytes
|
||||
//but it was detected in pokemon diamond also during the main save process
|
||||
addr = 0x1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("COMMAND: Unhandled Backup Memory command: %02X\n", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
//guarantees that the data buffer has room enough for the specified number of bytes
|
||||
void BackupDevice::ensure(u32 addr)
|
||||
{
|
||||
u32 size = data.size();
|
||||
if(size<addr)
|
||||
{
|
||||
data.resize(addr);
|
||||
}
|
||||
for(u32 i=size;i<addr;i++)
|
||||
data[i] = kUninitializedSaveDataValue;
|
||||
}
|
||||
|
||||
|
||||
u32 BackupDevice::addr_size_for_old_save_size(int bupmem_size)
|
||||
{
|
||||
switch(bupmem_size) {
|
||||
case MC_SIZE_4KBITS:
|
||||
return 1;
|
||||
case MC_SIZE_64KBITS:
|
||||
case MC_SIZE_256KBITS:
|
||||
case MC_SIZE_512KBITS:
|
||||
return 2;
|
||||
case MC_SIZE_1MBITS:
|
||||
case MC_SIZE_2MBITS:
|
||||
case MC_SIZE_4MBITS:
|
||||
case MC_SIZE_8MBITS:
|
||||
case MC_SIZE_16MBITS:
|
||||
case MC_SIZE_64MBITS:
|
||||
return 3;
|
||||
default:
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
u32 BackupDevice::addr_size_for_old_save_type(int bupmem_type)
|
||||
{
|
||||
switch(bupmem_type)
|
||||
{
|
||||
case MC_TYPE_EEPROM1:
|
||||
return 1;
|
||||
case MC_TYPE_EEPROM2:
|
||||
case MC_TYPE_FRAM:
|
||||
return 2;
|
||||
case MC_TYPE_FLASH:
|
||||
return 3;
|
||||
default:
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BackupDevice::load_old_state(u32 addr_size, u8* data, u32 datasize)
|
||||
{
|
||||
state = RUNNING;
|
||||
this->addr_size = addr_size;
|
||||
this->data.resize(datasize);
|
||||
memcpy(&this->data[0],data,datasize);
|
||||
|
||||
//dump back out as a dsv, just to keep things sane
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
void BackupDevice::loadfile()
|
||||
{
|
||||
//never use save files if we are in movie mode
|
||||
if(isMovieMode) return;
|
||||
if(filename.length() ==0) return; //No sense crashing if no filename supplied
|
||||
|
||||
FILE* inf = fopen(filename.c_str(),"rb");
|
||||
if(!inf)
|
||||
{
|
||||
//no dsv found; we need to try auto-importing a file with .sav extension
|
||||
printf("DeSmuME .dsv save file not found. Trying to load an old raw .sav file.\n");
|
||||
|
||||
//change extension to sav
|
||||
char tmp[MAX_PATH];
|
||||
strcpy(tmp,filename.c_str());
|
||||
tmp[strlen(tmp)-3] = 0;
|
||||
strcat(tmp,"sav");
|
||||
|
||||
inf = fopen(tmp,"rb");
|
||||
if(!inf)
|
||||
{
|
||||
printf("Missing save file %s\n",filename.c_str());
|
||||
return;
|
||||
}
|
||||
fclose(inf);
|
||||
|
||||
load_raw(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
//scan for desmume save footer
|
||||
const s32 cookieLen = (s32)strlen(kDesmumeSaveCookie);
|
||||
char *sigbuf = new char[cookieLen];
|
||||
fseek(inf, -cookieLen, SEEK_END);
|
||||
fread(sigbuf,1,cookieLen,inf);
|
||||
int cmp = memcmp(sigbuf,kDesmumeSaveCookie,cookieLen);
|
||||
delete[] sigbuf;
|
||||
if(cmp)
|
||||
{
|
||||
//maybe it is a misnamed raw save file. try loading it that way
|
||||
printf("Not a DeSmuME .dsv save file. Trying to load as raw.\n");
|
||||
fclose(inf);
|
||||
load_raw(filename.c_str());
|
||||
return;
|
||||
}
|
||||
//desmume format
|
||||
fseek(inf, -cookieLen, SEEK_END);
|
||||
fseek(inf, -4, SEEK_CUR);
|
||||
u32 version = 0xFFFFFFFF;
|
||||
read32le(&version,inf);
|
||||
if(version!=0) {
|
||||
printf("Unknown save file format\n");
|
||||
return;
|
||||
}
|
||||
fseek(inf, -24, SEEK_CUR);
|
||||
struct {
|
||||
u32 size,padSize,type,addr_size,mem_size;
|
||||
} info;
|
||||
read32le(&info.size,inf);
|
||||
read32le(&info.padSize,inf);
|
||||
read32le(&info.type,inf);
|
||||
read32le(&info.addr_size,inf);
|
||||
read32le(&info.mem_size,inf);
|
||||
|
||||
//establish the save data
|
||||
data.resize(info.size);
|
||||
fseek(inf, 0, SEEK_SET);
|
||||
if(info.size>0)
|
||||
fread(&data[0],1,info.size,inf); //read all the raw data we have
|
||||
state = RUNNING;
|
||||
addr_size = info.addr_size;
|
||||
//none of the other fields are used right now
|
||||
|
||||
fclose(inf);
|
||||
}
|
||||
}
|
||||
|
||||
bool BackupDevice::save_raw(const char* filename)
|
||||
{
|
||||
FILE* outf = fopen(filename,"wb");
|
||||
if(!outf) return false;
|
||||
u32 size = data.size();
|
||||
u32 padSize = pad_up_size(size);
|
||||
if(data.size()>0)
|
||||
fwrite(&data[0],1,size,outf);
|
||||
for(u32 i=size;i<padSize;i++)
|
||||
fputc(kUninitializedSaveDataValue,outf);
|
||||
fclose(outf);
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 BackupDevice::pad_up_size(u32 startSize)
|
||||
{
|
||||
u32 size = startSize;
|
||||
u32 ctr=0;
|
||||
while(ctr<saveSizes_count && size > saveSizes[ctr]) ctr++;
|
||||
u32 padSize = saveSizes[ctr];
|
||||
if(padSize == 0xFFFFFFFF)
|
||||
{
|
||||
printf("PANIC! Couldn't pad up save size. Refusing to pad.\n");
|
||||
padSize = startSize;
|
||||
}
|
||||
return padSize;
|
||||
}
|
||||
|
||||
void BackupDevice::lazy_flush()
|
||||
{
|
||||
if(flushPending || lazyFlushPending)
|
||||
{
|
||||
lazyFlushPending = flushPending = false;
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
void BackupDevice::flush()
|
||||
{
|
||||
//never use save files if we are in movie mode
|
||||
if(isMovieMode) return;
|
||||
|
||||
FILE* outf = fopen(filename.c_str(),"wb");
|
||||
if(outf)
|
||||
{
|
||||
if(data.size()>0)
|
||||
fwrite(&data[0],1,data.size(),outf);
|
||||
|
||||
//write the footer. we use a footer so that we can maximize the chance of the
|
||||
//save file being recognized as a raw save file by other emulators etc.
|
||||
|
||||
//first, pad up to the next largest known save size.
|
||||
u32 size = data.size();
|
||||
u32 padSize = pad_up_size(size);
|
||||
|
||||
for(u32 i=size;i<padSize;i++)
|
||||
fputc(kUninitializedSaveDataValue,outf);
|
||||
|
||||
//this is just for humans to read
|
||||
fprintf(outf,"|<--Snip above here to create a raw sav by excluding this DeSmuME savedata footer:");
|
||||
|
||||
//and now the actual footer
|
||||
write32le(size,outf); //the size of data that has actually been written
|
||||
write32le(padSize,outf); //the size we padded it to
|
||||
write32le(0,outf); //save memory type
|
||||
write32le(addr_size,outf);
|
||||
write32le(0,outf); //save memory size
|
||||
write32le(0,outf); //version number
|
||||
fprintf(outf, "%s", kDesmumeSaveCookie); //this is what we'll use to recognize the desmume format save
|
||||
|
||||
|
||||
fclose(outf);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Unable to open savefile %s\n",filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void BackupDevice::raw_applyUserSettings(u32& size)
|
||||
{
|
||||
//respect the user's choice of backup memory type
|
||||
if(CommonSettings.manualBackupType == MC_TYPE_AUTODETECT)
|
||||
addr_size = addr_size_for_old_save_size(size);
|
||||
else
|
||||
{
|
||||
int savetype = save_types[CommonSettings.manualBackupType][0];
|
||||
int savesize = save_types[CommonSettings.manualBackupType][1];
|
||||
addr_size = addr_size_for_old_save_type(savetype);
|
||||
if((u32)savesize<size) size = savesize;
|
||||
}
|
||||
|
||||
state = RUNNING;
|
||||
}
|
||||
|
||||
|
||||
bool BackupDevice::load_raw(const char* filename)
|
||||
{
|
||||
FILE* inf = fopen(filename,"rb");
|
||||
fseek(inf, 0, SEEK_END);
|
||||
u32 size = (u32)ftell(inf);
|
||||
fseek(inf, 0, SEEK_SET);
|
||||
|
||||
raw_applyUserSettings(size);
|
||||
|
||||
data.resize(size);
|
||||
fread(&data[0],1,size,inf);
|
||||
fclose(inf);
|
||||
|
||||
//dump back out as a dsv, just to keep things sane
|
||||
flush();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool BackupDevice::load_duc(const char* filename)
|
||||
{
|
||||
u32 size;
|
||||
char id[16];
|
||||
FILE* file = fopen(filename, "rb");
|
||||
if(file == NULL)
|
||||
return false;
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
size = (u32)ftell(file) - 500;
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
// Make sure we really have the right file
|
||||
fread((void *)id, sizeof(char), 16, file);
|
||||
|
||||
if (memcmp(id, "ARDS000000000001", 16) != 0)
|
||||
{
|
||||
printf("Not recognized as a valid DUC file\n");
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
// Skip the rest of the header since we don't need it
|
||||
fseek(file, 500, SEEK_SET);
|
||||
|
||||
raw_applyUserSettings(size);
|
||||
|
||||
ensure((u32)size);
|
||||
|
||||
fread(&data[0],1,size,file);
|
||||
fclose(file);
|
||||
|
||||
//choose
|
||||
|
||||
flush();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool BackupDevice::load_movie(std::istream* is) {
|
||||
|
||||
const s32 cookieLen = (s32)strlen(kDesmumeSaveCookie);
|
||||
|
||||
is->seekg(-cookieLen, std::ios::end);
|
||||
is->seekg(-4, std::ios::cur);
|
||||
|
||||
u32 version = 0xFFFFFFFF;
|
||||
is->read((char*)&version,4);
|
||||
if(version!=0) {
|
||||
printf("Unknown save file format\n");
|
||||
return false;
|
||||
}
|
||||
is->seekg(-24, std::ios::cur);
|
||||
|
||||
struct{
|
||||
u32 size,padSize,type,addr_size,mem_size;
|
||||
}info;
|
||||
|
||||
is->read((char*)&info.size,4);
|
||||
is->read((char*)&info.padSize,4);
|
||||
is->read((char*)&info.type,4);
|
||||
is->read((char*)&info.addr_size,4);
|
||||
is->read((char*)&info.mem_size,4);
|
||||
|
||||
//establish the save data
|
||||
data.resize(info.size);
|
||||
is->seekg(0, std::ios::beg);
|
||||
if(info.size>0)
|
||||
is->read((char*)&data[0],info.size);
|
||||
|
||||
state = RUNNING;
|
||||
addr_size = info.addr_size;
|
||||
//none of the other fields are used right now
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/* mic.cpp - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2009 DeSmuME Team
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#include "types.h"
|
||||
#include "mic.h"
|
||||
|
||||
static BOOL silence = TRUE;
|
||||
int MicButtonPressed;
|
||||
|
||||
BOOL Mic_Init()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Mic_Reset()
|
||||
{
|
||||
}
|
||||
|
||||
void Mic_DeInit()
|
||||
{
|
||||
}
|
||||
|
||||
u8 Mic_ReadSample()
|
||||
{
|
||||
if (silence)
|
||||
return 0;
|
||||
|
||||
return 150;
|
||||
}
|
||||
|
||||
void Mic_DoNoise(BOOL noise)
|
||||
{
|
||||
silence = !noise;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,42 +0,0 @@
|
|||
/* mic.h - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2009 DeSmuME Team
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef MIC_H
|
||||
#define MIC_H
|
||||
|
||||
extern int MicButtonPressed;
|
||||
|
||||
#ifdef WIN32
|
||||
static char MicSampleName[256];
|
||||
bool LoadSample(const char *name);
|
||||
#endif
|
||||
|
||||
extern int MicDisplay;
|
||||
|
||||
#ifdef FAKE_MIC
|
||||
void Mic_DoNoise(BOOL);
|
||||
#endif
|
||||
|
||||
BOOL Mic_Init();
|
||||
void Mic_Reset();
|
||||
void Mic_DeInit();
|
||||
u8 Mic_ReadSample();
|
||||
|
||||
#endif
|
|
@ -1,148 +0,0 @@
|
|||
/* mic_alsa.cpp - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2009 DeSmuME Team
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "types.h"
|
||||
#include "mic.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define MIC_BUFSIZE 4096
|
||||
|
||||
BOOL Mic_Inited = FALSE;
|
||||
u8 Mic_Buffer[2][MIC_BUFSIZE];
|
||||
u16 Mic_BufPos;
|
||||
u8 Mic_PlayBuf;
|
||||
u8 Mic_WriteBuf;
|
||||
|
||||
int MicButtonPressed;
|
||||
|
||||
// Handle for the PCM device
|
||||
static snd_pcm_t *pcm_handle;
|
||||
|
||||
BOOL Mic_Init()
|
||||
{
|
||||
snd_pcm_hw_params_t *hwparams;
|
||||
|
||||
if (Mic_Inited)
|
||||
return TRUE;
|
||||
|
||||
// Open the default sound card in capture
|
||||
if (snd_pcm_open(&pcm_handle, "plughw:0,0", SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK) < 0)
|
||||
return FALSE;
|
||||
|
||||
// Allocate the snd_pcm_hw_params_t structure and fill it.
|
||||
snd_pcm_hw_params_alloca(&hwparams);
|
||||
if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0)
|
||||
return FALSE;
|
||||
|
||||
//Set the access
|
||||
if (snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
|
||||
return FALSE ;
|
||||
|
||||
//dir 0 == exacte (Rate = 16K exacte)
|
||||
if (snd_pcm_hw_params_set_rate(pcm_handle, hwparams, 16000, 0) < 0)
|
||||
return FALSE;
|
||||
|
||||
/* Set sample format */
|
||||
if (snd_pcm_hw_params_set_format(pcm_handle, hwparams, SND_PCM_FORMAT_S8) < 0)
|
||||
return FALSE;
|
||||
|
||||
// Set one channel (mono)
|
||||
if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 1) < 0)
|
||||
return FALSE;
|
||||
|
||||
// Set 2 periods
|
||||
if (snd_pcm_hw_params_set_periods(pcm_handle, hwparams, 2, 0) < 0)
|
||||
return FALSE;
|
||||
|
||||
// Set the buffer sise
|
||||
if (snd_pcm_hw_params_set_buffer_size(pcm_handle, hwparams, MIC_BUFSIZE) < 0)
|
||||
return FALSE;
|
||||
|
||||
//Set the params
|
||||
if (snd_pcm_hw_params(pcm_handle, hwparams) < 0)
|
||||
return FALSE;
|
||||
|
||||
Mic_Inited = TRUE;
|
||||
Mic_Reset();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Mic_Reset()
|
||||
{
|
||||
if (!Mic_Inited)
|
||||
return;
|
||||
|
||||
memset(Mic_Buffer, 0, MIC_BUFSIZE * 2);
|
||||
Mic_BufPos = 0;
|
||||
Mic_PlayBuf = 1;
|
||||
Mic_WriteBuf = 0;
|
||||
}
|
||||
|
||||
void Mic_DeInit()
|
||||
{
|
||||
if (!Mic_Inited)
|
||||
return;
|
||||
|
||||
Mic_Inited = FALSE;
|
||||
|
||||
snd_pcm_drop(pcm_handle);
|
||||
snd_pcm_close(pcm_handle);
|
||||
}
|
||||
|
||||
static void snd_pcm_read()
|
||||
{
|
||||
int error;
|
||||
|
||||
error = snd_pcm_readi(pcm_handle, Mic_Buffer[Mic_WriteBuf], MIC_BUFSIZE);
|
||||
if (error < 0)
|
||||
error = snd_pcm_recover(pcm_handle, error, 0);
|
||||
if (error < 0)
|
||||
LOG("snd_pcm_readi FAIL!: %s\n", snd_strerror(error));
|
||||
}
|
||||
|
||||
u8 Mic_ReadSample()
|
||||
{
|
||||
u8 tmp;
|
||||
u8 ret;
|
||||
|
||||
if (!Mic_Inited)
|
||||
return 0;
|
||||
|
||||
tmp = Mic_Buffer[Mic_PlayBuf][Mic_BufPos >> 1];
|
||||
|
||||
if (Mic_BufPos & 0x1) {
|
||||
ret = ((tmp & 0x1) << 7);
|
||||
} else {
|
||||
ret = ((tmp & 0xFE) >> 1);
|
||||
snd_pcm_read();
|
||||
}
|
||||
|
||||
Mic_BufPos++;
|
||||
if (Mic_BufPos >= (MIC_BUFSIZE << 1)) {
|
||||
snd_pcm_read();
|
||||
Mic_BufPos = 0;
|
||||
Mic_PlayBuf ^= 1;
|
||||
Mic_WriteBuf ^= 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -1,360 +0,0 @@
|
|||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
#include "resource.h"
|
||||
#else
|
||||
#include <glib.h>
|
||||
#endif
|
||||
#include "time.h"
|
||||
#include "utils/xstring.h"
|
||||
|
||||
class PathInfo
|
||||
{
|
||||
public:
|
||||
|
||||
std::string path;
|
||||
std::string RomName;
|
||||
|
||||
#define MAX_FORMAT 20
|
||||
#define SECTION "PathSettings"
|
||||
|
||||
#define ROMKEY "Roms"
|
||||
#define BATTERYKEY "Battery"
|
||||
#define STATEKEY "States"
|
||||
#define SCREENSHOTKEY "Screenshots"
|
||||
#define AVIKEY "AviFiles"
|
||||
#define CHEATKEY "Cheats"
|
||||
#define SOUNDKEY "SoundSamples"
|
||||
#define FIRMWAREKEY "Firmware"
|
||||
#define FORMATKEY "format"
|
||||
#define DEFAULTFORMATKEY "defaultFormat"
|
||||
#define NEEDSSAVINGKEY "needsSaving"
|
||||
#define LASTVISITKEY "lastVisit"
|
||||
#define LUAKEY "Lua"
|
||||
char screenshotFormat[MAX_FORMAT];
|
||||
bool savelastromvisit;
|
||||
|
||||
enum KnownPath
|
||||
{
|
||||
FIRSTKNOWNPATH = 0,
|
||||
ROMS = 0,
|
||||
BATTERY,
|
||||
STATES,
|
||||
SCREENSHOTS,
|
||||
AVI_FILES,
|
||||
CHEATS,
|
||||
SOUNDS,
|
||||
FIRMWARE,
|
||||
MODULE,
|
||||
MAXKNOWNPATH = MODULE
|
||||
};
|
||||
|
||||
char pathToRoms[MAX_PATH];
|
||||
char pathToBattery[MAX_PATH];
|
||||
char pathToStates[MAX_PATH];
|
||||
char pathToScreenshots[MAX_PATH];
|
||||
char pathToAviFiles[MAX_PATH];
|
||||
char pathToCheats[MAX_PATH];
|
||||
char pathToSounds[MAX_PATH];
|
||||
char pathToFirmware[MAX_PATH];
|
||||
char pathToModule[MAX_PATH];
|
||||
char pathToLua[MAX_PATH];
|
||||
|
||||
void init(const char * filename) {
|
||||
|
||||
path = std::string(filename);
|
||||
|
||||
//extract the internal part of the logical rom name
|
||||
std::vector<std::string> parts = tokenize_str(filename,"|");
|
||||
SetRomName(parts[parts.size()-1].c_str());
|
||||
LoadModulePath();
|
||||
#ifndef WIN32
|
||||
|
||||
ReadPathSettings();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void LoadModulePath()
|
||||
{
|
||||
#ifdef WIN32
|
||||
char *p;
|
||||
ZeroMemory(pathToModule, sizeof(pathToModule));
|
||||
GetModuleFileName(NULL, pathToModule, sizeof(pathToModule));
|
||||
p = pathToModule + lstrlen(pathToModule);
|
||||
while (p >= pathToModule && *p != '\\') p--;
|
||||
if (++p >= pathToModule) *p = 0;
|
||||
#else
|
||||
// strcpy(pathToModule, g_get_home_dir());
|
||||
const char *homedir = getenv ("HOME");
|
||||
strcpy(pathToModule, homedir);
|
||||
#endif
|
||||
}
|
||||
|
||||
enum Action
|
||||
{
|
||||
GET,
|
||||
SET
|
||||
};
|
||||
|
||||
void GetDefaultPath(char *pathToDefault, const char *key, int maxCount)
|
||||
{
|
||||
strncpy(pathToDefault, pathToModule, maxCount);
|
||||
}
|
||||
|
||||
void ReadKey(char *pathToRead, const char *key)
|
||||
{
|
||||
#ifdef WIN32
|
||||
GetPrivateProfileString(SECTION, key, key, pathToRead, MAX_PATH, IniName);
|
||||
if(strcmp(pathToRead, key) == 0)
|
||||
#endif
|
||||
//since the variables are all intialized in this file they all use MAX_PATH
|
||||
GetDefaultPath(pathToRead, key, MAX_PATH);
|
||||
}
|
||||
|
||||
void ReadPathSettings()
|
||||
{
|
||||
if( ( strcmp(pathToModule, "") == 0) || !pathToModule)
|
||||
LoadModulePath();
|
||||
|
||||
ReadKey(pathToRoms, ROMKEY);
|
||||
ReadKey(pathToBattery, BATTERYKEY);
|
||||
ReadKey(pathToStates, STATEKEY);
|
||||
ReadKey(pathToScreenshots, SCREENSHOTKEY);
|
||||
ReadKey(pathToAviFiles, AVIKEY);
|
||||
ReadKey(pathToCheats, CHEATKEY);
|
||||
ReadKey(pathToSounds, SOUNDKEY);
|
||||
ReadKey(pathToFirmware, FIRMWAREKEY);
|
||||
ReadKey(pathToLua, LUAKEY);
|
||||
#ifdef WIN32
|
||||
GetPrivateProfileString(SECTION, FORMATKEY, "%f_%s_%r", screenshotFormat, MAX_FORMAT, IniName);
|
||||
savelastromvisit = GetPrivateProfileInt(SECTION, LASTVISITKEY, TRUE, IniName);
|
||||
currentimageformat = (ImageFormat)GetPrivateProfileInt(SECTION, DEFAULTFORMATKEY, PNG, IniName);
|
||||
#endif
|
||||
/*
|
||||
needsSaving = GetPrivateProfileInt(SECTION, NEEDSSAVINGKEY, TRUE, IniName);
|
||||
if(needsSaving)
|
||||
{
|
||||
needsSaving = FALSE;
|
||||
WritePathSettings();
|
||||
}*/
|
||||
}
|
||||
|
||||
void SwitchPath(Action action, KnownPath path, char * buffer)
|
||||
{
|
||||
char *pathToCopy = 0;
|
||||
switch(path)
|
||||
{
|
||||
case ROMS:
|
||||
pathToCopy = pathToRoms;
|
||||
break;
|
||||
case BATTERY:
|
||||
pathToCopy = pathToBattery;
|
||||
break;
|
||||
case STATES:
|
||||
pathToCopy = pathToStates;
|
||||
break;
|
||||
case SCREENSHOTS:
|
||||
pathToCopy = pathToScreenshots;
|
||||
break;
|
||||
case AVI_FILES:
|
||||
pathToCopy = pathToAviFiles;
|
||||
break;
|
||||
case CHEATS:
|
||||
pathToCopy = pathToCheats;
|
||||
break;
|
||||
case SOUNDS:
|
||||
pathToCopy = pathToSounds;
|
||||
break;
|
||||
case FIRMWARE:
|
||||
pathToCopy = pathToFirmware;
|
||||
break;
|
||||
case MODULE:
|
||||
pathToCopy = pathToModule;
|
||||
break;
|
||||
}
|
||||
|
||||
if(action == GET)
|
||||
{
|
||||
strncpy(buffer, pathToCopy, MAX_PATH);
|
||||
int len = strlen(buffer)-1;
|
||||
#ifdef WIN32
|
||||
if(buffer[len] != '\\')
|
||||
strcat(buffer, "\\");
|
||||
#else
|
||||
if(buffer[len] != '/')
|
||||
strcat(buffer, "/");
|
||||
#endif
|
||||
|
||||
}
|
||||
else if(action == SET)
|
||||
{
|
||||
int len = strlen(buffer)-1;
|
||||
if(buffer[len] == '\\')
|
||||
buffer[len] = '\0';
|
||||
|
||||
strncpy(pathToCopy, buffer, MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
std::string getpath(KnownPath path)
|
||||
{
|
||||
char temp[MAX_PATH];
|
||||
SwitchPath(GET, path, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
void getpath(KnownPath path, char *buffer)
|
||||
{
|
||||
SwitchPath(GET, path, buffer);
|
||||
}
|
||||
|
||||
void setpath(KnownPath path, char *buffer)
|
||||
{
|
||||
SwitchPath(SET, path, buffer);
|
||||
}
|
||||
|
||||
void getfilename(char *buffer, int maxCount)
|
||||
{
|
||||
strcpy(buffer,noextension().c_str());
|
||||
}
|
||||
|
||||
void getpathnoext(KnownPath path, char *buffer)
|
||||
{
|
||||
getpath(path, buffer);
|
||||
strcat(buffer, GetRomNameWithoutExtension().c_str());
|
||||
}
|
||||
|
||||
std::string extension() {
|
||||
|
||||
for(int i = int(path.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (path[i] == '.') {
|
||||
return path.substr(i+1);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string noextension() {
|
||||
|
||||
for(int i = int(path.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (path[i] == '.') {
|
||||
return path.substr(0, i);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
void formatname(char *output)
|
||||
{
|
||||
std::string file;
|
||||
time_t now = time(NULL);
|
||||
tm *time_struct = localtime(&now);
|
||||
srand(now);
|
||||
|
||||
for(int i = 0; i < MAX_FORMAT;i++)
|
||||
{
|
||||
char *c = &screenshotFormat[i];
|
||||
char tmp[MAX_PATH] = {0};
|
||||
|
||||
if(*c == '%')
|
||||
{
|
||||
c = &screenshotFormat[++i];
|
||||
switch(*c)
|
||||
{
|
||||
case 'f':
|
||||
|
||||
strcat(tmp, GetRomNameWithoutExtension().c_str());
|
||||
break;
|
||||
case 'D':
|
||||
strftime(tmp, MAX_PATH, "%d", time_struct);
|
||||
break;
|
||||
case 'M':
|
||||
strftime(tmp, MAX_PATH, "%m", time_struct);
|
||||
break;
|
||||
case 'Y':
|
||||
strftime(tmp, MAX_PATH, "%Y", time_struct);
|
||||
break;
|
||||
case 'h':
|
||||
strftime(tmp, MAX_PATH, "%H", time_struct);
|
||||
break;
|
||||
case 'm':
|
||||
strftime(tmp, MAX_PATH, "%M", time_struct);
|
||||
break;
|
||||
case 's':
|
||||
strftime(tmp, MAX_PATH, "%S", time_struct);
|
||||
break;
|
||||
case 'r':
|
||||
sprintf(tmp, "%d", rand() % RAND_MAX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int j;
|
||||
for(j=i;j<MAX_FORMAT-i;j++)
|
||||
if(screenshotFormat[j] != '%')
|
||||
tmp[j-i]=screenshotFormat[j];
|
||||
else
|
||||
break;
|
||||
tmp[j-i]='\0';
|
||||
}
|
||||
file += tmp;
|
||||
}
|
||||
strncpy(output, file.c_str(), MAX_PATH);
|
||||
}
|
||||
|
||||
enum ImageFormat
|
||||
{
|
||||
#ifdef WIN32
|
||||
PNG = IDC_PNG,
|
||||
BMP = IDC_BMP
|
||||
#else
|
||||
PNG,
|
||||
BMP
|
||||
#endif
|
||||
};
|
||||
|
||||
ImageFormat currentimageformat;
|
||||
|
||||
ImageFormat imageformat() {
|
||||
return currentimageformat;
|
||||
}
|
||||
|
||||
void SetRomName(const char *filename)
|
||||
{
|
||||
std::string str = filename;
|
||||
|
||||
//Truncate the path from filename
|
||||
int x = str.find_last_of("/\\");
|
||||
if (x > 0)
|
||||
str = str.substr(x+1);
|
||||
RomName = str;
|
||||
}
|
||||
|
||||
const char *GetRomName()
|
||||
{
|
||||
return RomName.c_str();
|
||||
}
|
||||
|
||||
std::string GetRomNameWithoutExtension()
|
||||
{
|
||||
int x = RomName.find_last_of(".");
|
||||
if (x > 0)
|
||||
return RomName.substr(0,x);
|
||||
else return RomName;
|
||||
}
|
||||
|
||||
bool isdsgba(std::string str) {
|
||||
int x = str.find_last_of(".");
|
||||
if (x > 0)
|
||||
str = str.substr(x-2);
|
||||
if(!strcmp(str.c_str(), "ds.gba"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
extern PathInfo path;
|
|
@ -1,86 +0,0 @@
|
|||
/* Copyright (C) 2009 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
//todo - everyone will want to support this eventually, i suppose
|
||||
#ifdef _MSC_VER
|
||||
#include "svnrev.h"
|
||||
#else
|
||||
#ifdef SVN_REV
|
||||
#define SVN_REV_STR SVN_REV
|
||||
#else
|
||||
#define SVN_REV_STR ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DESMUME_NAME "DeSmuME"
|
||||
|
||||
#ifdef _WIN64
|
||||
#define DESMUME_PLATFORM_STRING " x64"
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#define DESMUME_PLATFORM_STRING " x86"
|
||||
#else
|
||||
#define DESMUME_PLATFORM_STRING ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_SSE2
|
||||
#ifndef ENABLE_SSE
|
||||
#define DESMUME_CPUEXT_STRING " NOSSE"
|
||||
#else
|
||||
#define DESMUME_CPUEXT_STRING " NOSSE2"
|
||||
#endif
|
||||
#else
|
||||
#define DESMUME_CPUEXT_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
#define DESMUME_FEATURE_STRING " dev+"
|
||||
#else
|
||||
#define DESMUME_FEATURE_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DESMUME_SUBVERSION_STRING " debug"
|
||||
#elif defined(PUBLIC_RELEASE)
|
||||
#define DESMUME_SUBVERSION_STRING ""
|
||||
#else
|
||||
#define DESMUME_SUBVERSION_STRING " svn" SVN_REV_STR
|
||||
#endif
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define DESMUME_COMPILER " (Intel) "
|
||||
#define DESMUME_COMPILER_DETAIL " (Intel) "
|
||||
#elif defined(_MSC_VER)
|
||||
#define DESMUME_COMPILER ""
|
||||
#define DESMUME_COMPILER_DETAIL " msvc " _Py_STRINGIZE(_MSC_VER)
|
||||
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
||||
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
||||
#define _Py_STRINGIZE2(X) #X
|
||||
//re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5
|
||||
#else
|
||||
// TODO: make for others compilers
|
||||
#define DESMUME_COMPILER ""
|
||||
#define DESMUME_COMPILER_DETAIL ""
|
||||
#endif
|
||||
|
||||
#define DESMUME_VERSION_NUMERIC 90500
|
||||
#define DESMUME_VERSION_STRING " " "0.9.5" DESMUME_SUBVERSION_STRING DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_COMPILER
|
||||
#define DESMUME_NAME_AND_VERSION " " DESMUME_NAME DESMUME_VERSION_STRING
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 10
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeSmuME_VS2010", "DeSmuME_2010.vcxproj", "{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release FastBuild|Win32 = Release FastBuild|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release FastBuild|Win32.ActiveCfg = Release FastBuild|Win32
|
||||
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release FastBuild|Win32.Build.0 = Release FastBuild|Win32
|
||||
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,393 +0,0 @@
|
|||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release FastBuild|Win32">
|
||||
<Configuration>Release FastBuild</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>DeSmuME_VS2010</ProjectName>
|
||||
<ProjectGUID>{9F5F72A1-D3A5-4918-B460-E076B16D10A9}</ProjectGUID>
|
||||
<RootNamespace>DeSmuME</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCINSTALLDIR)\VCProjectDefaults\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.props" Condition="exists('$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.props" Condition="exists('$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">
|
||||
<Import Project="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.props" Condition="exists('$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\__bins\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\.VS2010\$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_debug</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\__bins\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\.VS2010\$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_release</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">$(SolutionDir)\__bins\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">$(SolutionDir)\.VS2010\$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">$(ProjectName)_releaseFastBuild</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>defaultconfig\SubWCRev.bat</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..;lua\lua-5.1.4\src;glib-2.20.1\build;glib-2.20.1\build\glib;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;EXPERIMENTAL_WIFI;HAVE_LIBZ;HAVE_LIBZZIP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lua-5.1.4-x86.lib;glib-2.20.1-x86.lib;vfw32.lib;winmm.lib;opengl32.lib;glu32.lib;ws2_32.lib;user32.lib;gdi32.lib;directx\dxguid.lib;shell32.lib;comdlg32.lib;directx\dxerr8.lib;directx\dsound.lib;directx\dinput8.lib;directx\ddraw.lib;zlib-2005-x32.lib;zziplib-2005-x32.lib;shlwapi.lib;winpcap\wpcap.lib;7zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>.\zlib123;.\zziplib;glib-2.20.1\lib;lua\lib;.\7z;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DeSmuME_x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>defaultconfig\SubWCRev.bat</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..;lua\lua-5.1.4\src;glib-2.20.1\build;glib-2.20.1\build\glib;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;RELEASE;EXPERIMENTAL_WIFI;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lua-5.1.4-x86.lib;glib-2.20.1-x86.lib;vfw32.lib;winmm.lib;opengl32.lib;glu32.lib;ws2_32.lib;user32.lib;gdi32.lib;directx\dxguid.lib;shell32.lib;comdlg32.lib;directx\dxerr8.lib;directx\dsound.lib;directx\dinput8.lib;directx\ddraw.lib;zlib-2005-x32.lib;zziplib-2005-x32.lib;shlwapi.lib;winpcap\wpcap.lib;7zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>.\zlib123;.\zziplib;glib-2.20.1\lib;lua\lib;.\7z;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<Profile>false</Profile>
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DeSmuME_x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>defaultconfig\SubWCRev.bat</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..;lua\lua-5.1.4\src;glib-2.20.1\build;glib-2.20.1\build\glib;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;RELEASE;EXPERIMENTAL_WIFI;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lua-5.1.4-x86.lib;glib-2.20.1-x86.lib;vfw32.lib;winmm.lib;opengl32.lib;glu32.lib;ws2_32.lib;user32.lib;gdi32.lib;directx\dxguid.lib;shell32.lib;comdlg32.lib;directx\dxerr8.lib;directx\dsound.lib;directx\dinput8.lib;directx\ddraw.lib;zlib-2005-x32.lib;zziplib-2005-x32.lib;shlwapi.lib;winpcap\wpcap.lib;7zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>.\zlib123;.\zziplib;glib-2.20.1\lib;lua\lib;.\7z;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<LinkTimeCodeGeneration>
|
||||
</LinkTimeCodeGeneration>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<Profile>false</Profile>
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DeSmuME_x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\addons.cpp" />
|
||||
<ClCompile Include="..\addons\compactFlash.cpp" />
|
||||
<ClCompile Include="..\addons\gbagame.cpp" />
|
||||
<ClCompile Include="..\addons\none.cpp" />
|
||||
<ClCompile Include="..\addons\rumblepak.cpp" />
|
||||
<ClCompile Include="..\armcpu.cpp" />
|
||||
<ClCompile Include="..\arm_instructions.cpp" />
|
||||
<ClCompile Include="..\bios.cpp" />
|
||||
<ClCompile Include="..\cheatSystem.cpp" />
|
||||
<ClCompile Include="..\commandline.cpp">
|
||||
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Cdecl</CallingConvention>
|
||||
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">Cdecl</CallingConvention>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\common.cpp" />
|
||||
<ClCompile Include="..\cp15.cpp" />
|
||||
<ClCompile Include="..\debug.cpp" />
|
||||
<ClCompile Include="..\Disassembler.cpp" />
|
||||
<ClCompile Include="..\FIFO.cpp" />
|
||||
<ClCompile Include="..\fs-windows.cpp" />
|
||||
<ClCompile Include="..\gdbstub\gdbstub.cpp" />
|
||||
<ClCompile Include="..\gfx3d.cpp" />
|
||||
<ClCompile Include="..\GPU.cpp" />
|
||||
<ClCompile Include="..\GPU_OSD.cpp" />
|
||||
<ClCompile Include="..\lua-engine.cpp" />
|
||||
<ClCompile Include="..\matrix.cpp" />
|
||||
<ClCompile Include="..\mc.cpp" />
|
||||
<ClCompile Include="..\MMU.cpp" />
|
||||
<ClCompile Include="..\movie.cpp" />
|
||||
<ClCompile Include="..\NDSSystem.cpp" />
|
||||
<ClCompile Include="..\OGLRender.cpp" />
|
||||
<ClCompile Include="..\rasterize.cpp" />
|
||||
<ClCompile Include="..\readwrite.cpp" />
|
||||
<ClCompile Include="..\render3D.cpp" />
|
||||
<ClCompile Include="..\ROMReader.cpp" />
|
||||
<ClCompile Include="..\rtc.cpp" />
|
||||
<ClCompile Include="..\saves.cpp" />
|
||||
<ClCompile Include="..\softrender.cpp" />
|
||||
<ClCompile Include="..\SPU.cpp" />
|
||||
<ClCompile Include="..\texcache.cpp" />
|
||||
<ClCompile Include="..\thumb_instructions.cpp" />
|
||||
<ClCompile Include="..\utils\ConvertUTF.c" />
|
||||
<ClCompile Include="..\utils\decrypt\crc.cpp" />
|
||||
<ClCompile Include="..\utils\decrypt\decrypt.cpp" />
|
||||
<ClCompile Include="..\utils\decrypt\header.cpp" />
|
||||
<ClCompile Include="..\utils\guid.cpp" />
|
||||
<ClCompile Include="..\utils\md5.cpp" />
|
||||
<ClCompile Include="..\utils\xstring.cpp" />
|
||||
<ClCompile Include="..\wifi.cpp" />
|
||||
<ClCompile Include="7zip.cpp" />
|
||||
<ClCompile Include="AboutBox.cpp" />
|
||||
<ClCompile Include="aviout.cpp" />
|
||||
<ClCompile Include="cheatsWin.cpp" />
|
||||
<ClCompile Include="colorctrl.cpp" />
|
||||
<ClCompile Include="console.cpp" />
|
||||
<ClCompile Include="CWindow.cpp" />
|
||||
<ClCompile Include="disView.cpp" />
|
||||
<ClCompile Include="FirmConfig.cpp" />
|
||||
<ClCompile Include="gbaslot_config.cpp" />
|
||||
<ClCompile Include="ginfo.cpp" />
|
||||
<ClCompile Include="hotkey.cpp" />
|
||||
<ClCompile Include="inputdx.cpp" />
|
||||
<ClCompile Include="IORegView.cpp" />
|
||||
<ClCompile Include="lightView.cpp" />
|
||||
<ClCompile Include="luaconsole.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="mapView.cpp" />
|
||||
<ClCompile Include="matrixView.cpp" />
|
||||
<ClCompile Include="memView.cpp" />
|
||||
<ClCompile Include="mic.cpp" />
|
||||
<ClCompile Include="oamView.cpp" />
|
||||
<ClCompile Include="ogl.cpp" />
|
||||
<ClCompile Include="OpenArchive.cpp" />
|
||||
<ClCompile Include="palView.cpp" />
|
||||
<ClCompile Include="pathsettings.cpp" />
|
||||
<ClCompile Include="ramwatch.cpp" />
|
||||
<ClCompile Include="ram_search.cpp" />
|
||||
<ClCompile Include="replay.cpp" />
|
||||
<ClCompile Include="snddx.cpp" />
|
||||
<ClCompile Include="soundView.cpp" />
|
||||
<ClCompile Include="throttle.cpp" />
|
||||
<ClCompile Include="tileView.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\matrix_sse2-x64.asm">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling x64...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml64 /nologo /c /Zi /Fo"$(IntDir)%(FileName).obj" "%(FullPath)"
|
||||
</Command>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling x64...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml64 /nologo /c /Zi /Fo"$(IntDir)%(FileName).obj" "%(FullPath)"
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(FileName).obj;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">Assembling x64...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">ml64 /nologo /c /Zi /Fo"$(IntDir)%(FileName).obj" "%(FullPath)"
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release FastBuild|Win32'">$(IntDir)%(FileName).obj;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="..\matrix_sse2-x86.asm" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="resources.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\instruction_tabdef.inc" />
|
||||
<None Include="..\thumb_tabdef.inc" />
|
||||
<None Include="bitmap1.bmp" />
|
||||
<None Include="DeSmuME.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\addons.h" />
|
||||
<ClInclude Include="..\ARM9.h" />
|
||||
<ClInclude Include="..\armcpu.h" />
|
||||
<ClInclude Include="..\arm_instructions.h" />
|
||||
<ClInclude Include="..\bios.h" />
|
||||
<ClInclude Include="..\bits.h" />
|
||||
<ClInclude Include="..\cheatSystem.h" />
|
||||
<ClInclude Include="..\commandline.h" />
|
||||
<ClInclude Include="..\common.h" />
|
||||
<ClInclude Include="..\cp15.h" />
|
||||
<ClInclude Include="..\debug.h" />
|
||||
<ClInclude Include="..\Disassembler.h" />
|
||||
<ClInclude Include="..\driver.h" />
|
||||
<ClInclude Include="..\dscard.h" />
|
||||
<ClInclude Include="..\fat.h" />
|
||||
<ClInclude Include="..\FIFO.h" />
|
||||
<ClInclude Include="..\fs.h" />
|
||||
<ClInclude Include="..\gdbstub.h" />
|
||||
<ClInclude Include="..\gfx3d.h" />
|
||||
<ClInclude Include="..\gl_vertex.h" />
|
||||
<ClInclude Include="..\GPU.h" />
|
||||
<ClInclude Include="..\GPU_osd.h" />
|
||||
<ClInclude Include="..\lua-engine.h" />
|
||||
<ClInclude Include="..\matrix.h" />
|
||||
<ClInclude Include="..\mc.h" />
|
||||
<ClInclude Include="..\mem.h" />
|
||||
<ClInclude Include="..\memorystream.h" />
|
||||
<ClInclude Include="..\mic.h" />
|
||||
<ClInclude Include="..\MMU.h" />
|
||||
<ClInclude Include="..\movie.h" />
|
||||
<ClInclude Include="..\NDSSystem.h" />
|
||||
<ClInclude Include="..\OGLRender.h" />
|
||||
<ClInclude Include="..\rasterize.h" />
|
||||
<ClInclude Include="..\readwrite.h" />
|
||||
<ClInclude Include="..\registers.h" />
|
||||
<ClInclude Include="..\render3D.h" />
|
||||
<ClInclude Include="..\ROMReader.h" />
|
||||
<ClInclude Include="..\rtc.h" />
|
||||
<ClInclude Include="..\saves.h" />
|
||||
<ClInclude Include="..\shaders.h" />
|
||||
<ClInclude Include="..\softrender.h" />
|
||||
<ClInclude Include="..\softrender_config.h" />
|
||||
<ClInclude Include="..\softrender_desmumefont.h" />
|
||||
<ClInclude Include="..\softrender_v3sysfont.h" />
|
||||
<ClInclude Include="..\SPU.h" />
|
||||
<ClInclude Include="..\texcache.h" />
|
||||
<ClInclude Include="..\thumb_instructions.h" />
|
||||
<ClInclude Include="..\types.h" />
|
||||
<ClInclude Include="..\utils\ConvertUTF.h" />
|
||||
<ClInclude Include="..\utils\decrypt\crc.h" />
|
||||
<ClInclude Include="..\utils\decrypt\decrypt.h" />
|
||||
<ClInclude Include="..\utils\decrypt\header.h" />
|
||||
<ClInclude Include="..\utils\guid.h" />
|
||||
<ClInclude Include="..\utils\md5.h" />
|
||||
<ClInclude Include="..\utils\valuearray.h" />
|
||||
<ClInclude Include="..\utils\xstring.h" />
|
||||
<ClInclude Include="..\version.h" />
|
||||
<ClInclude Include="..\wifi.h" />
|
||||
<ClInclude Include="7zip.h" />
|
||||
<ClInclude Include="7zipstreams.h" />
|
||||
<ClInclude Include="AboutBox.h" />
|
||||
<ClInclude Include="aviout.h" />
|
||||
<ClInclude Include="cheatsWin.h" />
|
||||
<ClInclude Include="colorctrl.h" />
|
||||
<ClInclude Include="console.h" />
|
||||
<ClInclude Include="CWindow.h" />
|
||||
<ClInclude Include="disView.h" />
|
||||
<ClInclude Include="FirmConfig.h" />
|
||||
<ClInclude Include="gbaslot_config.h" />
|
||||
<ClInclude Include="ginfo.h" />
|
||||
<ClInclude Include="hotkey.h" />
|
||||
<ClInclude Include="inputdx.h" />
|
||||
<ClInclude Include="IORegView.h" />
|
||||
<ClInclude Include="lightView.h" />
|
||||
<ClInclude Include="main.h" />
|
||||
<ClInclude Include="mapView.h" />
|
||||
<ClInclude Include="matrixView.h" />
|
||||
<ClInclude Include="memView.h" />
|
||||
<ClInclude Include="oamView.h" />
|
||||
<ClInclude Include="OpenArchive.h" />
|
||||
<ClInclude Include="palView.h" />
|
||||
<ClInclude Include="pathsettings.h" />
|
||||
<ClInclude Include="ramwatch.h" />
|
||||
<ClInclude Include="ram_search.h" />
|
||||
<ClInclude Include="replay.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="snddx.h" />
|
||||
<ClInclude Include="soundView.h" />
|
||||
<ClInclude Include="throttle.h" />
|
||||
<ClInclude Include="tileView.h" />
|
||||
<ClInclude Include="userconfig\userconfig.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCINSTALLDIR)\VCProjectDefaults\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
Binary file not shown.
|
@ -1,20 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agg-2.5", "agg-2.5.vcproj", "{887D5BD9-14EB-4B81-AABA-71E1E1063044}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{887D5BD9-14EB-4B81-AABA-71E1E1063044}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{887D5BD9-14EB-4B81-AABA-71E1E1063044}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{887D5BD9-14EB-4B81-AABA-71E1E1063044}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{887D5BD9-14EB-4B81-AABA-71E1E1063044}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,880 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="agg-2.5"
|
||||
ProjectGUID="{887D5BD9-14EB-4B81-AABA-71E1E1063044}"
|
||||
RootNamespace="agg-2.5"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\;.\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
WholeProgramOptimization="false"
|
||||
AdditionalIncludeDirectories=".\;.\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
|
||||
StringPooling="true"
|
||||
BasicRuntimeChecks="0"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
OmitDefaultLibName="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\agg_alpha_mask_u8.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_arc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_array.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_arrowhead.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_basics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_bezier_arc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_bezier_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_bitset_iterator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_blur.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_bounding_rect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_bspline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_cbox_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_clip_liang_barsky.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\util\agg_color_conv.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\util\agg_color_conv_rgb16.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\util\agg_color_conv_rgb8.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_color_gray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_color_rgba.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_adaptor_vcgen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_adaptor_vpgen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_bspline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_clip_polygon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_clip_polyline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_close_polygon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_concat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_contour.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_curve.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_dash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_gpc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_marker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_marker_adaptor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_segmentator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_shorten_path.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_smooth_poly1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_stroke.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_transform.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_conv_unclose_polygon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_curves.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_dda_line.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_ellipse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_ellipse_bresenham.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_embedded_raster_fonts.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_font_cache_manager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\font_win32_tt\agg_font_win32_tt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_gamma_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_gamma_functions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_gamma_lut.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_gamma_spline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_glyph_raster_bin.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_gradient_lut.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_gsv_text.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_image_accessors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_image_filters.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_line_aa_basics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_math.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_math_stroke.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_path_length.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_path_storage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_path_storage_integer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pattern_filters_rgba.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pixfmt_amask_adaptor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pixfmt_gray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pixfmt_rgb.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pixfmt_rgb_packed.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pixfmt_rgba.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_pixfmt_transposer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\platform\agg_platform_support.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_polygon_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rasterizer_cells_aa.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rasterizer_compound_aa.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rasterizer_outline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rasterizer_outline_aa.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rasterizer_scanline_aa.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rasterizer_sl_clip.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_rbox_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_base.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_markers.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_mclip.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_outline_aa.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_outline_image.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_primitives.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_raster_text.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_renderer_scanline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rendering_buffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rendering_buffer_dynarow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_rounded_rect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_scale_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_scanline_bin.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_scanline_boolean_algebra.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_scanline_p.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_scanline_storage_aa.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_scanline_storage_bin.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_scanline_u.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_shorten_path.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_simul_eq.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_slider_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_allocator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_converter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_gouraud.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_gouraud_gray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_gouraud_rgba.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_gradient.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_gradient_alpha.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_image_filter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_image_filter_gray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_image_filter_rgb.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_image_filter_rgba.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_interpolator_adaptor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_interpolator_linear.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_interpolator_persp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_interpolator_trans.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_pattern_gray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_pattern_rgb.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_pattern_rgba.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_solid.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_span_subdiv_adaptor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\ctrl\agg_spline_ctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_affine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_bilinear.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_double_path.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_perspective.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_single_path.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_viewport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_trans_warp_magnifier.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_bspline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_contour.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_dash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_markers_term.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_smooth_poly1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_stroke.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vcgen_vertex_sequence.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vertex_sequence.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vpgen_clip_polygon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vpgen_clip_polyline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\agg_vpgen_segmentator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\platform\win32\agg_win32_bmp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gpc\gpc.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\agg_arc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_arrowhead.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_bezier_arc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_bezier_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_bspline.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_cbox_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_curves.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_embedded_raster_fonts.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\font_win32_tt\agg_font_win32_tt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_gamma_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_gamma_spline.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_gsv_text.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_image_filters.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_line_aa_basics.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_line_profile_aa.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\platform\win32\agg_platform_support.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_polygon_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_rbox_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_rounded_rect.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_scale_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_slider_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ctrl\agg_spline_ctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_sqrt_tables.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_trans_affine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_trans_double_path.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_trans_single_path.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_trans_warp_magnifier.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vcgen_bspline.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vcgen_contour.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vcgen_dash.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vcgen_markers_term.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vcgen_smooth_poly1.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vcgen_stroke.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vpgen_clip_polygon.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vpgen_clip_polyline.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\agg_vpgen_segmentator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\platform\win32\agg_win32_bmp.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,184 +0,0 @@
|
|||
#ifndef PIXEL_FORMATS_INCLUDED
|
||||
#define PIXEL_FORMATS_INCLUDED
|
||||
|
||||
#if defined(AGG_GRAY8)
|
||||
|
||||
#include "agg_pixfmt_gray.h"
|
||||
#define pix_format agg::pix_format_gray8
|
||||
typedef agg::pixfmt_gray8 pixfmt;
|
||||
typedef agg::pixfmt_gray8_pre pixfmt_pre;
|
||||
typedef agg::gray8 color_type;
|
||||
|
||||
#elif defined(AGG_GRAY16)
|
||||
|
||||
#include "agg_pixfmt_gray.h"
|
||||
#define pix_format agg::pix_format_gray16
|
||||
typedef agg::pixfmt_gray16 pixfmt;
|
||||
typedef agg::pixfmt_gray16_pre pixfmt_pre;
|
||||
typedef agg::gray16 color_type;
|
||||
|
||||
#elif defined(AGG_BGR24)
|
||||
|
||||
#include "agg_pixfmt_rgb.h"
|
||||
#define pix_format agg::pix_format_bgr24
|
||||
typedef agg::pixfmt_bgr24 pixfmt;
|
||||
typedef agg::pixfmt_bgr24_pre pixfmt_pre;
|
||||
#define pixfmt_gamma agg::pixfmt_bgr24_gamma
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_bgr component_order;
|
||||
|
||||
#elif defined(AGG_RGB24)
|
||||
|
||||
#include "agg_pixfmt_rgb.h"
|
||||
#define pix_format agg::pix_format_rgb24
|
||||
typedef agg::pixfmt_rgb24 pixfmt;
|
||||
typedef agg::pixfmt_rgb24_pre pixfmt_pre;
|
||||
#define pixfmt_gamma agg::pixfmt_rgb24_gamma
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_rgb component_order;
|
||||
|
||||
#elif defined(AGG_BGR48)
|
||||
|
||||
#include "agg_pixfmt_rgb.h"
|
||||
#define pix_format agg::pix_format_bgr48
|
||||
typedef agg::pixfmt_bgr48 pixfmt;
|
||||
typedef agg::pixfmt_bgr48_pre pixfmt_pre;
|
||||
#define pixfmt_gamma agg::pixfmt_bgr48_gamma
|
||||
typedef agg::rgba16 color_type;
|
||||
typedef agg::order_bgr component_order;
|
||||
|
||||
#elif defined(AGG_RGB48)
|
||||
|
||||
#include "agg_pixfmt_rgb.h"
|
||||
#define pix_format agg::pix_format_rgb48
|
||||
typedef agg::pixfmt_rgb48 pixfmt;
|
||||
typedef agg::pixfmt_rgb48_pre pixfmt_pre;
|
||||
#define pixfmt_gamma agg::pixfmt_rgb48_gamma
|
||||
typedef agg::rgba16 color_type;
|
||||
typedef agg::order_rgb component_order;
|
||||
|
||||
#elif defined(AGG_BGRA32)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_bgra32
|
||||
typedef agg::pixfmt_bgra32 pixfmt;
|
||||
typedef agg::pixfmt_bgra32_pre pixfmt_pre;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_bgra component_order;
|
||||
|
||||
#elif defined(AGG_RGBA32)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_rgba32
|
||||
typedef agg::pixfmt_rgba32 pixfmt;
|
||||
typedef agg::pixfmt_rgba32_pre pixfmt_pre;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_rgba component_order;
|
||||
|
||||
#elif defined(AGG_ARGB32)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_argb32
|
||||
typedef agg::pixfmt_argb32 pixfmt;
|
||||
typedef agg::pixfmt_argb32_pre pixfmt_pre;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_argb component_order;
|
||||
|
||||
#elif defined(AGG_ABGR32)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_abgr32
|
||||
typedef agg::pixfmt_abgr32 pixfmt;
|
||||
typedef agg::pixfmt_abgr32_pre pixfmt_pre;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_argb component_order;
|
||||
|
||||
#elif defined(AGG_BGRA64)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_bgra64
|
||||
typedef agg::pixfmt_bgra64 pixfmt;
|
||||
typedef agg::pixfmt_bgra64_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
typedef agg::order_bgra component_order;
|
||||
|
||||
#elif defined(AGG_RGBA64)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_rgba64
|
||||
typedef agg::pixfmt_rgba64 pixfmt;
|
||||
typedef agg::pixfmt_rgba64_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
typedef agg::order_rgba component_order;
|
||||
|
||||
#elif defined(AGG_ARGB64)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_argb64
|
||||
typedef agg::pixfmt_argb64 pixfmt;
|
||||
typedef agg::pixfmt_argb64_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
typedef agg::order_argb component_order;
|
||||
|
||||
#elif defined(AGG_ABGR64)
|
||||
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#define pix_format agg::pix_format_abgr64
|
||||
typedef agg::pixfmt_abgr64 pixfmt;
|
||||
typedef agg::pixfmt_abgr64_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
typedef agg::order_argb component_order;
|
||||
|
||||
#elif defined(AGG_RGB565)
|
||||
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
#define pix_format agg::pix_format_rgb565
|
||||
typedef agg::pixfmt_rgb565 pixfmt;
|
||||
typedef agg::pixfmt_rgb565_pre pixfmt_pre;
|
||||
typedef agg::rgba8 color_type;
|
||||
|
||||
#elif defined(AGG_RGB555)
|
||||
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
#define pix_format agg::pix_format_rgb555
|
||||
typedef agg::pixfmt_rgb555 pixfmt;
|
||||
typedef agg::pixfmt_rgb555_pre pixfmt_pre;
|
||||
typedef agg::rgba8 color_type;
|
||||
|
||||
#elif defined(AGG_RGB_AAA)
|
||||
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
#define pix_format agg::pix_format_rgbAAA
|
||||
typedef agg::pixfmt_rgbAAA pixfmt;
|
||||
typedef agg::pixfmt_rgbAAA_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
|
||||
#elif defined(AGG_BGR_AAA)
|
||||
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
#define pix_format agg::pix_format_bgrAAA
|
||||
typedef agg::pixfmt_bgrAAA pixfmt;
|
||||
typedef agg::pixfmt_bgrAAA_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
|
||||
#elif defined(AGG_RGB_BBA)
|
||||
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
#define pix_format agg::pix_format_rgbBBA
|
||||
typedef agg::pixfmt_rgbBBA pixfmt;
|
||||
typedef agg::pixfmt_rgbBBA_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
|
||||
#elif defined(AGG_BGR_ABB)
|
||||
|
||||
#include "agg_pixfmt_rgb_packed.h"
|
||||
#define pix_format agg::pix_format_bgrABB
|
||||
typedef agg::pixfmt_bgrABB pixfmt;
|
||||
typedef agg::pixfmt_bgrABB_pre pixfmt_pre;
|
||||
typedef agg::rgba16 color_type;
|
||||
|
||||
#else
|
||||
#error Please define pixel format: AGG_GRAY8, AGG_BGR24, AGG_RGB24, etc. See this file above
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,201 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_FONT_FREETYPE_INCLUDED
|
||||
#define AGG_FONT_FREETYPE_INCLUDED
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
|
||||
#include "agg_scanline_storage_aa.h"
|
||||
#include "agg_scanline_storage_bin.h"
|
||||
#include "agg_scanline_u.h"
|
||||
#include "agg_scanline_bin.h"
|
||||
#include "agg_path_storage_integer.h"
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
#include "agg_conv_curve.h"
|
||||
#include "agg_font_cache_manager.h"
|
||||
#include "agg_trans_affine.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
|
||||
//-----------------------------------------------font_engine_freetype_base
|
||||
class font_engine_freetype_base
|
||||
{
|
||||
public:
|
||||
//--------------------------------------------------------------------
|
||||
typedef serialized_scanlines_adaptor_aa<int8u> gray8_adaptor_type;
|
||||
typedef serialized_scanlines_adaptor_bin mono_adaptor_type;
|
||||
typedef scanline_storage_aa8 scanlines_aa_type;
|
||||
typedef scanline_storage_bin scanlines_bin_type;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
~font_engine_freetype_base();
|
||||
font_engine_freetype_base(bool flag32, unsigned max_faces = 32);
|
||||
|
||||
// Set font parameters
|
||||
//--------------------------------------------------------------------
|
||||
void resolution(unsigned dpi);
|
||||
bool load_font(const char* font_name, unsigned face_index, glyph_rendering ren_type,
|
||||
const char* font_mem = 0, const long font_mem_size = 0);
|
||||
bool attach(const char* file_name);
|
||||
bool char_map(FT_Encoding map);
|
||||
bool height(double h);
|
||||
bool width(double w);
|
||||
void hinting(bool h);
|
||||
void flip_y(bool f);
|
||||
void transform(const trans_affine& affine);
|
||||
|
||||
// Set Gamma
|
||||
//--------------------------------------------------------------------
|
||||
template<class GammaF> void gamma(const GammaF& f)
|
||||
{
|
||||
m_rasterizer.gamma(f);
|
||||
}
|
||||
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
int last_error() const { return m_last_error; }
|
||||
unsigned resolution() const { return m_resolution; }
|
||||
const char* name() const { return m_name; }
|
||||
unsigned num_faces() const;
|
||||
FT_Encoding char_map() const { return m_char_map; }
|
||||
double height() const { return double(m_height) / 64.0; }
|
||||
double width() const { return double(m_width) / 64.0; }
|
||||
double ascender() const;
|
||||
double descender() const;
|
||||
bool hinting() const { return m_hinting; }
|
||||
bool flip_y() const { return m_flip_y; }
|
||||
|
||||
|
||||
// Interface mandatory to implement for font_cache_manager
|
||||
//--------------------------------------------------------------------
|
||||
const char* font_signature() const { return m_signature; }
|
||||
int change_stamp() const { return m_change_stamp; }
|
||||
|
||||
bool prepare_glyph(unsigned glyph_code);
|
||||
unsigned glyph_index() const { return m_glyph_index; }
|
||||
unsigned data_size() const { return m_data_size; }
|
||||
glyph_data_type data_type() const { return m_data_type; }
|
||||
const rect_i& bounds() const { return m_bounds; }
|
||||
double advance_x() const { return m_advance_x; }
|
||||
double advance_y() const { return m_advance_y; }
|
||||
void write_glyph_to(int8u* data) const;
|
||||
bool add_kerning(unsigned first, unsigned second,
|
||||
double* x, double* y);
|
||||
|
||||
private:
|
||||
font_engine_freetype_base(const font_engine_freetype_base&);
|
||||
const font_engine_freetype_base& operator = (const font_engine_freetype_base&);
|
||||
|
||||
void update_char_size();
|
||||
void update_signature();
|
||||
int find_face(const char* face_name) const;
|
||||
|
||||
bool m_flag32;
|
||||
int m_change_stamp;
|
||||
int m_last_error;
|
||||
char* m_name;
|
||||
unsigned m_name_len;
|
||||
unsigned m_face_index;
|
||||
FT_Encoding m_char_map;
|
||||
char* m_signature;
|
||||
unsigned m_height;
|
||||
unsigned m_width;
|
||||
bool m_hinting;
|
||||
bool m_flip_y;
|
||||
bool m_library_initialized;
|
||||
FT_Library m_library; // handle to library
|
||||
FT_Face* m_faces; // A pool of font faces
|
||||
char** m_face_names;
|
||||
unsigned m_num_faces;
|
||||
unsigned m_max_faces;
|
||||
FT_Face m_cur_face; // handle to the current face object
|
||||
int m_resolution;
|
||||
glyph_rendering m_glyph_rendering;
|
||||
unsigned m_glyph_index;
|
||||
unsigned m_data_size;
|
||||
glyph_data_type m_data_type;
|
||||
rect_i m_bounds;
|
||||
double m_advance_x;
|
||||
double m_advance_y;
|
||||
trans_affine m_affine;
|
||||
|
||||
path_storage_integer<int16, 6> m_path16;
|
||||
path_storage_integer<int32, 6> m_path32;
|
||||
conv_curve<path_storage_integer<int16, 6> > m_curves16;
|
||||
conv_curve<path_storage_integer<int32, 6> > m_curves32;
|
||||
scanline_u8 m_scanline_aa;
|
||||
scanline_bin m_scanline_bin;
|
||||
scanlines_aa_type m_scanlines_aa;
|
||||
scanlines_bin_type m_scanlines_bin;
|
||||
rasterizer_scanline_aa<> m_rasterizer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------font_engine_freetype_int16
|
||||
// This class uses values of type int16 (10.6 format) for the vector cache.
|
||||
// The vector cache is compact, but when rendering glyphs of height
|
||||
// more that 200 there integer overflow can occur.
|
||||
//
|
||||
class font_engine_freetype_int16 : public font_engine_freetype_base
|
||||
{
|
||||
public:
|
||||
typedef serialized_integer_path_adaptor<int16, 6> path_adaptor_type;
|
||||
typedef font_engine_freetype_base::gray8_adaptor_type gray8_adaptor_type;
|
||||
typedef font_engine_freetype_base::mono_adaptor_type mono_adaptor_type;
|
||||
typedef font_engine_freetype_base::scanlines_aa_type scanlines_aa_type;
|
||||
typedef font_engine_freetype_base::scanlines_bin_type scanlines_bin_type;
|
||||
|
||||
font_engine_freetype_int16(unsigned max_faces = 32) :
|
||||
font_engine_freetype_base(false, max_faces) {}
|
||||
};
|
||||
|
||||
//------------------------------------------------font_engine_freetype_int32
|
||||
// This class uses values of type int32 (26.6 format) for the vector cache.
|
||||
// The vector cache is twice larger than in font_engine_freetype_int16,
|
||||
// but it allows you to render glyphs of very large sizes.
|
||||
//
|
||||
class font_engine_freetype_int32 : public font_engine_freetype_base
|
||||
{
|
||||
public:
|
||||
typedef serialized_integer_path_adaptor<int32, 6> path_adaptor_type;
|
||||
typedef font_engine_freetype_base::gray8_adaptor_type gray8_adaptor_type;
|
||||
typedef font_engine_freetype_base::mono_adaptor_type mono_adaptor_type;
|
||||
typedef font_engine_freetype_base::scanlines_aa_type scanlines_aa_type;
|
||||
typedef font_engine_freetype_base::scanlines_bin_type scanlines_bin_type;
|
||||
|
||||
font_engine_freetype_int32(unsigned max_faces = 32) :
|
||||
font_engine_freetype_base(true, max_faces) {}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,946 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include <stdio.h>
|
||||
#include "agg_font_win32_tt.h"
|
||||
#include "agg_bitset_iterator.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
|
||||
#ifdef AGG_WIN9X_COMPLIANT
|
||||
#define GetGlyphOutlineX GetGlyphOutline
|
||||
#else
|
||||
#define GetGlyphOutlineX GetGlyphOutlineW
|
||||
#endif
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// This code implements the AUTODIN II polynomial
|
||||
// The variable corresponding to the macro argument "crc" should
|
||||
// be an unsigned long.
|
||||
// Oroginal code by Spencer Garrett <srg@quick.com>
|
||||
//
|
||||
|
||||
// generated using the AUTODIN II polynomial
|
||||
// x^32 + x^26 + x^23 + x^22 + x^16 +
|
||||
// x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static const unsigned crc32tab[256] =
|
||||
{
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
|
||||
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
||||
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
||||
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
|
||||
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
||||
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
||||
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
|
||||
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
|
||||
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
||||
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
|
||||
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
|
||||
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
|
||||
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
||||
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
|
||||
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
|
||||
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
|
||||
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
||||
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
||||
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
|
||||
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
|
||||
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
|
||||
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
||||
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
|
||||
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
|
||||
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
|
||||
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
||||
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
|
||||
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
|
||||
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
|
||||
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
|
||||
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
|
||||
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
|
||||
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
||||
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
|
||||
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
|
||||
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
||||
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
||||
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
|
||||
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
|
||||
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
|
||||
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
|
||||
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static unsigned calc_crc32(const unsigned char* buf, unsigned size)
|
||||
{
|
||||
unsigned crc = (unsigned)~0;
|
||||
const unsigned char* p;
|
||||
unsigned len = 0;
|
||||
unsigned nr = size;
|
||||
|
||||
for (len += nr, p = buf; nr--; ++p)
|
||||
{
|
||||
crc = (crc >> 8) ^ crc32tab[(crc ^ *p) & 0xff];
|
||||
}
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline FIXED dbl_to_fx(double d)
|
||||
{
|
||||
int l;
|
||||
l = int(d * 65536.0);
|
||||
return *(FIXED*)&l;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline int dbl_to_plain_fx(double d)
|
||||
{
|
||||
return int(d * 65536.0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline FIXED negate_fx(const FIXED& fx)
|
||||
{
|
||||
int l = -(*(int*)(&fx));
|
||||
return *(FIXED*)&l;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline double fx_to_dbl(const FIXED& p)
|
||||
{
|
||||
return double(p.value) + double(p.fract) * (1.0 / 65536.0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline int fx_to_plain_int(const FIXED& fx)
|
||||
{
|
||||
return *(int*)(&fx);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline int fx_to_int26p6(const FIXED& p)
|
||||
{
|
||||
return (int(p.value) << 6) + (int(p.fract) >> 10);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static inline int dbl_to_int26p6(double p)
|
||||
{
|
||||
return int(p * 64.0 + 0.5);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class Scanline, class ScanlineStorage>
|
||||
void decompose_win32_glyph_bitmap_mono(const char* gbuf,
|
||||
int w, int h,
|
||||
int x, int y,
|
||||
bool flip_y,
|
||||
Scanline& sl,
|
||||
ScanlineStorage& storage)
|
||||
{
|
||||
int i;
|
||||
int pitch = ((w + 31) >> 5) << 2;
|
||||
const int8u* buf = (const int8u*)gbuf;
|
||||
sl.reset(x, x + w);
|
||||
storage.prepare();
|
||||
if(flip_y)
|
||||
{
|
||||
buf += pitch * (h - 1);
|
||||
y += h;
|
||||
pitch = -pitch;
|
||||
}
|
||||
for(i = 0; i < h; i++)
|
||||
{
|
||||
sl.reset_spans();
|
||||
bitset_iterator bits(buf, 0);
|
||||
int j;
|
||||
for(j = 0; j < w; j++)
|
||||
{
|
||||
if(bits.bit()) sl.add_cell(x + j, cover_full);
|
||||
++bits;
|
||||
}
|
||||
buf += pitch;
|
||||
if(sl.num_spans())
|
||||
{
|
||||
sl.finalize(y - i - 1);
|
||||
storage.render(sl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class Rasterizer, class Scanline, class ScanlineStorage>
|
||||
void decompose_win32_glyph_bitmap_gray8(const char* gbuf,
|
||||
int w, int h,
|
||||
int x, int y,
|
||||
bool flip_y,
|
||||
Rasterizer& ras,
|
||||
Scanline& sl,
|
||||
ScanlineStorage& storage)
|
||||
{
|
||||
int i, j;
|
||||
int pitch = ((w + 3) >> 2) << 2;
|
||||
const int8u* buf = (const int8u*)gbuf;
|
||||
sl.reset(x, x + w);
|
||||
storage.prepare();
|
||||
if(flip_y)
|
||||
{
|
||||
buf += pitch * (h - 1);
|
||||
y += h;
|
||||
pitch = -pitch;
|
||||
}
|
||||
for(i = 0; i < h; i++)
|
||||
{
|
||||
sl.reset_spans();
|
||||
const int8u* p = buf;
|
||||
for(j = 0; j < w; j++)
|
||||
{
|
||||
if(*p)
|
||||
{
|
||||
unsigned v = *p;
|
||||
if(v == 64) v = 255;
|
||||
else v <<= 2;
|
||||
sl.add_cell(x + j, ras.apply_gamma(v));
|
||||
}
|
||||
++p;
|
||||
}
|
||||
buf += pitch;
|
||||
if(sl.num_spans())
|
||||
{
|
||||
sl.finalize(y - i - 1);
|
||||
storage.render(sl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class PathStorage>
|
||||
bool decompose_win32_glyph_outline(const char* gbuf,
|
||||
unsigned total_size,
|
||||
bool flip_y,
|
||||
const trans_affine& mtx,
|
||||
PathStorage& path)
|
||||
{
|
||||
const char* cur_glyph = gbuf;
|
||||
const char* end_glyph = gbuf + total_size;
|
||||
double x, y;
|
||||
typedef typename PathStorage::value_type value_type;
|
||||
|
||||
while(cur_glyph < end_glyph)
|
||||
{
|
||||
const TTPOLYGONHEADER* th = (TTPOLYGONHEADER*)cur_glyph;
|
||||
|
||||
const char* end_poly = cur_glyph + th->cb;
|
||||
const char* cur_poly = cur_glyph + sizeof(TTPOLYGONHEADER);
|
||||
|
||||
x = fx_to_dbl(th->pfxStart.x);
|
||||
y = fx_to_dbl(th->pfxStart.y);
|
||||
if(flip_y) y = -y;
|
||||
mtx.transform(&x, &y);
|
||||
path.move_to(value_type(dbl_to_int26p6(x)),
|
||||
value_type(dbl_to_int26p6(y)));
|
||||
|
||||
while(cur_poly < end_poly)
|
||||
{
|
||||
const TTPOLYCURVE* pc = (const TTPOLYCURVE*)cur_poly;
|
||||
|
||||
if (pc->wType == TT_PRIM_LINE)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < pc->cpfx; i++)
|
||||
{
|
||||
x = fx_to_dbl(pc->apfx[i].x);
|
||||
y = fx_to_dbl(pc->apfx[i].y);
|
||||
if(flip_y) y = -y;
|
||||
mtx.transform(&x, &y);
|
||||
path.line_to(value_type(dbl_to_int26p6(x)),
|
||||
value_type(dbl_to_int26p6(y)));
|
||||
}
|
||||
}
|
||||
|
||||
if (pc->wType == TT_PRIM_QSPLINE)
|
||||
{
|
||||
int u;
|
||||
for (u = 0; u < pc->cpfx - 1; u++) // Walk through points in spline
|
||||
{
|
||||
POINTFX pnt_b = pc->apfx[u]; // B is always the current point
|
||||
POINTFX pnt_c = pc->apfx[u+1];
|
||||
|
||||
if (u < pc->cpfx - 2) // If not on last spline, compute C
|
||||
{
|
||||
// midpoint (x,y)
|
||||
*(int*)&pnt_c.x = (*(int*)&pnt_b.x + *(int*)&pnt_c.x) / 2;
|
||||
*(int*)&pnt_c.y = (*(int*)&pnt_b.y + *(int*)&pnt_c.y) / 2;
|
||||
}
|
||||
|
||||
double x2, y2;
|
||||
x = fx_to_dbl(pnt_b.x);
|
||||
y = fx_to_dbl(pnt_b.y);
|
||||
x2 = fx_to_dbl(pnt_c.x);
|
||||
y2 = fx_to_dbl(pnt_c.y);
|
||||
if(flip_y) { y = -y; y2 = -y2; }
|
||||
mtx.transform(&x, &y);
|
||||
mtx.transform(&x2, &y2);
|
||||
path.curve3(value_type(dbl_to_int26p6(x)),
|
||||
value_type(dbl_to_int26p6(y)),
|
||||
value_type(dbl_to_int26p6(x2)),
|
||||
value_type(dbl_to_int26p6(y2)));
|
||||
}
|
||||
}
|
||||
cur_poly += sizeof(WORD) * 2 + sizeof(POINTFX) * pc->cpfx;
|
||||
}
|
||||
cur_glyph += th->cb;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
font_engine_win32_tt_base::~font_engine_win32_tt_base()
|
||||
{
|
||||
delete [] m_kerning_pairs;
|
||||
delete [] m_gbuf;
|
||||
delete [] m_signature;
|
||||
delete [] m_typeface;
|
||||
if(m_dc && m_old_font) ::SelectObject(m_dc, m_old_font);
|
||||
unsigned i;
|
||||
for(i = 0; i < m_num_fonts; ++i)
|
||||
{
|
||||
delete [] m_font_names[i];
|
||||
::DeleteObject(m_fonts[i]);
|
||||
}
|
||||
delete [] m_font_names;
|
||||
delete [] m_fonts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
font_engine_win32_tt_base::font_engine_win32_tt_base(bool flag32,
|
||||
HDC dc,
|
||||
unsigned max_fonts) :
|
||||
m_flag32(flag32),
|
||||
m_dc(dc),
|
||||
m_old_font(m_dc ? (HFONT)::GetCurrentObject(m_dc, OBJ_FONT) : 0),
|
||||
m_fonts(new HFONT [max_fonts]),
|
||||
m_num_fonts(0),
|
||||
m_max_fonts(max_fonts),
|
||||
m_font_names(new char* [max_fonts]),
|
||||
m_cur_font(0),
|
||||
|
||||
m_change_stamp(0),
|
||||
m_typeface(new char [256-16]),
|
||||
m_typeface_len(256-16-1),
|
||||
m_signature(new char [256+256-16]),
|
||||
m_height(0),
|
||||
m_width(0),
|
||||
m_weight(FW_REGULAR),
|
||||
m_italic(false),
|
||||
m_char_set(DEFAULT_CHARSET),
|
||||
m_pitch_and_family(FF_DONTCARE),
|
||||
m_hinting(true),
|
||||
m_flip_y(false),
|
||||
m_font_created(false),
|
||||
m_resolution(0),
|
||||
m_glyph_rendering(glyph_ren_native_gray8),
|
||||
m_glyph_index(0),
|
||||
m_data_size(0),
|
||||
m_data_type(glyph_data_invalid),
|
||||
m_bounds(1,1,0,0),
|
||||
m_advance_x(0.0),
|
||||
m_advance_y(0.0),
|
||||
m_gbuf(new char [buf_size]),
|
||||
m_kerning_pairs(0),
|
||||
m_num_kerning_pairs(0),
|
||||
m_max_kerning_pairs(0),
|
||||
|
||||
m_path16(),
|
||||
m_path32(),
|
||||
m_curves16(m_path16),
|
||||
m_curves32(m_path32),
|
||||
m_scanline_aa(),
|
||||
m_scanline_bin(),
|
||||
m_scanlines_aa(),
|
||||
m_scanlines_bin(),
|
||||
m_rasterizer()
|
||||
{
|
||||
m_curves16.approximation_scale(4.0);
|
||||
m_curves32.approximation_scale(4.0);
|
||||
memset(&m_matrix, 0, sizeof(m_matrix));
|
||||
m_matrix.eM11.value = 1;
|
||||
m_matrix.eM22.value = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
int font_engine_win32_tt_base::find_font(const char* name) const
|
||||
{
|
||||
unsigned i;
|
||||
for(i = 0; i < m_num_fonts; ++i)
|
||||
{
|
||||
if(strcmp(name, m_font_names[i]) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool font_engine_win32_tt_base::create_font(const char* typeface_,
|
||||
glyph_rendering ren_type)
|
||||
{
|
||||
if(m_dc)
|
||||
{
|
||||
unsigned len = strlen(typeface_);
|
||||
if(len > m_typeface_len)
|
||||
{
|
||||
delete [] m_signature;
|
||||
delete [] m_typeface;
|
||||
m_typeface = new char [len + 32];
|
||||
m_signature = new char [len + 32 + 256];
|
||||
m_typeface_len = len + 32 - 1;
|
||||
}
|
||||
|
||||
strcpy(m_typeface, typeface_);
|
||||
|
||||
int h = m_height;
|
||||
int w = m_width;
|
||||
|
||||
if(m_resolution)
|
||||
{
|
||||
h = ::MulDiv(m_height, m_resolution, 72);
|
||||
w = ::MulDiv(m_width, m_resolution, 72);
|
||||
}
|
||||
|
||||
m_glyph_rendering = ren_type;
|
||||
update_signature();
|
||||
int idx = find_font(m_signature);
|
||||
if(idx >= 0)
|
||||
{
|
||||
m_cur_font = m_fonts[idx];
|
||||
::SelectObject(m_dc, m_cur_font);
|
||||
m_num_kerning_pairs = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cur_font = ::CreateFont(-h, // height of font
|
||||
w, // average character width
|
||||
0, // angle of escapement
|
||||
0, // base-line orientation angle
|
||||
m_weight, // font weight
|
||||
m_italic, // italic attribute option
|
||||
0, // underline attribute option
|
||||
0, // strikeout attribute option
|
||||
m_char_set, // character set identifier
|
||||
OUT_DEFAULT_PRECIS, // output precision
|
||||
CLIP_DEFAULT_PRECIS, // clipping precision
|
||||
ANTIALIASED_QUALITY, // output quality
|
||||
m_pitch_and_family, // pitch and family
|
||||
m_typeface); // typeface name
|
||||
if(m_cur_font)
|
||||
{
|
||||
if(m_num_fonts >= m_max_fonts)
|
||||
{
|
||||
delete [] m_font_names[0];
|
||||
if(m_old_font) ::SelectObject(m_dc, m_old_font);
|
||||
::DeleteObject(m_fonts[0]);
|
||||
memcpy(m_fonts,
|
||||
m_fonts + 1,
|
||||
(m_max_fonts - 1) * sizeof(HFONT));
|
||||
memcpy(m_font_names,
|
||||
m_font_names + 1,
|
||||
(m_max_fonts - 1) * sizeof(char*));
|
||||
m_num_fonts = m_max_fonts - 1;
|
||||
}
|
||||
|
||||
update_signature();
|
||||
m_font_names[m_num_fonts] = new char[strlen(m_signature) + 1];
|
||||
strcpy(m_font_names[m_num_fonts], m_signature);
|
||||
m_fonts[m_num_fonts] = m_cur_font;
|
||||
++m_num_fonts;
|
||||
::SelectObject(m_dc, m_cur_font);
|
||||
m_num_kerning_pairs = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool font_engine_win32_tt_base::create_font(const char* typeface_,
|
||||
glyph_rendering ren_type,
|
||||
double height_,
|
||||
double width_,
|
||||
int weight_,
|
||||
bool italic_,
|
||||
DWORD char_set_,
|
||||
DWORD pitch_and_family_)
|
||||
{
|
||||
height(height_);
|
||||
width(width_);
|
||||
weight(weight_);
|
||||
italic(italic_);
|
||||
char_set(char_set_);
|
||||
pitch_and_family(pitch_and_family_);
|
||||
return create_font(typeface_, ren_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void font_engine_win32_tt_base::update_signature()
|
||||
{
|
||||
m_signature[0] = 0;
|
||||
if(m_dc && m_cur_font)
|
||||
{
|
||||
unsigned gamma_hash = 0;
|
||||
if(m_glyph_rendering == glyph_ren_native_gray8 ||
|
||||
m_glyph_rendering == glyph_ren_agg_mono ||
|
||||
m_glyph_rendering == glyph_ren_agg_gray8)
|
||||
{
|
||||
unsigned char gamma_table[rasterizer_scanline_aa<>::aa_scale];
|
||||
unsigned i;
|
||||
for(i = 0; i < rasterizer_scanline_aa<>::aa_scale; ++i)
|
||||
{
|
||||
gamma_table[i] = m_rasterizer.apply_gamma(i);
|
||||
}
|
||||
gamma_hash = calc_crc32(gamma_table, sizeof(gamma_table));
|
||||
}
|
||||
|
||||
sprintf(m_signature,
|
||||
"%s,%u,%d,%d:%dx%d,%d,%d,%d,%d,%d,%08X",
|
||||
m_typeface,
|
||||
m_char_set,
|
||||
int(m_glyph_rendering),
|
||||
m_resolution,
|
||||
m_height,
|
||||
m_width,
|
||||
m_weight,
|
||||
int(m_italic),
|
||||
int(m_hinting),
|
||||
int(m_flip_y),
|
||||
int(m_pitch_and_family),
|
||||
gamma_hash);
|
||||
|
||||
if(m_glyph_rendering == glyph_ren_outline ||
|
||||
m_glyph_rendering == glyph_ren_agg_mono ||
|
||||
m_glyph_rendering == glyph_ren_agg_gray8)
|
||||
{
|
||||
double mtx[6];
|
||||
char buf[100];
|
||||
m_affine.store_to(mtx);
|
||||
sprintf(buf, ",%08X%08X%08X%08X%08X%08X",
|
||||
dbl_to_plain_fx(mtx[0]),
|
||||
dbl_to_plain_fx(mtx[1]),
|
||||
dbl_to_plain_fx(mtx[2]),
|
||||
dbl_to_plain_fx(mtx[3]),
|
||||
dbl_to_plain_fx(mtx[4]),
|
||||
dbl_to_plain_fx(mtx[5]));
|
||||
strcat(m_signature, buf);
|
||||
}
|
||||
++m_change_stamp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool font_engine_win32_tt_base::prepare_glyph(unsigned glyph_code)
|
||||
{
|
||||
if(m_dc && m_cur_font)
|
||||
{
|
||||
int format = GGO_BITMAP;
|
||||
|
||||
switch(m_glyph_rendering)
|
||||
{
|
||||
case glyph_ren_native_gray8:
|
||||
format = GGO_GRAY8_BITMAP;
|
||||
break;
|
||||
|
||||
case glyph_ren_outline:
|
||||
case glyph_ren_agg_mono:
|
||||
case glyph_ren_agg_gray8:
|
||||
format = GGO_NATIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef GGO_UNHINTED // For compatibility with old SDKs.
|
||||
#define GGO_UNHINTED 0x0100
|
||||
#endif
|
||||
if(!m_hinting) format |= GGO_UNHINTED;
|
||||
|
||||
GLYPHMETRICS gm;
|
||||
int total_size = GetGlyphOutlineX(m_dc,
|
||||
glyph_code,
|
||||
format,
|
||||
&gm,
|
||||
buf_size,
|
||||
(void*)m_gbuf,
|
||||
&m_matrix);
|
||||
|
||||
if(total_size < 0)
|
||||
{
|
||||
// GetGlyphOutline() fails when being called for
|
||||
// GGO_GRAY8_BITMAP and white space (stupid Microsoft).
|
||||
// It doesn't even initialize the glyph metrics
|
||||
// structure. So, we have to query the metrics
|
||||
// separately (basically we need gmCellIncX).
|
||||
int total_size = GetGlyphOutlineX(m_dc,
|
||||
glyph_code,
|
||||
GGO_METRICS,
|
||||
&gm,
|
||||
buf_size,
|
||||
(void*)m_gbuf,
|
||||
&m_matrix);
|
||||
|
||||
if(total_size < 0) return false;
|
||||
gm.gmBlackBoxX = gm.gmBlackBoxY = 0;
|
||||
total_size = 0;
|
||||
}
|
||||
|
||||
m_glyph_index = glyph_code;
|
||||
m_advance_x = gm.gmCellIncX;
|
||||
m_advance_y = -gm.gmCellIncY;
|
||||
|
||||
switch(m_glyph_rendering)
|
||||
{
|
||||
case glyph_ren_native_mono:
|
||||
decompose_win32_glyph_bitmap_mono(m_gbuf,
|
||||
gm.gmBlackBoxX,
|
||||
gm.gmBlackBoxY,
|
||||
gm.gmptGlyphOrigin.x,
|
||||
m_flip_y ? -gm.gmptGlyphOrigin.y :
|
||||
gm.gmptGlyphOrigin.y,
|
||||
m_flip_y,
|
||||
m_scanline_bin,
|
||||
m_scanlines_bin);
|
||||
m_bounds.x1 = m_scanlines_bin.min_x();
|
||||
m_bounds.y1 = m_scanlines_bin.min_y();
|
||||
m_bounds.x2 = m_scanlines_bin.max_x() + 1;
|
||||
m_bounds.y2 = m_scanlines_bin.max_y() + 1;
|
||||
m_data_size = m_scanlines_bin.byte_size();
|
||||
m_data_type = glyph_data_mono;
|
||||
return true;
|
||||
|
||||
case glyph_ren_native_gray8:
|
||||
decompose_win32_glyph_bitmap_gray8(m_gbuf,
|
||||
gm.gmBlackBoxX,
|
||||
gm.gmBlackBoxY,
|
||||
gm.gmptGlyphOrigin.x,
|
||||
m_flip_y ? -gm.gmptGlyphOrigin.y :
|
||||
gm.gmptGlyphOrigin.y,
|
||||
m_flip_y,
|
||||
m_rasterizer,
|
||||
m_scanline_aa,
|
||||
m_scanlines_aa);
|
||||
m_bounds.x1 = m_scanlines_aa.min_x();
|
||||
m_bounds.y1 = m_scanlines_aa.min_y();
|
||||
m_bounds.x2 = m_scanlines_aa.max_x() + 1;
|
||||
m_bounds.y2 = m_scanlines_aa.max_y() + 1;
|
||||
m_data_size = m_scanlines_aa.byte_size();
|
||||
m_data_type = glyph_data_gray8;
|
||||
return true;
|
||||
|
||||
case glyph_ren_outline:
|
||||
m_affine.transform(&m_advance_x, &m_advance_y);
|
||||
if(m_flag32)
|
||||
{
|
||||
m_path32.remove_all();
|
||||
if(decompose_win32_glyph_outline(m_gbuf,
|
||||
total_size,
|
||||
m_flip_y,
|
||||
m_affine,
|
||||
m_path32))
|
||||
{
|
||||
rect_d bnd = m_path32.bounding_rect();
|
||||
m_data_size = m_path32.byte_size();
|
||||
m_data_type = glyph_data_outline;
|
||||
m_bounds.x1 = int(floor(bnd.x1));
|
||||
m_bounds.y1 = int(floor(bnd.y1));
|
||||
m_bounds.x2 = int(ceil(bnd.x2));
|
||||
m_bounds.y2 = int(ceil(bnd.y2));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_path16.remove_all();
|
||||
if(decompose_win32_glyph_outline(m_gbuf,
|
||||
total_size,
|
||||
m_flip_y,
|
||||
m_affine,
|
||||
m_path16))
|
||||
{
|
||||
rect_d bnd = m_path16.bounding_rect();
|
||||
m_data_size = m_path16.byte_size();
|
||||
m_data_type = glyph_data_outline;
|
||||
m_bounds.x1 = int(floor(bnd.x1));
|
||||
m_bounds.y1 = int(floor(bnd.y1));
|
||||
m_bounds.x2 = int(ceil(bnd.x2));
|
||||
m_bounds.y2 = int(ceil(bnd.y2));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case glyph_ren_agg_mono:
|
||||
m_rasterizer.reset();
|
||||
m_affine.transform(&m_advance_x, &m_advance_y);
|
||||
if(m_flag32)
|
||||
{
|
||||
m_path32.remove_all();
|
||||
decompose_win32_glyph_outline(m_gbuf,
|
||||
total_size,
|
||||
m_flip_y,
|
||||
m_affine,
|
||||
m_path32);
|
||||
m_rasterizer.add_path(m_curves32);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_path16.remove_all();
|
||||
decompose_win32_glyph_outline(m_gbuf,
|
||||
total_size,
|
||||
m_flip_y,
|
||||
m_affine,
|
||||
m_path16);
|
||||
m_rasterizer.add_path(m_curves16);
|
||||
}
|
||||
m_scanlines_bin.prepare(); // Remove all
|
||||
render_scanlines(m_rasterizer, m_scanline_bin, m_scanlines_bin);
|
||||
m_bounds.x1 = m_scanlines_bin.min_x();
|
||||
m_bounds.y1 = m_scanlines_bin.min_y();
|
||||
m_bounds.x2 = m_scanlines_bin.max_x() + 1;
|
||||
m_bounds.y2 = m_scanlines_bin.max_y() + 1;
|
||||
m_data_size = m_scanlines_bin.byte_size();
|
||||
m_data_type = glyph_data_mono;
|
||||
return true;
|
||||
|
||||
case glyph_ren_agg_gray8:
|
||||
m_rasterizer.reset();
|
||||
m_affine.transform(&m_advance_x, &m_advance_y);
|
||||
if(m_flag32)
|
||||
{
|
||||
m_path32.remove_all();
|
||||
decompose_win32_glyph_outline(m_gbuf,
|
||||
total_size,
|
||||
m_flip_y,
|
||||
m_affine,
|
||||
m_path32);
|
||||
m_rasterizer.add_path(m_curves32);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_path16.remove_all();
|
||||
decompose_win32_glyph_outline(m_gbuf,
|
||||
total_size,
|
||||
m_flip_y,
|
||||
m_affine,
|
||||
m_path16);
|
||||
m_rasterizer.add_path(m_curves16);
|
||||
}
|
||||
m_scanlines_aa.prepare(); // Remove all
|
||||
render_scanlines(m_rasterizer, m_scanline_aa, m_scanlines_aa);
|
||||
m_bounds.x1 = m_scanlines_aa.min_x();
|
||||
m_bounds.y1 = m_scanlines_aa.min_y();
|
||||
m_bounds.x2 = m_scanlines_aa.max_x() + 1;
|
||||
m_bounds.y2 = m_scanlines_aa.max_y() + 1;
|
||||
m_data_size = m_scanlines_aa.byte_size();
|
||||
m_data_type = glyph_data_gray8;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void font_engine_win32_tt_base::write_glyph_to(int8u* data) const
|
||||
{
|
||||
if(data && m_data_size)
|
||||
{
|
||||
switch(m_data_type)
|
||||
{
|
||||
case glyph_data_mono: m_scanlines_bin.serialize(data); break;
|
||||
case glyph_data_gray8: m_scanlines_aa.serialize(data); break;
|
||||
case glyph_data_outline:
|
||||
if(m_flag32)
|
||||
{
|
||||
m_path32.serialize(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_path16.serialize(data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static bool pair_less(const KERNINGPAIR& v1, const KERNINGPAIR& v2)
|
||||
{
|
||||
if(v1.wFirst != v2.wFirst) return v1.wFirst < v2.wFirst;
|
||||
return v1.wSecond < v2.wSecond;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void font_engine_win32_tt_base::sort_kerning_pairs()
|
||||
{
|
||||
pod_array_adaptor<KERNINGPAIR> pairs(m_kerning_pairs, m_num_kerning_pairs);
|
||||
quick_sort(pairs, pair_less);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void font_engine_win32_tt_base::load_kerning_pairs()
|
||||
{
|
||||
if(m_dc && m_cur_font)
|
||||
{
|
||||
if(m_kerning_pairs == 0)
|
||||
{
|
||||
m_kerning_pairs = new KERNINGPAIR [16384-16];
|
||||
m_max_kerning_pairs = 16384-16;
|
||||
}
|
||||
m_num_kerning_pairs = ::GetKerningPairs(m_dc,
|
||||
m_max_kerning_pairs,
|
||||
m_kerning_pairs);
|
||||
|
||||
if(m_num_kerning_pairs)
|
||||
{
|
||||
// Check to see if the kerning pairs are sorted and
|
||||
// sort them if they are not.
|
||||
//----------------
|
||||
unsigned i;
|
||||
for(i = 1; i < m_num_kerning_pairs; ++i)
|
||||
{
|
||||
if(!pair_less(m_kerning_pairs[i - 1], m_kerning_pairs[i]))
|
||||
{
|
||||
sort_kerning_pairs();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool font_engine_win32_tt_base::add_kerning(unsigned first, unsigned second,
|
||||
double* x, double* y)
|
||||
{
|
||||
if(m_dc && m_cur_font)
|
||||
{
|
||||
if(m_num_kerning_pairs == 0)
|
||||
{
|
||||
load_kerning_pairs();
|
||||
}
|
||||
|
||||
int end = m_num_kerning_pairs - 1;
|
||||
int beg = 0;
|
||||
KERNINGPAIR t;
|
||||
t.wFirst = (WORD)first;
|
||||
t.wSecond = (WORD)second;
|
||||
while(beg <= end)
|
||||
{
|
||||
int mid = (end + beg) / 2;
|
||||
if(m_kerning_pairs[mid].wFirst == t.wFirst &&
|
||||
m_kerning_pairs[mid].wSecond == t.wSecond)
|
||||
{
|
||||
double dx = m_kerning_pairs[mid].iKernAmount;
|
||||
double dy = 0.0;
|
||||
if(m_glyph_rendering == glyph_ren_outline ||
|
||||
m_glyph_rendering == glyph_ren_agg_mono ||
|
||||
m_glyph_rendering == glyph_ren_agg_gray8)
|
||||
{
|
||||
m_affine.transform_2x2(&dx, &dy);
|
||||
}
|
||||
*x += dx;
|
||||
*y += dy;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if(pair_less(t, m_kerning_pairs[mid]))
|
||||
{
|
||||
end = mid - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
beg = mid + 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_FONT_WIN32_TT_INCLUDED
|
||||
#define AGG_FONT_WIN32_TT_INCLUDED
|
||||
|
||||
#include <windows.h>
|
||||
#include "agg_scanline_storage_aa.h"
|
||||
#include "agg_scanline_storage_bin.h"
|
||||
#include "agg_scanline_u.h"
|
||||
#include "agg_scanline_bin.h"
|
||||
#include "agg_path_storage_integer.h"
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
#include "agg_conv_curve.h"
|
||||
#include "agg_trans_affine.h"
|
||||
#include "agg_font_cache_manager.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-----------------------------------------------font_engine_win32_tt_base
|
||||
class font_engine_win32_tt_base
|
||||
{
|
||||
enum { buf_size = 32768-32 };
|
||||
|
||||
public:
|
||||
//--------------------------------------------------------------------
|
||||
typedef serialized_scanlines_adaptor_aa<int8u> gray8_adaptor_type;
|
||||
typedef serialized_scanlines_adaptor_bin mono_adaptor_type;
|
||||
typedef scanline_storage_aa8 scanlines_aa_type;
|
||||
typedef scanline_storage_bin scanlines_bin_type;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
~font_engine_win32_tt_base();
|
||||
font_engine_win32_tt_base(bool flag32, HDC dc, unsigned max_fonts = 32);
|
||||
|
||||
// Set font parameters
|
||||
//--------------------------------------------------------------------
|
||||
void resolution(unsigned dpi) { m_resolution = unsigned(dpi); }
|
||||
void height(double h) { m_height = unsigned(h); }
|
||||
void width(double w) { m_width = unsigned(w); }
|
||||
void weight(int w) { m_weight = w; }
|
||||
void italic(bool it) { m_italic = it; }
|
||||
void char_set(DWORD c) { m_char_set = c; }
|
||||
void pitch_and_family(DWORD p){ m_pitch_and_family = p; }
|
||||
void flip_y(bool flip) { m_flip_y = flip; }
|
||||
void hinting(bool h) { m_hinting = h; }
|
||||
bool create_font(const char* typeface_, glyph_rendering ren_type);
|
||||
|
||||
bool create_font(const char* typeface_,
|
||||
glyph_rendering ren_type,
|
||||
double height_,
|
||||
double width_=0.0,
|
||||
int weight_=FW_REGULAR,
|
||||
bool italic_=false,
|
||||
DWORD char_set_=ANSI_CHARSET,
|
||||
DWORD pitch_and_family_=FF_DONTCARE);
|
||||
|
||||
// Set Gamma
|
||||
//--------------------------------------------------------------------
|
||||
template<class GammaF> void gamma(const GammaF& f)
|
||||
{
|
||||
m_rasterizer.gamma(f);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void transform(const agg::trans_affine& mtx)
|
||||
{
|
||||
m_affine = mtx;
|
||||
}
|
||||
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
unsigned resolution() const { return m_resolution; }
|
||||
const char* typeface() const { return m_typeface; }
|
||||
double height() const { return m_height; }
|
||||
double width() const { return m_width; }
|
||||
int weight() const { return m_weight; }
|
||||
bool italic() const { return m_italic; }
|
||||
DWORD char_set() const { return m_char_set; }
|
||||
DWORD pitch_and_family() const { return m_pitch_and_family; }
|
||||
bool hinting() const { return m_hinting; }
|
||||
bool flip_y() const { return m_flip_y; }
|
||||
|
||||
|
||||
// Interface mandatory to implement for font_cache_manager
|
||||
//--------------------------------------------------------------------
|
||||
const char* font_signature() const { return m_signature; }
|
||||
int change_stamp() const { return m_change_stamp; }
|
||||
|
||||
bool prepare_glyph(unsigned glyph_code);
|
||||
unsigned glyph_index() const { return m_glyph_index; }
|
||||
unsigned data_size() const { return m_data_size; }
|
||||
glyph_data_type data_type() const { return m_data_type; }
|
||||
const rect_i& bounds() const { return m_bounds; }
|
||||
double advance_x() const { return m_advance_x; }
|
||||
double advance_y() const { return m_advance_y; }
|
||||
void write_glyph_to(int8u* data) const;
|
||||
bool add_kerning(unsigned first, unsigned second,
|
||||
double* x, double* y);
|
||||
|
||||
private:
|
||||
font_engine_win32_tt_base(const font_engine_win32_tt_base&);
|
||||
const font_engine_win32_tt_base& operator = (const font_engine_win32_tt_base&);
|
||||
|
||||
void update_signature();
|
||||
void load_kerning_pairs();
|
||||
void sort_kerning_pairs();
|
||||
int find_font(const char* name) const;
|
||||
|
||||
bool m_flag32;
|
||||
HDC m_dc;
|
||||
HFONT m_old_font;
|
||||
HFONT* m_fonts;
|
||||
unsigned m_num_fonts;
|
||||
unsigned m_max_fonts;
|
||||
char** m_font_names;
|
||||
HFONT m_cur_font;
|
||||
|
||||
int m_change_stamp;
|
||||
char* m_typeface;
|
||||
unsigned m_typeface_len;
|
||||
char* m_signature;
|
||||
unsigned m_height;
|
||||
unsigned m_width;
|
||||
int m_weight;
|
||||
bool m_italic;
|
||||
DWORD m_char_set;
|
||||
DWORD m_pitch_and_family;
|
||||
bool m_hinting;
|
||||
bool m_flip_y;
|
||||
|
||||
bool m_font_created;
|
||||
unsigned m_resolution;
|
||||
glyph_rendering m_glyph_rendering;
|
||||
unsigned m_glyph_index;
|
||||
unsigned m_data_size;
|
||||
glyph_data_type m_data_type;
|
||||
rect_i m_bounds;
|
||||
double m_advance_x;
|
||||
double m_advance_y;
|
||||
MAT2 m_matrix;
|
||||
char* m_gbuf;
|
||||
KERNINGPAIR* m_kerning_pairs;
|
||||
unsigned m_num_kerning_pairs;
|
||||
unsigned m_max_kerning_pairs;
|
||||
trans_affine m_affine;
|
||||
|
||||
path_storage_integer<int16, 6> m_path16;
|
||||
path_storage_integer<int32, 6> m_path32;
|
||||
conv_curve<path_storage_integer<int16, 6> > m_curves16;
|
||||
conv_curve<path_storage_integer<int32, 6> > m_curves32;
|
||||
scanline_u8 m_scanline_aa;
|
||||
scanline_bin m_scanline_bin;
|
||||
scanlines_aa_type m_scanlines_aa;
|
||||
scanlines_bin_type m_scanlines_bin;
|
||||
rasterizer_scanline_aa<> m_rasterizer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------font_engine_win32_tt_int16
|
||||
// This class uses values of type int16 (10.6 format) for the vector cache.
|
||||
// The vector cache is compact, but when rendering glyphs of height
|
||||
// more that 200 there integer overflow can occur.
|
||||
//
|
||||
class font_engine_win32_tt_int16 : public font_engine_win32_tt_base
|
||||
{
|
||||
public:
|
||||
typedef serialized_integer_path_adaptor<int16, 6> path_adaptor_type;
|
||||
typedef font_engine_win32_tt_base::gray8_adaptor_type gray8_adaptor_type;
|
||||
typedef font_engine_win32_tt_base::mono_adaptor_type mono_adaptor_type;
|
||||
typedef font_engine_win32_tt_base::scanlines_aa_type scanlines_aa_type;
|
||||
typedef font_engine_win32_tt_base::scanlines_bin_type scanlines_bin_type;
|
||||
|
||||
font_engine_win32_tt_int16(HDC dc, unsigned max_fonts = 32) :
|
||||
font_engine_win32_tt_base(false, dc, max_fonts) {}
|
||||
};
|
||||
|
||||
//------------------------------------------------font_engine_win32_tt_int32
|
||||
// This class uses values of type int32 (26.6 format) for the vector cache.
|
||||
// The vector cache is twice larger than in font_engine_win32_tt_int16,
|
||||
// but it allows you to render glyphs of very large sizes.
|
||||
//
|
||||
class font_engine_win32_tt_int32 : public font_engine_win32_tt_base
|
||||
{
|
||||
public:
|
||||
typedef serialized_integer_path_adaptor<int32, 6> path_adaptor_type;
|
||||
typedef font_engine_win32_tt_base::gray8_adaptor_type gray8_adaptor_type;
|
||||
typedef font_engine_win32_tt_base::mono_adaptor_type mono_adaptor_type;
|
||||
typedef font_engine_win32_tt_base::scanlines_aa_type scanlines_aa_type;
|
||||
typedef font_engine_win32_tt_base::scanlines_bin_type scanlines_bin_type;
|
||||
|
||||
font_engine_win32_tt_int32(HDC dc, unsigned max_fonts = 32) :
|
||||
font_engine_win32_tt_base(true, dc, max_fonts) {}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,505 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_ALPHA_MASK_U8_INCLUDED
|
||||
#define AGG_ALPHA_MASK_U8_INCLUDED
|
||||
|
||||
#include <string.h>
|
||||
#include "agg_basics.h"
|
||||
#include "agg_rendering_buffer.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//===================================================one_component_mask_u8
|
||||
struct one_component_mask_u8
|
||||
{
|
||||
static unsigned calculate(const int8u* p) { return *p; }
|
||||
};
|
||||
|
||||
|
||||
//=====================================================rgb_to_gray_mask_u8
|
||||
template<unsigned R, unsigned G, unsigned B>
|
||||
struct rgb_to_gray_mask_u8
|
||||
{
|
||||
static unsigned calculate(const int8u* p)
|
||||
{
|
||||
return (p[R]*77 + p[G]*150 + p[B]*29) >> 8;
|
||||
}
|
||||
};
|
||||
|
||||
//==========================================================alpha_mask_u8
|
||||
template<unsigned Step=1, unsigned Offset=0, class MaskF=one_component_mask_u8>
|
||||
class alpha_mask_u8
|
||||
{
|
||||
public:
|
||||
typedef int8u cover_type;
|
||||
typedef alpha_mask_u8<Step, Offset, MaskF> self_type;
|
||||
enum cover_scale_e
|
||||
{
|
||||
cover_shift = 8,
|
||||
cover_none = 0,
|
||||
cover_full = 255
|
||||
};
|
||||
|
||||
alpha_mask_u8() : m_rbuf(0) {}
|
||||
explicit alpha_mask_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {}
|
||||
|
||||
void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; }
|
||||
|
||||
MaskF& mask_function() { return m_mask_function; }
|
||||
const MaskF& mask_function() const { return m_mask_function; }
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
cover_type pixel(int x, int y) const
|
||||
{
|
||||
if(x >= 0 && y >= 0 &&
|
||||
x < (int)m_rbuf->width() &&
|
||||
y < (int)m_rbuf->height())
|
||||
{
|
||||
return (cover_type)m_mask_function.calculate(
|
||||
m_rbuf->row_ptr(y) + x * Step + Offset);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
cover_type combine_pixel(int x, int y, cover_type val) const
|
||||
{
|
||||
if(x >= 0 && y >= 0 &&
|
||||
x < (int)m_rbuf->width() &&
|
||||
y < (int)m_rbuf->height())
|
||||
{
|
||||
return (cover_type)((cover_full + val *
|
||||
m_mask_function.calculate(
|
||||
m_rbuf->row_ptr(y) + x * Step + Offset)) >>
|
||||
cover_shift);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void fill_hspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
int xmax = m_rbuf->width() - 1;
|
||||
int ymax = m_rbuf->height() - 1;
|
||||
|
||||
int count = num_pix;
|
||||
cover_type* covers = dst;
|
||||
|
||||
if(y < 0 || y > ymax)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
|
||||
if(x < 0)
|
||||
{
|
||||
count += x;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers, 0, -x * sizeof(cover_type));
|
||||
covers -= x;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if(x + count > xmax)
|
||||
{
|
||||
int rest = x + count - xmax - 1;
|
||||
count -= rest;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers + count, 0, rest * sizeof(cover_type));
|
||||
}
|
||||
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*covers++ = (cover_type)m_mask_function.calculate(mask);
|
||||
mask += Step;
|
||||
}
|
||||
while(--count);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void combine_hspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
int xmax = m_rbuf->width() - 1;
|
||||
int ymax = m_rbuf->height() - 1;
|
||||
|
||||
int count = num_pix;
|
||||
cover_type* covers = dst;
|
||||
|
||||
if(y < 0 || y > ymax)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
|
||||
if(x < 0)
|
||||
{
|
||||
count += x;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers, 0, -x * sizeof(cover_type));
|
||||
covers -= x;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if(x + count > xmax)
|
||||
{
|
||||
int rest = x + count - xmax - 1;
|
||||
count -= rest;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers + count, 0, rest * sizeof(cover_type));
|
||||
}
|
||||
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*covers = (cover_type)((cover_full + (*covers) *
|
||||
m_mask_function.calculate(mask)) >>
|
||||
cover_shift);
|
||||
++covers;
|
||||
mask += Step;
|
||||
}
|
||||
while(--count);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void fill_vspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
int xmax = m_rbuf->width() - 1;
|
||||
int ymax = m_rbuf->height() - 1;
|
||||
|
||||
int count = num_pix;
|
||||
cover_type* covers = dst;
|
||||
|
||||
if(x < 0 || x > xmax)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
|
||||
if(y < 0)
|
||||
{
|
||||
count += y;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers, 0, -y * sizeof(cover_type));
|
||||
covers -= y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
if(y + count > ymax)
|
||||
{
|
||||
int rest = y + count - ymax - 1;
|
||||
count -= rest;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers + count, 0, rest * sizeof(cover_type));
|
||||
}
|
||||
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*covers++ = (cover_type)m_mask_function.calculate(mask);
|
||||
mask += m_rbuf->stride();
|
||||
}
|
||||
while(--count);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void combine_vspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
int xmax = m_rbuf->width() - 1;
|
||||
int ymax = m_rbuf->height() - 1;
|
||||
|
||||
int count = num_pix;
|
||||
cover_type* covers = dst;
|
||||
|
||||
if(x < 0 || x > xmax)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
|
||||
if(y < 0)
|
||||
{
|
||||
count += y;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers, 0, -y * sizeof(cover_type));
|
||||
covers -= y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
if(y + count > ymax)
|
||||
{
|
||||
int rest = y + count - ymax - 1;
|
||||
count -= rest;
|
||||
if(count <= 0)
|
||||
{
|
||||
memset(dst, 0, num_pix * sizeof(cover_type));
|
||||
return;
|
||||
}
|
||||
memset(covers + count, 0, rest * sizeof(cover_type));
|
||||
}
|
||||
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*covers = (cover_type)((cover_full + (*covers) *
|
||||
m_mask_function.calculate(mask)) >>
|
||||
cover_shift);
|
||||
++covers;
|
||||
mask += m_rbuf->stride();
|
||||
}
|
||||
while(--count);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
alpha_mask_u8(const self_type&);
|
||||
const self_type& operator = (const self_type&);
|
||||
|
||||
rendering_buffer* m_rbuf;
|
||||
MaskF m_mask_function;
|
||||
};
|
||||
|
||||
|
||||
typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8
|
||||
|
||||
typedef alpha_mask_u8<3, 0> alpha_mask_rgb24r; //----alpha_mask_rgb24r
|
||||
typedef alpha_mask_u8<3, 1> alpha_mask_rgb24g; //----alpha_mask_rgb24g
|
||||
typedef alpha_mask_u8<3, 2> alpha_mask_rgb24b; //----alpha_mask_rgb24b
|
||||
|
||||
typedef alpha_mask_u8<3, 2> alpha_mask_bgr24r; //----alpha_mask_bgr24r
|
||||
typedef alpha_mask_u8<3, 1> alpha_mask_bgr24g; //----alpha_mask_bgr24g
|
||||
typedef alpha_mask_u8<3, 0> alpha_mask_bgr24b; //----alpha_mask_bgr24b
|
||||
|
||||
typedef alpha_mask_u8<4, 0> alpha_mask_rgba32r; //----alpha_mask_rgba32r
|
||||
typedef alpha_mask_u8<4, 1> alpha_mask_rgba32g; //----alpha_mask_rgba32g
|
||||
typedef alpha_mask_u8<4, 2> alpha_mask_rgba32b; //----alpha_mask_rgba32b
|
||||
typedef alpha_mask_u8<4, 3> alpha_mask_rgba32a; //----alpha_mask_rgba32a
|
||||
|
||||
typedef alpha_mask_u8<4, 1> alpha_mask_argb32r; //----alpha_mask_argb32r
|
||||
typedef alpha_mask_u8<4, 2> alpha_mask_argb32g; //----alpha_mask_argb32g
|
||||
typedef alpha_mask_u8<4, 3> alpha_mask_argb32b; //----alpha_mask_argb32b
|
||||
typedef alpha_mask_u8<4, 0> alpha_mask_argb32a; //----alpha_mask_argb32a
|
||||
|
||||
typedef alpha_mask_u8<4, 2> alpha_mask_bgra32r; //----alpha_mask_bgra32r
|
||||
typedef alpha_mask_u8<4, 1> alpha_mask_bgra32g; //----alpha_mask_bgra32g
|
||||
typedef alpha_mask_u8<4, 0> alpha_mask_bgra32b; //----alpha_mask_bgra32b
|
||||
typedef alpha_mask_u8<4, 3> alpha_mask_bgra32a; //----alpha_mask_bgra32a
|
||||
|
||||
typedef alpha_mask_u8<4, 3> alpha_mask_abgr32r; //----alpha_mask_abgr32r
|
||||
typedef alpha_mask_u8<4, 2> alpha_mask_abgr32g; //----alpha_mask_abgr32g
|
||||
typedef alpha_mask_u8<4, 1> alpha_mask_abgr32b; //----alpha_mask_abgr32b
|
||||
typedef alpha_mask_u8<4, 0> alpha_mask_abgr32a; //----alpha_mask_abgr32a
|
||||
|
||||
typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgb24gray; //----alpha_mask_rgb24gray
|
||||
typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgr24gray; //----alpha_mask_bgr24gray
|
||||
typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgba32gray; //----alpha_mask_rgba32gray
|
||||
typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_argb32gray; //----alpha_mask_argb32gray
|
||||
typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgra32gray; //----alpha_mask_bgra32gray
|
||||
typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_abgr32gray; //----alpha_mask_abgr32gray
|
||||
|
||||
|
||||
|
||||
//==========================================================amask_no_clip_u8
|
||||
template<unsigned Step=1, unsigned Offset=0, class MaskF=one_component_mask_u8>
|
||||
class amask_no_clip_u8
|
||||
{
|
||||
public:
|
||||
typedef int8u cover_type;
|
||||
typedef amask_no_clip_u8<Step, Offset, MaskF> self_type;
|
||||
enum cover_scale_e
|
||||
{
|
||||
cover_shift = 8,
|
||||
cover_none = 0,
|
||||
cover_full = 255
|
||||
};
|
||||
|
||||
amask_no_clip_u8() : m_rbuf(0) {}
|
||||
explicit amask_no_clip_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {}
|
||||
|
||||
void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; }
|
||||
|
||||
MaskF& mask_function() { return m_mask_function; }
|
||||
const MaskF& mask_function() const { return m_mask_function; }
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
cover_type pixel(int x, int y) const
|
||||
{
|
||||
return (cover_type)m_mask_function.calculate(
|
||||
m_rbuf->row_ptr(y) + x * Step + Offset);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
cover_type combine_pixel(int x, int y, cover_type val) const
|
||||
{
|
||||
return (cover_type)((cover_full + val *
|
||||
m_mask_function.calculate(
|
||||
m_rbuf->row_ptr(y) + x * Step + Offset)) >>
|
||||
cover_shift);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void fill_hspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*dst++ = (cover_type)m_mask_function.calculate(mask);
|
||||
mask += Step;
|
||||
}
|
||||
while(--num_pix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void combine_hspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*dst = (cover_type)((cover_full + (*dst) *
|
||||
m_mask_function.calculate(mask)) >>
|
||||
cover_shift);
|
||||
++dst;
|
||||
mask += Step;
|
||||
}
|
||||
while(--num_pix);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void fill_vspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*dst++ = (cover_type)m_mask_function.calculate(mask);
|
||||
mask += m_rbuf->stride();
|
||||
}
|
||||
while(--num_pix);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void combine_vspan(int x, int y, cover_type* dst, int num_pix) const
|
||||
{
|
||||
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
|
||||
do
|
||||
{
|
||||
*dst = (cover_type)((cover_full + (*dst) *
|
||||
m_mask_function.calculate(mask)) >>
|
||||
cover_shift);
|
||||
++dst;
|
||||
mask += m_rbuf->stride();
|
||||
}
|
||||
while(--num_pix);
|
||||
}
|
||||
|
||||
private:
|
||||
amask_no_clip_u8(const self_type&);
|
||||
const self_type& operator = (const self_type&);
|
||||
|
||||
rendering_buffer* m_rbuf;
|
||||
MaskF m_mask_function;
|
||||
};
|
||||
|
||||
|
||||
typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8
|
||||
|
||||
typedef amask_no_clip_u8<3, 0> amask_no_clip_rgb24r; //----amask_no_clip_rgb24r
|
||||
typedef amask_no_clip_u8<3, 1> amask_no_clip_rgb24g; //----amask_no_clip_rgb24g
|
||||
typedef amask_no_clip_u8<3, 2> amask_no_clip_rgb24b; //----amask_no_clip_rgb24b
|
||||
|
||||
typedef amask_no_clip_u8<3, 2> amask_no_clip_bgr24r; //----amask_no_clip_bgr24r
|
||||
typedef amask_no_clip_u8<3, 1> amask_no_clip_bgr24g; //----amask_no_clip_bgr24g
|
||||
typedef amask_no_clip_u8<3, 0> amask_no_clip_bgr24b; //----amask_no_clip_bgr24b
|
||||
|
||||
typedef amask_no_clip_u8<4, 0> amask_no_clip_rgba32r; //----amask_no_clip_rgba32r
|
||||
typedef amask_no_clip_u8<4, 1> amask_no_clip_rgba32g; //----amask_no_clip_rgba32g
|
||||
typedef amask_no_clip_u8<4, 2> amask_no_clip_rgba32b; //----amask_no_clip_rgba32b
|
||||
typedef amask_no_clip_u8<4, 3> amask_no_clip_rgba32a; //----amask_no_clip_rgba32a
|
||||
|
||||
typedef amask_no_clip_u8<4, 1> amask_no_clip_argb32r; //----amask_no_clip_argb32r
|
||||
typedef amask_no_clip_u8<4, 2> amask_no_clip_argb32g; //----amask_no_clip_argb32g
|
||||
typedef amask_no_clip_u8<4, 3> amask_no_clip_argb32b; //----amask_no_clip_argb32b
|
||||
typedef amask_no_clip_u8<4, 0> amask_no_clip_argb32a; //----amask_no_clip_argb32a
|
||||
|
||||
typedef amask_no_clip_u8<4, 2> amask_no_clip_bgra32r; //----amask_no_clip_bgra32r
|
||||
typedef amask_no_clip_u8<4, 1> amask_no_clip_bgra32g; //----amask_no_clip_bgra32g
|
||||
typedef amask_no_clip_u8<4, 0> amask_no_clip_bgra32b; //----amask_no_clip_bgra32b
|
||||
typedef amask_no_clip_u8<4, 3> amask_no_clip_bgra32a; //----amask_no_clip_bgra32a
|
||||
|
||||
typedef amask_no_clip_u8<4, 3> amask_no_clip_abgr32r; //----amask_no_clip_abgr32r
|
||||
typedef amask_no_clip_u8<4, 2> amask_no_clip_abgr32g; //----amask_no_clip_abgr32g
|
||||
typedef amask_no_clip_u8<4, 1> amask_no_clip_abgr32b; //----amask_no_clip_abgr32b
|
||||
typedef amask_no_clip_u8<4, 0> amask_no_clip_abgr32a; //----amask_no_clip_abgr32a
|
||||
|
||||
typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgb24gray; //----amask_no_clip_rgb24gray
|
||||
typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgr24gray; //----amask_no_clip_bgr24gray
|
||||
typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgba32gray; //----amask_no_clip_rgba32gray
|
||||
typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_argb32gray; //----amask_no_clip_argb32gray
|
||||
typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgra32gray; //----amask_no_clip_bgra32gray
|
||||
typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_abgr32gray; //----amask_no_clip_abgr32gray
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_ARC_INCLUDED
|
||||
#define AGG_ARC_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//=====================================================================arc
|
||||
//
|
||||
// See Implementation agg_arc.cpp
|
||||
//
|
||||
class arc
|
||||
{
|
||||
public:
|
||||
arc() : m_scale(1.0), m_initialized(false) {}
|
||||
arc(double x, double y,
|
||||
double rx, double ry,
|
||||
double a1, double a2,
|
||||
bool ccw=true);
|
||||
|
||||
void init(double x, double y,
|
||||
double rx, double ry,
|
||||
double a1, double a2,
|
||||
bool ccw=true);
|
||||
|
||||
void approximation_scale(double s);
|
||||
double approximation_scale() const { return m_scale; }
|
||||
|
||||
void rewind(unsigned);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
void normalize(double a1, double a2, bool ccw);
|
||||
|
||||
double m_x;
|
||||
double m_y;
|
||||
double m_rx;
|
||||
double m_ry;
|
||||
double m_angle;
|
||||
double m_start;
|
||||
double m_end;
|
||||
double m_scale;
|
||||
double m_da;
|
||||
bool m_ccw;
|
||||
bool m_initialized;
|
||||
unsigned m_path_cmd;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,88 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_ARROWHEAD_INCLUDED
|
||||
#define AGG_ARROWHEAD_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//===============================================================arrowhead
|
||||
//
|
||||
// See implementation agg_arrowhead.cpp
|
||||
//
|
||||
class arrowhead
|
||||
{
|
||||
public:
|
||||
arrowhead();
|
||||
|
||||
void head(double d1, double d2, double d3, double d4)
|
||||
{
|
||||
m_head_d1 = d1;
|
||||
m_head_d2 = d2;
|
||||
m_head_d3 = d3;
|
||||
m_head_d4 = d4;
|
||||
m_head_flag = true;
|
||||
}
|
||||
|
||||
void head() { m_head_flag = true; }
|
||||
void no_head() { m_head_flag = false; }
|
||||
|
||||
void tail(double d1, double d2, double d3, double d4)
|
||||
{
|
||||
m_tail_d1 = d1;
|
||||
m_tail_d2 = d2;
|
||||
m_tail_d3 = d3;
|
||||
m_tail_d4 = d4;
|
||||
m_tail_flag = true;
|
||||
}
|
||||
|
||||
void tail() { m_tail_flag = true; }
|
||||
void no_tail() { m_tail_flag = false; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
double m_head_d1;
|
||||
double m_head_d2;
|
||||
double m_head_d3;
|
||||
double m_head_d4;
|
||||
double m_tail_d1;
|
||||
double m_tail_d2;
|
||||
double m_tail_d3;
|
||||
double m_tail_d4;
|
||||
bool m_head_flag;
|
||||
bool m_tail_flag;
|
||||
double m_coord[16];
|
||||
unsigned m_cmd[8];
|
||||
unsigned m_curr_id;
|
||||
unsigned m_curr_coord;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,539 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_BASICS_INCLUDED
|
||||
#define AGG_BASICS_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_config.h"
|
||||
|
||||
//---------------------------------------------------------AGG_CUSTOM_ALLOCATOR
|
||||
#ifdef AGG_CUSTOM_ALLOCATOR
|
||||
#include "agg_allocator.h"
|
||||
#else
|
||||
namespace agg
|
||||
{
|
||||
// The policy of all AGG containers and memory allocation strategy
|
||||
// in general is that no allocated data requires explicit construction.
|
||||
// It means that the allocator can be really simple; you can even
|
||||
// replace new/delete to malloc/free. The constructors and destructors
|
||||
// won't be called in this case, however everything will remain working.
|
||||
// The second argument of deallocate() is the size of the allocated
|
||||
// block. You can use this information if you wish.
|
||||
//------------------------------------------------------------pod_allocator
|
||||
template<class T> struct pod_allocator
|
||||
{
|
||||
static T* allocate(unsigned num) { return new T [num]; }
|
||||
static void deallocate(T* ptr, unsigned) { delete [] ptr; }
|
||||
};
|
||||
|
||||
// Single object allocator. It's also can be replaced with your custom
|
||||
// allocator. The difference is that it can only allocate a single
|
||||
// object and the constructor and destructor must be called.
|
||||
// In AGG there is no need to allocate an array of objects with
|
||||
// calling their constructors (only single ones). So that, if you
|
||||
// replace these new/delete to malloc/free make sure that the in-place
|
||||
// new is called and take care of calling the destructor too.
|
||||
//------------------------------------------------------------obj_allocator
|
||||
template<class T> struct obj_allocator
|
||||
{
|
||||
static T* allocate() { return new T; }
|
||||
static void deallocate(T* ptr) { delete ptr; }
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------------------------------- Default basic types
|
||||
//
|
||||
// If the compiler has different capacity of the basic types you can redefine
|
||||
// them via the compiler command line or by generating agg_config.h that is
|
||||
// empty by default.
|
||||
//
|
||||
#ifndef AGG_INT8
|
||||
#define AGG_INT8 signed char
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT8U
|
||||
#define AGG_INT8U unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT16
|
||||
#define AGG_INT16 short
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT16U
|
||||
#define AGG_INT16U unsigned short
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT32
|
||||
#define AGG_INT32 int
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT32U
|
||||
#define AGG_INT32U unsigned
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT64
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#define AGG_INT64 signed __int64
|
||||
#else
|
||||
#define AGG_INT64 signed long long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AGG_INT64U
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#define AGG_INT64U unsigned __int64
|
||||
#else
|
||||
#define AGG_INT64U unsigned long long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//------------------------------------------------ Some fixes for MS Visual C++
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable:4786) // Identifier was truncated...
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define AGG_INLINE __forceinline
|
||||
#else
|
||||
#define AGG_INLINE inline
|
||||
#endif
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
typedef AGG_INT8 int8; //----int8
|
||||
typedef AGG_INT8U int8u; //----int8u
|
||||
typedef AGG_INT16 int16; //----int16
|
||||
typedef AGG_INT16U int16u; //----int16u
|
||||
typedef AGG_INT32 int32; //----int32
|
||||
typedef AGG_INT32U int32u; //----int32u
|
||||
typedef AGG_INT64 int64; //----int64
|
||||
typedef AGG_INT64U int64u; //----int64u
|
||||
|
||||
#if defined(AGG_FISTP)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4035) //Disable warning "no return value"
|
||||
AGG_INLINE int iround(double v) //-------iround
|
||||
{
|
||||
int t;
|
||||
__asm fld qword ptr [v]
|
||||
__asm fistp dword ptr [t]
|
||||
__asm mov eax, dword ptr [t]
|
||||
}
|
||||
AGG_INLINE unsigned uround(double v) //-------uround
|
||||
{
|
||||
unsigned t;
|
||||
__asm fld qword ptr [v]
|
||||
__asm fistp dword ptr [t]
|
||||
__asm mov eax, dword ptr [t]
|
||||
}
|
||||
#pragma warning(pop)
|
||||
AGG_INLINE unsigned ufloor(double v) //-------ufloor
|
||||
{
|
||||
return unsigned(floor(v));
|
||||
}
|
||||
AGG_INLINE unsigned uceil(double v) //--------uceil
|
||||
{
|
||||
return unsigned(ceil(v));
|
||||
}
|
||||
#elif defined(AGG_QIFIST)
|
||||
AGG_INLINE int iround(double v)
|
||||
{
|
||||
return int(v);
|
||||
}
|
||||
AGG_INLINE int uround(double v)
|
||||
{
|
||||
return unsigned(v);
|
||||
}
|
||||
AGG_INLINE unsigned ufloor(double v)
|
||||
{
|
||||
return unsigned(floor(v));
|
||||
}
|
||||
AGG_INLINE unsigned uceil(double v)
|
||||
{
|
||||
return unsigned(ceil(v));
|
||||
}
|
||||
#else
|
||||
AGG_INLINE int iround(double v)
|
||||
{
|
||||
return int((v < 0.0) ? v - 0.5 : v + 0.5);
|
||||
}
|
||||
AGG_INLINE int uround(double v)
|
||||
{
|
||||
return unsigned(v + 0.5);
|
||||
}
|
||||
AGG_INLINE unsigned ufloor(double v)
|
||||
{
|
||||
return unsigned(v);
|
||||
}
|
||||
AGG_INLINE unsigned uceil(double v)
|
||||
{
|
||||
return unsigned(ceil(v));
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------saturation
|
||||
template<int Limit> struct saturation
|
||||
{
|
||||
AGG_INLINE static int iround(double v)
|
||||
{
|
||||
if(v < double(-Limit)) return -Limit;
|
||||
if(v > double( Limit)) return Limit;
|
||||
return agg::iround(v);
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------mul_one
|
||||
template<unsigned Shift> struct mul_one
|
||||
{
|
||||
AGG_INLINE static unsigned mul(unsigned a, unsigned b)
|
||||
{
|
||||
register unsigned q = a * b + (1 << (Shift-1));
|
||||
return (q + (q >> Shift)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
typedef unsigned char cover_type; //----cover_type
|
||||
enum cover_scale_e
|
||||
{
|
||||
cover_shift = 8, //----cover_shift
|
||||
cover_size = 1 << cover_shift, //----cover_size
|
||||
cover_mask = cover_size - 1, //----cover_mask
|
||||
cover_none = 0, //----cover_none
|
||||
cover_full = cover_mask //----cover_full
|
||||
};
|
||||
|
||||
//----------------------------------------------------poly_subpixel_scale_e
|
||||
// These constants determine the subpixel accuracy, to be more precise,
|
||||
// the number of bits of the fractional part of the coordinates.
|
||||
// The possible coordinate capacity in bits can be calculated by formula:
|
||||
// sizeof(int) * 8 - poly_subpixel_shift, i.e, for 32-bit integers and
|
||||
// 8-bits fractional part the capacity is 24 bits.
|
||||
enum poly_subpixel_scale_e
|
||||
{
|
||||
poly_subpixel_shift = 8, //----poly_subpixel_shift
|
||||
poly_subpixel_scale = 1<<poly_subpixel_shift, //----poly_subpixel_scale
|
||||
poly_subpixel_mask = poly_subpixel_scale-1, //----poly_subpixel_mask
|
||||
};
|
||||
|
||||
//----------------------------------------------------------filling_rule_e
|
||||
enum filling_rule_e
|
||||
{
|
||||
fill_non_zero,
|
||||
fill_even_odd
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------pi
|
||||
const double pi = 3.14159265358979323846;
|
||||
|
||||
//------------------------------------------------------------------deg2rad
|
||||
inline double deg2rad(double deg)
|
||||
{
|
||||
return deg * pi / 180.0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------rad2deg
|
||||
inline double rad2deg(double rad)
|
||||
{
|
||||
return rad * 180.0 / pi;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------rect_base
|
||||
template<class T> struct rect_base
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef rect_base<T> self_type;
|
||||
T x1, y1, x2, y2;
|
||||
|
||||
rect_base() {}
|
||||
rect_base(T x1_, T y1_, T x2_, T y2_) :
|
||||
x1(x1_), y1(y1_), x2(x2_), y2(y2_) {}
|
||||
|
||||
void init(T x1_, T y1_, T x2_, T y2_)
|
||||
{
|
||||
x1 = x1_; y1 = y1_; x2 = x2_; y2 = y2_;
|
||||
}
|
||||
|
||||
const self_type& normalize()
|
||||
{
|
||||
T t;
|
||||
if(x1 > x2) { t = x1; x1 = x2; x2 = t; }
|
||||
if(y1 > y2) { t = y1; y1 = y2; y2 = t; }
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool clip(const self_type& r)
|
||||
{
|
||||
if(x2 > r.x2) x2 = r.x2;
|
||||
if(y2 > r.y2) y2 = r.y2;
|
||||
if(x1 < r.x1) x1 = r.x1;
|
||||
if(y1 < r.y1) y1 = r.y1;
|
||||
return x1 <= x2 && y1 <= y2;
|
||||
}
|
||||
|
||||
bool is_valid() const
|
||||
{
|
||||
return x1 <= x2 && y1 <= y2;
|
||||
}
|
||||
|
||||
bool hit_test(T x, T y) const
|
||||
{
|
||||
return (x >= x1 && x <= x2 && y >= y1 && y <= y2);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------intersect_rectangles
|
||||
template<class Rect>
|
||||
inline Rect intersect_rectangles(const Rect& r1, const Rect& r2)
|
||||
{
|
||||
Rect r = r1;
|
||||
|
||||
// First process x2,y2 because the other order
|
||||
// results in Internal Compiler Error under
|
||||
// Microsoft Visual C++ .NET 2003 69462-335-0000007-18038 in
|
||||
// case of "Maximize Speed" optimization option.
|
||||
//-----------------
|
||||
if(r.x2 > r2.x2) r.x2 = r2.x2;
|
||||
if(r.y2 > r2.y2) r.y2 = r2.y2;
|
||||
if(r.x1 < r2.x1) r.x1 = r2.x1;
|
||||
if(r.y1 < r2.y1) r.y1 = r2.y1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------unite_rectangles
|
||||
template<class Rect>
|
||||
inline Rect unite_rectangles(const Rect& r1, const Rect& r2)
|
||||
{
|
||||
Rect r = r1;
|
||||
if(r.x2 < r2.x2) r.x2 = r2.x2;
|
||||
if(r.y2 < r2.y2) r.y2 = r2.y2;
|
||||
if(r.x1 > r2.x1) r.x1 = r2.x1;
|
||||
if(r.y1 > r2.y1) r.y1 = r2.y1;
|
||||
return r;
|
||||
}
|
||||
|
||||
typedef rect_base<int> rect_i; //----rect_i
|
||||
typedef rect_base<float> rect_f; //----rect_f
|
||||
typedef rect_base<double> rect_d; //----rect_d
|
||||
|
||||
//---------------------------------------------------------path_commands_e
|
||||
enum path_commands_e
|
||||
{
|
||||
path_cmd_stop = 0, //----path_cmd_stop
|
||||
path_cmd_move_to = 1, //----path_cmd_move_to
|
||||
path_cmd_line_to = 2, //----path_cmd_line_to
|
||||
path_cmd_curve3 = 3, //----path_cmd_curve3
|
||||
path_cmd_curve4 = 4, //----path_cmd_curve4
|
||||
path_cmd_curveN = 5, //----path_cmd_curveN
|
||||
path_cmd_catrom = 6, //----path_cmd_catrom
|
||||
path_cmd_ubspline = 7, //----path_cmd_ubspline
|
||||
path_cmd_end_poly = 0x0F, //----path_cmd_end_poly
|
||||
path_cmd_mask = 0x0F //----path_cmd_mask
|
||||
};
|
||||
|
||||
//------------------------------------------------------------path_flags_e
|
||||
enum path_flags_e
|
||||
{
|
||||
path_flags_none = 0, //----path_flags_none
|
||||
path_flags_ccw = 0x10, //----path_flags_ccw
|
||||
path_flags_cw = 0x20, //----path_flags_cw
|
||||
path_flags_close = 0x40, //----path_flags_close
|
||||
path_flags_mask = 0xF0 //----path_flags_mask
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------is_vertex
|
||||
inline bool is_vertex(unsigned c)
|
||||
{
|
||||
return c >= path_cmd_move_to && c < path_cmd_end_poly;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------is_drawing
|
||||
inline bool is_drawing(unsigned c)
|
||||
{
|
||||
return c >= path_cmd_line_to && c < path_cmd_end_poly;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------is_stop
|
||||
inline bool is_stop(unsigned c)
|
||||
{
|
||||
return c == path_cmd_stop;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------is_move_to
|
||||
inline bool is_move_to(unsigned c)
|
||||
{
|
||||
return c == path_cmd_move_to;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------is_line_to
|
||||
inline bool is_line_to(unsigned c)
|
||||
{
|
||||
return c == path_cmd_line_to;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------is_curve
|
||||
inline bool is_curve(unsigned c)
|
||||
{
|
||||
return c == path_cmd_curve3 || c == path_cmd_curve4;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------is_curve3
|
||||
inline bool is_curve3(unsigned c)
|
||||
{
|
||||
return c == path_cmd_curve3;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------is_curve4
|
||||
inline bool is_curve4(unsigned c)
|
||||
{
|
||||
return c == path_cmd_curve4;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------is_end_poly
|
||||
inline bool is_end_poly(unsigned c)
|
||||
{
|
||||
return (c & path_cmd_mask) == path_cmd_end_poly;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------is_close
|
||||
inline bool is_close(unsigned c)
|
||||
{
|
||||
return (c & ~(path_flags_cw | path_flags_ccw)) ==
|
||||
(path_cmd_end_poly | path_flags_close);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------is_next_poly
|
||||
inline bool is_next_poly(unsigned c)
|
||||
{
|
||||
return is_stop(c) || is_move_to(c) || is_end_poly(c);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------is_cw
|
||||
inline bool is_cw(unsigned c)
|
||||
{
|
||||
return (c & path_flags_cw) != 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------is_ccw
|
||||
inline bool is_ccw(unsigned c)
|
||||
{
|
||||
return (c & path_flags_ccw) != 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------is_oriented
|
||||
inline bool is_oriented(unsigned c)
|
||||
{
|
||||
return (c & (path_flags_cw | path_flags_ccw)) != 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------is_closed
|
||||
inline bool is_closed(unsigned c)
|
||||
{
|
||||
return (c & path_flags_close) != 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------get_close_flag
|
||||
inline unsigned get_close_flag(unsigned c)
|
||||
{
|
||||
return c & path_flags_close;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------clear_orientation
|
||||
inline unsigned clear_orientation(unsigned c)
|
||||
{
|
||||
return c & ~(path_flags_cw | path_flags_ccw);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------get_orientation
|
||||
inline unsigned get_orientation(unsigned c)
|
||||
{
|
||||
return c & (path_flags_cw | path_flags_ccw);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------set_orientation
|
||||
inline unsigned set_orientation(unsigned c, unsigned o)
|
||||
{
|
||||
return clear_orientation(c) | o;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------point_base
|
||||
template<class T> struct point_base
|
||||
{
|
||||
typedef T value_type;
|
||||
T x,y;
|
||||
point_base() {}
|
||||
point_base(T x_, T y_) : x(x_), y(y_) {}
|
||||
};
|
||||
typedef point_base<int> point_i; //-----point_i
|
||||
typedef point_base<float> point_f; //-----point_f
|
||||
typedef point_base<double> point_d; //-----point_d
|
||||
|
||||
//-------------------------------------------------------------vertex_base
|
||||
template<class T> struct vertex_base
|
||||
{
|
||||
typedef T value_type;
|
||||
T x,y;
|
||||
unsigned cmd;
|
||||
vertex_base() {}
|
||||
vertex_base(T x_, T y_, unsigned cmd_) : x(x_), y(y_), cmd(cmd_) {}
|
||||
};
|
||||
typedef vertex_base<int> vertex_i; //-----vertex_i
|
||||
typedef vertex_base<float> vertex_f; //-----vertex_f
|
||||
typedef vertex_base<double> vertex_d; //-----vertex_d
|
||||
|
||||
//----------------------------------------------------------------row_info
|
||||
template<class T> struct row_info
|
||||
{
|
||||
int x1, x2;
|
||||
T* ptr;
|
||||
row_info() {}
|
||||
row_info(int x1_, int x2_, T* ptr_) : x1(x1_), x2(x2_), ptr(ptr_) {}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------const_row_info
|
||||
template<class T> struct const_row_info
|
||||
{
|
||||
int x1, x2;
|
||||
const T* ptr;
|
||||
const_row_info() {}
|
||||
const_row_info(int x1_, int x2_, const T* ptr_) :
|
||||
x1(x1_), x2(x2_), ptr(ptr_) {}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------is_equal_eps
|
||||
template<class T> inline bool is_equal_eps(T v1, T v2, T epsilon)
|
||||
{
|
||||
return fabs(v1 - v2) <= double(epsilon);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_BEZIER_ARC_INCLUDED
|
||||
#define AGG_BEZIER_ARC_INCLUDED
|
||||
|
||||
#include "agg_conv_transform.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void arc_to_bezier(double cx, double cy, double rx, double ry,
|
||||
double start_angle, double sweep_angle,
|
||||
double* curve);
|
||||
|
||||
|
||||
//==============================================================bezier_arc
|
||||
//
|
||||
// See implemantaion agg_bezier_arc.cpp
|
||||
//
|
||||
class bezier_arc
|
||||
{
|
||||
public:
|
||||
//--------------------------------------------------------------------
|
||||
bezier_arc() : m_vertex(26), m_num_vertices(0), m_cmd(path_cmd_line_to) {}
|
||||
bezier_arc(double x, double y,
|
||||
double rx, double ry,
|
||||
double start_angle,
|
||||
double sweep_angle)
|
||||
{
|
||||
init(x, y, rx, ry, start_angle, sweep_angle);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void init(double x, double y,
|
||||
double rx, double ry,
|
||||
double start_angle,
|
||||
double sweep_angle);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void rewind(unsigned)
|
||||
{
|
||||
m_vertex = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
if(m_vertex >= m_num_vertices) return path_cmd_stop;
|
||||
*x = m_vertices[m_vertex];
|
||||
*y = m_vertices[m_vertex + 1];
|
||||
m_vertex += 2;
|
||||
return (m_vertex == 2) ? path_cmd_move_to : m_cmd;
|
||||
}
|
||||
|
||||
// Supplemantary functions. num_vertices() actually returns doubled
|
||||
// number of vertices. That is, for 1 vertex it returns 2.
|
||||
//--------------------------------------------------------------------
|
||||
unsigned num_vertices() const { return m_num_vertices; }
|
||||
const double* vertices() const { return m_vertices; }
|
||||
double* vertices() { return m_vertices; }
|
||||
|
||||
private:
|
||||
unsigned m_vertex;
|
||||
unsigned m_num_vertices;
|
||||
double m_vertices[26];
|
||||
unsigned m_cmd;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//==========================================================bezier_arc_svg
|
||||
// Compute an SVG-style bezier arc.
|
||||
//
|
||||
// Computes an elliptical arc from (x1, y1) to (x2, y2). The size and
|
||||
// orientation of the ellipse are defined by two radii (rx, ry)
|
||||
// and an x-axis-rotation, which indicates how the ellipse as a whole
|
||||
// is rotated relative to the current coordinate system. The center
|
||||
// (cx, cy) of the ellipse is calculated automatically to satisfy the
|
||||
// constraints imposed by the other parameters.
|
||||
// large-arc-flag and sweep-flag contribute to the automatic calculations
|
||||
// and help determine how the arc is drawn.
|
||||
class bezier_arc_svg
|
||||
{
|
||||
public:
|
||||
//--------------------------------------------------------------------
|
||||
bezier_arc_svg() : m_arc(), m_radii_ok(false) {}
|
||||
|
||||
bezier_arc_svg(double x1, double y1,
|
||||
double rx, double ry,
|
||||
double angle,
|
||||
bool large_arc_flag,
|
||||
bool sweep_flag,
|
||||
double x2, double y2) :
|
||||
m_arc(), m_radii_ok(false)
|
||||
{
|
||||
init(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void init(double x1, double y1,
|
||||
double rx, double ry,
|
||||
double angle,
|
||||
bool large_arc_flag,
|
||||
bool sweep_flag,
|
||||
double x2, double y2);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
bool radii_ok() const { return m_radii_ok; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void rewind(unsigned)
|
||||
{
|
||||
m_arc.rewind(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
return m_arc.vertex(x, y);
|
||||
}
|
||||
|
||||
// Supplemantary functions. num_vertices() actually returns doubled
|
||||
// number of vertices. That is, for 1 vertex it returns 2.
|
||||
//--------------------------------------------------------------------
|
||||
unsigned num_vertices() const { return m_arc.num_vertices(); }
|
||||
const double* vertices() const { return m_arc.vertices(); }
|
||||
double* vertices() { return m_arc.vertices(); }
|
||||
|
||||
private:
|
||||
bezier_arc m_arc;
|
||||
bool m_radii_ok;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,63 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_BITSET_ITERATOR_INCLUDED
|
||||
#define AGG_BITSET_ITERATOR_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
class bitset_iterator
|
||||
{
|
||||
public:
|
||||
bitset_iterator(const int8u* bits, unsigned offset = 0) :
|
||||
m_bits(bits + (offset >> 3)),
|
||||
m_mask(0x80 >> (offset & 7))
|
||||
{}
|
||||
|
||||
void operator ++ ()
|
||||
{
|
||||
m_mask >>= 1;
|
||||
if(m_mask == 0)
|
||||
{
|
||||
++m_bits;
|
||||
m_mask = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned bit() const
|
||||
{
|
||||
return (*m_bits) & m_mask;
|
||||
}
|
||||
|
||||
private:
|
||||
const int8u* m_bits;
|
||||
int8u m_mask;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,122 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_BOUNDING_RECT_INCLUDED
|
||||
#define AGG_BOUNDING_RECT_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------bounding_rect
|
||||
template<class VertexSource, class GetId, class CoordT>
|
||||
bool bounding_rect(VertexSource& vs, GetId& gi,
|
||||
unsigned start, unsigned num,
|
||||
CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2)
|
||||
{
|
||||
unsigned i;
|
||||
double x;
|
||||
double y;
|
||||
bool first = true;
|
||||
|
||||
*x1 = CoordT(1);
|
||||
*y1 = CoordT(1);
|
||||
*x2 = CoordT(0);
|
||||
*y2 = CoordT(0);
|
||||
|
||||
for(i = 0; i < num; i++)
|
||||
{
|
||||
vs.rewind(gi[start + i]);
|
||||
unsigned cmd;
|
||||
while(!is_stop(cmd = vs.vertex(&x, &y)))
|
||||
{
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
*x1 = CoordT(x);
|
||||
*y1 = CoordT(y);
|
||||
*x2 = CoordT(x);
|
||||
*y2 = CoordT(y);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(CoordT(x) < *x1) *x1 = CoordT(x);
|
||||
if(CoordT(y) < *y1) *y1 = CoordT(y);
|
||||
if(CoordT(x) > *x2) *x2 = CoordT(x);
|
||||
if(CoordT(y) > *y2) *y2 = CoordT(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return *x1 <= *x2 && *y1 <= *y2;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------bounding_rect_single
|
||||
template<class VertexSource, class CoordT>
|
||||
bool bounding_rect_single(VertexSource& vs, unsigned path_id,
|
||||
CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2)
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
bool first = true;
|
||||
|
||||
*x1 = CoordT(1);
|
||||
*y1 = CoordT(1);
|
||||
*x2 = CoordT(0);
|
||||
*y2 = CoordT(0);
|
||||
|
||||
vs.rewind(path_id);
|
||||
unsigned cmd;
|
||||
while(!is_stop(cmd = vs.vertex(&x, &y)))
|
||||
{
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
*x1 = CoordT(x);
|
||||
*y1 = CoordT(y);
|
||||
*x2 = CoordT(x);
|
||||
*y2 = CoordT(y);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(CoordT(x) < *x1) *x1 = CoordT(x);
|
||||
if(CoordT(y) < *y1) *y1 = CoordT(y);
|
||||
if(CoordT(x) > *x2) *x2 = CoordT(x);
|
||||
if(CoordT(y) > *y2) *y2 = CoordT(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return *x1 <= *x2 && *y1 <= *y2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,81 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_BSPLINE_INCLUDED
|
||||
#define AGG_BSPLINE_INCLUDED
|
||||
|
||||
#include "agg_array.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//----------------------------------------------------------------bspline
|
||||
// A very simple class of Bi-cubic Spline interpolation.
|
||||
// First call init(num, x[], y[]) where num - number of source points,
|
||||
// x, y - arrays of X and Y values respectively. Here Y must be a function
|
||||
// of X. It means that all the X-coordinates must be arranged in the ascending
|
||||
// order.
|
||||
// Then call get(x) that calculates a value Y for the respective X.
|
||||
// The class supports extrapolation, i.e. you can call get(x) where x is
|
||||
// outside the given with init() X-range. Extrapolation is a simple linear
|
||||
// function.
|
||||
//
|
||||
// See Implementation agg_bspline.cpp
|
||||
//------------------------------------------------------------------------
|
||||
class bspline
|
||||
{
|
||||
public:
|
||||
bspline();
|
||||
bspline(int num);
|
||||
bspline(int num, const double* x, const double* y);
|
||||
|
||||
void init(int num);
|
||||
void add_point(double x, double y);
|
||||
void prepare();
|
||||
|
||||
void init(int num, const double* x, const double* y);
|
||||
|
||||
double get(double x) const;
|
||||
double get_stateful(double x) const;
|
||||
|
||||
private:
|
||||
bspline(const bspline&);
|
||||
const bspline& operator = (const bspline&);
|
||||
|
||||
static void bsearch(int n, const double *x, double x0, int *i);
|
||||
double extrapolation_left(double x) const;
|
||||
double extrapolation_right(double x) const;
|
||||
double interpolation(double x, int i) const;
|
||||
|
||||
int m_max;
|
||||
int m_num;
|
||||
double* m_x;
|
||||
double* m_y;
|
||||
pod_array<double> m_am;
|
||||
mutable int m_last_idx;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,339 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CLIP_LIANG_BARSKY_INCLUDED
|
||||
#define AGG_CLIP_LIANG_BARSKY_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
enum clipping_flags_e
|
||||
{
|
||||
clipping_flags_x1_clipped = 4,
|
||||
clipping_flags_x2_clipped = 1,
|
||||
clipping_flags_y1_clipped = 8,
|
||||
clipping_flags_y2_clipped = 2,
|
||||
clipping_flags_x_clipped = clipping_flags_x1_clipped | clipping_flags_x2_clipped,
|
||||
clipping_flags_y_clipped = clipping_flags_y1_clipped | clipping_flags_y2_clipped
|
||||
};
|
||||
|
||||
//----------------------------------------------------------clipping_flags
|
||||
// Determine the clipping code of the vertex according to the
|
||||
// Cyrus-Beck line clipping algorithm
|
||||
//
|
||||
// | |
|
||||
// 0110 | 0010 | 0011
|
||||
// | |
|
||||
// -------+--------+-------- clip_box.y2
|
||||
// | |
|
||||
// 0100 | 0000 | 0001
|
||||
// | |
|
||||
// -------+--------+-------- clip_box.y1
|
||||
// | |
|
||||
// 1100 | 1000 | 1001
|
||||
// | |
|
||||
// clip_box.x1 clip_box.x2
|
||||
//
|
||||
//
|
||||
template<class T>
|
||||
inline unsigned clipping_flags(T x, T y, const rect_base<T>& clip_box)
|
||||
{
|
||||
return (x > clip_box.x2) |
|
||||
((y > clip_box.y2) << 1) |
|
||||
((x < clip_box.x1) << 2) |
|
||||
((y < clip_box.y1) << 3);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------clipping_flags_x
|
||||
template<class T>
|
||||
inline unsigned clipping_flags_x(T x, const rect_base<T>& clip_box)
|
||||
{
|
||||
return (x > clip_box.x2) | ((x < clip_box.x1) << 2);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------clipping_flags_y
|
||||
template<class T>
|
||||
inline unsigned clipping_flags_y(T y, const rect_base<T>& clip_box)
|
||||
{
|
||||
return ((y > clip_box.y2) << 1) | ((y < clip_box.y1) << 3);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------clip_liang_barsky
|
||||
template<class T>
|
||||
inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
|
||||
const rect_base<T>& clip_box,
|
||||
T* x, T* y)
|
||||
{
|
||||
const double nearzero = 1e-30;
|
||||
|
||||
double deltax = x2 - x1;
|
||||
double deltay = y2 - y1;
|
||||
double xin;
|
||||
double xout;
|
||||
double yin;
|
||||
double yout;
|
||||
double tinx;
|
||||
double tiny;
|
||||
double toutx;
|
||||
double touty;
|
||||
double tin1;
|
||||
double tin2;
|
||||
double tout1;
|
||||
unsigned np = 0;
|
||||
|
||||
if(deltax == 0.0)
|
||||
{
|
||||
// bump off of the vertical
|
||||
deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
|
||||
}
|
||||
|
||||
if(deltay == 0.0)
|
||||
{
|
||||
// bump off of the horizontal
|
||||
deltay = (y1 > clip_box.y1) ? -nearzero : nearzero;
|
||||
}
|
||||
|
||||
if(deltax > 0.0)
|
||||
{
|
||||
// points to right
|
||||
xin = clip_box.x1;
|
||||
xout = clip_box.x2;
|
||||
}
|
||||
else
|
||||
{
|
||||
xin = clip_box.x2;
|
||||
xout = clip_box.x1;
|
||||
}
|
||||
|
||||
if(deltay > 0.0)
|
||||
{
|
||||
// points up
|
||||
yin = clip_box.y1;
|
||||
yout = clip_box.y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
yin = clip_box.y2;
|
||||
yout = clip_box.y1;
|
||||
}
|
||||
|
||||
tinx = (xin - x1) / deltax;
|
||||
tiny = (yin - y1) / deltay;
|
||||
|
||||
if (tinx < tiny)
|
||||
{
|
||||
// hits x first
|
||||
tin1 = tinx;
|
||||
tin2 = tiny;
|
||||
}
|
||||
else
|
||||
{
|
||||
// hits y first
|
||||
tin1 = tiny;
|
||||
tin2 = tinx;
|
||||
}
|
||||
|
||||
if(tin1 <= 1.0)
|
||||
{
|
||||
if(0.0 < tin1)
|
||||
{
|
||||
*x++ = (T)xin;
|
||||
*y++ = (T)yin;
|
||||
++np;
|
||||
}
|
||||
|
||||
if(tin2 <= 1.0)
|
||||
{
|
||||
toutx = (xout - x1) / deltax;
|
||||
touty = (yout - y1) / deltay;
|
||||
|
||||
tout1 = (toutx < touty) ? toutx : touty;
|
||||
|
||||
if(tin2 > 0.0 || tout1 > 0.0)
|
||||
{
|
||||
if(tin2 <= tout1)
|
||||
{
|
||||
if(tin2 > 0.0)
|
||||
{
|
||||
if(tinx > tiny)
|
||||
{
|
||||
*x++ = (T)xin;
|
||||
*y++ = (T)(y1 + tinx * deltay);
|
||||
}
|
||||
else
|
||||
{
|
||||
*x++ = (T)(x1 + tiny * deltax);
|
||||
*y++ = (T)yin;
|
||||
}
|
||||
++np;
|
||||
}
|
||||
|
||||
if(tout1 < 1.0)
|
||||
{
|
||||
if(toutx < touty)
|
||||
{
|
||||
*x++ = (T)xout;
|
||||
*y++ = (T)(y1 + toutx * deltay);
|
||||
}
|
||||
else
|
||||
{
|
||||
*x++ = (T)(x1 + touty * deltax);
|
||||
*y++ = (T)yout;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*x++ = x2;
|
||||
*y++ = y2;
|
||||
}
|
||||
++np;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tinx > tiny)
|
||||
{
|
||||
*x++ = (T)xin;
|
||||
*y++ = (T)yout;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x++ = (T)xout;
|
||||
*y++ = (T)yin;
|
||||
}
|
||||
++np;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return np;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template<class T>
|
||||
bool clip_move_point(T x1, T y1, T x2, T y2,
|
||||
const rect_base<T>& clip_box,
|
||||
T* x, T* y, unsigned flags)
|
||||
{
|
||||
T bound;
|
||||
|
||||
if(flags & clipping_flags_x_clipped)
|
||||
{
|
||||
if(x1 == x2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bound = (flags & clipping_flags_x1_clipped) ? clip_box.x1 : clip_box.x2;
|
||||
*y = (T)(double(bound - x1) * (y2 - y1) / (x2 - x1) + y1);
|
||||
*x = bound;
|
||||
}
|
||||
|
||||
flags = clipping_flags_y(*y, clip_box);
|
||||
if(flags & clipping_flags_y_clipped)
|
||||
{
|
||||
if(y1 == y2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bound = (flags & clipping_flags_y1_clipped) ? clip_box.y1 : clip_box.y2;
|
||||
*x = (T)(double(bound - y1) * (x2 - x1) / (y2 - y1) + x1);
|
||||
*y = bound;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------clip_line_segment
|
||||
// Returns: ret >= 4 - Fully clipped
|
||||
// (ret & 1) != 0 - First point has been moved
|
||||
// (ret & 2) != 0 - Second point has been moved
|
||||
//
|
||||
template<class T>
|
||||
unsigned clip_line_segment(T* x1, T* y1, T* x2, T* y2,
|
||||
const rect_base<T>& clip_box)
|
||||
{
|
||||
unsigned f1 = clipping_flags(*x1, *y1, clip_box);
|
||||
unsigned f2 = clipping_flags(*x2, *y2, clip_box);
|
||||
unsigned ret = 0;
|
||||
|
||||
if((f2 | f1) == 0)
|
||||
{
|
||||
// Fully visible
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((f1 & clipping_flags_x_clipped) != 0 &&
|
||||
(f1 & clipping_flags_x_clipped) == (f2 & clipping_flags_x_clipped))
|
||||
{
|
||||
// Fully clipped
|
||||
return 4;
|
||||
}
|
||||
|
||||
if((f1 & clipping_flags_y_clipped) != 0 &&
|
||||
(f1 & clipping_flags_y_clipped) == (f2 & clipping_flags_y_clipped))
|
||||
{
|
||||
// Fully clipped
|
||||
return 4;
|
||||
}
|
||||
|
||||
T tx1 = *x1;
|
||||
T ty1 = *y1;
|
||||
T tx2 = *x2;
|
||||
T ty2 = *y2;
|
||||
if(f1)
|
||||
{
|
||||
if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x1, y1, f1))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
if(*x1 == *x2 && *y1 == *y2)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
ret |= 1;
|
||||
}
|
||||
if(f2)
|
||||
{
|
||||
if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x2, y2, f2))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
if(*x1 == *x2 && *y1 == *y2)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
ret |= 2;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,423 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Adaptation for high precision colors has been sponsored by
|
||||
// Liberty Technology Systems, Inc., visit http://lib-sys.com
|
||||
//
|
||||
// Liberty Technology Systems, Inc. is the provider of
|
||||
// PostScript and PDF technology for software developers.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// color types gray8, gray16
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_COLOR_GRAY_INCLUDED
|
||||
#define AGG_COLOR_GRAY_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_color_rgba.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//===================================================================gray8
|
||||
struct gray8
|
||||
{
|
||||
typedef int8u value_type;
|
||||
typedef int32u calc_type;
|
||||
typedef int32 long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = 8,
|
||||
base_scale = 1 << base_shift,
|
||||
base_mask = base_scale - 1
|
||||
};
|
||||
typedef gray8 self_type;
|
||||
|
||||
value_type v;
|
||||
value_type a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8(unsigned v_, unsigned a_=base_mask) :
|
||||
v(int8u(v_)), a(int8u(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8(const self_type& c, unsigned a_) :
|
||||
v(c.v), a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8(const rgba& c) :
|
||||
v((value_type)uround((0.299*c.r + 0.587*c.g + 0.114*c.b) * double(base_mask))),
|
||||
a((value_type)uround(c.a * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8(const rgba& c, double a_) :
|
||||
v((value_type)uround((0.299*c.r + 0.587*c.g + 0.114*c.b) * double(base_mask))),
|
||||
a((value_type)uround(a_ * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8(const rgba8& c) :
|
||||
v((c.r*77 + c.g*150 + c.b*29) >> 8),
|
||||
a(c.a) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray8(const rgba8& c, unsigned a_) :
|
||||
v((c.r*77 + c.g*150 + c.b*29) >> 8),
|
||||
a(a_) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
{
|
||||
v = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& transparent()
|
||||
{
|
||||
a = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void opacity(double a_)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = (value_type)uround(a_ * double(base_mask));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return double(a) / double(base_mask);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
v = value_type((calc_type(v) * a) >> base_shift);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply(unsigned a_)
|
||||
{
|
||||
if(a == base_mask && a_ >= base_mask) return *this;
|
||||
if(a == 0 || a_ == 0)
|
||||
{
|
||||
v = a = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * a_) / a;
|
||||
v = value_type((v_ > a_) ? a_ : v_);
|
||||
a = value_type(a_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& demultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * base_mask) / a;
|
||||
v = value_type((v_ > base_mask) ? (value_type)base_mask : v_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
self_type gradient(self_type c, double k) const
|
||||
{
|
||||
self_type ret;
|
||||
calc_type ik = uround(k * base_scale);
|
||||
ret.v = value_type(calc_type(v) + (((calc_type(c.v) - v) * ik) >> base_shift));
|
||||
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE void add(const self_type& c, unsigned cover)
|
||||
{
|
||||
calc_type cv, ca;
|
||||
if(cover == cover_mask)
|
||||
{
|
||||
if(c.a == base_mask)
|
||||
{
|
||||
*this = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + c.v; v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + ((c.v * cover + cover_mask/2) >> cover_shift);
|
||||
ca = a + ((c.a * cover + cover_mask/2) >> cover_shift);
|
||||
v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type no_color() { return self_type(0,0); }
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------gray8_pre
|
||||
inline gray8 gray8_pre(unsigned v, unsigned a = gray8::base_mask)
|
||||
{
|
||||
return gray8(v,a).premultiply();
|
||||
}
|
||||
inline gray8 gray8_pre(const gray8& c, unsigned a)
|
||||
{
|
||||
return gray8(c,a).premultiply();
|
||||
}
|
||||
inline gray8 gray8_pre(const rgba& c)
|
||||
{
|
||||
return gray8(c).premultiply();
|
||||
}
|
||||
inline gray8 gray8_pre(const rgba& c, double a)
|
||||
{
|
||||
return gray8(c,a).premultiply();
|
||||
}
|
||||
inline gray8 gray8_pre(const rgba8& c)
|
||||
{
|
||||
return gray8(c).premultiply();
|
||||
}
|
||||
inline gray8 gray8_pre(const rgba8& c, unsigned a)
|
||||
{
|
||||
return gray8(c,a).premultiply();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================================gray16
|
||||
struct gray16
|
||||
{
|
||||
typedef int16u value_type;
|
||||
typedef int32u calc_type;
|
||||
typedef int64 long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = 16,
|
||||
base_scale = 1 << base_shift,
|
||||
base_mask = base_scale - 1
|
||||
};
|
||||
typedef gray16 self_type;
|
||||
|
||||
value_type v;
|
||||
value_type a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(unsigned v_, unsigned a_=base_mask) :
|
||||
v(int16u(v_)), a(int16u(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const self_type& c, unsigned a_) :
|
||||
v(c.v), a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const rgba& c) :
|
||||
v((value_type)uround((0.299*c.r + 0.587*c.g + 0.114*c.b) * double(base_mask))),
|
||||
a((value_type)uround(c.a * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const rgba& c, double a_) :
|
||||
v((value_type)uround((0.299*c.r + 0.587*c.g + 0.114*c.b) * double(base_mask))),
|
||||
a((value_type)uround(a_ * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const rgba8& c) :
|
||||
v(c.r*77 + c.g*150 + c.b*29),
|
||||
a((value_type(c.a) << 8) | c.a) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const rgba8& c, unsigned a_) :
|
||||
v(c.r*77 + c.g*150 + c.b*29),
|
||||
a((value_type(a_) << 8) | c.a) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
{
|
||||
v = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& transparent()
|
||||
{
|
||||
a = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void opacity(double a_)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = (value_type)uround(a_ * double(base_mask));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return double(a) / double(base_mask);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
v = value_type((calc_type(v) * a) >> base_shift);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply(unsigned a_)
|
||||
{
|
||||
if(a == base_mask && a_ >= base_mask) return *this;
|
||||
if(a == 0 || a_ == 0)
|
||||
{
|
||||
v = a = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * a_) / a;
|
||||
v = value_type((v_ > a_) ? a_ : v_);
|
||||
a = value_type(a_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& demultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * base_mask) / a;
|
||||
v = value_type((v_ > base_mask) ? base_mask : v_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
self_type gradient(self_type c, double k) const
|
||||
{
|
||||
self_type ret;
|
||||
calc_type ik = uround(k * base_scale);
|
||||
ret.v = value_type(calc_type(v) + (((calc_type(c.v) - v) * ik) >> base_shift));
|
||||
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE void add(const self_type& c, unsigned cover)
|
||||
{
|
||||
calc_type cv, ca;
|
||||
if(cover == cover_mask)
|
||||
{
|
||||
if(c.a == base_mask)
|
||||
{
|
||||
*this = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + c.v; v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + ((c.v * cover + cover_mask/2) >> cover_shift);
|
||||
ca = a + ((c.a * cover + cover_mask/2) >> cover_shift);
|
||||
v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type no_color() { return self_type(0,0); }
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------gray16_pre
|
||||
inline gray16 gray16_pre(unsigned v, unsigned a = gray16::base_mask)
|
||||
{
|
||||
return gray16(v,a).premultiply();
|
||||
}
|
||||
inline gray16 gray16_pre(const gray16& c, unsigned a)
|
||||
{
|
||||
return gray16(c,a).premultiply();
|
||||
}
|
||||
inline gray16 gray16_pre(const rgba& c)
|
||||
{
|
||||
return gray16(c).premultiply();
|
||||
}
|
||||
inline gray16 gray16_pre(const rgba& c, double a)
|
||||
{
|
||||
return gray16(c,a).premultiply();
|
||||
}
|
||||
inline gray16 gray16_pre(const rgba8& c)
|
||||
{
|
||||
return gray16(c).premultiply();
|
||||
}
|
||||
inline gray16 gray16_pre(const rgba8& c, unsigned a)
|
||||
{
|
||||
return gray16(c,a).premultiply();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,756 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Adaptation for high precision colors has been sponsored by
|
||||
// Liberty Technology Systems, Inc., visit http://lib-sys.com
|
||||
//
|
||||
// Liberty Technology Systems, Inc. is the provider of
|
||||
// PostScript and PDF technology for software developers.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://www.antigrain.com
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_COLOR_RGBA_INCLUDED
|
||||
#define AGG_COLOR_RGBA_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
// Supported byte orders for RGB and RGBA pixel formats
|
||||
//=======================================================================
|
||||
struct order_rgb { enum rgb_e { R=0, G=1, B=2, rgb_tag }; }; //----order_rgb
|
||||
struct order_bgr { enum bgr_e { B=0, G=1, R=2, rgb_tag }; }; //----order_bgr
|
||||
struct order_rgba { enum rgba_e { R=0, G=1, B=2, A=3, rgba_tag }; }; //----order_rgba
|
||||
struct order_argb { enum argb_e { A=0, R=1, G=2, B=3, rgba_tag }; }; //----order_argb
|
||||
struct order_abgr { enum abgr_e { A=0, B=1, G=2, R=3, rgba_tag }; }; //----order_abgr
|
||||
struct order_bgra { enum bgra_e { B=0, G=1, R=2, A=3, rgba_tag }; }; //----order_bgra
|
||||
|
||||
//====================================================================rgba
|
||||
struct rgba
|
||||
{
|
||||
typedef double value_type;
|
||||
|
||||
double r;
|
||||
double g;
|
||||
double b;
|
||||
double a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba(double r_, double g_, double b_, double a_=1.0) :
|
||||
r(r_), g(g_), b(b_), a(a_) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba(const rgba& c, double a_) : r(c.r), g(c.g), b(c.b), a(a_) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const rgba& transparent()
|
||||
{
|
||||
a = 0.0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const rgba& opacity(double a_)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = a_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const rgba& premultiply()
|
||||
{
|
||||
r *= a;
|
||||
g *= a;
|
||||
b *= a;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const rgba& premultiply(double a_)
|
||||
{
|
||||
if(a <= 0.0 || a_ <= 0.0)
|
||||
{
|
||||
r = g = b = a = 0.0;
|
||||
return *this;
|
||||
}
|
||||
a_ /= a;
|
||||
r *= a_;
|
||||
g *= a_;
|
||||
b *= a_;
|
||||
a = a_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const rgba& demultiply()
|
||||
{
|
||||
if(a == 0)
|
||||
{
|
||||
r = g = b = 0;
|
||||
return *this;
|
||||
}
|
||||
double a_ = 1.0 / a;
|
||||
r *= a_;
|
||||
g *= a_;
|
||||
b *= a_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba gradient(rgba c, double k) const
|
||||
{
|
||||
rgba ret;
|
||||
ret.r = r + (c.r - r) * k;
|
||||
ret.g = g + (c.g - g) * k;
|
||||
ret.b = b + (c.b - b) * k;
|
||||
ret.a = a + (c.a - a) * k;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static rgba no_color() { return rgba(0,0,0,0); }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static rgba from_wavelength(double wl, double gamma = 1.0);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
explicit rgba(double wavelen, double gamma=1.0)
|
||||
{
|
||||
*this = from_wavelength(wavelen, gamma);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------rgba_pre
|
||||
inline rgba rgba_pre(double r, double g, double b, double a=1.0)
|
||||
{
|
||||
return rgba(r, g, b, a).premultiply();
|
||||
}
|
||||
inline rgba rgba_pre(const rgba& c)
|
||||
{
|
||||
return rgba(c).premultiply();
|
||||
}
|
||||
inline rgba rgba_pre(const rgba& c, double a)
|
||||
{
|
||||
return rgba(c, a).premultiply();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
inline rgba rgba::from_wavelength(double wl, double gamma)
|
||||
{
|
||||
rgba t(0.0, 0.0, 0.0);
|
||||
|
||||
if(wl >= 380.0 && wl <= 440.0)
|
||||
{
|
||||
t.r = -1.0 * (wl - 440.0) / (440.0 - 380.0);
|
||||
t.b = 1.0;
|
||||
}
|
||||
else
|
||||
if(wl >= 440.0 && wl <= 490.0)
|
||||
{
|
||||
t.g = (wl - 440.0) / (490.0 - 440.0);
|
||||
t.b = 1.0;
|
||||
}
|
||||
else
|
||||
if(wl >= 490.0 && wl <= 510.0)
|
||||
{
|
||||
t.g = 1.0;
|
||||
t.b = -1.0 * (wl - 510.0) / (510.0 - 490.0);
|
||||
}
|
||||
else
|
||||
if(wl >= 510.0 && wl <= 580.0)
|
||||
{
|
||||
t.r = (wl - 510.0) / (580.0 - 510.0);
|
||||
t.g = 1.0;
|
||||
}
|
||||
else
|
||||
if(wl >= 580.0 && wl <= 645.0)
|
||||
{
|
||||
t.r = 1.0;
|
||||
t.g = -1.0 * (wl - 645.0) / (645.0 - 580.0);
|
||||
}
|
||||
else
|
||||
if(wl >= 645.0 && wl <= 780.0)
|
||||
{
|
||||
t.r = 1.0;
|
||||
}
|
||||
|
||||
double s = 1.0;
|
||||
if(wl > 700.0) s = 0.3 + 0.7 * (780.0 - wl) / (780.0 - 700.0);
|
||||
else if(wl < 420.0) s = 0.3 + 0.7 * (wl - 380.0) / (420.0 - 380.0);
|
||||
|
||||
t.r = pow(t.r * s, gamma);
|
||||
t.g = pow(t.g * s, gamma);
|
||||
t.b = pow(t.b * s, gamma);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//===================================================================rgba8
|
||||
struct rgba8
|
||||
{
|
||||
typedef int8u value_type;
|
||||
typedef int32u calc_type;
|
||||
typedef int32 long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = 8,
|
||||
base_scale = 1 << base_shift,
|
||||
base_mask = base_scale - 1
|
||||
};
|
||||
typedef rgba8 self_type;
|
||||
|
||||
|
||||
value_type r;
|
||||
value_type g;
|
||||
value_type b;
|
||||
value_type a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba8() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba8(unsigned r_, unsigned g_, unsigned b_, unsigned a_=base_mask) :
|
||||
r(value_type(r_)),
|
||||
g(value_type(g_)),
|
||||
b(value_type(b_)),
|
||||
a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba8(const rgba& c, double a_) :
|
||||
r((value_type)uround(c.r * double(base_mask))),
|
||||
g((value_type)uround(c.g * double(base_mask))),
|
||||
b((value_type)uround(c.b * double(base_mask))),
|
||||
a((value_type)uround(a_ * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba8(const self_type& c, unsigned a_) :
|
||||
r(c.r), g(c.g), b(c.b), a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba8(const rgba& c) :
|
||||
r((value_type)uround(c.r * double(base_mask))),
|
||||
g((value_type)uround(c.g * double(base_mask))),
|
||||
b((value_type)uround(c.b * double(base_mask))),
|
||||
a((value_type)uround(c.a * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& transparent()
|
||||
{
|
||||
a = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& opacity(double a_)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = (value_type)uround(a_ * double(base_mask));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return double(a) / double(base_mask);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& premultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
r = g = b = 0;
|
||||
return *this;
|
||||
}
|
||||
r = value_type((calc_type(r) * a) >> base_shift);
|
||||
g = value_type((calc_type(g) * a) >> base_shift);
|
||||
b = value_type((calc_type(b) * a) >> base_shift);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& premultiply(unsigned a_)
|
||||
{
|
||||
if(a == base_mask && a_ >= base_mask) return *this;
|
||||
if(a == 0 || a_ == 0)
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type r_ = (calc_type(r) * a_) / a;
|
||||
calc_type g_ = (calc_type(g) * a_) / a;
|
||||
calc_type b_ = (calc_type(b) * a_) / a;
|
||||
r = value_type((r_ > a_) ? a_ : r_);
|
||||
g = value_type((g_ > a_) ? a_ : g_);
|
||||
b = value_type((b_ > a_) ? a_ : b_);
|
||||
a = value_type(a_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& demultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
r = g = b = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type r_ = (calc_type(r) * base_mask) / a;
|
||||
calc_type g_ = (calc_type(g) * base_mask) / a;
|
||||
calc_type b_ = (calc_type(b) * base_mask) / a;
|
||||
r = value_type((r_ > calc_type(base_mask)) ? calc_type(base_mask) : r_);
|
||||
g = value_type((g_ > calc_type(base_mask)) ? calc_type(base_mask) : g_);
|
||||
b = value_type((b_ > calc_type(base_mask)) ? calc_type(base_mask) : b_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE self_type gradient(const self_type& c, double k) const
|
||||
{
|
||||
self_type ret;
|
||||
calc_type ik = uround(k * base_scale);
|
||||
ret.r = value_type(calc_type(r) + (((calc_type(c.r) - r) * ik) >> base_shift));
|
||||
ret.g = value_type(calc_type(g) + (((calc_type(c.g) - g) * ik) >> base_shift));
|
||||
ret.b = value_type(calc_type(b) + (((calc_type(c.b) - b) * ik) >> base_shift));
|
||||
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE void add(const self_type& c, unsigned cover)
|
||||
{
|
||||
calc_type cr, cg, cb, ca;
|
||||
if(cover == cover_mask)
|
||||
{
|
||||
if(c.a == base_mask)
|
||||
{
|
||||
*this = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = r + c.r; r = (cr > calc_type(base_mask)) ? calc_type(base_mask) : cr;
|
||||
cg = g + c.g; g = (cg > calc_type(base_mask)) ? calc_type(base_mask) : cg;
|
||||
cb = b + c.b; b = (cb > calc_type(base_mask)) ? calc_type(base_mask) : cb;
|
||||
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = r + ((c.r * cover + cover_mask/2) >> cover_shift);
|
||||
cg = g + ((c.g * cover + cover_mask/2) >> cover_shift);
|
||||
cb = b + ((c.b * cover + cover_mask/2) >> cover_shift);
|
||||
ca = a + ((c.a * cover + cover_mask/2) >> cover_shift);
|
||||
r = (cr > calc_type(base_mask)) ? calc_type(base_mask) : cr;
|
||||
g = (cg > calc_type(base_mask)) ? calc_type(base_mask) : cg;
|
||||
b = (cb > calc_type(base_mask)) ? calc_type(base_mask) : cb;
|
||||
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
template<class GammaLUT>
|
||||
AGG_INLINE void apply_gamma_dir(const GammaLUT& gamma)
|
||||
{
|
||||
r = gamma.dir(r);
|
||||
g = gamma.dir(g);
|
||||
b = gamma.dir(b);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
template<class GammaLUT>
|
||||
AGG_INLINE void apply_gamma_inv(const GammaLUT& gamma)
|
||||
{
|
||||
r = gamma.inv(r);
|
||||
g = gamma.inv(g);
|
||||
b = gamma.inv(b);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type no_color() { return self_type(0,0,0,0); }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type from_wavelength(double wl, double gamma = 1.0)
|
||||
{
|
||||
return self_type(rgba::from_wavelength(wl, gamma));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------rgba8_pre
|
||||
inline rgba8 rgba8_pre(unsigned r, unsigned g, unsigned b,
|
||||
unsigned a = rgba8::base_mask)
|
||||
{
|
||||
return rgba8(r,g,b,a).premultiply();
|
||||
}
|
||||
inline rgba8 rgba8_pre(const rgba8& c)
|
||||
{
|
||||
return rgba8(c).premultiply();
|
||||
}
|
||||
inline rgba8 rgba8_pre(const rgba8& c, unsigned a)
|
||||
{
|
||||
return rgba8(c,a).premultiply();
|
||||
}
|
||||
inline rgba8 rgba8_pre(const rgba& c)
|
||||
{
|
||||
return rgba8(c).premultiply();
|
||||
}
|
||||
inline rgba8 rgba8_pre(const rgba& c, double a)
|
||||
{
|
||||
return rgba8(c,a).premultiply();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------rgb8_packed
|
||||
inline rgba8 rgb8_packed(unsigned v)
|
||||
{
|
||||
return rgba8((v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------bgr8_packed
|
||||
inline rgba8 bgr8_packed(unsigned v)
|
||||
{
|
||||
return rgba8(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------argb8_packed
|
||||
inline rgba8 argb8_packed(unsigned v)
|
||||
{
|
||||
return rgba8((v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF, v >> 24);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------rgba8_gamma_dir
|
||||
template<class GammaLUT>
|
||||
rgba8 rgba8_gamma_dir(rgba8 c, const GammaLUT& gamma)
|
||||
{
|
||||
return rgba8(gamma.dir(c.r), gamma.dir(c.g), gamma.dir(c.b), c.a);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------rgba8_gamma_inv
|
||||
template<class GammaLUT>
|
||||
rgba8 rgba8_gamma_inv(rgba8 c, const GammaLUT& gamma)
|
||||
{
|
||||
return rgba8(gamma.inv(c.r), gamma.inv(c.g), gamma.inv(c.b), c.a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================================rgba16
|
||||
struct rgba16
|
||||
{
|
||||
typedef int16u value_type;
|
||||
typedef int32u calc_type;
|
||||
typedef int64 long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = 16,
|
||||
base_scale = 1 << base_shift,
|
||||
base_mask = base_scale - 1
|
||||
};
|
||||
typedef rgba16 self_type;
|
||||
|
||||
value_type r;
|
||||
value_type g;
|
||||
value_type b;
|
||||
value_type a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16(unsigned r_, unsigned g_, unsigned b_, unsigned a_=base_mask) :
|
||||
r(value_type(r_)),
|
||||
g(value_type(g_)),
|
||||
b(value_type(b_)),
|
||||
a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16(const self_type& c, unsigned a_) :
|
||||
r(c.r), g(c.g), b(c.b), a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16(const rgba& c) :
|
||||
r((value_type)uround(c.r * double(base_mask))),
|
||||
g((value_type)uround(c.g * double(base_mask))),
|
||||
b((value_type)uround(c.b * double(base_mask))),
|
||||
a((value_type)uround(c.a * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16(const rgba& c, double a_) :
|
||||
r((value_type)uround(c.r * double(base_mask))),
|
||||
g((value_type)uround(c.g * double(base_mask))),
|
||||
b((value_type)uround(c.b * double(base_mask))),
|
||||
a((value_type)uround(a_ * double(base_mask))) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16(const rgba8& c) :
|
||||
r(value_type((value_type(c.r) << 8) | c.r)),
|
||||
g(value_type((value_type(c.g) << 8) | c.g)),
|
||||
b(value_type((value_type(c.b) << 8) | c.b)),
|
||||
a(value_type((value_type(c.a) << 8) | c.a)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
rgba16(const rgba8& c, unsigned a_) :
|
||||
r(value_type((value_type(c.r) << 8) | c.r)),
|
||||
g(value_type((value_type(c.g) << 8) | c.g)),
|
||||
b(value_type((value_type(c.b) << 8) | c.b)),
|
||||
a(value_type(( a_ << 8) | c.a)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& transparent()
|
||||
{
|
||||
a = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& opacity(double a_)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = (value_type)uround(a_ * double(base_mask));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return double(a) / double(base_mask);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& premultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
r = g = b = 0;
|
||||
return *this;
|
||||
}
|
||||
r = value_type((calc_type(r) * a) >> base_shift);
|
||||
g = value_type((calc_type(g) * a) >> base_shift);
|
||||
b = value_type((calc_type(b) * a) >> base_shift);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& premultiply(unsigned a_)
|
||||
{
|
||||
if(a == base_mask && a_ >= base_mask) return *this;
|
||||
if(a == 0 || a_ == 0)
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type r_ = (calc_type(r) * a_) / a;
|
||||
calc_type g_ = (calc_type(g) * a_) / a;
|
||||
calc_type b_ = (calc_type(b) * a_) / a;
|
||||
r = value_type((r_ > a_) ? a_ : r_);
|
||||
g = value_type((g_ > a_) ? a_ : g_);
|
||||
b = value_type((b_ > a_) ? a_ : b_);
|
||||
a = value_type(a_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE const self_type& demultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
r = g = b = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type r_ = (calc_type(r) * base_mask) / a;
|
||||
calc_type g_ = (calc_type(g) * base_mask) / a;
|
||||
calc_type b_ = (calc_type(b) * base_mask) / a;
|
||||
r = value_type((r_ > calc_type(base_mask)) ? calc_type(base_mask) : r_);
|
||||
g = value_type((g_ > calc_type(base_mask)) ? calc_type(base_mask) : g_);
|
||||
b = value_type((b_ > calc_type(base_mask)) ? calc_type(base_mask) : b_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE self_type gradient(const self_type& c, double k) const
|
||||
{
|
||||
self_type ret;
|
||||
calc_type ik = uround(k * base_scale);
|
||||
ret.r = value_type(calc_type(r) + (((calc_type(c.r) - r) * ik) >> base_shift));
|
||||
ret.g = value_type(calc_type(g) + (((calc_type(c.g) - g) * ik) >> base_shift));
|
||||
ret.b = value_type(calc_type(b) + (((calc_type(c.b) - b) * ik) >> base_shift));
|
||||
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE void add(const self_type& c, unsigned cover)
|
||||
{
|
||||
calc_type cr, cg, cb, ca;
|
||||
if(cover == cover_mask)
|
||||
{
|
||||
if(c.a == base_mask)
|
||||
{
|
||||
*this = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = r + c.r; r = (cr > calc_type(base_mask)) ? calc_type(base_mask) : cr;
|
||||
cg = g + c.g; g = (cg > calc_type(base_mask)) ? calc_type(base_mask) : cg;
|
||||
cb = b + c.b; b = (cb > calc_type(base_mask)) ? calc_type(base_mask) : cb;
|
||||
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = r + ((c.r * cover + cover_mask) >> cover_shift);
|
||||
cg = g + ((c.g * cover + cover_mask) >> cover_shift);
|
||||
cb = b + ((c.b * cover + cover_mask) >> cover_shift);
|
||||
ca = a + ((c.a * cover + cover_mask) >> cover_shift);
|
||||
r = (cr > calc_type(base_mask)) ? calc_type(base_mask) : cr;
|
||||
g = (cg > calc_type(base_mask)) ? calc_type(base_mask) : cg;
|
||||
b = (cb > calc_type(base_mask)) ? calc_type(base_mask) : cb;
|
||||
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
template<class GammaLUT>
|
||||
AGG_INLINE void apply_gamma_dir(const GammaLUT& gamma)
|
||||
{
|
||||
r = gamma.dir(r);
|
||||
g = gamma.dir(g);
|
||||
b = gamma.dir(b);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
template<class GammaLUT>
|
||||
AGG_INLINE void apply_gamma_inv(const GammaLUT& gamma)
|
||||
{
|
||||
r = gamma.inv(r);
|
||||
g = gamma.inv(g);
|
||||
b = gamma.inv(b);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type no_color() { return self_type(0,0,0,0); }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type from_wavelength(double wl, double gamma = 1.0)
|
||||
{
|
||||
return self_type(rgba::from_wavelength(wl, gamma));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------rgba16_pre
|
||||
inline rgba16 rgba16_pre(unsigned r, unsigned g, unsigned b,
|
||||
unsigned a = rgba16::base_mask)
|
||||
{
|
||||
return rgba16(r,g,b,a).premultiply();
|
||||
}
|
||||
inline rgba16 rgba16_pre(const rgba16& c, unsigned a)
|
||||
{
|
||||
return rgba16(c,a).premultiply();
|
||||
}
|
||||
inline rgba16 rgba16_pre(const rgba& c)
|
||||
{
|
||||
return rgba16(c).premultiply();
|
||||
}
|
||||
inline rgba16 rgba16_pre(const rgba& c, double a)
|
||||
{
|
||||
return rgba16(c,a).premultiply();
|
||||
}
|
||||
inline rgba16 rgba16_pre(const rgba8& c)
|
||||
{
|
||||
return rgba16(c).premultiply();
|
||||
}
|
||||
inline rgba16 rgba16_pre(const rgba8& c, unsigned a)
|
||||
{
|
||||
return rgba16(c,a).premultiply();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------rgba16_gamma_dir
|
||||
template<class GammaLUT>
|
||||
rgba16 rgba16_gamma_dir(rgba16 c, const GammaLUT& gamma)
|
||||
{
|
||||
return rgba16(gamma.dir(c.r), gamma.dir(c.g), gamma.dir(c.b), c.a);
|
||||
}
|
||||
|
||||
//------------------------------------------------------rgba16_gamma_inv
|
||||
template<class GammaLUT>
|
||||
rgba16 rgba16_gamma_inv(rgba16 c, const GammaLUT& gamma)
|
||||
{
|
||||
return rgba16(gamma.inv(c.r), gamma.inv(c.g), gamma.inv(c.b), c.a);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef AGG_CONFIG_INCLUDED
|
||||
#define AGG_CONFIG_INCLUDED
|
||||
|
||||
// This file can be used to redefine certain data types.
|
||||
|
||||
//---------------------------------------
|
||||
// 1. Default basic types such as:
|
||||
//
|
||||
// AGG_INT8
|
||||
// AGG_INT8U
|
||||
// AGG_INT16
|
||||
// AGG_INT16U
|
||||
// AGG_INT32
|
||||
// AGG_INT32U
|
||||
// AGG_INT64
|
||||
// AGG_INT64U
|
||||
//
|
||||
// Just replace this file with new defines if necessary.
|
||||
// For example, if your compiler doesn't have a 64 bit integer type
|
||||
// you can still use AGG if you define the follows:
|
||||
//
|
||||
// #define AGG_INT64 int
|
||||
// #define AGG_INT64U unsigned
|
||||
//
|
||||
// It will result in overflow in 16 bit-per-component image/pattern resampling
|
||||
// but it won't result any crash and the rest of the library will remain
|
||||
// fully functional.
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
// 2. Default rendering_buffer type. Can be:
|
||||
//
|
||||
// Provides faster access for massive pixel operations,
|
||||
// such as blur, image filtering:
|
||||
// #define AGG_RENDERING_BUFFER row_ptr_cache<int8u>
|
||||
//
|
||||
// Provides cheaper creation and destruction (no mem allocs):
|
||||
// #define AGG_RENDERING_BUFFER row_accessor<int8u>
|
||||
//
|
||||
// You can still use both of them simultaneouslyin your applications
|
||||
// This #define is used only for default rendering_buffer type,
|
||||
// in short hand typedefs like pixfmt_rgba32.
|
||||
|
||||
#endif
|
|
@ -1,166 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_ADAPTOR_VCGEN_INCLUDED
|
||||
#define AGG_CONV_ADAPTOR_VCGEN_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//------------------------------------------------------------null_markers
|
||||
struct null_markers
|
||||
{
|
||||
void remove_all() {}
|
||||
void add_vertex(double, double, unsigned) {}
|
||||
void prepare_src() {}
|
||||
|
||||
void rewind(unsigned) {}
|
||||
unsigned vertex(double*, double*) { return path_cmd_stop; }
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------conv_adaptor_vcgen
|
||||
template<class VertexSource,
|
||||
class Generator,
|
||||
class Markers=null_markers> class conv_adaptor_vcgen
|
||||
{
|
||||
enum status
|
||||
{
|
||||
initial,
|
||||
accumulate,
|
||||
generate
|
||||
};
|
||||
|
||||
public:
|
||||
explicit conv_adaptor_vcgen(VertexSource& source) :
|
||||
m_source(&source),
|
||||
m_status(initial)
|
||||
{}
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
Generator& generator() { return m_generator; }
|
||||
const Generator& generator() const { return m_generator; }
|
||||
|
||||
Markers& markers() { return m_markers; }
|
||||
const Markers& markers() const { return m_markers; }
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
m_source->rewind(path_id);
|
||||
m_status = initial;
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
// Prohibit copying
|
||||
conv_adaptor_vcgen(const conv_adaptor_vcgen<VertexSource, Generator, Markers>&);
|
||||
const conv_adaptor_vcgen<VertexSource, Generator, Markers>&
|
||||
operator = (const conv_adaptor_vcgen<VertexSource, Generator, Markers>&);
|
||||
|
||||
VertexSource* m_source;
|
||||
Generator m_generator;
|
||||
Markers m_markers;
|
||||
status m_status;
|
||||
unsigned m_last_cmd;
|
||||
double m_start_x;
|
||||
double m_start_y;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource, class Generator, class Markers>
|
||||
unsigned conv_adaptor_vcgen<VertexSource, Generator, Markers>::vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd = path_cmd_stop;
|
||||
bool done = false;
|
||||
while(!done)
|
||||
{
|
||||
switch(m_status)
|
||||
{
|
||||
case initial:
|
||||
m_markers.remove_all();
|
||||
m_last_cmd = m_source->vertex(&m_start_x, &m_start_y);
|
||||
m_status = accumulate;
|
||||
|
||||
case accumulate:
|
||||
if(is_stop(m_last_cmd)) return path_cmd_stop;
|
||||
|
||||
m_generator.remove_all();
|
||||
m_generator.add_vertex(m_start_x, m_start_y, path_cmd_move_to);
|
||||
m_markers.add_vertex(m_start_x, m_start_y, path_cmd_move_to);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
cmd = m_source->vertex(x, y);
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
m_last_cmd = cmd;
|
||||
if(is_move_to(cmd))
|
||||
{
|
||||
m_start_x = *x;
|
||||
m_start_y = *y;
|
||||
break;
|
||||
}
|
||||
m_generator.add_vertex(*x, *y, cmd);
|
||||
m_markers.add_vertex(*x, *y, path_cmd_line_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_stop(cmd))
|
||||
{
|
||||
m_last_cmd = path_cmd_stop;
|
||||
break;
|
||||
}
|
||||
if(is_end_poly(cmd))
|
||||
{
|
||||
m_generator.add_vertex(*x, *y, cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_generator.rewind(0);
|
||||
m_status = generate;
|
||||
|
||||
case generate:
|
||||
cmd = m_generator.vertex(x, y);
|
||||
if(is_stop(cmd))
|
||||
{
|
||||
m_status = accumulate;
|
||||
break;
|
||||
}
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,168 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_ADAPTOR_VPGEN_INCLUDED
|
||||
#define AGG_CONV_ADAPTOR_VPGEN_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//======================================================conv_adaptor_vpgen
|
||||
template<class VertexSource, class VPGen> class conv_adaptor_vpgen
|
||||
{
|
||||
public:
|
||||
explicit conv_adaptor_vpgen(VertexSource& source) : m_source(&source) {}
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
VPGen& vpgen() { return m_vpgen; }
|
||||
const VPGen& vpgen() const { return m_vpgen; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
conv_adaptor_vpgen(const conv_adaptor_vpgen<VertexSource, VPGen>&);
|
||||
const conv_adaptor_vpgen<VertexSource, VPGen>&
|
||||
operator = (const conv_adaptor_vpgen<VertexSource, VPGen>&);
|
||||
|
||||
VertexSource* m_source;
|
||||
VPGen m_vpgen;
|
||||
double m_start_x;
|
||||
double m_start_y;
|
||||
unsigned m_poly_flags;
|
||||
int m_vertices;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource, class VPGen>
|
||||
void conv_adaptor_vpgen<VertexSource, VPGen>::rewind(unsigned path_id)
|
||||
{
|
||||
m_source->rewind(path_id);
|
||||
m_vpgen.reset();
|
||||
m_start_x = 0;
|
||||
m_start_y = 0;
|
||||
m_poly_flags = 0;
|
||||
m_vertices = 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource, class VPGen>
|
||||
unsigned conv_adaptor_vpgen<VertexSource, VPGen>::vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd = path_cmd_stop;
|
||||
for(;;)
|
||||
{
|
||||
cmd = m_vpgen.vertex(x, y);
|
||||
if(!is_stop(cmd)) break;
|
||||
|
||||
if(m_poly_flags && !m_vpgen.auto_unclose())
|
||||
{
|
||||
*x = 0.0;
|
||||
*y = 0.0;
|
||||
cmd = m_poly_flags;
|
||||
m_poly_flags = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_vertices < 0)
|
||||
{
|
||||
if(m_vertices < -1)
|
||||
{
|
||||
m_vertices = 0;
|
||||
return path_cmd_stop;
|
||||
}
|
||||
m_vpgen.move_to(m_start_x, m_start_y);
|
||||
m_vertices = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
double tx, ty;
|
||||
cmd = m_source->vertex(&tx, &ty);
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(is_move_to(cmd))
|
||||
{
|
||||
if(m_vpgen.auto_close() && m_vertices > 2)
|
||||
{
|
||||
m_vpgen.line_to(m_start_x, m_start_y);
|
||||
m_poly_flags = path_cmd_end_poly | path_flags_close;
|
||||
m_start_x = tx;
|
||||
m_start_y = ty;
|
||||
m_vertices = -1;
|
||||
continue;
|
||||
}
|
||||
m_vpgen.move_to(tx, ty);
|
||||
m_start_x = tx;
|
||||
m_start_y = ty;
|
||||
m_vertices = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_vpgen.line_to(tx, ty);
|
||||
++m_vertices;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_end_poly(cmd))
|
||||
{
|
||||
m_poly_flags = cmd;
|
||||
if(is_closed(cmd) || m_vpgen.auto_close())
|
||||
{
|
||||
if(m_vpgen.auto_close()) m_poly_flags |= path_flags_close;
|
||||
if(m_vertices > 2)
|
||||
{
|
||||
m_vpgen.line_to(m_start_x, m_start_y);
|
||||
}
|
||||
m_vertices = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// path_cmd_stop
|
||||
if(m_vpgen.auto_close() && m_vertices > 2)
|
||||
{
|
||||
m_vpgen.line_to(m_start_x, m_start_y);
|
||||
m_poly_flags = path_cmd_end_poly | path_flags_close;
|
||||
m_vertices = -2;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_BSPLINE_INCLUDED
|
||||
#define AGG_CONV_BSPLINE_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_vcgen_bspline.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//---------------------------------------------------------conv_bspline
|
||||
template<class VertexSource>
|
||||
struct conv_bspline : public conv_adaptor_vcgen<VertexSource, vcgen_bspline>
|
||||
{
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_bspline> base_type;
|
||||
|
||||
conv_bspline(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_bspline>(vs) {}
|
||||
|
||||
void interpolation_step(double v) { base_type::generator().interpolation_step(v); }
|
||||
double interpolation_step() const { return base_type::generator().interpolation_step(); }
|
||||
|
||||
private:
|
||||
conv_bspline(const conv_bspline<VertexSource>&);
|
||||
const conv_bspline<VertexSource>&
|
||||
operator = (const conv_bspline<VertexSource>&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Polygon clipping converter
|
||||
// There an optimized Liang-Basky algorithm is used.
|
||||
// The algorithm doesn't optimize the degenerate edges, i.e. it will never
|
||||
// break a closed polygon into two or more ones, instead, there will be
|
||||
// degenerate edges coinciding with the respective clipping boundaries.
|
||||
// This is a sub-optimal solution, because that optimization would require
|
||||
// extra, rather expensive math while the rasterizer tolerates it quite well,
|
||||
// without any considerable overhead.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef AGG_CONV_CLIP_POLYGON_INCLUDED
|
||||
#define AGG_CONV_CLIP_POLYGON_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_conv_adaptor_vpgen.h"
|
||||
#include "agg_vpgen_clip_polygon.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//=======================================================conv_clip_polygon
|
||||
template<class VertexSource>
|
||||
struct conv_clip_polygon : public conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon>
|
||||
{
|
||||
typedef conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon> base_type;
|
||||
|
||||
conv_clip_polygon(VertexSource& vs) :
|
||||
conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon>(vs) {}
|
||||
|
||||
void clip_box(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
base_type::vpgen().clip_box(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
double x1() const { return base_type::vpgen().x1(); }
|
||||
double y1() const { return base_type::vpgen().y1(); }
|
||||
double x2() const { return base_type::vpgen().x2(); }
|
||||
double y2() const { return base_type::vpgen().y2(); }
|
||||
|
||||
private:
|
||||
conv_clip_polygon(const conv_clip_polygon<VertexSource>&);
|
||||
const conv_clip_polygon<VertexSource>&
|
||||
operator = (const conv_clip_polygon<VertexSource>&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,72 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// polyline clipping converter
|
||||
// There an optimized Liang-Basky algorithm is used.
|
||||
// The algorithm doesn't optimize the degenerate edges, i.e. it will never
|
||||
// break a closed polyline into two or more ones, instead, there will be
|
||||
// degenerate edges coinciding with the respective clipping boundaries.
|
||||
// This is a sub-optimal solution, because that optimization would require
|
||||
// extra, rather expensive math while the rasterizer tolerates it quite well,
|
||||
// without any considerable overhead.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef AGG_CONV_CLIP_polyline_INCLUDED
|
||||
#define AGG_CONV_CLIP_polyline_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_conv_adaptor_vpgen.h"
|
||||
#include "agg_vpgen_clip_polyline.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//=======================================================conv_clip_polyline
|
||||
template<class VertexSource>
|
||||
struct conv_clip_polyline : public conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline>
|
||||
{
|
||||
typedef conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline> base_type;
|
||||
|
||||
conv_clip_polyline(VertexSource& vs) :
|
||||
conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline>(vs) {}
|
||||
|
||||
void clip_box(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
base_type::vpgen().clip_box(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
double x1() const { return base_type::vpgen().x1(); }
|
||||
double y1() const { return base_type::vpgen().y1(); }
|
||||
double x2() const { return base_type::vpgen().x2(); }
|
||||
double y2() const { return base_type::vpgen().y2(); }
|
||||
|
||||
private:
|
||||
conv_clip_polyline(const conv_clip_polyline<VertexSource>&);
|
||||
const conv_clip_polyline<VertexSource>&
|
||||
operator = (const conv_clip_polyline<VertexSource>&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,134 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_CLOSE_POLYGON_INCLUDED
|
||||
#define AGG_CONV_CLOSE_POLYGON_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//======================================================conv_close_polygon
|
||||
template<class VertexSource> class conv_close_polygon
|
||||
{
|
||||
public:
|
||||
explicit conv_close_polygon(VertexSource& vs) : m_source(&vs) {}
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
conv_close_polygon(const conv_close_polygon<VertexSource>&);
|
||||
const conv_close_polygon<VertexSource>&
|
||||
operator = (const conv_close_polygon<VertexSource>&);
|
||||
|
||||
VertexSource* m_source;
|
||||
unsigned m_cmd[2];
|
||||
double m_x[2];
|
||||
double m_y[2];
|
||||
unsigned m_vertex;
|
||||
bool m_line_to;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource>
|
||||
void conv_close_polygon<VertexSource>::rewind(unsigned path_id)
|
||||
{
|
||||
m_source->rewind(path_id);
|
||||
m_vertex = 2;
|
||||
m_line_to = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource>
|
||||
unsigned conv_close_polygon<VertexSource>::vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd = path_cmd_stop;
|
||||
for(;;)
|
||||
{
|
||||
if(m_vertex < 2)
|
||||
{
|
||||
*x = m_x[m_vertex];
|
||||
*y = m_y[m_vertex];
|
||||
cmd = m_cmd[m_vertex];
|
||||
++m_vertex;
|
||||
break;
|
||||
}
|
||||
|
||||
cmd = m_source->vertex(x, y);
|
||||
|
||||
if(is_end_poly(cmd))
|
||||
{
|
||||
cmd |= path_flags_close;
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_stop(cmd))
|
||||
{
|
||||
if(m_line_to)
|
||||
{
|
||||
m_cmd[0] = path_cmd_end_poly | path_flags_close;
|
||||
m_cmd[1] = path_cmd_stop;
|
||||
m_vertex = 0;
|
||||
m_line_to = false;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_move_to(cmd))
|
||||
{
|
||||
if(m_line_to)
|
||||
{
|
||||
m_x[0] = 0.0;
|
||||
m_y[0] = 0.0;
|
||||
m_cmd[0] = path_cmd_end_poly | path_flags_close;
|
||||
m_x[1] = *x;
|
||||
m_y[1] = *y;
|
||||
m_cmd[1] = cmd;
|
||||
m_vertex = 0;
|
||||
m_line_to = false;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
m_line_to = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_CONCAT_INCLUDED
|
||||
#define AGG_CONV_CONCAT_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//=============================================================conv_concat
|
||||
// Concatenation of two paths. Usually used to combine lines or curves
|
||||
// with markers such as arrowheads
|
||||
template<class VS1, class VS2> class conv_concat
|
||||
{
|
||||
public:
|
||||
conv_concat(VS1& source1, VS2& source2) :
|
||||
m_source1(&source1), m_source2(&source2), m_status(2) {}
|
||||
void attach1(VS1& source) { m_source1 = &source; }
|
||||
void attach2(VS2& source) { m_source2 = &source; }
|
||||
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
m_source1->rewind(path_id);
|
||||
m_source2->rewind(0);
|
||||
m_status = 0;
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd;
|
||||
if(m_status == 0)
|
||||
{
|
||||
cmd = m_source1->vertex(x, y);
|
||||
if(!is_stop(cmd)) return cmd;
|
||||
m_status = 1;
|
||||
}
|
||||
if(m_status == 1)
|
||||
{
|
||||
cmd = m_source2->vertex(x, y);
|
||||
if(!is_stop(cmd)) return cmd;
|
||||
m_status = 2;
|
||||
}
|
||||
return path_cmd_stop;
|
||||
}
|
||||
|
||||
private:
|
||||
conv_concat(const conv_concat<VS1, VS2>&);
|
||||
const conv_concat<VS1, VS2>&
|
||||
operator = (const conv_concat<VS1, VS2>&);
|
||||
|
||||
VS1* m_source1;
|
||||
VS2* m_source2;
|
||||
int m_status;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,71 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_CONTOUR_INCLUDED
|
||||
#define AGG_CONV_CONTOUR_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_vcgen_contour.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------conv_contour
|
||||
template<class VertexSource>
|
||||
struct conv_contour : public conv_adaptor_vcgen<VertexSource, vcgen_contour>
|
||||
{
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_contour> base_type;
|
||||
|
||||
conv_contour(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_contour>(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void line_join(line_join_e lj) { base_type::generator().line_join(lj); }
|
||||
void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); }
|
||||
void width(double w) { base_type::generator().width(w); }
|
||||
void miter_limit(double ml) { base_type::generator().miter_limit(ml); }
|
||||
void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); }
|
||||
void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); }
|
||||
void approximation_scale(double as) { base_type::generator().approximation_scale(as); }
|
||||
void auto_detect_orientation(bool v) { base_type::generator().auto_detect_orientation(v); }
|
||||
|
||||
line_join_e line_join() const { return base_type::generator().line_join(); }
|
||||
inner_join_e inner_join() const { return base_type::generator().inner_join(); }
|
||||
double width() const { return base_type::generator().width(); }
|
||||
double miter_limit() const { return base_type::generator().miter_limit(); }
|
||||
double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); }
|
||||
double approximation_scale() const { return base_type::generator().approximation_scale(); }
|
||||
bool auto_detect_orientation() const { return base_type::generator().auto_detect_orientation(); }
|
||||
|
||||
private:
|
||||
conv_contour(const conv_contour<VertexSource>&);
|
||||
const conv_contour<VertexSource>&
|
||||
operator = (const conv_contour<VertexSource>&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,206 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_CURVE_INCLUDED
|
||||
#define AGG_CONV_CURVE_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_curves.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
|
||||
//---------------------------------------------------------------conv_curve
|
||||
// Curve converter class. Any path storage can have Bezier curves defined
|
||||
// by their control points. There're two types of curves supported: curve3
|
||||
// and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control
|
||||
// point. Curve4 has 2 control points (4 points in total) and can be used
|
||||
// to interpolate more complicated curves. Curve4, unlike curve3 can be used
|
||||
// to approximate arcs, both circular and elliptical. Curves are approximated
|
||||
// with straight lines and one of the approaches is just to store the whole
|
||||
// sequence of vertices that approximate our curve. It takes additional
|
||||
// memory, and at the same time the consecutive vertices can be calculated
|
||||
// on demand.
|
||||
//
|
||||
// Initially, path storages are not suppose to keep all the vertices of the
|
||||
// curves (although, nothing prevents us from doing so). Instead, path_storage
|
||||
// keeps only vertices, needed to calculate a curve on demand. Those vertices
|
||||
// are marked with special commands. So, if the path_storage contains curves
|
||||
// (which are not real curves yet), and we render this storage directly,
|
||||
// all we will see is only 2 or 3 straight line segments (for curve3 and
|
||||
// curve4 respectively). If we need to see real curves drawn we need to
|
||||
// include this class into the conversion pipeline.
|
||||
//
|
||||
// Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4
|
||||
// and converts these vertices into a move_to/line_to sequence.
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VertexSource,
|
||||
class Curve3=curve3,
|
||||
class Curve4=curve4> class conv_curve
|
||||
{
|
||||
public:
|
||||
typedef Curve3 curve3_type;
|
||||
typedef Curve4 curve4_type;
|
||||
typedef conv_curve<VertexSource, Curve3, Curve4> self_type;
|
||||
|
||||
explicit conv_curve(VertexSource& source) :
|
||||
m_source(&source), m_last_x(0.0), m_last_y(0.0) {}
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
void approximation_method(curve_approximation_method_e v)
|
||||
{
|
||||
m_curve3.approximation_method(v);
|
||||
m_curve4.approximation_method(v);
|
||||
}
|
||||
|
||||
curve_approximation_method_e approximation_method() const
|
||||
{
|
||||
return m_curve4.approximation_method();
|
||||
}
|
||||
|
||||
void approximation_scale(double s)
|
||||
{
|
||||
m_curve3.approximation_scale(s);
|
||||
m_curve4.approximation_scale(s);
|
||||
}
|
||||
|
||||
double approximation_scale() const
|
||||
{
|
||||
return m_curve4.approximation_scale();
|
||||
}
|
||||
|
||||
void angle_tolerance(double v)
|
||||
{
|
||||
m_curve3.angle_tolerance(v);
|
||||
m_curve4.angle_tolerance(v);
|
||||
}
|
||||
|
||||
double angle_tolerance() const
|
||||
{
|
||||
return m_curve4.angle_tolerance();
|
||||
}
|
||||
|
||||
void cusp_limit(double v)
|
||||
{
|
||||
m_curve3.cusp_limit(v);
|
||||
m_curve4.cusp_limit(v);
|
||||
}
|
||||
|
||||
double cusp_limit() const
|
||||
{
|
||||
return m_curve4.cusp_limit();
|
||||
}
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
conv_curve(const self_type&);
|
||||
const self_type& operator = (const self_type&);
|
||||
|
||||
VertexSource* m_source;
|
||||
double m_last_x;
|
||||
double m_last_y;
|
||||
curve3_type m_curve3;
|
||||
curve4_type m_curve4;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource, class Curve3, class Curve4>
|
||||
void conv_curve<VertexSource, Curve3, Curve4>::rewind(unsigned path_id)
|
||||
{
|
||||
m_source->rewind(path_id);
|
||||
m_last_x = 0.0;
|
||||
m_last_y = 0.0;
|
||||
m_curve3.reset();
|
||||
m_curve4.reset();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VertexSource, class Curve3, class Curve4>
|
||||
unsigned conv_curve<VertexSource, Curve3, Curve4>::vertex(double* x, double* y)
|
||||
{
|
||||
if(!is_stop(m_curve3.vertex(x, y)))
|
||||
{
|
||||
m_last_x = *x;
|
||||
m_last_y = *y;
|
||||
return path_cmd_line_to;
|
||||
}
|
||||
|
||||
if(!is_stop(m_curve4.vertex(x, y)))
|
||||
{
|
||||
m_last_x = *x;
|
||||
m_last_y = *y;
|
||||
return path_cmd_line_to;
|
||||
}
|
||||
|
||||
double ct2_x;
|
||||
double ct2_y;
|
||||
double end_x;
|
||||
double end_y;
|
||||
|
||||
unsigned cmd = m_source->vertex(x, y);
|
||||
switch(cmd)
|
||||
{
|
||||
case path_cmd_curve3:
|
||||
m_source->vertex(&end_x, &end_y);
|
||||
|
||||
m_curve3.init(m_last_x, m_last_y,
|
||||
*x, *y,
|
||||
end_x, end_y);
|
||||
|
||||
m_curve3.vertex(x, y); // First call returns path_cmd_move_to
|
||||
m_curve3.vertex(x, y); // This is the first vertex of the curve
|
||||
cmd = path_cmd_line_to;
|
||||
break;
|
||||
|
||||
case path_cmd_curve4:
|
||||
m_source->vertex(&ct2_x, &ct2_y);
|
||||
m_source->vertex(&end_x, &end_y);
|
||||
|
||||
m_curve4.init(m_last_x, m_last_y,
|
||||
*x, *y,
|
||||
ct2_x, ct2_y,
|
||||
end_x, end_y);
|
||||
|
||||
m_curve4.vertex(x, y); // First call returns path_cmd_move_to
|
||||
m_curve4.vertex(x, y); // This is the first vertex of the curve
|
||||
cmd = path_cmd_line_to;
|
||||
break;
|
||||
}
|
||||
m_last_x = *x;
|
||||
m_last_y = *y;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,74 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_DASH_INCLUDED
|
||||
#define AGG_CONV_DASH_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_vcgen_dash.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------conv_dash
|
||||
template<class VertexSource, class Markers=null_markers>
|
||||
struct conv_dash : public conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers>
|
||||
{
|
||||
typedef Markers marker_type;
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers> base_type;
|
||||
|
||||
conv_dash(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers>(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void remove_all_dashes()
|
||||
{
|
||||
base_type::generator().remove_all_dashes();
|
||||
}
|
||||
|
||||
void add_dash(double dash_len, double gap_len)
|
||||
{
|
||||
base_type::generator().add_dash(dash_len, gap_len);
|
||||
}
|
||||
|
||||
void dash_start(double ds)
|
||||
{
|
||||
base_type::generator().dash_start(ds);
|
||||
}
|
||||
|
||||
void shorten(double s) { base_type::generator().shorten(s); }
|
||||
double shorten() const { return base_type::generator().shorten(); }
|
||||
|
||||
private:
|
||||
conv_dash(const conv_dash<VertexSource, Markers>&);
|
||||
const conv_dash<VertexSource, Markers>&
|
||||
operator = (const conv_dash<VertexSource, Markers>&);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,441 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// General Polygon Clipper based on the GPC library by Alan Murta
|
||||
// Union, Intersection, XOR, A-B, B-A
|
||||
// Contact the author if you intend to use it in commercial applications!
|
||||
// http://www.cs.man.ac.uk/aig/staff/alan/software/
|
||||
// Alan Murta (email: gpc@cs.man.ac.uk)
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_GPC_INCLUDED
|
||||
#define AGG_CONV_GPC_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_basics.h"
|
||||
#include "agg_array.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "gpc.h"
|
||||
}
|
||||
|
||||
namespace agg
|
||||
{
|
||||
enum gpc_op_e
|
||||
{
|
||||
gpc_or,
|
||||
gpc_and,
|
||||
gpc_xor,
|
||||
gpc_a_minus_b,
|
||||
gpc_b_minus_a
|
||||
};
|
||||
|
||||
|
||||
//================================================================conv_gpc
|
||||
template<class VSA, class VSB> class conv_gpc
|
||||
{
|
||||
enum status
|
||||
{
|
||||
status_move_to,
|
||||
status_line_to,
|
||||
status_stop
|
||||
};
|
||||
|
||||
struct contour_header_type
|
||||
{
|
||||
int num_vertices;
|
||||
int hole_flag;
|
||||
gpc_vertex* vertices;
|
||||
};
|
||||
|
||||
typedef pod_bvector<gpc_vertex, 8> vertex_array_type;
|
||||
typedef pod_bvector<contour_header_type, 6> contour_header_array_type;
|
||||
|
||||
|
||||
public:
|
||||
typedef VSA source_a_type;
|
||||
typedef VSB source_b_type;
|
||||
typedef conv_gpc<source_a_type, source_b_type> self_type;
|
||||
|
||||
~conv_gpc()
|
||||
{
|
||||
free_gpc_data();
|
||||
}
|
||||
|
||||
conv_gpc(source_a_type& a, source_b_type& b, gpc_op_e op = gpc_or) :
|
||||
m_src_a(&a),
|
||||
m_src_b(&b),
|
||||
m_status(status_move_to),
|
||||
m_vertex(-1),
|
||||
m_contour(-1),
|
||||
m_operation(op)
|
||||
{
|
||||
memset(&m_poly_a, 0, sizeof(m_poly_a));
|
||||
memset(&m_poly_b, 0, sizeof(m_poly_b));
|
||||
memset(&m_result, 0, sizeof(m_result));
|
||||
}
|
||||
|
||||
void attach1(VSA& source) { m_src_a = &source; }
|
||||
void attach2(VSB& source) { m_src_b = &source; }
|
||||
|
||||
void operation(gpc_op_e v) { m_operation = v; }
|
||||
|
||||
// Vertex Source Interface
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
conv_gpc(const conv_gpc<VSA, VSB>&);
|
||||
const conv_gpc<VSA, VSB>& operator = (const conv_gpc<VSA, VSB>&);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void free_polygon(gpc_polygon& p);
|
||||
void free_result();
|
||||
void free_gpc_data();
|
||||
void start_contour();
|
||||
void add_vertex(double x, double y);
|
||||
void end_contour(unsigned orientation);
|
||||
void make_polygon(gpc_polygon& p);
|
||||
void start_extracting();
|
||||
bool next_contour();
|
||||
bool next_vertex(double* x, double* y);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
template<class VS> void add(VS& src, gpc_polygon& p)
|
||||
{
|
||||
unsigned cmd;
|
||||
double x, y;
|
||||
double start_x = 0.0;
|
||||
double start_y = 0.0;
|
||||
bool line_to = false;
|
||||
unsigned orientation = 0;
|
||||
|
||||
m_contour_accumulator.remove_all();
|
||||
|
||||
while(!is_stop(cmd = src.vertex(&x, &y)))
|
||||
{
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(is_move_to(cmd))
|
||||
{
|
||||
if(line_to)
|
||||
{
|
||||
end_contour(orientation);
|
||||
orientation = 0;
|
||||
}
|
||||
start_contour();
|
||||
start_x = x;
|
||||
start_y = y;
|
||||
}
|
||||
add_vertex(x, y);
|
||||
line_to = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_end_poly(cmd))
|
||||
{
|
||||
orientation = get_orientation(cmd);
|
||||
if(line_to && is_closed(cmd))
|
||||
{
|
||||
add_vertex(start_x, start_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(line_to)
|
||||
{
|
||||
end_contour(orientation);
|
||||
}
|
||||
make_polygon(p);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
//--------------------------------------------------------------------
|
||||
source_a_type* m_src_a;
|
||||
source_b_type* m_src_b;
|
||||
status m_status;
|
||||
int m_vertex;
|
||||
int m_contour;
|
||||
gpc_op_e m_operation;
|
||||
vertex_array_type m_vertex_accumulator;
|
||||
contour_header_array_type m_contour_accumulator;
|
||||
gpc_polygon m_poly_a;
|
||||
gpc_polygon m_poly_b;
|
||||
gpc_polygon m_result;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::free_polygon(gpc_polygon& p)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < p.num_contours; i++)
|
||||
{
|
||||
pod_allocator<gpc_vertex>::deallocate(p.contour[i].vertex,
|
||||
p.contour[i].num_vertices);
|
||||
}
|
||||
pod_allocator<gpc_vertex_list>::deallocate(p.contour, p.num_contours);
|
||||
memset(&p, 0, sizeof(gpc_polygon));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::free_result()
|
||||
{
|
||||
if(m_result.contour)
|
||||
{
|
||||
gpc_free_polygon(&m_result);
|
||||
}
|
||||
memset(&m_result, 0, sizeof(m_result));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::free_gpc_data()
|
||||
{
|
||||
free_polygon(m_poly_a);
|
||||
free_polygon(m_poly_b);
|
||||
free_result();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::start_contour()
|
||||
{
|
||||
contour_header_type h;
|
||||
memset(&h, 0, sizeof(h));
|
||||
m_contour_accumulator.add(h);
|
||||
m_vertex_accumulator.remove_all();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
inline void conv_gpc<VSA, VSB>::add_vertex(double x, double y)
|
||||
{
|
||||
gpc_vertex v;
|
||||
v.x = x;
|
||||
v.y = y;
|
||||
m_vertex_accumulator.add(v);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::end_contour(unsigned orientation)
|
||||
{
|
||||
if(m_contour_accumulator.size())
|
||||
{
|
||||
if(m_vertex_accumulator.size() > 2)
|
||||
{
|
||||
contour_header_type& h =
|
||||
m_contour_accumulator[m_contour_accumulator.size() - 1];
|
||||
|
||||
h.num_vertices = m_vertex_accumulator.size();
|
||||
h.hole_flag = 0;
|
||||
|
||||
// TO DO: Clarify the "holes"
|
||||
//if(is_cw(orientation)) h.hole_flag = 1;
|
||||
|
||||
h.vertices = pod_allocator<gpc_vertex>::allocate(h.num_vertices);
|
||||
gpc_vertex* d = h.vertices;
|
||||
int i;
|
||||
for(i = 0; i < h.num_vertices; i++)
|
||||
{
|
||||
const gpc_vertex& s = m_vertex_accumulator[i];
|
||||
d->x = s.x;
|
||||
d->y = s.y;
|
||||
++d;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_vertex_accumulator.remove_last();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::make_polygon(gpc_polygon& p)
|
||||
{
|
||||
free_polygon(p);
|
||||
if(m_contour_accumulator.size())
|
||||
{
|
||||
p.num_contours = m_contour_accumulator.size();
|
||||
|
||||
p.hole = 0;
|
||||
p.contour = pod_allocator<gpc_vertex_list>::allocate(p.num_contours);
|
||||
|
||||
int i;
|
||||
gpc_vertex_list* pv = p.contour;
|
||||
for(i = 0; i < p.num_contours; i++)
|
||||
{
|
||||
const contour_header_type& h = m_contour_accumulator[i];
|
||||
pv->num_vertices = h.num_vertices;
|
||||
pv->vertex = h.vertices;
|
||||
++pv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::start_extracting()
|
||||
{
|
||||
m_status = status_move_to;
|
||||
m_contour = -1;
|
||||
m_vertex = -1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
bool conv_gpc<VSA, VSB>::next_contour()
|
||||
{
|
||||
if(++m_contour < m_result.num_contours)
|
||||
{
|
||||
m_vertex = -1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
inline bool conv_gpc<VSA, VSB>::next_vertex(double* x, double* y)
|
||||
{
|
||||
const gpc_vertex_list& vlist = m_result.contour[m_contour];
|
||||
if(++m_vertex < vlist.num_vertices)
|
||||
{
|
||||
const gpc_vertex& v = vlist.vertex[m_vertex];
|
||||
*x = v.x;
|
||||
*y = v.y;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
void conv_gpc<VSA, VSB>::rewind(unsigned path_id)
|
||||
{
|
||||
free_result();
|
||||
m_src_a->rewind(path_id);
|
||||
m_src_b->rewind(path_id);
|
||||
add(*m_src_a, m_poly_a);
|
||||
add(*m_src_b, m_poly_b);
|
||||
switch(m_operation)
|
||||
{
|
||||
case gpc_or:
|
||||
gpc_polygon_clip(GPC_UNION,
|
||||
&m_poly_a,
|
||||
&m_poly_b,
|
||||
&m_result);
|
||||
break;
|
||||
|
||||
case gpc_and:
|
||||
gpc_polygon_clip(GPC_INT,
|
||||
&m_poly_a,
|
||||
&m_poly_b,
|
||||
&m_result);
|
||||
break;
|
||||
|
||||
case gpc_xor:
|
||||
gpc_polygon_clip(GPC_XOR,
|
||||
&m_poly_a,
|
||||
&m_poly_b,
|
||||
&m_result);
|
||||
break;
|
||||
|
||||
case gpc_a_minus_b:
|
||||
gpc_polygon_clip(GPC_DIFF,
|
||||
&m_poly_a,
|
||||
&m_poly_b,
|
||||
&m_result);
|
||||
break;
|
||||
|
||||
case gpc_b_minus_a:
|
||||
gpc_polygon_clip(GPC_DIFF,
|
||||
&m_poly_b,
|
||||
&m_poly_a,
|
||||
&m_result);
|
||||
break;
|
||||
}
|
||||
start_extracting();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VSA, class VSB>
|
||||
unsigned conv_gpc<VSA, VSB>::vertex(double* x, double* y)
|
||||
{
|
||||
if(m_status == status_move_to)
|
||||
{
|
||||
if(next_contour())
|
||||
{
|
||||
if(next_vertex(x, y))
|
||||
{
|
||||
m_status = status_line_to;
|
||||
return path_cmd_move_to;
|
||||
}
|
||||
m_status = status_stop;
|
||||
return path_cmd_end_poly | path_flags_close;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(next_vertex(x, y))
|
||||
{
|
||||
return path_cmd_line_to;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_status = status_move_to;
|
||||
}
|
||||
return path_cmd_end_poly | path_flags_close;
|
||||
}
|
||||
return path_cmd_stop;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,154 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_MARKER_INCLUDED
|
||||
#define AGG_CONV_MARKER_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_trans_affine.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//-------------------------------------------------------------conv_marker
|
||||
template<class MarkerLocator, class MarkerShapes>
|
||||
class conv_marker
|
||||
{
|
||||
public:
|
||||
conv_marker(MarkerLocator& ml, MarkerShapes& ms);
|
||||
|
||||
trans_affine& transform() { return m_transform; }
|
||||
const trans_affine& transform() const { return m_transform; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
conv_marker(const conv_marker<MarkerLocator, MarkerShapes>&);
|
||||
const conv_marker<MarkerLocator, MarkerShapes>&
|
||||
operator = (const conv_marker<MarkerLocator, MarkerShapes>&);
|
||||
|
||||
enum status_e
|
||||
{
|
||||
initial,
|
||||
markers,
|
||||
polygon,
|
||||
stop
|
||||
};
|
||||
|
||||
MarkerLocator* m_marker_locator;
|
||||
MarkerShapes* m_marker_shapes;
|
||||
trans_affine m_transform;
|
||||
trans_affine m_mtx;
|
||||
status_e m_status;
|
||||
unsigned m_marker;
|
||||
unsigned m_num_markers;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class MarkerLocator, class MarkerShapes>
|
||||
conv_marker<MarkerLocator, MarkerShapes>::conv_marker(MarkerLocator& ml, MarkerShapes& ms) :
|
||||
m_marker_locator(&ml),
|
||||
m_marker_shapes(&ms),
|
||||
m_status(initial),
|
||||
m_marker(0),
|
||||
m_num_markers(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class MarkerLocator, class MarkerShapes>
|
||||
void conv_marker<MarkerLocator, MarkerShapes>::rewind(unsigned)
|
||||
{
|
||||
m_status = initial;
|
||||
m_marker = 0;
|
||||
m_num_markers = 1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class MarkerLocator, class MarkerShapes>
|
||||
unsigned conv_marker<MarkerLocator, MarkerShapes>::vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd = path_cmd_move_to;
|
||||
double x1, y1, x2, y2;
|
||||
|
||||
while(!is_stop(cmd))
|
||||
{
|
||||
switch(m_status)
|
||||
{
|
||||
case initial:
|
||||
if(m_num_markers == 0)
|
||||
{
|
||||
cmd = path_cmd_stop;
|
||||
break;
|
||||
}
|
||||
m_marker_locator->rewind(m_marker);
|
||||
++m_marker;
|
||||
m_num_markers = 0;
|
||||
m_status = markers;
|
||||
|
||||
case markers:
|
||||
if(is_stop(m_marker_locator->vertex(&x1, &y1)))
|
||||
{
|
||||
m_status = initial;
|
||||
break;
|
||||
}
|
||||
if(is_stop(m_marker_locator->vertex(&x2, &y2)))
|
||||
{
|
||||
m_status = initial;
|
||||
break;
|
||||
}
|
||||
++m_num_markers;
|
||||
m_mtx = m_transform;
|
||||
m_mtx *= trans_affine_rotation(atan2(y2 - y1, x2 - x1));
|
||||
m_mtx *= trans_affine_translation(x1, y1);
|
||||
m_marker_shapes->rewind(m_marker - 1);
|
||||
m_status = polygon;
|
||||
|
||||
case polygon:
|
||||
cmd = m_marker_shapes->vertex(x, y);
|
||||
if(is_stop(cmd))
|
||||
{
|
||||
cmd = path_cmd_move_to;
|
||||
m_status = markers;
|
||||
break;
|
||||
}
|
||||
m_mtx.transform(x, y);
|
||||
return cmd;
|
||||
|
||||
case stop:
|
||||
cmd = path_cmd_stop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_MARKER_ADAPTOR_INCLUDED
|
||||
#define AGG_CONV_MARKER_ADAPTOR_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
#include "agg_vcgen_vertex_sequence.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//=====================================================conv_marker_adaptor
|
||||
template<class VertexSource, class Markers=null_markers>
|
||||
struct conv_marker_adaptor :
|
||||
public conv_adaptor_vcgen<VertexSource, vcgen_vertex_sequence, Markers>
|
||||
{
|
||||
typedef Markers marker_type;
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_vertex_sequence, Markers> base_type;
|
||||
|
||||
conv_marker_adaptor(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_vertex_sequence, Markers>(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void shorten(double s) { base_type::generator().shorten(s); }
|
||||
double shorten() const { return base_type::generator().shorten(); }
|
||||
|
||||
private:
|
||||
conv_marker_adaptor(const conv_marker_adaptor<VertexSource, Markers>&);
|
||||
const conv_marker_adaptor<VertexSource, Markers>&
|
||||
operator = (const conv_marker_adaptor<VertexSource, Markers>&);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,57 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_SEGMENTATOR_INCLUDED
|
||||
#define AGG_CONV_SEGMENTATOR_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_conv_adaptor_vpgen.h"
|
||||
#include "agg_vpgen_segmentator.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//========================================================conv_segmentator
|
||||
template<class VertexSource>
|
||||
struct conv_segmentator : public conv_adaptor_vpgen<VertexSource, vpgen_segmentator>
|
||||
{
|
||||
typedef conv_adaptor_vpgen<VertexSource, vpgen_segmentator> base_type;
|
||||
|
||||
conv_segmentator(VertexSource& vs) :
|
||||
conv_adaptor_vpgen<VertexSource, vpgen_segmentator>(vs) {}
|
||||
|
||||
void approximation_scale(double s) { base_type::vpgen().approximation_scale(s); }
|
||||
double approximation_scale() const { return base_type::vpgen().approximation_scale(); }
|
||||
|
||||
private:
|
||||
conv_segmentator(const conv_segmentator<VertexSource>&);
|
||||
const conv_segmentator<VertexSource>&
|
||||
operator = (const conv_segmentator<VertexSource>&);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_SHORTEN_PATH_INCLUDED
|
||||
#define AGG_CONV_SHORTEN_PATH_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
#include "agg_vcgen_vertex_sequence.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//=======================================================conv_shorten_path
|
||||
template<class VertexSource> class conv_shorten_path :
|
||||
public conv_adaptor_vcgen<VertexSource, vcgen_vertex_sequence>
|
||||
{
|
||||
public:
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_vertex_sequence> base_type;
|
||||
|
||||
conv_shorten_path(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_vertex_sequence>(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void shorten(double s) { base_type::generator().shorten(s); }
|
||||
double shorten() const { return base_type::generator().shorten(); }
|
||||
|
||||
private:
|
||||
conv_shorten_path(const conv_shorten_path<VertexSource>&);
|
||||
const conv_shorten_path<VertexSource>&
|
||||
operator = (const conv_shorten_path<VertexSource>&);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,86 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_SMOOTH_POLY1_INCLUDED
|
||||
#define AGG_CONV_SMOOTH_POLY1_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_vcgen_smooth_poly1.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
#include "agg_conv_curve.h"
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-------------------------------------------------------conv_smooth_poly1
|
||||
template<class VertexSource>
|
||||
struct conv_smooth_poly1 :
|
||||
public conv_adaptor_vcgen<VertexSource, vcgen_smooth_poly1>
|
||||
{
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_smooth_poly1> base_type;
|
||||
|
||||
conv_smooth_poly1(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_smooth_poly1>(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void smooth_value(double v) { base_type::generator().smooth_value(v); }
|
||||
double smooth_value() const { return base_type::generator().smooth_value(); }
|
||||
|
||||
private:
|
||||
conv_smooth_poly1(const conv_smooth_poly1<VertexSource>&);
|
||||
const conv_smooth_poly1<VertexSource>&
|
||||
operator = (const conv_smooth_poly1<VertexSource>&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------conv_smooth_poly1_curve
|
||||
template<class VertexSource>
|
||||
struct conv_smooth_poly1_curve :
|
||||
public conv_curve<conv_smooth_poly1<VertexSource> >
|
||||
{
|
||||
conv_smooth_poly1_curve(VertexSource& vs) :
|
||||
conv_curve<conv_smooth_poly1<VertexSource> >(m_smooth),
|
||||
m_smooth(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void smooth_value(double v) { m_smooth.generator().smooth_value(v); }
|
||||
double smooth_value() const { return m_smooth.generator().smooth_value(); }
|
||||
|
||||
private:
|
||||
conv_smooth_poly1_curve(const conv_smooth_poly1_curve<VertexSource>&);
|
||||
const conv_smooth_poly1_curve<VertexSource>&
|
||||
operator = (const conv_smooth_poly1_curve<VertexSource>&);
|
||||
|
||||
conv_smooth_poly1<VertexSource> m_smooth;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_STROKE_INCLUDED
|
||||
#define AGG_CONV_STROKE_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_vcgen_stroke.h"
|
||||
#include "agg_conv_adaptor_vcgen.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-------------------------------------------------------------conv_stroke
|
||||
template<class VertexSource, class Markers=null_markers>
|
||||
struct conv_stroke :
|
||||
public conv_adaptor_vcgen<VertexSource, vcgen_stroke, Markers>
|
||||
{
|
||||
typedef Markers marker_type;
|
||||
typedef conv_adaptor_vcgen<VertexSource, vcgen_stroke, Markers> base_type;
|
||||
|
||||
conv_stroke(VertexSource& vs) :
|
||||
conv_adaptor_vcgen<VertexSource, vcgen_stroke, Markers>(vs)
|
||||
{
|
||||
}
|
||||
|
||||
void line_cap(line_cap_e lc) { base_type::generator().line_cap(lc); }
|
||||
void line_join(line_join_e lj) { base_type::generator().line_join(lj); }
|
||||
void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); }
|
||||
|
||||
line_cap_e line_cap() const { return base_type::generator().line_cap(); }
|
||||
line_join_e line_join() const { return base_type::generator().line_join(); }
|
||||
inner_join_e inner_join() const { return base_type::generator().inner_join(); }
|
||||
|
||||
void width(double w) { base_type::generator().width(w); }
|
||||
void miter_limit(double ml) { base_type::generator().miter_limit(ml); }
|
||||
void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); }
|
||||
void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); }
|
||||
void approximation_scale(double as) { base_type::generator().approximation_scale(as); }
|
||||
|
||||
double width() const { return base_type::generator().width(); }
|
||||
double miter_limit() const { return base_type::generator().miter_limit(); }
|
||||
double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); }
|
||||
double approximation_scale() const { return base_type::generator().approximation_scale(); }
|
||||
|
||||
void shorten(double s) { base_type::generator().shorten(s); }
|
||||
double shorten() const { return base_type::generator().shorten(); }
|
||||
|
||||
private:
|
||||
conv_stroke(const conv_stroke<VertexSource, Markers>&);
|
||||
const conv_stroke<VertexSource, Markers>&
|
||||
operator = (const conv_stroke<VertexSource, Markers>&);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,74 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_TRANSFORM_INCLUDED
|
||||
#define AGG_CONV_TRANSFORM_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include "agg_trans_affine.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//----------------------------------------------------------conv_transform
|
||||
template<class VertexSource, class Transformer=trans_affine> class conv_transform
|
||||
{
|
||||
public:
|
||||
conv_transform(VertexSource& source, const Transformer& tr) :
|
||||
m_source(&source), m_trans(&tr) {}
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
m_source->rewind(path_id);
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd = m_source->vertex(x, y);
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
m_trans->transform(x, y);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void transformer(const Transformer& tr)
|
||||
{
|
||||
m_trans = &tr;
|
||||
}
|
||||
|
||||
private:
|
||||
conv_transform(const conv_transform<VertexSource>&);
|
||||
const conv_transform<VertexSource>&
|
||||
operator = (const conv_transform<VertexSource>&);
|
||||
|
||||
VertexSource* m_source;
|
||||
const Transformer* m_trans;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,61 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CONV_UNCLOSE_POLYGON_INCLUDED
|
||||
#define AGG_CONV_UNCLOSE_POLYGON_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//====================================================conv_unclose_polygon
|
||||
template<class VertexSource> class conv_unclose_polygon
|
||||
{
|
||||
public:
|
||||
explicit conv_unclose_polygon(VertexSource& vs) : m_source(&vs) {}
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
m_source->rewind(path_id);
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
unsigned cmd = m_source->vertex(x, y);
|
||||
if(is_end_poly(cmd)) cmd &= ~path_flags_close;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private:
|
||||
conv_unclose_polygon(const conv_unclose_polygon<VertexSource>&);
|
||||
const conv_unclose_polygon<VertexSource>&
|
||||
operator = (const conv_unclose_polygon<VertexSource>&);
|
||||
|
||||
VertexSource* m_source;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,701 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_CURVES_INCLUDED
|
||||
#define AGG_CURVES_INCLUDED
|
||||
|
||||
#include "agg_array.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
// See Implementation agg_curves.cpp
|
||||
|
||||
//--------------------------------------------curve_approximation_method_e
|
||||
enum curve_approximation_method_e
|
||||
{
|
||||
curve_inc,
|
||||
curve_div
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------curve3_inc
|
||||
class curve3_inc
|
||||
{
|
||||
public:
|
||||
curve3_inc() :
|
||||
m_num_steps(0), m_step(0), m_scale(1.0) { }
|
||||
|
||||
curve3_inc(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3) :
|
||||
m_num_steps(0), m_step(0), m_scale(1.0)
|
||||
{
|
||||
init(x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
void reset() { m_num_steps = 0; m_step = -1; }
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3);
|
||||
|
||||
void approximation_method(curve_approximation_method_e) {}
|
||||
curve_approximation_method_e approximation_method() const { return curve_inc; }
|
||||
|
||||
void approximation_scale(double s);
|
||||
double approximation_scale() const;
|
||||
|
||||
void angle_tolerance(double) {}
|
||||
double angle_tolerance() const { return 0.0; }
|
||||
|
||||
void cusp_limit(double) {}
|
||||
double cusp_limit() const { return 0.0; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
int m_num_steps;
|
||||
int m_step;
|
||||
double m_scale;
|
||||
double m_start_x;
|
||||
double m_start_y;
|
||||
double m_end_x;
|
||||
double m_end_y;
|
||||
double m_fx;
|
||||
double m_fy;
|
||||
double m_dfx;
|
||||
double m_dfy;
|
||||
double m_ddfx;
|
||||
double m_ddfy;
|
||||
double m_saved_fx;
|
||||
double m_saved_fy;
|
||||
double m_saved_dfx;
|
||||
double m_saved_dfy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------curve3_div
|
||||
class curve3_div
|
||||
{
|
||||
public:
|
||||
curve3_div() :
|
||||
m_approximation_scale(1.0),
|
||||
m_angle_tolerance(0.0),
|
||||
m_count(0)
|
||||
{}
|
||||
|
||||
curve3_div(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3) :
|
||||
m_approximation_scale(1.0),
|
||||
m_angle_tolerance(0.0),
|
||||
m_count(0)
|
||||
{
|
||||
init(x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
void reset() { m_points.remove_all(); m_count = 0; }
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3);
|
||||
|
||||
void approximation_method(curve_approximation_method_e) {}
|
||||
curve_approximation_method_e approximation_method() const { return curve_div; }
|
||||
|
||||
void approximation_scale(double s) { m_approximation_scale = s; }
|
||||
double approximation_scale() const { return m_approximation_scale; }
|
||||
|
||||
void angle_tolerance(double a) { m_angle_tolerance = a; }
|
||||
double angle_tolerance() const { return m_angle_tolerance; }
|
||||
|
||||
void cusp_limit(double) {}
|
||||
double cusp_limit() const { return 0.0; }
|
||||
|
||||
void rewind(unsigned)
|
||||
{
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
if(m_count >= m_points.size()) return path_cmd_stop;
|
||||
const point_d& p = m_points[m_count++];
|
||||
*x = p.x;
|
||||
*y = p.y;
|
||||
return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to;
|
||||
}
|
||||
|
||||
private:
|
||||
void bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3);
|
||||
void recursive_bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
unsigned level);
|
||||
|
||||
double m_approximation_scale;
|
||||
double m_distance_tolerance_square;
|
||||
double m_angle_tolerance;
|
||||
unsigned m_count;
|
||||
pod_bvector<point_d> m_points;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------curve4_points
|
||||
struct curve4_points
|
||||
{
|
||||
double cp[8];
|
||||
curve4_points() {}
|
||||
curve4_points(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4)
|
||||
{
|
||||
cp[0] = x1; cp[1] = y1; cp[2] = x2; cp[3] = y2;
|
||||
cp[4] = x3; cp[5] = y3; cp[6] = x4; cp[7] = y4;
|
||||
}
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4)
|
||||
{
|
||||
cp[0] = x1; cp[1] = y1; cp[2] = x2; cp[3] = y2;
|
||||
cp[4] = x3; cp[5] = y3; cp[6] = x4; cp[7] = y4;
|
||||
}
|
||||
double operator [] (unsigned i) const { return cp[i]; }
|
||||
double& operator [] (unsigned i) { return cp[i]; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------curve4_inc
|
||||
class curve4_inc
|
||||
{
|
||||
public:
|
||||
curve4_inc() :
|
||||
m_num_steps(0), m_step(0), m_scale(1.0) { }
|
||||
|
||||
curve4_inc(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4) :
|
||||
m_num_steps(0), m_step(0), m_scale(1.0)
|
||||
{
|
||||
init(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
|
||||
curve4_inc(const curve4_points& cp) :
|
||||
m_num_steps(0), m_step(0), m_scale(1.0)
|
||||
{
|
||||
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
void reset() { m_num_steps = 0; m_step = -1; }
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4);
|
||||
|
||||
void init(const curve4_points& cp)
|
||||
{
|
||||
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
void approximation_method(curve_approximation_method_e) {}
|
||||
curve_approximation_method_e approximation_method() const { return curve_inc; }
|
||||
|
||||
void approximation_scale(double s);
|
||||
double approximation_scale() const;
|
||||
|
||||
void angle_tolerance(double) {}
|
||||
double angle_tolerance() const { return 0.0; }
|
||||
|
||||
void cusp_limit(double) {}
|
||||
double cusp_limit() const { return 0.0; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
int m_num_steps;
|
||||
int m_step;
|
||||
double m_scale;
|
||||
double m_start_x;
|
||||
double m_start_y;
|
||||
double m_end_x;
|
||||
double m_end_y;
|
||||
double m_fx;
|
||||
double m_fy;
|
||||
double m_dfx;
|
||||
double m_dfy;
|
||||
double m_ddfx;
|
||||
double m_ddfy;
|
||||
double m_dddfx;
|
||||
double m_dddfy;
|
||||
double m_saved_fx;
|
||||
double m_saved_fy;
|
||||
double m_saved_dfx;
|
||||
double m_saved_dfy;
|
||||
double m_saved_ddfx;
|
||||
double m_saved_ddfy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------catrom_to_bezier
|
||||
inline curve4_points catrom_to_bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4)
|
||||
{
|
||||
// Trans. matrix Catmull-Rom to Bezier
|
||||
//
|
||||
// 0 1 0 0
|
||||
// -1/6 1 1/6 0
|
||||
// 0 1/6 1 -1/6
|
||||
// 0 0 1 0
|
||||
//
|
||||
return curve4_points(
|
||||
x2,
|
||||
y2,
|
||||
(-x1 + 6*x2 + x3) / 6,
|
||||
(-y1 + 6*y2 + y3) / 6,
|
||||
( x2 + 6*x3 - x4) / 6,
|
||||
( y2 + 6*y3 - y4) / 6,
|
||||
x3,
|
||||
y3);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline curve4_points
|
||||
catrom_to_bezier(const curve4_points& cp)
|
||||
{
|
||||
return catrom_to_bezier(cp[0], cp[1], cp[2], cp[3],
|
||||
cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------ubspline_to_bezier
|
||||
inline curve4_points ubspline_to_bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4)
|
||||
{
|
||||
// Trans. matrix Uniform BSpline to Bezier
|
||||
//
|
||||
// 1/6 4/6 1/6 0
|
||||
// 0 4/6 2/6 0
|
||||
// 0 2/6 4/6 0
|
||||
// 0 1/6 4/6 1/6
|
||||
//
|
||||
return curve4_points(
|
||||
(x1 + 4*x2 + x3) / 6,
|
||||
(y1 + 4*y2 + y3) / 6,
|
||||
(4*x2 + 2*x3) / 6,
|
||||
(4*y2 + 2*y3) / 6,
|
||||
(2*x2 + 4*x3) / 6,
|
||||
(2*y2 + 4*y3) / 6,
|
||||
(x2 + 4*x3 + x4) / 6,
|
||||
(y2 + 4*y3 + y4) / 6);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline curve4_points
|
||||
ubspline_to_bezier(const curve4_points& cp)
|
||||
{
|
||||
return ubspline_to_bezier(cp[0], cp[1], cp[2], cp[3],
|
||||
cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------hermite_to_bezier
|
||||
inline curve4_points hermite_to_bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4)
|
||||
{
|
||||
// Trans. matrix Hermite to Bezier
|
||||
//
|
||||
// 1 0 0 0
|
||||
// 1 0 1/3 0
|
||||
// 0 1 0 -1/3
|
||||
// 0 1 0 0
|
||||
//
|
||||
return curve4_points(
|
||||
x1,
|
||||
y1,
|
||||
(3*x1 + x3) / 3,
|
||||
(3*y1 + y3) / 3,
|
||||
(3*x2 - x4) / 3,
|
||||
(3*y2 - y4) / 3,
|
||||
x2,
|
||||
y2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline curve4_points
|
||||
hermite_to_bezier(const curve4_points& cp)
|
||||
{
|
||||
return hermite_to_bezier(cp[0], cp[1], cp[2], cp[3],
|
||||
cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------curve4_div
|
||||
class curve4_div
|
||||
{
|
||||
public:
|
||||
curve4_div() :
|
||||
m_approximation_scale(1.0),
|
||||
m_angle_tolerance(0.0),
|
||||
m_cusp_limit(0.0),
|
||||
m_count(0)
|
||||
{}
|
||||
|
||||
curve4_div(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4) :
|
||||
m_approximation_scale(1.0),
|
||||
m_angle_tolerance(0.0),
|
||||
m_cusp_limit(0.0),
|
||||
m_count(0)
|
||||
{
|
||||
init(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
|
||||
curve4_div(const curve4_points& cp) :
|
||||
m_approximation_scale(1.0),
|
||||
m_angle_tolerance(0.0),
|
||||
m_count(0)
|
||||
{
|
||||
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
void reset() { m_points.remove_all(); m_count = 0; }
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4);
|
||||
|
||||
void init(const curve4_points& cp)
|
||||
{
|
||||
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
void approximation_method(curve_approximation_method_e) {}
|
||||
|
||||
curve_approximation_method_e approximation_method() const
|
||||
{
|
||||
return curve_div;
|
||||
}
|
||||
|
||||
void approximation_scale(double s) { m_approximation_scale = s; }
|
||||
double approximation_scale() const { return m_approximation_scale; }
|
||||
|
||||
void angle_tolerance(double a) { m_angle_tolerance = a; }
|
||||
double angle_tolerance() const { return m_angle_tolerance; }
|
||||
|
||||
void cusp_limit(double v)
|
||||
{
|
||||
m_cusp_limit = (v == 0.0) ? 0.0 : pi - v;
|
||||
}
|
||||
|
||||
double cusp_limit() const
|
||||
{
|
||||
return (m_cusp_limit == 0.0) ? 0.0 : pi - m_cusp_limit;
|
||||
}
|
||||
|
||||
void rewind(unsigned)
|
||||
{
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
if(m_count >= m_points.size()) return path_cmd_stop;
|
||||
const point_d& p = m_points[m_count++];
|
||||
*x = p.x;
|
||||
*y = p.y;
|
||||
return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to;
|
||||
}
|
||||
|
||||
private:
|
||||
void bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4);
|
||||
|
||||
void recursive_bezier(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4,
|
||||
unsigned level);
|
||||
|
||||
double m_approximation_scale;
|
||||
double m_distance_tolerance_square;
|
||||
double m_angle_tolerance;
|
||||
double m_cusp_limit;
|
||||
unsigned m_count;
|
||||
pod_bvector<point_d> m_points;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------curve3
|
||||
class curve3
|
||||
{
|
||||
public:
|
||||
curve3() : m_approximation_method(curve_div) {}
|
||||
curve3(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3) :
|
||||
m_approximation_method(curve_div)
|
||||
{
|
||||
init(x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_curve_inc.reset();
|
||||
m_curve_div.reset();
|
||||
}
|
||||
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3)
|
||||
{
|
||||
if(m_approximation_method == curve_inc)
|
||||
{
|
||||
m_curve_inc.init(x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_curve_div.init(x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
}
|
||||
|
||||
void approximation_method(curve_approximation_method_e v)
|
||||
{
|
||||
m_approximation_method = v;
|
||||
}
|
||||
|
||||
curve_approximation_method_e approximation_method() const
|
||||
{
|
||||
return m_approximation_method;
|
||||
}
|
||||
|
||||
void approximation_scale(double s)
|
||||
{
|
||||
m_curve_inc.approximation_scale(s);
|
||||
m_curve_div.approximation_scale(s);
|
||||
}
|
||||
|
||||
double approximation_scale() const
|
||||
{
|
||||
return m_curve_inc.approximation_scale();
|
||||
}
|
||||
|
||||
void angle_tolerance(double a)
|
||||
{
|
||||
m_curve_div.angle_tolerance(a);
|
||||
}
|
||||
|
||||
double angle_tolerance() const
|
||||
{
|
||||
return m_curve_div.angle_tolerance();
|
||||
}
|
||||
|
||||
void cusp_limit(double v)
|
||||
{
|
||||
m_curve_div.cusp_limit(v);
|
||||
}
|
||||
|
||||
double cusp_limit() const
|
||||
{
|
||||
return m_curve_div.cusp_limit();
|
||||
}
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
if(m_approximation_method == curve_inc)
|
||||
{
|
||||
m_curve_inc.rewind(path_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_curve_div.rewind(path_id);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
if(m_approximation_method == curve_inc)
|
||||
{
|
||||
return m_curve_inc.vertex(x, y);
|
||||
}
|
||||
return m_curve_div.vertex(x, y);
|
||||
}
|
||||
|
||||
private:
|
||||
curve3_inc m_curve_inc;
|
||||
curve3_div m_curve_div;
|
||||
curve_approximation_method_e m_approximation_method;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------curve4
|
||||
class curve4
|
||||
{
|
||||
public:
|
||||
curve4() : m_approximation_method(curve_div) {}
|
||||
curve4(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4) :
|
||||
m_approximation_method(curve_div)
|
||||
{
|
||||
init(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
|
||||
curve4(const curve4_points& cp) :
|
||||
m_approximation_method(curve_div)
|
||||
{
|
||||
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_curve_inc.reset();
|
||||
m_curve_div.reset();
|
||||
}
|
||||
|
||||
void init(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x4, double y4)
|
||||
{
|
||||
if(m_approximation_method == curve_inc)
|
||||
{
|
||||
m_curve_inc.init(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
}
|
||||
|
||||
void init(const curve4_points& cp)
|
||||
{
|
||||
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
|
||||
}
|
||||
|
||||
void approximation_method(curve_approximation_method_e v)
|
||||
{
|
||||
m_approximation_method = v;
|
||||
}
|
||||
|
||||
curve_approximation_method_e approximation_method() const
|
||||
{
|
||||
return m_approximation_method;
|
||||
}
|
||||
|
||||
void approximation_scale(double s)
|
||||
{
|
||||
m_curve_inc.approximation_scale(s);
|
||||
m_curve_div.approximation_scale(s);
|
||||
}
|
||||
double approximation_scale() const { return m_curve_inc.approximation_scale(); }
|
||||
|
||||
void angle_tolerance(double v)
|
||||
{
|
||||
m_curve_div.angle_tolerance(v);
|
||||
}
|
||||
|
||||
double angle_tolerance() const
|
||||
{
|
||||
return m_curve_div.angle_tolerance();
|
||||
}
|
||||
|
||||
void cusp_limit(double v)
|
||||
{
|
||||
m_curve_div.cusp_limit(v);
|
||||
}
|
||||
|
||||
double cusp_limit() const
|
||||
{
|
||||
return m_curve_div.cusp_limit();
|
||||
}
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
if(m_approximation_method == curve_inc)
|
||||
{
|
||||
m_curve_inc.rewind(path_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_curve_div.rewind(path_id);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
if(m_approximation_method == curve_inc)
|
||||
{
|
||||
return m_curve_inc.vertex(x, y);
|
||||
}
|
||||
return m_curve_div.vertex(x, y);
|
||||
}
|
||||
|
||||
private:
|
||||
curve4_inc m_curve_inc;
|
||||
curve4_div m_curve_div;
|
||||
curve_approximation_method_e m_approximation_method;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,295 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_DDA_LINE_INCLUDED
|
||||
#define AGG_DDA_LINE_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//===================================================dda_line_interpolator
|
||||
template<int FractionShift, int YShift=0> class dda_line_interpolator
|
||||
{
|
||||
public:
|
||||
//--------------------------------------------------------------------
|
||||
dda_line_interpolator() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
dda_line_interpolator(int y1, int y2, unsigned count) :
|
||||
m_y(y1),
|
||||
m_inc(((y2 - y1) << FractionShift) / int(count)),
|
||||
m_dy(0)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void operator ++ ()
|
||||
{
|
||||
m_dy += m_inc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void operator -- ()
|
||||
{
|
||||
m_dy -= m_inc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void operator += (unsigned n)
|
||||
{
|
||||
m_dy += m_inc * n;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void operator -= (unsigned n)
|
||||
{
|
||||
m_dy -= m_inc * n;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int y() const { return m_y + (m_dy >> (FractionShift-YShift)); }
|
||||
int dy() const { return m_dy; }
|
||||
|
||||
|
||||
private:
|
||||
int m_y;
|
||||
int m_inc;
|
||||
int m_dy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================dda2_line_interpolator
|
||||
class dda2_line_interpolator
|
||||
{
|
||||
public:
|
||||
typedef int save_data_type;
|
||||
enum save_size_e { save_size = 2 };
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
dda2_line_interpolator() {}
|
||||
|
||||
//-------------------------------------------- Forward-adjusted line
|
||||
dda2_line_interpolator(int y1, int y2, int count) :
|
||||
m_cnt(count <= 0 ? 1 : count),
|
||||
m_lft((y2 - y1) / m_cnt),
|
||||
m_rem((y2 - y1) % m_cnt),
|
||||
m_mod(m_rem),
|
||||
m_y(y1)
|
||||
{
|
||||
if(m_mod <= 0)
|
||||
{
|
||||
m_mod += count;
|
||||
m_rem += count;
|
||||
m_lft--;
|
||||
}
|
||||
m_mod -= count;
|
||||
}
|
||||
|
||||
//-------------------------------------------- Backward-adjusted line
|
||||
dda2_line_interpolator(int y1, int y2, int count, int) :
|
||||
m_cnt(count <= 0 ? 1 : count),
|
||||
m_lft((y2 - y1) / m_cnt),
|
||||
m_rem((y2 - y1) % m_cnt),
|
||||
m_mod(m_rem),
|
||||
m_y(y1)
|
||||
{
|
||||
if(m_mod <= 0)
|
||||
{
|
||||
m_mod += count;
|
||||
m_rem += count;
|
||||
m_lft--;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------- Backward-adjusted line
|
||||
dda2_line_interpolator(int y, int count) :
|
||||
m_cnt(count <= 0 ? 1 : count),
|
||||
m_lft(y / m_cnt),
|
||||
m_rem(y % m_cnt),
|
||||
m_mod(m_rem),
|
||||
m_y(0)
|
||||
{
|
||||
if(m_mod <= 0)
|
||||
{
|
||||
m_mod += count;
|
||||
m_rem += count;
|
||||
m_lft--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void save(save_data_type* data) const
|
||||
{
|
||||
data[0] = m_mod;
|
||||
data[1] = m_y;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void load(const save_data_type* data)
|
||||
{
|
||||
m_mod = data[0];
|
||||
m_y = data[1];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void operator++()
|
||||
{
|
||||
m_mod += m_rem;
|
||||
m_y += m_lft;
|
||||
if(m_mod > 0)
|
||||
{
|
||||
m_mod -= m_cnt;
|
||||
m_y++;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void operator--()
|
||||
{
|
||||
if(m_mod <= m_rem)
|
||||
{
|
||||
m_mod += m_cnt;
|
||||
m_y--;
|
||||
}
|
||||
m_mod -= m_rem;
|
||||
m_y -= m_lft;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void adjust_forward()
|
||||
{
|
||||
m_mod -= m_cnt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void adjust_backward()
|
||||
{
|
||||
m_mod += m_cnt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int mod() const { return m_mod; }
|
||||
int rem() const { return m_rem; }
|
||||
int lft() const { return m_lft; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int y() const { return m_y; }
|
||||
|
||||
private:
|
||||
int m_cnt;
|
||||
int m_lft;
|
||||
int m_rem;
|
||||
int m_mod;
|
||||
int m_y;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------line_bresenham_interpolator
|
||||
class line_bresenham_interpolator
|
||||
{
|
||||
public:
|
||||
enum subpixel_scale_e
|
||||
{
|
||||
subpixel_shift = 8,
|
||||
subpixel_scale = 1 << subpixel_shift,
|
||||
subpixel_mask = subpixel_scale - 1
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static int line_lr(int v) { return v >> subpixel_shift; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
line_bresenham_interpolator(int x1, int y1, int x2, int y2) :
|
||||
m_x1_lr(line_lr(x1)),
|
||||
m_y1_lr(line_lr(y1)),
|
||||
m_x2_lr(line_lr(x2)),
|
||||
m_y2_lr(line_lr(y2)),
|
||||
m_ver(abs(m_x2_lr - m_x1_lr) < abs(m_y2_lr - m_y1_lr)),
|
||||
m_len(m_ver ? abs(m_y2_lr - m_y1_lr) :
|
||||
abs(m_x2_lr - m_x1_lr)),
|
||||
m_inc(m_ver ? ((y2 > y1) ? 1 : -1) : ((x2 > x1) ? 1 : -1)),
|
||||
m_interpolator(m_ver ? x1 : y1,
|
||||
m_ver ? x2 : y2,
|
||||
m_len)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
bool is_ver() const { return m_ver; }
|
||||
unsigned len() const { return m_len; }
|
||||
int inc() const { return m_inc; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void hstep()
|
||||
{
|
||||
++m_interpolator;
|
||||
m_x1_lr += m_inc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void vstep()
|
||||
{
|
||||
++m_interpolator;
|
||||
m_y1_lr += m_inc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int x1() const { return m_x1_lr; }
|
||||
int y1() const { return m_y1_lr; }
|
||||
int x2() const { return line_lr(m_interpolator.y()); }
|
||||
int y2() const { return line_lr(m_interpolator.y()); }
|
||||
int x2_hr() const { return m_interpolator.y(); }
|
||||
int y2_hr() const { return m_interpolator.y(); }
|
||||
|
||||
private:
|
||||
int m_x1_lr;
|
||||
int m_y1_lr;
|
||||
int m_x2_lr;
|
||||
int m_y2_lr;
|
||||
bool m_ver;
|
||||
unsigned m_len;
|
||||
int m_inc;
|
||||
dda2_line_interpolator m_interpolator;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,128 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_ELLIPSE_INCLUDED
|
||||
#define AGG_ELLIPSE_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
#include <math.h>
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//----------------------------------------------------------------ellipse
|
||||
class ellipse
|
||||
{
|
||||
public:
|
||||
ellipse() :
|
||||
m_x(0.0), m_y(0.0), m_rx(1.0), m_ry(1.0), m_scale(1.0),
|
||||
m_num(4), m_step(0), m_cw(false) {}
|
||||
|
||||
ellipse(double x, double y, double rx, double ry,
|
||||
unsigned num_steps=0, bool cw=false) :
|
||||
m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0),
|
||||
m_num(num_steps), m_step(0), m_cw(cw)
|
||||
{
|
||||
if(m_num == 0) calc_num_steps();
|
||||
}
|
||||
|
||||
void init(double x, double y, double rx, double ry,
|
||||
unsigned num_steps=0, bool cw=false);
|
||||
|
||||
void approximation_scale(double scale);
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
void calc_num_steps();
|
||||
|
||||
double m_x;
|
||||
double m_y;
|
||||
double m_rx;
|
||||
double m_ry;
|
||||
double m_scale;
|
||||
unsigned m_num;
|
||||
unsigned m_step;
|
||||
bool m_cw;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
inline void ellipse::init(double x, double y, double rx, double ry,
|
||||
unsigned num_steps, bool cw)
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
m_rx = rx;
|
||||
m_ry = ry;
|
||||
m_num = num_steps;
|
||||
m_step = 0;
|
||||
m_cw = cw;
|
||||
if(m_num == 0) calc_num_steps();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
inline void ellipse::approximation_scale(double scale)
|
||||
{
|
||||
m_scale = scale;
|
||||
calc_num_steps();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
inline void ellipse::calc_num_steps()
|
||||
{
|
||||
double ra = (fabs(m_rx) + fabs(m_ry)) / 2;
|
||||
double da = acos(ra / (ra + 0.125 / m_scale)) * 2;
|
||||
m_num = uround(2*pi / da);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
inline void ellipse::rewind(unsigned)
|
||||
{
|
||||
m_step = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
inline unsigned ellipse::vertex(double* x, double* y)
|
||||
{
|
||||
if(m_step == m_num)
|
||||
{
|
||||
++m_step;
|
||||
return path_cmd_end_poly | path_flags_close | path_flags_ccw;
|
||||
}
|
||||
if(m_step > m_num) return path_cmd_stop;
|
||||
double angle = double(m_step) / double(m_num) * 2.0 * pi;
|
||||
if(m_cw) angle = 2.0 * pi - angle;
|
||||
*x = m_x + cos(angle) * m_rx;
|
||||
*y = m_y + sin(angle) * m_ry;
|
||||
m_step++;
|
||||
return ((m_step == 1) ? path_cmd_move_to : path_cmd_line_to);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_ELLIPSE_BRESENHAM_INCLUDED
|
||||
#define AGG_ELLIPSE_BRESENHAM_INCLUDED
|
||||
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//------------------------------------------ellipse_bresenham_interpolator
|
||||
class ellipse_bresenham_interpolator
|
||||
{
|
||||
public:
|
||||
ellipse_bresenham_interpolator(int rx, int ry) :
|
||||
m_rx2(rx * rx),
|
||||
m_ry2(ry * ry),
|
||||
m_two_rx2(m_rx2 << 1),
|
||||
m_two_ry2(m_ry2 << 1),
|
||||
m_dx(0),
|
||||
m_dy(0),
|
||||
m_inc_x(0),
|
||||
m_inc_y(-ry * m_two_rx2),
|
||||
m_cur_f(0)
|
||||
{}
|
||||
|
||||
int dx() const { return m_dx; }
|
||||
int dy() const { return m_dy; }
|
||||
|
||||
void operator++ ()
|
||||
{
|
||||
int mx, my, mxy, min_m;
|
||||
int fx, fy, fxy;
|
||||
|
||||
mx = fx = m_cur_f + m_inc_x + m_ry2;
|
||||
if(mx < 0) mx = -mx;
|
||||
|
||||
my = fy = m_cur_f + m_inc_y + m_rx2;
|
||||
if(my < 0) my = -my;
|
||||
|
||||
mxy = fxy = m_cur_f + m_inc_x + m_ry2 + m_inc_y + m_rx2;
|
||||
if(mxy < 0) mxy = -mxy;
|
||||
|
||||
min_m = mx;
|
||||
bool flag = true;
|
||||
|
||||
if(min_m > my)
|
||||
{
|
||||
min_m = my;
|
||||
flag = false;
|
||||
}
|
||||
|
||||
m_dx = m_dy = 0;
|
||||
|
||||
if(min_m > mxy)
|
||||
{
|
||||
m_inc_x += m_two_ry2;
|
||||
m_inc_y += m_two_rx2;
|
||||
m_cur_f = fxy;
|
||||
m_dx = 1;
|
||||
m_dy = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if(flag)
|
||||
{
|
||||
m_inc_x += m_two_ry2;
|
||||
m_cur_f = fx;
|
||||
m_dx = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
m_inc_y += m_two_rx2;
|
||||
m_cur_f = fy;
|
||||
m_dy = 1;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_rx2;
|
||||
int m_ry2;
|
||||
int m_two_rx2;
|
||||
int m_two_ry2;
|
||||
int m_dx;
|
||||
int m_dy;
|
||||
int m_inc_x;
|
||||
int m_inc_y;
|
||||
int m_cur_f;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_EMBEDDED_RASTER_FONTS_INCLUDED
|
||||
#define AGG_EMBEDDED_RASTER_FONTS_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
extern const int8u gse4x6[];
|
||||
extern const int8u gse4x8[];
|
||||
extern const int8u gse5x7[];
|
||||
extern const int8u gse5x9[];
|
||||
extern const int8u gse6x12[];
|
||||
extern const int8u gse6x9[];
|
||||
extern const int8u gse7x11[];
|
||||
extern const int8u gse7x11_bold[];
|
||||
extern const int8u gse7x15[];
|
||||
extern const int8u gse7x15_bold[];
|
||||
extern const int8u gse8x16[];
|
||||
extern const int8u gse8x16_bold[];
|
||||
extern const int8u mcs11_prop[];
|
||||
extern const int8u mcs11_prop_condensed[];
|
||||
extern const int8u mcs12_prop[];
|
||||
extern const int8u mcs13_prop[];
|
||||
extern const int8u mcs5x10_mono[];
|
||||
extern const int8u mcs5x11_mono[];
|
||||
extern const int8u mcs6x10_mono[];
|
||||
extern const int8u mcs6x11_mono[];
|
||||
extern const int8u mcs7x12_mono_high[];
|
||||
extern const int8u mcs7x12_mono_low[];
|
||||
extern const int8u verdana12[];
|
||||
extern const int8u verdana12_bold[];
|
||||
extern const int8u verdana13[];
|
||||
extern const int8u verdana13_bold[];
|
||||
extern const int8u verdana14[];
|
||||
extern const int8u verdana14_bold[];
|
||||
extern const int8u verdana16[];
|
||||
extern const int8u verdana16_bold[];
|
||||
extern const int8u verdana17[];
|
||||
extern const int8u verdana17_bold[];
|
||||
extern const int8u verdana18[];
|
||||
extern const int8u verdana18_bold[];
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,418 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_FONT_CACHE_MANAGER_INCLUDED
|
||||
#define AGG_FONT_CACHE_MANAGER_INCLUDED
|
||||
|
||||
#include <string.h>
|
||||
#include "agg_array.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//---------------------------------------------------------glyph_data_type
|
||||
enum glyph_data_type
|
||||
{
|
||||
glyph_data_invalid = 0,
|
||||
glyph_data_mono = 1,
|
||||
glyph_data_gray8 = 2,
|
||||
glyph_data_outline = 3
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------glyph_cache
|
||||
struct glyph_cache
|
||||
{
|
||||
unsigned glyph_index;
|
||||
int8u* data;
|
||||
unsigned data_size;
|
||||
glyph_data_type data_type;
|
||||
rect_i bounds;
|
||||
double advance_x;
|
||||
double advance_y;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------font_cache
|
||||
class font_cache
|
||||
{
|
||||
public:
|
||||
enum block_size_e { block_size = 16384-16 };
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
font_cache() :
|
||||
m_allocator(block_size),
|
||||
m_font_signature(0)
|
||||
{}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void signature(const char* font_signature)
|
||||
{
|
||||
m_font_signature = (char*)m_allocator.allocate(strlen(font_signature) + 1);
|
||||
strcpy(m_font_signature, font_signature);
|
||||
memset(m_glyphs, 0, sizeof(m_glyphs));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
bool font_is(const char* font_signature) const
|
||||
{
|
||||
return strcmp(font_signature, m_font_signature) == 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const glyph_cache* find_glyph(unsigned glyph_code) const
|
||||
{
|
||||
unsigned msb = (glyph_code >> 8) & 0xFF;
|
||||
if(m_glyphs[msb])
|
||||
{
|
||||
return m_glyphs[msb][glyph_code & 0xFF];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
glyph_cache* cache_glyph(unsigned glyph_code,
|
||||
unsigned glyph_index,
|
||||
unsigned data_size,
|
||||
glyph_data_type data_type,
|
||||
const rect_i& bounds,
|
||||
double advance_x,
|
||||
double advance_y)
|
||||
{
|
||||
unsigned msb = (glyph_code >> 8) & 0xFF;
|
||||
if(m_glyphs[msb] == 0)
|
||||
{
|
||||
m_glyphs[msb] =
|
||||
(glyph_cache**)m_allocator.allocate(sizeof(glyph_cache*) * 256,
|
||||
sizeof(glyph_cache*));
|
||||
memset(m_glyphs[msb], 0, sizeof(glyph_cache*) * 256);
|
||||
}
|
||||
|
||||
unsigned lsb = glyph_code & 0xFF;
|
||||
if(m_glyphs[msb][lsb]) return 0; // Already exists, do not overwrite
|
||||
|
||||
glyph_cache* glyph =
|
||||
(glyph_cache*)m_allocator.allocate(sizeof(glyph_cache),
|
||||
sizeof(double));
|
||||
|
||||
glyph->glyph_index = glyph_index;
|
||||
glyph->data = m_allocator.allocate(data_size);
|
||||
glyph->data_size = data_size;
|
||||
glyph->data_type = data_type;
|
||||
glyph->bounds = bounds;
|
||||
glyph->advance_x = advance_x;
|
||||
glyph->advance_y = advance_y;
|
||||
return m_glyphs[msb][lsb] = glyph;
|
||||
}
|
||||
|
||||
private:
|
||||
block_allocator m_allocator;
|
||||
glyph_cache** m_glyphs[256];
|
||||
char* m_font_signature;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------font_cache_pool
|
||||
class font_cache_pool
|
||||
{
|
||||
public:
|
||||
//--------------------------------------------------------------------
|
||||
~font_cache_pool()
|
||||
{
|
||||
unsigned i;
|
||||
for(i = 0; i < m_num_fonts; ++i)
|
||||
{
|
||||
obj_allocator<font_cache>::deallocate(m_fonts[i]);
|
||||
}
|
||||
pod_allocator<font_cache*>::deallocate(m_fonts, m_max_fonts);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
font_cache_pool(unsigned max_fonts=32) :
|
||||
m_fonts(pod_allocator<font_cache*>::allocate(max_fonts)),
|
||||
m_max_fonts(max_fonts),
|
||||
m_num_fonts(0),
|
||||
m_cur_font(0)
|
||||
{}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void font(const char* font_signature, bool reset_cache = false)
|
||||
{
|
||||
int idx = find_font(font_signature);
|
||||
if(idx >= 0)
|
||||
{
|
||||
if(reset_cache)
|
||||
{
|
||||
obj_allocator<font_cache>::deallocate(m_fonts[idx]);
|
||||
m_fonts[idx] = obj_allocator<font_cache>::allocate();
|
||||
m_fonts[idx]->signature(font_signature);
|
||||
}
|
||||
m_cur_font = m_fonts[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_num_fonts >= m_max_fonts)
|
||||
{
|
||||
obj_allocator<font_cache>::deallocate(m_fonts[0]);
|
||||
memcpy(m_fonts,
|
||||
m_fonts + 1,
|
||||
(m_max_fonts - 1) * sizeof(font_cache*));
|
||||
m_num_fonts = m_max_fonts - 1;
|
||||
}
|
||||
m_fonts[m_num_fonts] = obj_allocator<font_cache>::allocate();
|
||||
m_fonts[m_num_fonts]->signature(font_signature);
|
||||
m_cur_font = m_fonts[m_num_fonts];
|
||||
++m_num_fonts;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const font_cache* font() const
|
||||
{
|
||||
return m_cur_font;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const glyph_cache* find_glyph(unsigned glyph_code) const
|
||||
{
|
||||
if(m_cur_font) return m_cur_font->find_glyph(glyph_code);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
glyph_cache* cache_glyph(unsigned glyph_code,
|
||||
unsigned glyph_index,
|
||||
unsigned data_size,
|
||||
glyph_data_type data_type,
|
||||
const rect_i& bounds,
|
||||
double advance_x,
|
||||
double advance_y)
|
||||
{
|
||||
if(m_cur_font)
|
||||
{
|
||||
return m_cur_font->cache_glyph(glyph_code,
|
||||
glyph_index,
|
||||
data_size,
|
||||
data_type,
|
||||
bounds,
|
||||
advance_x,
|
||||
advance_y);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int find_font(const char* font_signature)
|
||||
{
|
||||
unsigned i;
|
||||
for(i = 0; i < m_num_fonts; i++)
|
||||
{
|
||||
if(m_fonts[i]->font_is(font_signature)) return int(i);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
font_cache** m_fonts;
|
||||
unsigned m_max_fonts;
|
||||
unsigned m_num_fonts;
|
||||
font_cache* m_cur_font;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
enum glyph_rendering
|
||||
{
|
||||
glyph_ren_native_mono,
|
||||
glyph_ren_native_gray8,
|
||||
glyph_ren_outline,
|
||||
glyph_ren_agg_mono,
|
||||
glyph_ren_agg_gray8
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------font_cache_manager
|
||||
template<class FontEngine> class font_cache_manager
|
||||
{
|
||||
public:
|
||||
typedef FontEngine font_engine_type;
|
||||
typedef font_cache_manager<FontEngine> self_type;
|
||||
typedef typename font_engine_type::path_adaptor_type path_adaptor_type;
|
||||
typedef typename font_engine_type::gray8_adaptor_type gray8_adaptor_type;
|
||||
typedef typename gray8_adaptor_type::embedded_scanline gray8_scanline_type;
|
||||
typedef typename font_engine_type::mono_adaptor_type mono_adaptor_type;
|
||||
typedef typename mono_adaptor_type::embedded_scanline mono_scanline_type;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
font_cache_manager(font_engine_type& engine, unsigned max_fonts=32) :
|
||||
m_fonts(max_fonts),
|
||||
m_engine(engine),
|
||||
m_change_stamp(-1),
|
||||
m_prev_glyph(0),
|
||||
m_last_glyph(0)
|
||||
{}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void reset_last_glyph()
|
||||
{
|
||||
m_prev_glyph = m_last_glyph = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const glyph_cache* glyph(unsigned glyph_code)
|
||||
{
|
||||
synchronize();
|
||||
const glyph_cache* gl = m_fonts.find_glyph(glyph_code);
|
||||
if(gl)
|
||||
{
|
||||
m_prev_glyph = m_last_glyph;
|
||||
return m_last_glyph = gl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_engine.prepare_glyph(glyph_code))
|
||||
{
|
||||
m_prev_glyph = m_last_glyph;
|
||||
m_last_glyph = m_fonts.cache_glyph(glyph_code,
|
||||
m_engine.glyph_index(),
|
||||
m_engine.data_size(),
|
||||
m_engine.data_type(),
|
||||
m_engine.bounds(),
|
||||
m_engine.advance_x(),
|
||||
m_engine.advance_y());
|
||||
m_engine.write_glyph_to(m_last_glyph->data);
|
||||
return m_last_glyph;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void init_embedded_adaptors(const glyph_cache* gl,
|
||||
double x, double y,
|
||||
double scale=1.0)
|
||||
{
|
||||
if(gl)
|
||||
{
|
||||
switch(gl->data_type)
|
||||
{
|
||||
default: return;
|
||||
case glyph_data_mono:
|
||||
m_mono_adaptor.init(gl->data, gl->data_size, x, y);
|
||||
break;
|
||||
|
||||
case glyph_data_gray8:
|
||||
m_gray8_adaptor.init(gl->data, gl->data_size, x, y);
|
||||
break;
|
||||
|
||||
case glyph_data_outline:
|
||||
m_path_adaptor.init(gl->data, gl->data_size, x, y, scale);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
path_adaptor_type& path_adaptor() { return m_path_adaptor; }
|
||||
gray8_adaptor_type& gray8_adaptor() { return m_gray8_adaptor; }
|
||||
gray8_scanline_type& gray8_scanline() { return m_gray8_scanline; }
|
||||
mono_adaptor_type& mono_adaptor() { return m_mono_adaptor; }
|
||||
mono_scanline_type& mono_scanline() { return m_mono_scanline; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const glyph_cache* perv_glyph() const { return m_prev_glyph; }
|
||||
const glyph_cache* last_glyph() const { return m_last_glyph; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
bool add_kerning(double* x, double* y)
|
||||
{
|
||||
if(m_prev_glyph && m_last_glyph)
|
||||
{
|
||||
return m_engine.add_kerning(m_prev_glyph->glyph_index,
|
||||
m_last_glyph->glyph_index,
|
||||
x, y);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void precache(unsigned from, unsigned to)
|
||||
{
|
||||
for(; from <= to; ++from) glyph(from);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void reset_cache()
|
||||
{
|
||||
m_fonts.font(m_engine.font_signature(), true);
|
||||
m_change_stamp = m_engine.change_stamp();
|
||||
m_prev_glyph = m_last_glyph = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
//--------------------------------------------------------------------
|
||||
font_cache_manager(const self_type&);
|
||||
const self_type& operator = (const self_type&);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void synchronize()
|
||||
{
|
||||
if(m_change_stamp != m_engine.change_stamp())
|
||||
{
|
||||
m_fonts.font(m_engine.font_signature());
|
||||
m_change_stamp = m_engine.change_stamp();
|
||||
m_prev_glyph = m_last_glyph = 0;
|
||||
}
|
||||
}
|
||||
|
||||
font_cache_pool m_fonts;
|
||||
font_engine_type& m_engine;
|
||||
int m_change_stamp;
|
||||
double m_dx;
|
||||
double m_dy;
|
||||
const glyph_cache* m_prev_glyph;
|
||||
const glyph_cache* m_last_glyph;
|
||||
path_adaptor_type m_path_adaptor;
|
||||
gray8_adaptor_type m_gray8_adaptor;
|
||||
gray8_scanline_type m_gray8_scanline;
|
||||
mono_adaptor_type m_mono_adaptor;
|
||||
mono_scanline_type m_mono_scanline;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_GAMMA_FUNCTIONS_INCLUDED
|
||||
#define AGG_GAMMA_FUNCTIONS_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//===============================================================gamma_none
|
||||
struct gamma_none
|
||||
{
|
||||
double operator()(double x) const { return x; }
|
||||
};
|
||||
|
||||
|
||||
//==============================================================gamma_power
|
||||
class gamma_power
|
||||
{
|
||||
public:
|
||||
gamma_power() : m_gamma(1.0) {}
|
||||
gamma_power(double g) : m_gamma(g) {}
|
||||
|
||||
void gamma(double g) { m_gamma = g; }
|
||||
double gamma() const { return m_gamma; }
|
||||
|
||||
double operator() (double x) const
|
||||
{
|
||||
return pow(x, m_gamma);
|
||||
}
|
||||
|
||||
private:
|
||||
double m_gamma;
|
||||
};
|
||||
|
||||
|
||||
//==========================================================gamma_threshold
|
||||
class gamma_threshold
|
||||
{
|
||||
public:
|
||||
gamma_threshold() : m_threshold(0.5) {}
|
||||
gamma_threshold(double t) : m_threshold(t) {}
|
||||
|
||||
void threshold(double t) { m_threshold = t; }
|
||||
double threshold() const { return m_threshold; }
|
||||
|
||||
double operator() (double x) const
|
||||
{
|
||||
return (x < m_threshold) ? 0.0 : 1.0;
|
||||
}
|
||||
|
||||
private:
|
||||
double m_threshold;
|
||||
};
|
||||
|
||||
|
||||
//============================================================gamma_linear
|
||||
class gamma_linear
|
||||
{
|
||||
public:
|
||||
gamma_linear() : m_start(0.0), m_end(1.0) {}
|
||||
gamma_linear(double s, double e) : m_start(s), m_end(e) {}
|
||||
|
||||
void set(double s, double e) { m_start = s; m_end = e; }
|
||||
void start(double s) { m_start = s; }
|
||||
void end(double e) { m_end = e; }
|
||||
double start() const { return m_start; }
|
||||
double end() const { return m_end; }
|
||||
|
||||
double operator() (double x) const
|
||||
{
|
||||
if(x < m_start) return 0.0;
|
||||
if(x > m_end) return 1.0;
|
||||
return (x - m_start) / (m_end - m_start);
|
||||
}
|
||||
|
||||
private:
|
||||
double m_start;
|
||||
double m_end;
|
||||
};
|
||||
|
||||
|
||||
//==========================================================gamma_multiply
|
||||
class gamma_multiply
|
||||
{
|
||||
public:
|
||||
gamma_multiply() : m_mul(1.0) {}
|
||||
gamma_multiply(double v) : m_mul(v) {}
|
||||
|
||||
void value(double v) { m_mul = v; }
|
||||
double value() const { return m_mul; }
|
||||
|
||||
double operator() (double x) const
|
||||
{
|
||||
double y = x * m_mul;
|
||||
if(y > 1.0) y = 1.0;
|
||||
return y;
|
||||
}
|
||||
|
||||
private:
|
||||
double m_mul;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_GAMMA_LUT_INCLUDED
|
||||
#define AGG_GAMMA_LUT_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class LoResT=int8u,
|
||||
class HiResT=int8u,
|
||||
unsigned GammaShift=8,
|
||||
unsigned HiResShift=8> class gamma_lut
|
||||
{
|
||||
public:
|
||||
typedef gamma_lut<LoResT, HiResT, GammaShift, HiResShift> self_type;
|
||||
|
||||
enum gamma_scale_e
|
||||
{
|
||||
gamma_shift = GammaShift,
|
||||
gamma_size = 1 << gamma_shift,
|
||||
gamma_mask = gamma_size - 1
|
||||
};
|
||||
|
||||
enum hi_res_scale_e
|
||||
{
|
||||
hi_res_shift = HiResShift,
|
||||
hi_res_size = 1 << hi_res_shift,
|
||||
hi_res_mask = hi_res_size - 1
|
||||
};
|
||||
|
||||
~gamma_lut()
|
||||
{
|
||||
pod_allocator<LoResT>::deallocate(m_inv_gamma, hi_res_size);
|
||||
pod_allocator<HiResT>::deallocate(m_dir_gamma, gamma_size);
|
||||
}
|
||||
|
||||
gamma_lut() :
|
||||
m_gamma(1.0),
|
||||
m_dir_gamma(pod_allocator<HiResT>::allocate(gamma_size)),
|
||||
m_inv_gamma(pod_allocator<LoResT>::allocate(hi_res_size))
|
||||
{
|
||||
unsigned i;
|
||||
for(i = 0; i < gamma_size; i++)
|
||||
{
|
||||
m_dir_gamma[i] = HiResT(i << (hi_res_shift - gamma_shift));
|
||||
}
|
||||
|
||||
for(i = 0; i < hi_res_size; i++)
|
||||
{
|
||||
m_inv_gamma[i] = LoResT(i >> (hi_res_shift - gamma_shift));
|
||||
}
|
||||
}
|
||||
|
||||
gamma_lut(double g) :
|
||||
m_gamma(1.0),
|
||||
m_dir_gamma(pod_allocator<HiResT>::allocate(gamma_size)),
|
||||
m_inv_gamma(pod_allocator<LoResT>::allocate(hi_res_size))
|
||||
{
|
||||
gamma(g);
|
||||
}
|
||||
|
||||
void gamma(double g)
|
||||
{
|
||||
m_gamma = g;
|
||||
|
||||
unsigned i;
|
||||
for(i = 0; i < gamma_size; i++)
|
||||
{
|
||||
m_dir_gamma[i] = (HiResT)
|
||||
uround(pow(i / double(gamma_mask), m_gamma) * double(hi_res_mask));
|
||||
}
|
||||
|
||||
double inv_g = 1.0 / g;
|
||||
for(i = 0; i < hi_res_size; i++)
|
||||
{
|
||||
m_inv_gamma[i] = (LoResT)
|
||||
uround(pow(i / double(hi_res_mask), inv_g) * double(gamma_mask));
|
||||
}
|
||||
}
|
||||
|
||||
double gamma() const
|
||||
{
|
||||
return m_gamma;
|
||||
}
|
||||
|
||||
HiResT dir(LoResT v) const
|
||||
{
|
||||
return m_dir_gamma[unsigned(v)];
|
||||
}
|
||||
|
||||
LoResT inv(HiResT v) const
|
||||
{
|
||||
return m_inv_gamma[unsigned(v)];
|
||||
}
|
||||
|
||||
private:
|
||||
gamma_lut(const self_type&);
|
||||
const self_type& operator = (const self_type&);
|
||||
|
||||
double m_gamma;
|
||||
HiResT* m_dir_gamma;
|
||||
LoResT* m_inv_gamma;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,164 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_GLYPH_RASTER_BIN_INCLUDED
|
||||
#define AGG_GLYPH_RASTER_BIN_INCLUDED
|
||||
|
||||
#include <string.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//========================================================glyph_raster_bin
|
||||
template<class ColorT> class glyph_raster_bin
|
||||
{
|
||||
public:
|
||||
typedef ColorT color_type;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
struct glyph_rect
|
||||
{
|
||||
int x1,y1,x2,y2;
|
||||
double dx, dy;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
glyph_raster_bin(const int8u* font) :
|
||||
m_font(font),
|
||||
m_big_endian(false)
|
||||
{
|
||||
int t = 1;
|
||||
if(*(char*)&t == 0) m_big_endian = true;
|
||||
memset(m_span, 0, sizeof(m_span));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const int8u* font() const { return m_font; }
|
||||
void font(const int8u* f) { m_font = f; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double height() const { return m_font[0]; }
|
||||
double base_line() const { return m_font[1]; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
template<class CharT>
|
||||
double width(const CharT* str) const
|
||||
{
|
||||
unsigned start_char = m_font[2];
|
||||
unsigned num_chars = m_font[3];
|
||||
|
||||
unsigned w = 0;
|
||||
while(*str)
|
||||
{
|
||||
unsigned glyph = *str;
|
||||
const int8u* bits = m_font + 4 + num_chars * 2 +
|
||||
value(m_font + 4 + (glyph - start_char) * 2);
|
||||
w += *bits;
|
||||
++str;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void prepare(glyph_rect* r, double x, double y, unsigned glyph, bool flip)
|
||||
{
|
||||
unsigned start_char = m_font[2];
|
||||
unsigned num_chars = m_font[3];
|
||||
|
||||
m_bits = m_font + 4 + num_chars * 2 +
|
||||
value(m_font + 4 + (glyph - start_char) * 2);
|
||||
|
||||
m_glyph_width = *m_bits++;
|
||||
m_glyph_byte_width = (m_glyph_width + 7) >> 3;
|
||||
|
||||
r->x1 = int(x);
|
||||
r->x2 = r->x1 + m_glyph_width - 1;
|
||||
if(flip)
|
||||
{
|
||||
r->y1 = int(y) - m_font[0] + m_font[1];
|
||||
r->y2 = r->y1 + m_font[0] - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
r->y1 = int(y) - m_font[1] + 1;
|
||||
r->y2 = r->y1 + m_font[0] - 1;
|
||||
}
|
||||
r->dx = m_glyph_width;
|
||||
r->dy = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const cover_type* span(unsigned i)
|
||||
{
|
||||
i = m_font[0] - i - 1;
|
||||
const int8u* bits = m_bits + i * m_glyph_byte_width;
|
||||
unsigned j;
|
||||
unsigned val = *bits;
|
||||
unsigned nb = 0;
|
||||
for(j = 0; j < m_glyph_width; ++j)
|
||||
{
|
||||
m_span[j] = (cover_type)((val & 0x80) ? cover_full : cover_none);
|
||||
val <<= 1;
|
||||
if(++nb >= 8)
|
||||
{
|
||||
val = *++bits;
|
||||
nb = 0;
|
||||
}
|
||||
}
|
||||
return m_span;
|
||||
}
|
||||
|
||||
private:
|
||||
//--------------------------------------------------------------------
|
||||
int16u value(const int8u* p) const
|
||||
{
|
||||
int16u v;
|
||||
if(m_big_endian)
|
||||
{
|
||||
*(int8u*)&v = p[1];
|
||||
*((int8u*)&v + 1) = p[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
*(int8u*)&v = p[0];
|
||||
*((int8u*)&v + 1) = p[1];
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const int8u* m_font;
|
||||
bool m_big_endian;
|
||||
cover_type m_span[32];
|
||||
const int8u* m_bits;
|
||||
unsigned m_glyph_width;
|
||||
unsigned m_glyph_byte_width;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,253 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_GRADIENT_LUT_INCLUDED
|
||||
#define AGG_GRADIENT_LUT_INCLUDED
|
||||
|
||||
#include "agg_array.h"
|
||||
#include "agg_dda_line.h"
|
||||
#include "agg_color_rgba.h"
|
||||
#include "agg_color_gray.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//======================================================color_interpolator
|
||||
template<class ColorT> struct color_interpolator
|
||||
{
|
||||
public:
|
||||
typedef ColorT color_type;
|
||||
|
||||
color_interpolator(const color_type& c1,
|
||||
const color_type& c2,
|
||||
unsigned len) :
|
||||
m_c1(c1),
|
||||
m_c2(c2),
|
||||
m_len(len),
|
||||
m_count(0)
|
||||
{}
|
||||
|
||||
void operator ++ ()
|
||||
{
|
||||
++m_count;
|
||||
}
|
||||
|
||||
color_type color() const
|
||||
{
|
||||
return m_c1.gradient(m_c2, double(m_count) / m_len);
|
||||
}
|
||||
|
||||
private:
|
||||
color_type m_c1;
|
||||
color_type m_c2;
|
||||
unsigned m_len;
|
||||
unsigned m_count;
|
||||
};
|
||||
|
||||
//========================================================================
|
||||
// Fast specialization for rgba8
|
||||
template<> struct color_interpolator<rgba8>
|
||||
{
|
||||
public:
|
||||
typedef rgba8 color_type;
|
||||
|
||||
color_interpolator(const color_type& c1,
|
||||
const color_type& c2,
|
||||
unsigned len) :
|
||||
r(c1.r, c2.r, len),
|
||||
g(c1.g, c2.g, len),
|
||||
b(c1.b, c2.b, len),
|
||||
a(c1.a, c2.a, len)
|
||||
{}
|
||||
|
||||
void operator ++ ()
|
||||
{
|
||||
++r; ++g; ++b; ++a;
|
||||
}
|
||||
|
||||
color_type color() const
|
||||
{
|
||||
return color_type(r.y(), g.y(), b.y(), a.y());
|
||||
}
|
||||
|
||||
private:
|
||||
agg::dda_line_interpolator<14> r, g, b, a;
|
||||
};
|
||||
|
||||
//========================================================================
|
||||
// Fast specialization for gray8
|
||||
template<> struct color_interpolator<gray8>
|
||||
{
|
||||
public:
|
||||
typedef gray8 color_type;
|
||||
|
||||
color_interpolator(const color_type& c1,
|
||||
const color_type& c2,
|
||||
unsigned len) :
|
||||
v(c1.v, c2.v, len),
|
||||
a(c1.a, c2.a, len)
|
||||
{}
|
||||
|
||||
void operator ++ ()
|
||||
{
|
||||
++v; ++a;
|
||||
}
|
||||
|
||||
color_type color() const
|
||||
{
|
||||
return color_type(v.y(), a.y());
|
||||
}
|
||||
|
||||
private:
|
||||
agg::dda_line_interpolator<14> v,a;
|
||||
};
|
||||
|
||||
//============================================================gradient_lut
|
||||
template<class ColorInterpolator,
|
||||
unsigned ColorLutSize=256> class gradient_lut
|
||||
{
|
||||
public:
|
||||
typedef ColorInterpolator interpolator_type;
|
||||
typedef typename interpolator_type::color_type color_type;
|
||||
enum { color_lut_size = ColorLutSize };
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gradient_lut() : m_color_lut(color_lut_size) {}
|
||||
|
||||
// Build Gradient Lut
|
||||
// First, call remove_all(), then add_color() at least twice,
|
||||
// then build_lut(). Argument "offset" in add_color must be
|
||||
// in range [0...1] and defines a color stop as it is described
|
||||
// in SVG specification, section Gradients and Patterns.
|
||||
// The simplest linear gradient is:
|
||||
// gradient_lut.add_color(0.0, start_color);
|
||||
// gradient_lut.add_color(1.0, end_color);
|
||||
//--------------------------------------------------------------------
|
||||
void remove_all();
|
||||
void add_color(double offset, const color_type& color);
|
||||
void build_lut();
|
||||
|
||||
// Size-index Interface. This class can be used directly as the
|
||||
// ColorF in span_gradient. All it needs is two access methods
|
||||
// size() and operator [].
|
||||
//--------------------------------------------------------------------
|
||||
static unsigned size()
|
||||
{
|
||||
return color_lut_size;
|
||||
}
|
||||
const color_type& operator [] (unsigned i) const
|
||||
{
|
||||
return m_color_lut[i];
|
||||
}
|
||||
|
||||
private:
|
||||
//--------------------------------------------------------------------
|
||||
struct color_point
|
||||
{
|
||||
double offset;
|
||||
color_type color;
|
||||
|
||||
color_point() {}
|
||||
color_point(double off, const color_type& c) :
|
||||
offset(off), color(c)
|
||||
{
|
||||
if(offset < 0.0) offset = 0.0;
|
||||
if(offset > 1.0) offset = 1.0;
|
||||
}
|
||||
};
|
||||
typedef agg::pod_bvector<color_point, 4> color_profile_type;
|
||||
typedef agg::pod_array<color_type> color_lut_type;
|
||||
|
||||
static bool offset_less(const color_point& a, const color_point& b)
|
||||
{
|
||||
return a.offset < b.offset;
|
||||
}
|
||||
static bool offset_equal(const color_point& a, const color_point& b)
|
||||
{
|
||||
return a.offset == b.offset;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
color_profile_type m_color_profile;
|
||||
color_lut_type m_color_lut;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class T, unsigned S>
|
||||
void gradient_lut<T,S>::remove_all()
|
||||
{
|
||||
m_color_profile.remove_all();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class T, unsigned S>
|
||||
void gradient_lut<T,S>::add_color(double offset, const color_type& color)
|
||||
{
|
||||
m_color_profile.add(color_point(offset, color));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class T, unsigned S>
|
||||
void gradient_lut<T,S>::build_lut()
|
||||
{
|
||||
quick_sort(m_color_profile, offset_less);
|
||||
m_color_profile.cut_at(remove_duplicates(m_color_profile, offset_equal));
|
||||
if(m_color_profile.size() >= 2)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned start = uround(m_color_profile[0].offset * color_lut_size);
|
||||
unsigned end;
|
||||
color_type c = m_color_profile[0].color;
|
||||
for(i = 0; i < start; i++)
|
||||
{
|
||||
m_color_lut[i] = c;
|
||||
}
|
||||
for(i = 1; i < m_color_profile.size(); i++)
|
||||
{
|
||||
end = uround(m_color_profile[i].offset * color_lut_size);
|
||||
interpolator_type ci(m_color_profile[i-1].color,
|
||||
m_color_profile[i ].color,
|
||||
end - start + 1);
|
||||
while(start < end)
|
||||
{
|
||||
m_color_lut[start] = ci.color();
|
||||
++ci;
|
||||
++start;
|
||||
}
|
||||
}
|
||||
c = m_color_profile.last().color;
|
||||
for(; end < m_color_lut.size(); end++)
|
||||
{
|
||||
m_color_lut[end] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,158 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_GSV_TEXT_INCLUDED
|
||||
#define AGG_GSV_TEXT_INCLUDED
|
||||
|
||||
#include "agg_array.h"
|
||||
#include "agg_conv_stroke.h"
|
||||
#include "agg_conv_transform.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
|
||||
//---------------------------------------------------------------gsv_text
|
||||
//
|
||||
// See Implementation agg_gsv_text.cpp
|
||||
//
|
||||
class gsv_text
|
||||
{
|
||||
enum status
|
||||
{
|
||||
initial,
|
||||
next_char,
|
||||
start_glyph,
|
||||
glyph
|
||||
};
|
||||
|
||||
public:
|
||||
gsv_text();
|
||||
|
||||
void font(const void* font);
|
||||
void flip(bool flip_y) { m_flip = flip_y; }
|
||||
void load_font(const char* file);
|
||||
void size(double height, double width=0.0);
|
||||
void space(double space);
|
||||
void line_space(double line_space);
|
||||
void start_point(double x, double y);
|
||||
void text(const char* text);
|
||||
|
||||
double text_width();
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
private:
|
||||
// not supposed to be copied
|
||||
gsv_text(const gsv_text&);
|
||||
const gsv_text& operator = (const gsv_text&);
|
||||
|
||||
int16u value(const int8u* p) const
|
||||
{
|
||||
int16u v;
|
||||
if(m_big_endian)
|
||||
{
|
||||
*(int8u*)&v = p[1];
|
||||
*((int8u*)&v + 1) = p[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
*(int8u*)&v = p[0];
|
||||
*((int8u*)&v + 1) = p[1];
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private:
|
||||
double m_x;
|
||||
double m_y;
|
||||
double m_start_x;
|
||||
double m_width;
|
||||
double m_height;
|
||||
double m_space;
|
||||
double m_line_space;
|
||||
char m_chr[2];
|
||||
char* m_text;
|
||||
pod_array<char> m_text_buf;
|
||||
char* m_cur_chr;
|
||||
const void* m_font;
|
||||
pod_array<char> m_loaded_font;
|
||||
status m_status;
|
||||
bool m_big_endian;
|
||||
bool m_flip;
|
||||
int8u* m_indices;
|
||||
int8* m_glyphs;
|
||||
int8* m_bglyph;
|
||||
int8* m_eglyph;
|
||||
double m_w;
|
||||
double m_h;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------gsv_text_outline
|
||||
template<class Transformer = trans_affine> class gsv_text_outline
|
||||
{
|
||||
public:
|
||||
gsv_text_outline(gsv_text& text, const Transformer& trans) :
|
||||
m_polyline(text),
|
||||
m_trans(m_polyline, trans)
|
||||
{
|
||||
}
|
||||
|
||||
void width(double w)
|
||||
{
|
||||
m_polyline.width(w);
|
||||
}
|
||||
|
||||
void transformer(const Transformer* trans)
|
||||
{
|
||||
m_trans->transformer(trans);
|
||||
}
|
||||
|
||||
void rewind(unsigned path_id)
|
||||
{
|
||||
m_trans.rewind(path_id);
|
||||
m_polyline.line_join(round_join);
|
||||
m_polyline.line_cap(round_cap);
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y)
|
||||
{
|
||||
return m_trans.vertex(x, y);
|
||||
}
|
||||
|
||||
private:
|
||||
conv_stroke<gsv_text> m_polyline;
|
||||
conv_transform<conv_stroke<gsv_text>, Transformer> m_trans;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,490 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_IMAGE_ACCESSORS_INCLUDED
|
||||
#define AGG_IMAGE_ACCESSORS_INCLUDED
|
||||
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//-----------------------------------------------------image_accessor_clip
|
||||
template<class PixFmt> class image_accessor_clip
|
||||
{
|
||||
public:
|
||||
typedef PixFmt pixfmt_type;
|
||||
typedef typename pixfmt_type::color_type color_type;
|
||||
typedef typename pixfmt_type::order_type order_type;
|
||||
typedef typename pixfmt_type::value_type value_type;
|
||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||
|
||||
image_accessor_clip() {}
|
||||
explicit image_accessor_clip(const pixfmt_type& pixf,
|
||||
const color_type& bk) :
|
||||
m_pixf(&pixf)
|
||||
{
|
||||
pixfmt_type::make_pix(m_bk_buf, bk);
|
||||
}
|
||||
|
||||
void attach(const pixfmt_type& pixf)
|
||||
{
|
||||
m_pixf = &pixf;
|
||||
}
|
||||
|
||||
void background_color(const color_type& bk)
|
||||
{
|
||||
pixfmt_type::make_pix(m_bk_buf, bk);
|
||||
}
|
||||
|
||||
private:
|
||||
AGG_INLINE const int8u* pixel() const
|
||||
{
|
||||
if(m_y >= 0 && m_y < (int)m_pixf->height() &&
|
||||
m_x >= 0 && m_x < (int)m_pixf->width())
|
||||
{
|
||||
return m_pixf->pix_ptr(m_x, m_y);
|
||||
}
|
||||
return m_bk_buf;
|
||||
}
|
||||
|
||||
public:
|
||||
AGG_INLINE const int8u* span(int x, int y, unsigned len)
|
||||
{
|
||||
m_x = m_x0 = x;
|
||||
m_y = y;
|
||||
if(y >= 0 && y < (int)m_pixf->height() &&
|
||||
x >= 0 && x+(int)len <= (int)m_pixf->width())
|
||||
{
|
||||
return m_pix_ptr = m_pixf->pix_ptr(x, y);
|
||||
}
|
||||
m_pix_ptr = 0;
|
||||
return pixel();
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_x()
|
||||
{
|
||||
if(m_pix_ptr) return m_pix_ptr += pix_width;
|
||||
++m_x;
|
||||
return pixel();
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_y()
|
||||
{
|
||||
++m_y;
|
||||
m_x = m_x0;
|
||||
if(m_pix_ptr &&
|
||||
m_y >= 0 && m_y < (int)m_pixf->height())
|
||||
{
|
||||
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
||||
}
|
||||
m_pix_ptr = 0;
|
||||
return pixel();
|
||||
}
|
||||
|
||||
private:
|
||||
const pixfmt_type* m_pixf;
|
||||
int8u m_bk_buf[4];
|
||||
int m_x, m_x0, m_y;
|
||||
const int8u* m_pix_ptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------image_accessor_no_clip
|
||||
template<class PixFmt> class image_accessor_no_clip
|
||||
{
|
||||
public:
|
||||
typedef PixFmt pixfmt_type;
|
||||
typedef typename pixfmt_type::color_type color_type;
|
||||
typedef typename pixfmt_type::order_type order_type;
|
||||
typedef typename pixfmt_type::value_type value_type;
|
||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||
|
||||
image_accessor_no_clip() {}
|
||||
explicit image_accessor_no_clip(const pixfmt_type& pixf) :
|
||||
m_pixf(&pixf)
|
||||
{}
|
||||
|
||||
void attach(const pixfmt_type& pixf)
|
||||
{
|
||||
m_pixf = &pixf;
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* span(int x, int y, unsigned)
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
return m_pix_ptr = m_pixf->pix_ptr(x, y);
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_x()
|
||||
{
|
||||
return m_pix_ptr += pix_width;
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_y()
|
||||
{
|
||||
++m_y;
|
||||
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
||||
}
|
||||
|
||||
private:
|
||||
const pixfmt_type* m_pixf;
|
||||
int m_x, m_y;
|
||||
const int8u* m_pix_ptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------image_accessor_clone
|
||||
template<class PixFmt> class image_accessor_clone
|
||||
{
|
||||
public:
|
||||
typedef PixFmt pixfmt_type;
|
||||
typedef typename pixfmt_type::color_type color_type;
|
||||
typedef typename pixfmt_type::order_type order_type;
|
||||
typedef typename pixfmt_type::value_type value_type;
|
||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||
|
||||
image_accessor_clone() {}
|
||||
explicit image_accessor_clone(const pixfmt_type& pixf) :
|
||||
m_pixf(&pixf)
|
||||
{}
|
||||
|
||||
void attach(const pixfmt_type& pixf)
|
||||
{
|
||||
m_pixf = &pixf;
|
||||
}
|
||||
|
||||
private:
|
||||
AGG_INLINE const int8u* pixel() const
|
||||
{
|
||||
register int x = m_x;
|
||||
register int y = m_y;
|
||||
if(x < 0) x = 0;
|
||||
if(y < 0) y = 0;
|
||||
if(x >= (int)m_pixf->width()) x = m_pixf->width() - 1;
|
||||
if(y >= (int)m_pixf->height()) y = m_pixf->height() - 1;
|
||||
return m_pixf->pix_ptr(x, y);
|
||||
}
|
||||
|
||||
public:
|
||||
AGG_INLINE const int8u* span(int x, int y, unsigned len)
|
||||
{
|
||||
m_x = m_x0 = x;
|
||||
m_y = y;
|
||||
if(y >= 0 && y < (int)m_pixf->height() &&
|
||||
x >= 0 && x+len <= (int)m_pixf->width())
|
||||
{
|
||||
return m_pix_ptr = m_pixf->pix_ptr(x, y);
|
||||
}
|
||||
m_pix_ptr = 0;
|
||||
return pixel();
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_x()
|
||||
{
|
||||
if(m_pix_ptr) return m_pix_ptr += pix_width;
|
||||
++m_x;
|
||||
return pixel();
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_y()
|
||||
{
|
||||
++m_y;
|
||||
m_x = m_x0;
|
||||
if(m_pix_ptr &&
|
||||
m_y >= 0 && m_y < (int)m_pixf->height())
|
||||
{
|
||||
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
||||
}
|
||||
m_pix_ptr = 0;
|
||||
return pixel();
|
||||
}
|
||||
|
||||
private:
|
||||
const pixfmt_type* m_pixf;
|
||||
int m_x, m_x0, m_y;
|
||||
const int8u* m_pix_ptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------image_accessor_wrap
|
||||
template<class PixFmt, class WrapX, class WrapY> class image_accessor_wrap
|
||||
{
|
||||
public:
|
||||
typedef PixFmt pixfmt_type;
|
||||
typedef typename pixfmt_type::color_type color_type;
|
||||
typedef typename pixfmt_type::order_type order_type;
|
||||
typedef typename pixfmt_type::value_type value_type;
|
||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||
|
||||
image_accessor_wrap() {}
|
||||
explicit image_accessor_wrap(const pixfmt_type& pixf) :
|
||||
m_pixf(&pixf),
|
||||
m_wrap_x(pixf.width()),
|
||||
m_wrap_y(pixf.height())
|
||||
{}
|
||||
|
||||
void attach(const pixfmt_type& pixf)
|
||||
{
|
||||
m_pixf = &pixf;
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* span(int x, int y, unsigned)
|
||||
{
|
||||
m_x = x;
|
||||
m_row_ptr = m_pixf->row_ptr(m_wrap_y(y));
|
||||
return m_row_ptr + m_wrap_x(x) * pix_width;
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_x()
|
||||
{
|
||||
int x = ++m_wrap_x;
|
||||
return m_row_ptr + x * pix_width;
|
||||
}
|
||||
|
||||
AGG_INLINE const int8u* next_y()
|
||||
{
|
||||
m_row_ptr = m_pixf->row_ptr(++m_wrap_y);
|
||||
return m_row_ptr + m_wrap_x(m_x) * pix_width;
|
||||
}
|
||||
|
||||
private:
|
||||
const pixfmt_type* m_pixf;
|
||||
const int8u* m_row_ptr;
|
||||
int m_x;
|
||||
WrapX m_wrap_x;
|
||||
WrapY m_wrap_y;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------wrap_mode_repeat
|
||||
class wrap_mode_repeat
|
||||
{
|
||||
public:
|
||||
wrap_mode_repeat() {}
|
||||
wrap_mode_repeat(unsigned size) :
|
||||
m_size(size),
|
||||
m_add(size * (0x3FFFFFFF / size)),
|
||||
m_value(0)
|
||||
{}
|
||||
|
||||
AGG_INLINE unsigned operator() (int v)
|
||||
{
|
||||
return m_value = (unsigned(v) + m_add) % m_size;
|
||||
}
|
||||
|
||||
AGG_INLINE unsigned operator++ ()
|
||||
{
|
||||
++m_value;
|
||||
if(m_value >= m_size) m_value = 0;
|
||||
return m_value;
|
||||
}
|
||||
private:
|
||||
unsigned m_size;
|
||||
unsigned m_add;
|
||||
unsigned m_value;
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------wrap_mode_repeat_pow2
|
||||
class wrap_mode_repeat_pow2
|
||||
{
|
||||
public:
|
||||
wrap_mode_repeat_pow2() {}
|
||||
wrap_mode_repeat_pow2(unsigned size) : m_value(0)
|
||||
{
|
||||
m_mask = 1;
|
||||
while(m_mask < size) m_mask = (m_mask << 1) | 1;
|
||||
m_mask >>= 1;
|
||||
}
|
||||
AGG_INLINE unsigned operator() (int v)
|
||||
{
|
||||
return m_value = unsigned(v) & m_mask;
|
||||
}
|
||||
AGG_INLINE unsigned operator++ ()
|
||||
{
|
||||
++m_value;
|
||||
if(m_value > m_mask) m_value = 0;
|
||||
return m_value;
|
||||
}
|
||||
private:
|
||||
unsigned m_mask;
|
||||
unsigned m_value;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------wrap_mode_repeat_auto_pow2
|
||||
class wrap_mode_repeat_auto_pow2
|
||||
{
|
||||
public:
|
||||
wrap_mode_repeat_auto_pow2() {}
|
||||
wrap_mode_repeat_auto_pow2(unsigned size) :
|
||||
m_size(size),
|
||||
m_add(size * (0x3FFFFFFF / size)),
|
||||
m_mask((m_size & (m_size-1)) ? 0 : m_size-1),
|
||||
m_value(0)
|
||||
{}
|
||||
|
||||
AGG_INLINE unsigned operator() (int v)
|
||||
{
|
||||
if(m_mask) return m_value = unsigned(v) & m_mask;
|
||||
return m_value = (unsigned(v) + m_add) % m_size;
|
||||
}
|
||||
AGG_INLINE unsigned operator++ ()
|
||||
{
|
||||
++m_value;
|
||||
if(m_value >= m_size) m_value = 0;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned m_size;
|
||||
unsigned m_add;
|
||||
unsigned m_mask;
|
||||
unsigned m_value;
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------wrap_mode_reflect
|
||||
class wrap_mode_reflect
|
||||
{
|
||||
public:
|
||||
wrap_mode_reflect() {}
|
||||
wrap_mode_reflect(unsigned size) :
|
||||
m_size(size),
|
||||
m_size2(size * 2),
|
||||
m_add(m_size2 * (0x3FFFFFFF / m_size2)),
|
||||
m_value(0)
|
||||
{}
|
||||
|
||||
AGG_INLINE unsigned operator() (int v)
|
||||
{
|
||||
m_value = (unsigned(v) + m_add) % m_size2;
|
||||
if(m_value >= m_size) return m_size2 - m_value - 1;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
AGG_INLINE unsigned operator++ ()
|
||||
{
|
||||
++m_value;
|
||||
if(m_value >= m_size2) m_value = 0;
|
||||
if(m_value >= m_size) return m_size2 - m_value - 1;
|
||||
return m_value;
|
||||
}
|
||||
private:
|
||||
unsigned m_size;
|
||||
unsigned m_size2;
|
||||
unsigned m_add;
|
||||
unsigned m_value;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------wrap_mode_reflect_pow2
|
||||
class wrap_mode_reflect_pow2
|
||||
{
|
||||
public:
|
||||
wrap_mode_reflect_pow2() {}
|
||||
wrap_mode_reflect_pow2(unsigned size) : m_value(0)
|
||||
{
|
||||
m_mask = 1;
|
||||
m_size = 1;
|
||||
while(m_mask < size)
|
||||
{
|
||||
m_mask = (m_mask << 1) | 1;
|
||||
m_size <<= 1;
|
||||
}
|
||||
}
|
||||
AGG_INLINE unsigned operator() (int v)
|
||||
{
|
||||
m_value = unsigned(v) & m_mask;
|
||||
if(m_value >= m_size) return m_mask - m_value;
|
||||
return m_value;
|
||||
}
|
||||
AGG_INLINE unsigned operator++ ()
|
||||
{
|
||||
++m_value;
|
||||
m_value &= m_mask;
|
||||
if(m_value >= m_size) return m_mask - m_value;
|
||||
return m_value;
|
||||
}
|
||||
private:
|
||||
unsigned m_size;
|
||||
unsigned m_mask;
|
||||
unsigned m_value;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------wrap_mode_reflect_auto_pow2
|
||||
class wrap_mode_reflect_auto_pow2
|
||||
{
|
||||
public:
|
||||
wrap_mode_reflect_auto_pow2() {}
|
||||
wrap_mode_reflect_auto_pow2(unsigned size) :
|
||||
m_size(size),
|
||||
m_size2(size * 2),
|
||||
m_add(m_size2 * (0x3FFFFFFF / m_size2)),
|
||||
m_mask((m_size2 & (m_size2-1)) ? 0 : m_size2-1),
|
||||
m_value(0)
|
||||
{}
|
||||
|
||||
AGG_INLINE unsigned operator() (int v)
|
||||
{
|
||||
m_value = m_mask ? unsigned(v) & m_mask :
|
||||
(unsigned(v) + m_add) % m_size2;
|
||||
if(m_value >= m_size) return m_size2 - m_value - 1;
|
||||
return m_value;
|
||||
}
|
||||
AGG_INLINE unsigned operator++ ()
|
||||
{
|
||||
++m_value;
|
||||
if(m_value >= m_size2) m_value = 0;
|
||||
if(m_value >= m_size) return m_size2 - m_value - 1;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned m_size;
|
||||
unsigned m_size2;
|
||||
unsigned m_add;
|
||||
unsigned m_mask;
|
||||
unsigned m_value;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,453 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_IMAGE_FILTERS_INCLUDED
|
||||
#define AGG_IMAGE_FILTERS_INCLUDED
|
||||
|
||||
#include "agg_array.h"
|
||||
#include "agg_math.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
// See Implementation agg_image_filters.cpp
|
||||
|
||||
enum image_filter_scale_e
|
||||
{
|
||||
image_filter_shift = 14, //----image_filter_shift
|
||||
image_filter_scale = 1 << image_filter_shift, //----image_filter_scale
|
||||
image_filter_mask = image_filter_scale - 1 //----image_filter_mask
|
||||
};
|
||||
|
||||
enum image_subpixel_scale_e
|
||||
{
|
||||
image_subpixel_shift = 8, //----image_subpixel_shift
|
||||
image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale
|
||||
image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------image_filter_lut
|
||||
class image_filter_lut
|
||||
{
|
||||
public:
|
||||
template<class FilterF> void calculate(const FilterF& filter,
|
||||
bool normalization=true)
|
||||
{
|
||||
double r = filter.radius();
|
||||
realloc_lut(r);
|
||||
unsigned i;
|
||||
unsigned pivot = diameter() << (image_subpixel_shift - 1);
|
||||
for(i = 0; i < pivot; i++)
|
||||
{
|
||||
double x = double(i) / double(image_subpixel_scale);
|
||||
double y = filter.calc_weight(x);
|
||||
m_weight_array[pivot + i] =
|
||||
m_weight_array[pivot - i] = (int16)iround(y * image_filter_scale);
|
||||
}
|
||||
unsigned end = (diameter() << image_subpixel_shift) - 1;
|
||||
m_weight_array[0] = m_weight_array[end];
|
||||
if(normalization)
|
||||
{
|
||||
normalize();
|
||||
}
|
||||
}
|
||||
|
||||
image_filter_lut() : m_radius(0), m_diameter(0), m_start(0) {}
|
||||
|
||||
template<class FilterF> image_filter_lut(const FilterF& filter,
|
||||
bool normalization=true)
|
||||
{
|
||||
calculate(filter, normalization);
|
||||
}
|
||||
|
||||
double radius() const { return m_radius; }
|
||||
unsigned diameter() const { return m_diameter; }
|
||||
int start() const { return m_start; }
|
||||
const int16* weight_array() const { return &m_weight_array[0]; }
|
||||
void normalize();
|
||||
|
||||
private:
|
||||
void realloc_lut(double radius);
|
||||
image_filter_lut(const image_filter_lut&);
|
||||
const image_filter_lut& operator = (const image_filter_lut&);
|
||||
|
||||
double m_radius;
|
||||
unsigned m_diameter;
|
||||
int m_start;
|
||||
pod_array<int16> m_weight_array;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------image_filter
|
||||
template<class FilterF> class image_filter : public image_filter_lut
|
||||
{
|
||||
public:
|
||||
image_filter()
|
||||
{
|
||||
calculate(m_filter_function);
|
||||
}
|
||||
private:
|
||||
FilterF m_filter_function;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------image_filter_bilinear
|
||||
struct image_filter_bilinear
|
||||
{
|
||||
static double radius() { return 1.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return 1.0 - x;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------image_filter_hanning
|
||||
struct image_filter_hanning
|
||||
{
|
||||
static double radius() { return 1.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return 0.5 + 0.5 * cos(pi * x);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------image_filter_hamming
|
||||
struct image_filter_hamming
|
||||
{
|
||||
static double radius() { return 1.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return 0.54 + 0.46 * cos(pi * x);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------image_filter_hermite
|
||||
struct image_filter_hermite
|
||||
{
|
||||
static double radius() { return 1.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return (2.0 * x - 3.0) * x * x + 1.0;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------image_filter_quadric
|
||||
struct image_filter_quadric
|
||||
{
|
||||
static double radius() { return 1.5; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
double t;
|
||||
if(x < 0.5) return 0.75 - x * x;
|
||||
if(x < 1.5) {t = x - 1.5; return 0.5 * t * t;}
|
||||
return 0.0;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------image_filter_bicubic
|
||||
class image_filter_bicubic
|
||||
{
|
||||
static double pow3(double x)
|
||||
{
|
||||
return (x <= 0.0) ? 0.0 : x * x * x;
|
||||
}
|
||||
|
||||
public:
|
||||
static double radius() { return 2.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return
|
||||
(1.0/6.0) *
|
||||
(pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1));
|
||||
}
|
||||
};
|
||||
|
||||
//-------------------------------------------------image_filter_kaiser
|
||||
class image_filter_kaiser
|
||||
{
|
||||
double a;
|
||||
double i0a;
|
||||
double epsilon;
|
||||
|
||||
public:
|
||||
image_filter_kaiser(double b = 6.33) :
|
||||
a(b), epsilon(1e-12)
|
||||
{
|
||||
i0a = 1.0 / bessel_i0(b);
|
||||
}
|
||||
|
||||
static double radius() { return 1.0; }
|
||||
double calc_weight(double x) const
|
||||
{
|
||||
return bessel_i0(a * sqrt(1. - x * x)) * i0a;
|
||||
}
|
||||
|
||||
private:
|
||||
double bessel_i0(double x) const
|
||||
{
|
||||
int i;
|
||||
double sum, y, t;
|
||||
|
||||
sum = 1.;
|
||||
y = x * x / 4.;
|
||||
t = y;
|
||||
|
||||
for(i = 2; t > epsilon; i++)
|
||||
{
|
||||
sum += t;
|
||||
t *= (double)y / (i * i);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------image_filter_catrom
|
||||
struct image_filter_catrom
|
||||
{
|
||||
static double radius() { return 2.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
if(x < 1.0) return 0.5 * (2.0 + x * x * (-5.0 + x * 3.0));
|
||||
if(x < 2.0) return 0.5 * (4.0 + x * (-8.0 + x * (5.0 - x)));
|
||||
return 0.;
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------image_filter_mitchell
|
||||
class image_filter_mitchell
|
||||
{
|
||||
double p0, p2, p3;
|
||||
double q0, q1, q2, q3;
|
||||
|
||||
public:
|
||||
image_filter_mitchell(double b = 1.0/3.0, double c = 1.0/3.0) :
|
||||
p0((6.0 - 2.0 * b) / 6.0),
|
||||
p2((-18.0 + 12.0 * b + 6.0 * c) / 6.0),
|
||||
p3((12.0 - 9.0 * b - 6.0 * c) / 6.0),
|
||||
q0((8.0 * b + 24.0 * c) / 6.0),
|
||||
q1((-12.0 * b - 48.0 * c) / 6.0),
|
||||
q2((6.0 * b + 30.0 * c) / 6.0),
|
||||
q3((-b - 6.0 * c) / 6.0)
|
||||
{}
|
||||
|
||||
static double radius() { return 2.0; }
|
||||
double calc_weight(double x) const
|
||||
{
|
||||
if(x < 1.0) return p0 + x * x * (p2 + x * p3);
|
||||
if(x < 2.0) return q0 + x * (q1 + x * (q2 + x * q3));
|
||||
return 0.0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------image_filter_spline16
|
||||
struct image_filter_spline16
|
||||
{
|
||||
static double radius() { return 2.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
if(x < 1.0)
|
||||
{
|
||||
return ((x - 9.0/5.0 ) * x - 1.0/5.0 ) * x + 1.0;
|
||||
}
|
||||
return ((-1.0/3.0 * (x-1) + 4.0/5.0) * (x-1) - 7.0/15.0 ) * (x-1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------image_filter_spline36
|
||||
struct image_filter_spline36
|
||||
{
|
||||
static double radius() { return 3.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
if(x < 1.0)
|
||||
{
|
||||
return ((13.0/11.0 * x - 453.0/209.0) * x - 3.0/209.0) * x + 1.0;
|
||||
}
|
||||
if(x < 2.0)
|
||||
{
|
||||
return ((-6.0/11.0 * (x-1) + 270.0/209.0) * (x-1) - 156.0/ 209.0) * (x-1);
|
||||
}
|
||||
return ((1.0/11.0 * (x-2) - 45.0/209.0) * (x-2) + 26.0/209.0) * (x-2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------image_filter_gaussian
|
||||
struct image_filter_gaussian
|
||||
{
|
||||
static double radius() { return 2.0; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return exp(-2.0 * x * x) * sqrt(2.0 / pi);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------image_filter_bessel
|
||||
struct image_filter_bessel
|
||||
{
|
||||
static double radius() { return 3.2383; }
|
||||
static double calc_weight(double x)
|
||||
{
|
||||
return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------image_filter_sinc
|
||||
class image_filter_sinc
|
||||
{
|
||||
public:
|
||||
image_filter_sinc(double r) : m_radius(r < 2.0 ? 2.0 : r) {}
|
||||
double radius() const { return m_radius; }
|
||||
double calc_weight(double x) const
|
||||
{
|
||||
if(x == 0.0) return 1.0;
|
||||
x *= pi;
|
||||
return sin(x) / x;
|
||||
}
|
||||
private:
|
||||
double m_radius;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------image_filter_lanczos
|
||||
class image_filter_lanczos
|
||||
{
|
||||
public:
|
||||
image_filter_lanczos(double r) : m_radius(r < 2.0 ? 2.0 : r) {}
|
||||
double radius() const { return m_radius; }
|
||||
double calc_weight(double x) const
|
||||
{
|
||||
if(x == 0.0) return 1.0;
|
||||
if(x > m_radius) return 0.0;
|
||||
x *= pi;
|
||||
double xr = x / m_radius;
|
||||
return (sin(x) / x) * (sin(xr) / xr);
|
||||
}
|
||||
private:
|
||||
double m_radius;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------image_filter_blackman
|
||||
class image_filter_blackman
|
||||
{
|
||||
public:
|
||||
image_filter_blackman(double r) : m_radius(r < 2.0 ? 2.0 : r) {}
|
||||
double radius() const { return m_radius; }
|
||||
double calc_weight(double x) const
|
||||
{
|
||||
if(x == 0.0) return 1.0;
|
||||
if(x > m_radius) return 0.0;
|
||||
x *= pi;
|
||||
double xr = x / m_radius;
|
||||
return (sin(x) / x) * (0.42 + 0.5*cos(xr) + 0.08*cos(2*xr));
|
||||
}
|
||||
private:
|
||||
double m_radius;
|
||||
};
|
||||
|
||||
//------------------------------------------------image_filter_sinc36
|
||||
class image_filter_sinc36 : public image_filter_sinc
|
||||
{ public: image_filter_sinc36() : image_filter_sinc(3.0){} };
|
||||
|
||||
//------------------------------------------------image_filter_sinc64
|
||||
class image_filter_sinc64 : public image_filter_sinc
|
||||
{ public: image_filter_sinc64() : image_filter_sinc(4.0){} };
|
||||
|
||||
//-----------------------------------------------image_filter_sinc100
|
||||
class image_filter_sinc100 : public image_filter_sinc
|
||||
{ public: image_filter_sinc100() : image_filter_sinc(5.0){} };
|
||||
|
||||
//-----------------------------------------------image_filter_sinc144
|
||||
class image_filter_sinc144 : public image_filter_sinc
|
||||
{ public: image_filter_sinc144() : image_filter_sinc(6.0){} };
|
||||
|
||||
//-----------------------------------------------image_filter_sinc196
|
||||
class image_filter_sinc196 : public image_filter_sinc
|
||||
{ public: image_filter_sinc196() : image_filter_sinc(7.0){} };
|
||||
|
||||
//-----------------------------------------------image_filter_sinc256
|
||||
class image_filter_sinc256 : public image_filter_sinc
|
||||
{ public: image_filter_sinc256() : image_filter_sinc(8.0){} };
|
||||
|
||||
//---------------------------------------------image_filter_lanczos36
|
||||
class image_filter_lanczos36 : public image_filter_lanczos
|
||||
{ public: image_filter_lanczos36() : image_filter_lanczos(3.0){} };
|
||||
|
||||
//---------------------------------------------image_filter_lanczos64
|
||||
class image_filter_lanczos64 : public image_filter_lanczos
|
||||
{ public: image_filter_lanczos64() : image_filter_lanczos(4.0){} };
|
||||
|
||||
//--------------------------------------------image_filter_lanczos100
|
||||
class image_filter_lanczos100 : public image_filter_lanczos
|
||||
{ public: image_filter_lanczos100() : image_filter_lanczos(5.0){} };
|
||||
|
||||
//--------------------------------------------image_filter_lanczos144
|
||||
class image_filter_lanczos144 : public image_filter_lanczos
|
||||
{ public: image_filter_lanczos144() : image_filter_lanczos(6.0){} };
|
||||
|
||||
//--------------------------------------------image_filter_lanczos196
|
||||
class image_filter_lanczos196 : public image_filter_lanczos
|
||||
{ public: image_filter_lanczos196() : image_filter_lanczos(7.0){} };
|
||||
|
||||
//--------------------------------------------image_filter_lanczos256
|
||||
class image_filter_lanczos256 : public image_filter_lanczos
|
||||
{ public: image_filter_lanczos256() : image_filter_lanczos(8.0){} };
|
||||
|
||||
//--------------------------------------------image_filter_blackman36
|
||||
class image_filter_blackman36 : public image_filter_blackman
|
||||
{ public: image_filter_blackman36() : image_filter_blackman(3.0){} };
|
||||
|
||||
//--------------------------------------------image_filter_blackman64
|
||||
class image_filter_blackman64 : public image_filter_blackman
|
||||
{ public: image_filter_blackman64() : image_filter_blackman(4.0){} };
|
||||
|
||||
//-------------------------------------------image_filter_blackman100
|
||||
class image_filter_blackman100 : public image_filter_blackman
|
||||
{ public: image_filter_blackman100() : image_filter_blackman(5.0){} };
|
||||
|
||||
//-------------------------------------------image_filter_blackman144
|
||||
class image_filter_blackman144 : public image_filter_blackman
|
||||
{ public: image_filter_blackman144() : image_filter_blackman(6.0){} };
|
||||
|
||||
//-------------------------------------------image_filter_blackman196
|
||||
class image_filter_blackman196 : public image_filter_blackman
|
||||
{ public: image_filter_blackman196() : image_filter_blackman(7.0){} };
|
||||
|
||||
//-------------------------------------------image_filter_blackman256
|
||||
class image_filter_blackman256 : public image_filter_blackman
|
||||
{ public: image_filter_blackman256() : image_filter_blackman(8.0){} };
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,199 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_LINE_AA_BASICS_INCLUDED
|
||||
#define AGG_LINE_AA_BASICS_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
// See Implementation agg_line_aa_basics.cpp
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
enum line_subpixel_scale_e
|
||||
{
|
||||
line_subpixel_shift = 8, //----line_subpixel_shift
|
||||
line_subpixel_scale = 1 << line_subpixel_shift, //----line_subpixel_scale
|
||||
line_subpixel_mask = line_subpixel_scale - 1, //----line_subpixel_mask
|
||||
line_max_coord = (1 << 28) - 1, //----line_max_coord
|
||||
line_max_length = 1 << (line_subpixel_shift + 10) //----line_max_length
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
enum line_mr_subpixel_scale_e
|
||||
{
|
||||
line_mr_subpixel_shift = 4, //----line_mr_subpixel_shift
|
||||
line_mr_subpixel_scale = 1 << line_mr_subpixel_shift, //----line_mr_subpixel_scale
|
||||
line_mr_subpixel_mask = line_mr_subpixel_scale - 1 //----line_mr_subpixel_mask
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------line_mr
|
||||
AGG_INLINE int line_mr(int x)
|
||||
{
|
||||
return x >> (line_subpixel_shift - line_mr_subpixel_shift);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------line_hr
|
||||
AGG_INLINE int line_hr(int x)
|
||||
{
|
||||
return x << (line_subpixel_shift - line_mr_subpixel_shift);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------line_dbl_hr
|
||||
AGG_INLINE int line_dbl_hr(int x)
|
||||
{
|
||||
return x << line_subpixel_shift;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------line_coord
|
||||
struct line_coord
|
||||
{
|
||||
AGG_INLINE static int conv(double x)
|
||||
{
|
||||
return iround(x * line_subpixel_scale);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------line_coord_sat
|
||||
struct line_coord_sat
|
||||
{
|
||||
AGG_INLINE static int conv(double x)
|
||||
{
|
||||
return saturation<line_max_coord>::iround(x * line_subpixel_scale);
|
||||
}
|
||||
};
|
||||
|
||||
//==========================================================line_parameters
|
||||
struct line_parameters
|
||||
{
|
||||
//---------------------------------------------------------------------
|
||||
line_parameters() {}
|
||||
line_parameters(int x1_, int y1_, int x2_, int y2_, int len_) :
|
||||
x1(x1_), y1(y1_), x2(x2_), y2(y2_),
|
||||
dx(abs(x2_ - x1_)),
|
||||
dy(abs(y2_ - y1_)),
|
||||
sx((x2_ > x1_) ? 1 : -1),
|
||||
sy((y2_ > y1_) ? 1 : -1),
|
||||
vertical(dy >= dx),
|
||||
inc(vertical ? sy : sx),
|
||||
len(len_),
|
||||
octant((sy & 4) | (sx & 2) | int(vertical))
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
unsigned orthogonal_quadrant() const { return s_orthogonal_quadrant[octant]; }
|
||||
unsigned diagonal_quadrant() const { return s_diagonal_quadrant[octant]; }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
bool same_orthogonal_quadrant(const line_parameters& lp) const
|
||||
{
|
||||
return s_orthogonal_quadrant[octant] == s_orthogonal_quadrant[lp.octant];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
bool same_diagonal_quadrant(const line_parameters& lp) const
|
||||
{
|
||||
return s_diagonal_quadrant[octant] == s_diagonal_quadrant[lp.octant];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
void divide(line_parameters& lp1, line_parameters& lp2) const
|
||||
{
|
||||
int xmid = (x1 + x2) >> 1;
|
||||
int ymid = (y1 + y2) >> 1;
|
||||
int len2 = len >> 1;
|
||||
|
||||
lp1 = *this;
|
||||
lp2 = *this;
|
||||
|
||||
lp1.x2 = xmid;
|
||||
lp1.y2 = ymid;
|
||||
lp1.len = len2;
|
||||
lp1.dx = abs(lp1.x2 - lp1.x1);
|
||||
lp1.dy = abs(lp1.y2 - lp1.y1);
|
||||
|
||||
lp2.x1 = xmid;
|
||||
lp2.y1 = ymid;
|
||||
lp2.len = len2;
|
||||
lp2.dx = abs(lp2.x2 - lp2.x1);
|
||||
lp2.dy = abs(lp2.y2 - lp2.y1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
int x1, y1, x2, y2, dx, dy, sx, sy;
|
||||
bool vertical;
|
||||
int inc;
|
||||
int len;
|
||||
int octant;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
static const int8u s_orthogonal_quadrant[8];
|
||||
static const int8u s_diagonal_quadrant[8];
|
||||
};
|
||||
|
||||
|
||||
|
||||
// See Implementation agg_line_aa_basics.cpp
|
||||
|
||||
//----------------------------------------------------------------bisectrix
|
||||
void bisectrix(const line_parameters& l1,
|
||||
const line_parameters& l2,
|
||||
int* x, int* y);
|
||||
|
||||
|
||||
//-------------------------------------------fix_degenerate_bisectrix_start
|
||||
void inline fix_degenerate_bisectrix_start(const line_parameters& lp,
|
||||
int* x, int* y)
|
||||
{
|
||||
int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) -
|
||||
double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len);
|
||||
if(d < line_subpixel_scale/2)
|
||||
{
|
||||
*x = lp.x1 + (lp.y2 - lp.y1);
|
||||
*y = lp.y1 - (lp.x2 - lp.x1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------fix_degenerate_bisectrix_end
|
||||
void inline fix_degenerate_bisectrix_end(const line_parameters& lp,
|
||||
int* x, int* y)
|
||||
{
|
||||
int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) -
|
||||
double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len);
|
||||
if(d < line_subpixel_scale/2)
|
||||
{
|
||||
*x = lp.x2 + (lp.y2 - lp.y1);
|
||||
*y = lp.y2 - (lp.x2 - lp.x1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,446 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
// Bessel function (besj) was adapted for use in AGG library by Andy Wilk
|
||||
// Contact: castor.vulgaris@gmail.com
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_MATH_INCLUDED
|
||||
#define AGG_MATH_INCLUDED
|
||||
|
||||
#include <math.h>
|
||||
#include "agg_basics.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
||||
//------------------------------------------------------vertex_dist_epsilon
|
||||
// Coinciding points maximal distance (Epsilon)
|
||||
const double vertex_dist_epsilon = 1e-14;
|
||||
|
||||
//-----------------------------------------------------intersection_epsilon
|
||||
// See calc_intersection
|
||||
const double intersection_epsilon = 1.0e-30;
|
||||
|
||||
//------------------------------------------------------------cross_product
|
||||
AGG_INLINE double cross_product(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x, double y)
|
||||
{
|
||||
return (x - x2) * (y2 - y1) - (y - y2) * (x2 - x1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------point_in_triangle
|
||||
AGG_INLINE bool point_in_triangle(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double x, double y)
|
||||
{
|
||||
bool cp1 = cross_product(x1, y1, x2, y2, x, y) < 0.0;
|
||||
bool cp2 = cross_product(x2, y2, x3, y3, x, y) < 0.0;
|
||||
bool cp3 = cross_product(x3, y3, x1, y1, x, y) < 0.0;
|
||||
return cp1 == cp2 && cp2 == cp3 && cp3 == cp1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------calc_distance
|
||||
AGG_INLINE double calc_distance(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
double dx = x2-x1;
|
||||
double dy = y2-y1;
|
||||
return sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------calc_sq_distance
|
||||
AGG_INLINE double calc_sq_distance(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
double dx = x2-x1;
|
||||
double dy = y2-y1;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
//------------------------------------------------calc_line_point_distance
|
||||
AGG_INLINE double calc_line_point_distance(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x, double y)
|
||||
{
|
||||
double dx = x2-x1;
|
||||
double dy = y2-y1;
|
||||
double d = sqrt(dx * dx + dy * dy);
|
||||
if(d < vertex_dist_epsilon)
|
||||
{
|
||||
return calc_distance(x1, y1, x, y);
|
||||
}
|
||||
return ((x - x2) * dy - (y - y2) * dx) / d;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------calc_line_point_u
|
||||
AGG_INLINE double calc_segment_point_u(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x, double y)
|
||||
{
|
||||
double dx = x2 - x1;
|
||||
double dy = y2 - y1;
|
||||
|
||||
if(dx == 0 && dy == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pdx = x - x1;
|
||||
double pdy = y - y1;
|
||||
|
||||
return (pdx * dx + pdy * dy) / (dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
//---------------------------------------------calc_line_point_sq_distance
|
||||
AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x, double y,
|
||||
double u)
|
||||
{
|
||||
if(u <= 0)
|
||||
{
|
||||
return calc_sq_distance(x, y, x1, y1);
|
||||
}
|
||||
else
|
||||
if(u >= 1)
|
||||
{
|
||||
return calc_sq_distance(x, y, x2, y2);
|
||||
}
|
||||
return calc_sq_distance(x, y, x1 + u * (x2 - x1), y1 + u * (y2 - y1));
|
||||
}
|
||||
|
||||
//---------------------------------------------calc_line_point_sq_distance
|
||||
AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x, double y)
|
||||
{
|
||||
return
|
||||
calc_segment_point_sq_distance(
|
||||
x1, y1, x2, y2, x, y,
|
||||
calc_segment_point_u(x1, y1, x2, y2, x, y));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------calc_intersection
|
||||
AGG_INLINE bool calc_intersection(double ax, double ay, double bx, double by,
|
||||
double cx, double cy, double dx, double dy,
|
||||
double* x, double* y)
|
||||
{
|
||||
double num = (ay-cy) * (dx-cx) - (ax-cx) * (dy-cy);
|
||||
double den = (bx-ax) * (dy-cy) - (by-ay) * (dx-cx);
|
||||
if(fabs(den) < intersection_epsilon) return false;
|
||||
double r = num / den;
|
||||
*x = ax + r * (bx-ax);
|
||||
*y = ay + r * (by-ay);
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------intersection_exists
|
||||
AGG_INLINE bool intersection_exists(double x1, double y1, double x2, double y2,
|
||||
double x3, double y3, double x4, double y4)
|
||||
{
|
||||
// It's less expensive but you can't control the
|
||||
// boundary conditions: Less or LessEqual
|
||||
double dx1 = x2 - x1;
|
||||
double dy1 = y2 - y1;
|
||||
double dx2 = x4 - x3;
|
||||
double dy2 = y4 - y3;
|
||||
return ((x3 - x2) * dy1 - (y3 - y2) * dx1 < 0.0) !=
|
||||
((x4 - x2) * dy1 - (y4 - y2) * dx1 < 0.0) &&
|
||||
((x1 - x4) * dy2 - (y1 - y4) * dx2 < 0.0) !=
|
||||
((x2 - x4) * dy2 - (y2 - y4) * dx2 < 0.0);
|
||||
|
||||
// It's is more expensive but more flexible
|
||||
// in terms of boundary conditions.
|
||||
//--------------------
|
||||
//double den = (x2-x1) * (y4-y3) - (y2-y1) * (x4-x3);
|
||||
//if(fabs(den) < intersection_epsilon) return false;
|
||||
//double nom1 = (x4-x3) * (y1-y3) - (y4-y3) * (x1-x3);
|
||||
//double nom2 = (x2-x1) * (y1-y3) - (y2-y1) * (x1-x3);
|
||||
//double ua = nom1 / den;
|
||||
//double ub = nom2 / den;
|
||||
//return ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------calc_orthogonal
|
||||
AGG_INLINE void calc_orthogonal(double thickness,
|
||||
double x1, double y1,
|
||||
double x2, double y2,
|
||||
double* x, double* y)
|
||||
{
|
||||
double dx = x2 - x1;
|
||||
double dy = y2 - y1;
|
||||
double d = sqrt(dx*dx + dy*dy);
|
||||
*x = thickness * dy / d;
|
||||
*y = -thickness * dx / d;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------dilate_triangle
|
||||
AGG_INLINE void dilate_triangle(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
double *x, double* y,
|
||||
double d)
|
||||
{
|
||||
double dx1=0.0;
|
||||
double dy1=0.0;
|
||||
double dx2=0.0;
|
||||
double dy2=0.0;
|
||||
double dx3=0.0;
|
||||
double dy3=0.0;
|
||||
double loc = cross_product(x1, y1, x2, y2, x3, y3);
|
||||
if(fabs(loc) > intersection_epsilon)
|
||||
{
|
||||
if(cross_product(x1, y1, x2, y2, x3, y3) > 0.0)
|
||||
{
|
||||
d = -d;
|
||||
}
|
||||
calc_orthogonal(d, x1, y1, x2, y2, &dx1, &dy1);
|
||||
calc_orthogonal(d, x2, y2, x3, y3, &dx2, &dy2);
|
||||
calc_orthogonal(d, x3, y3, x1, y1, &dx3, &dy3);
|
||||
}
|
||||
*x++ = x1 + dx1; *y++ = y1 + dy1;
|
||||
*x++ = x2 + dx1; *y++ = y2 + dy1;
|
||||
*x++ = x2 + dx2; *y++ = y2 + dy2;
|
||||
*x++ = x3 + dx2; *y++ = y3 + dy2;
|
||||
*x++ = x3 + dx3; *y++ = y3 + dy3;
|
||||
*x++ = x1 + dx3; *y++ = y1 + dy3;
|
||||
}
|
||||
|
||||
//------------------------------------------------------calc_triangle_area
|
||||
AGG_INLINE double calc_triangle_area(double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3)
|
||||
{
|
||||
return (x1*y2 - x2*y1 + x2*y3 - x3*y2 + x3*y1 - x1*y3) * 0.5;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------calc_polygon_area
|
||||
template<class Storage> double calc_polygon_area(const Storage& st)
|
||||
{
|
||||
unsigned i;
|
||||
double sum = 0.0;
|
||||
double x = st[0].x;
|
||||
double y = st[0].y;
|
||||
double xs = x;
|
||||
double ys = y;
|
||||
|
||||
for(i = 1; i < st.size(); i++)
|
||||
{
|
||||
const typename Storage::value_type& v = st[i];
|
||||
sum += x * v.y - y * v.x;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
}
|
||||
return (sum + x * ys - y * xs) * 0.5;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Tables for fast sqrt
|
||||
extern int16u g_sqrt_table[1024];
|
||||
extern int8 g_elder_bit_table[256];
|
||||
|
||||
|
||||
//---------------------------------------------------------------fast_sqrt
|
||||
//Fast integer Sqrt - really fast: no cycles, divisions or multiplications
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4035) //Disable warning "no return value"
|
||||
#endif
|
||||
AGG_INLINE unsigned fast_sqrt(unsigned val)
|
||||
{
|
||||
#if defined(_M_IX86) && defined(_MSC_VER) && !defined(AGG_NO_ASM)
|
||||
//For Ix86 family processors this assembler code is used.
|
||||
//The key command here is bsr - determination the number of the most
|
||||
//significant bit of the value. For other processors
|
||||
//(and maybe compilers) the pure C "#else" section is used.
|
||||
__asm
|
||||
{
|
||||
mov ebx, val
|
||||
mov edx, 11
|
||||
bsr ecx, ebx
|
||||
sub ecx, 9
|
||||
jle less_than_9_bits
|
||||
shr ecx, 1
|
||||
adc ecx, 0
|
||||
sub edx, ecx
|
||||
shl ecx, 1
|
||||
shr ebx, cl
|
||||
less_than_9_bits:
|
||||
xor eax, eax
|
||||
mov ax, g_sqrt_table[ebx*2]
|
||||
mov ecx, edx
|
||||
shr eax, cl
|
||||
}
|
||||
#else
|
||||
|
||||
//This code is actually pure C and portable to most
|
||||
//arcitectures including 64bit ones.
|
||||
unsigned t = val;
|
||||
int bit=0;
|
||||
unsigned shift = 11;
|
||||
|
||||
//The following piece of code is just an emulation of the
|
||||
//Ix86 assembler command "bsr" (see above). However on old
|
||||
//Intels (like Intel MMX 233MHz) this code is about twice
|
||||
//faster (sic!) then just one "bsr". On PIII and PIV the
|
||||
//bsr is optimized quite well.
|
||||
bit = t >> 24;
|
||||
if(bit)
|
||||
{
|
||||
bit = g_elder_bit_table[bit] + 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
bit = (t >> 16) & 0xFF;
|
||||
if(bit)
|
||||
{
|
||||
bit = g_elder_bit_table[bit] + 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
bit = (t >> 8) & 0xFF;
|
||||
if(bit)
|
||||
{
|
||||
bit = g_elder_bit_table[bit] + 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
bit = g_elder_bit_table[t];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//This code calculates the sqrt.
|
||||
bit -= 9;
|
||||
if(bit > 0)
|
||||
{
|
||||
bit = (bit >> 1) + (bit & 1);
|
||||
shift -= bit;
|
||||
val >>= (bit << 1);
|
||||
}
|
||||
return g_sqrt_table[val] >> shift;
|
||||
#endif
|
||||
}
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------besj
|
||||
// Function BESJ calculates Bessel function of first kind of order n
|
||||
// Arguments:
|
||||
// n - an integer (>=0), the order
|
||||
// x - value at which the Bessel function is required
|
||||
//--------------------
|
||||
// C++ Mathematical Library
|
||||
// Convereted from equivalent FORTRAN library
|
||||
// Converetd by Gareth Walker for use by course 392 computational project
|
||||
// All functions tested and yield the same results as the corresponding
|
||||
// FORTRAN versions.
|
||||
//
|
||||
// If you have any problems using these functions please report them to
|
||||
// M.Muldoon@UMIST.ac.uk
|
||||
//
|
||||
// Documentation available on the web
|
||||
// http://www.ma.umist.ac.uk/mrm/Teaching/392/libs/392.html
|
||||
// Version 1.0 8/98
|
||||
// 29 October, 1999
|
||||
//--------------------
|
||||
// Adapted for use in AGG library by Andy Wilk (castor.vulgaris@gmail.com)
|
||||
//------------------------------------------------------------------------
|
||||
inline double besj(double x, int n)
|
||||
{
|
||||
if(n < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
double d = 1E-6;
|
||||
double b = 0;
|
||||
if(fabs(x) <= d)
|
||||
{
|
||||
if(n != 0) return 0;
|
||||
return 1;
|
||||
}
|
||||
double b1 = 0; // b1 is the value from the previous iteration
|
||||
// Set up a starting order for recurrence
|
||||
int m1 = (int)fabs(x) + 6;
|
||||
if(fabs(x) > 5)
|
||||
{
|
||||
m1 = (int)(fabs(1.4 * x + 60 / x));
|
||||
}
|
||||
int m2 = (int)(n + 2 + fabs(x) / 4);
|
||||
if (m1 > m2)
|
||||
{
|
||||
m2 = m1;
|
||||
}
|
||||
|
||||
// Apply recurrence down from curent max order
|
||||
for(;;)
|
||||
{
|
||||
double c3 = 0;
|
||||
double c2 = 1E-30;
|
||||
double c4 = 0;
|
||||
int m8 = 1;
|
||||
if (m2 / 2 * 2 == m2)
|
||||
{
|
||||
m8 = -1;
|
||||
}
|
||||
int imax = m2 - 2;
|
||||
for (int i = 1; i <= imax; i++)
|
||||
{
|
||||
double c6 = 2 * (m2 - i) * c2 / x - c3;
|
||||
c3 = c2;
|
||||
c2 = c6;
|
||||
if(m2 - i - 1 == n)
|
||||
{
|
||||
b = c6;
|
||||
}
|
||||
m8 = -1 * m8;
|
||||
if (m8 > 0)
|
||||
{
|
||||
c4 = c4 + 2 * c6;
|
||||
}
|
||||
}
|
||||
double c6 = 2 * c2 / x - c3;
|
||||
if(n == 0)
|
||||
{
|
||||
b = c6;
|
||||
}
|
||||
c4 += c6;
|
||||
b /= c4;
|
||||
if(fabs(b - b1) < d)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
b1 = b;
|
||||
m2 += 3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,531 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_STROKE_MATH_INCLUDED
|
||||
#define AGG_STROKE_MATH_INCLUDED
|
||||
|
||||
#include "agg_math.h"
|
||||
#include "agg_vertex_sequence.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
//-------------------------------------------------------------line_cap_e
|
||||
enum line_cap_e
|
||||
{
|
||||
butt_cap,
|
||||
square_cap,
|
||||
round_cap
|
||||
};
|
||||
|
||||
//------------------------------------------------------------line_join_e
|
||||
enum line_join_e
|
||||
{
|
||||
miter_join = 0,
|
||||
miter_join_revert = 1,
|
||||
round_join = 2,
|
||||
bevel_join = 3,
|
||||
miter_join_round = 4
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------inner_join_e
|
||||
enum inner_join_e
|
||||
{
|
||||
inner_bevel,
|
||||
inner_miter,
|
||||
inner_jag,
|
||||
inner_round
|
||||
};
|
||||
|
||||
//------------------------------------------------------------math_stroke
|
||||
template<class VertexConsumer> class math_stroke
|
||||
{
|
||||
public:
|
||||
typedef typename VertexConsumer::value_type coord_type;
|
||||
|
||||
math_stroke();
|
||||
|
||||
void line_cap(line_cap_e lc) { m_line_cap = lc; }
|
||||
void line_join(line_join_e lj) { m_line_join = lj; }
|
||||
void inner_join(inner_join_e ij) { m_inner_join = ij; }
|
||||
|
||||
line_cap_e line_cap() const { return m_line_cap; }
|
||||
line_join_e line_join() const { return m_line_join; }
|
||||
inner_join_e inner_join() const { return m_inner_join; }
|
||||
|
||||
void width(double w);
|
||||
void miter_limit(double ml) { m_miter_limit = ml; }
|
||||
void miter_limit_theta(double t);
|
||||
void inner_miter_limit(double ml) { m_inner_miter_limit = ml; }
|
||||
void approximation_scale(double as) { m_approx_scale = as; }
|
||||
|
||||
double width() const { return m_width * 2.0; }
|
||||
double miter_limit() const { return m_miter_limit; }
|
||||
double inner_miter_limit() const { return m_inner_miter_limit; }
|
||||
double approximation_scale() const { return m_approx_scale; }
|
||||
|
||||
void calc_cap(VertexConsumer& vc,
|
||||
const vertex_dist& v0,
|
||||
const vertex_dist& v1,
|
||||
double len);
|
||||
|
||||
void calc_join(VertexConsumer& vc,
|
||||
const vertex_dist& v0,
|
||||
const vertex_dist& v1,
|
||||
const vertex_dist& v2,
|
||||
double len1,
|
||||
double len2);
|
||||
|
||||
private:
|
||||
AGG_INLINE void add_vertex(VertexConsumer& vc, double x, double y)
|
||||
{
|
||||
vc.add(coord_type(x, y));
|
||||
}
|
||||
|
||||
void calc_arc(VertexConsumer& vc,
|
||||
double x, double y,
|
||||
double dx1, double dy1,
|
||||
double dx2, double dy2);
|
||||
|
||||
void calc_miter(VertexConsumer& vc,
|
||||
const vertex_dist& v0,
|
||||
const vertex_dist& v1,
|
||||
const vertex_dist& v2,
|
||||
double dx1, double dy1,
|
||||
double dx2, double dy2,
|
||||
line_join_e lj,
|
||||
double mlimit,
|
||||
double dbevel);
|
||||
|
||||
double m_width;
|
||||
double m_width_abs;
|
||||
double m_width_eps;
|
||||
int m_width_sign;
|
||||
double m_miter_limit;
|
||||
double m_inner_miter_limit;
|
||||
double m_approx_scale;
|
||||
line_cap_e m_line_cap;
|
||||
line_join_e m_line_join;
|
||||
inner_join_e m_inner_join;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VC> math_stroke<VC>::math_stroke() :
|
||||
m_width(0.5),
|
||||
m_width_abs(0.5),
|
||||
m_width_eps(0.5/1024.0),
|
||||
m_width_sign(1),
|
||||
m_miter_limit(4.0),
|
||||
m_inner_miter_limit(1.01),
|
||||
m_approx_scale(1.0),
|
||||
m_line_cap(butt_cap),
|
||||
m_line_join(miter_join),
|
||||
m_inner_join(inner_miter)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VC> void math_stroke<VC>::width(double w)
|
||||
{
|
||||
m_width = w * 0.5;
|
||||
if(m_width < 0)
|
||||
{
|
||||
m_width_abs = -m_width;
|
||||
m_width_sign = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_width_abs = m_width;
|
||||
m_width_sign = 1;
|
||||
}
|
||||
m_width_eps = m_width / 1024.0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VC> void math_stroke<VC>::miter_limit_theta(double t)
|
||||
{
|
||||
m_miter_limit = 1.0 / sin(t * 0.5) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VC>
|
||||
void math_stroke<VC>::calc_arc(VC& vc,
|
||||
double x, double y,
|
||||
double dx1, double dy1,
|
||||
double dx2, double dy2)
|
||||
{
|
||||
double a1 = atan2(dy1 * m_width_sign, dx1 * m_width_sign);
|
||||
double a2 = atan2(dy2 * m_width_sign, dx2 * m_width_sign);
|
||||
double da = a1 - a2;
|
||||
int i, n;
|
||||
|
||||
da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
|
||||
|
||||
add_vertex(vc, x + dx1, y + dy1);
|
||||
if(m_width_sign > 0)
|
||||
{
|
||||
if(a1 > a2) a2 += 2 * pi;
|
||||
n = int((a2 - a1) / da);
|
||||
da = (a2 - a1) / (n + 1);
|
||||
a1 += da;
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
add_vertex(vc, x + cos(a1) * m_width, y + sin(a1) * m_width);
|
||||
a1 += da;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(a1 < a2) a2 -= 2 * pi;
|
||||
n = int((a1 - a2) / da);
|
||||
da = (a1 - a2) / (n + 1);
|
||||
a1 -= da;
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
add_vertex(vc, x + cos(a1) * m_width, y + sin(a1) * m_width);
|
||||
a1 -= da;
|
||||
}
|
||||
}
|
||||
add_vertex(vc, x + dx2, y + dy2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VC>
|
||||
void math_stroke<VC>::calc_miter(VC& vc,
|
||||
const vertex_dist& v0,
|
||||
const vertex_dist& v1,
|
||||
const vertex_dist& v2,
|
||||
double dx1, double dy1,
|
||||
double dx2, double dy2,
|
||||
line_join_e lj,
|
||||
double mlimit,
|
||||
double dbevel)
|
||||
{
|
||||
double xi = v1.x;
|
||||
double yi = v1.y;
|
||||
double di = 1;
|
||||
double lim = m_width_abs * mlimit;
|
||||
bool miter_limit_exceeded = true; // Assume the worst
|
||||
bool intersection_failed = true; // Assume the worst
|
||||
|
||||
if(calc_intersection(v0.x + dx1, v0.y - dy1,
|
||||
v1.x + dx1, v1.y - dy1,
|
||||
v1.x + dx2, v1.y - dy2,
|
||||
v2.x + dx2, v2.y - dy2,
|
||||
&xi, &yi))
|
||||
{
|
||||
// Calculation of the intersection succeeded
|
||||
//---------------------
|
||||
di = calc_distance(v1.x, v1.y, xi, yi);
|
||||
if(di <= lim)
|
||||
{
|
||||
// Inside the miter limit
|
||||
//---------------------
|
||||
add_vertex(vc, xi, yi);
|
||||
miter_limit_exceeded = false;
|
||||
}
|
||||
intersection_failed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculation of the intersection failed, most probably
|
||||
// the three points lie one straight line.
|
||||
// First check if v0 and v2 lie on the opposite sides of vector:
|
||||
// (v1.x, v1.y) -> (v1.x+dx1, v1.y-dy1), that is, the perpendicular
|
||||
// to the line determined by vertices v0 and v1.
|
||||
// This condition determines whether the next line segments continues
|
||||
// the previous one or goes back.
|
||||
//----------------
|
||||
double x2 = v1.x + dx1;
|
||||
double y2 = v1.y - dy1;
|
||||
if((cross_product(v0.x, v0.y, v1.x, v1.y, x2, y2) < 0.0) ==
|
||||
(cross_product(v1.x, v1.y, v2.x, v2.y, x2, y2) < 0.0))
|
||||
{
|
||||
// This case means that the next segment continues
|
||||
// the previous one (straight line)
|
||||
//-----------------
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
miter_limit_exceeded = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(miter_limit_exceeded)
|
||||
{
|
||||
// Miter limit exceeded
|
||||
//------------------------
|
||||
switch(lj)
|
||||
{
|
||||
case miter_join_revert:
|
||||
// For the compatibility with SVG, PDF, etc,
|
||||
// we use a simple bevel join instead of
|
||||
// "smart" bevel
|
||||
//-------------------
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
add_vertex(vc, v1.x + dx2, v1.y - dy2);
|
||||
break;
|
||||
|
||||
case miter_join_round:
|
||||
calc_arc(vc, v1.x, v1.y, dx1, -dy1, dx2, -dy2);
|
||||
break;
|
||||
|
||||
default:
|
||||
// If no miter-revert, calculate new dx1, dy1, dx2, dy2
|
||||
//----------------
|
||||
if(intersection_failed)
|
||||
{
|
||||
mlimit *= m_width_sign;
|
||||
add_vertex(vc, v1.x + dx1 + dy1 * mlimit,
|
||||
v1.y - dy1 + dx1 * mlimit);
|
||||
add_vertex(vc, v1.x + dx2 - dy2 * mlimit,
|
||||
v1.y - dy2 - dx2 * mlimit);
|
||||
}
|
||||
else
|
||||
{
|
||||
double x1 = v1.x + dx1;
|
||||
double y1 = v1.y - dy1;
|
||||
double x2 = v1.x + dx2;
|
||||
double y2 = v1.y - dy2;
|
||||
di = (lim - dbevel) / (di - dbevel);
|
||||
add_vertex(vc, x1 + (xi - x1) * di,
|
||||
y1 + (yi - y1) * di);
|
||||
add_vertex(vc, x2 + (xi - x2) * di,
|
||||
y2 + (yi - y2) * di);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------stroke_calc_cap
|
||||
template<class VC>
|
||||
void math_stroke<VC>::calc_cap(VC& vc,
|
||||
const vertex_dist& v0,
|
||||
const vertex_dist& v1,
|
||||
double len)
|
||||
{
|
||||
vc.remove_all();
|
||||
|
||||
double dx1 = (v1.y - v0.y) / len;
|
||||
double dy1 = (v1.x - v0.x) / len;
|
||||
double dx2 = 0;
|
||||
double dy2 = 0;
|
||||
|
||||
dx1 *= m_width;
|
||||
dy1 *= m_width;
|
||||
|
||||
if(m_line_cap != round_cap)
|
||||
{
|
||||
if(m_line_cap == square_cap)
|
||||
{
|
||||
dx2 = dy1 * m_width_sign;
|
||||
dy2 = dx1 * m_width_sign;
|
||||
}
|
||||
add_vertex(vc, v0.x - dx1 - dx2, v0.y + dy1 - dy2);
|
||||
add_vertex(vc, v0.x + dx1 - dx2, v0.y - dy1 - dy2);
|
||||
}
|
||||
else
|
||||
{
|
||||
double da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
|
||||
double a1;
|
||||
int i;
|
||||
int n = int(pi / da);
|
||||
|
||||
da = pi / (n + 1);
|
||||
add_vertex(vc, v0.x - dx1, v0.y + dy1);
|
||||
if(m_width_sign > 0)
|
||||
{
|
||||
a1 = atan2(dy1, -dx1);
|
||||
a1 += da;
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
add_vertex(vc, v0.x + cos(a1) * m_width,
|
||||
v0.y + sin(a1) * m_width);
|
||||
a1 += da;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a1 = atan2(-dy1, dx1);
|
||||
a1 -= da;
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
add_vertex(vc, v0.x + cos(a1) * m_width,
|
||||
v0.y + sin(a1) * m_width);
|
||||
a1 -= da;
|
||||
}
|
||||
}
|
||||
add_vertex(vc, v0.x + dx1, v0.y - dy1);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
template<class VC>
|
||||
void math_stroke<VC>::calc_join(VC& vc,
|
||||
const vertex_dist& v0,
|
||||
const vertex_dist& v1,
|
||||
const vertex_dist& v2,
|
||||
double len1,
|
||||
double len2)
|
||||
{
|
||||
double dx1 = m_width * (v1.y - v0.y) / len1;
|
||||
double dy1 = m_width * (v1.x - v0.x) / len1;
|
||||
double dx2 = m_width * (v2.y - v1.y) / len2;
|
||||
double dy2 = m_width * (v2.x - v1.x) / len2;
|
||||
|
||||
vc.remove_all();
|
||||
|
||||
double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y);
|
||||
if(cp != 0 && (cp > 0) == (m_width > 0))
|
||||
{
|
||||
// Inner join
|
||||
//---------------
|
||||
double limit = ((len1 < len2) ? len1 : len2) / m_width_abs;
|
||||
if(limit < m_inner_miter_limit)
|
||||
{
|
||||
limit = m_inner_miter_limit;
|
||||
}
|
||||
|
||||
switch(m_inner_join)
|
||||
{
|
||||
default: // inner_bevel
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
add_vertex(vc, v1.x + dx2, v1.y - dy2);
|
||||
break;
|
||||
|
||||
case inner_miter:
|
||||
calc_miter(vc,
|
||||
v0, v1, v2, dx1, dy1, dx2, dy2,
|
||||
miter_join_revert,
|
||||
limit, 0);
|
||||
break;
|
||||
|
||||
case inner_jag:
|
||||
case inner_round:
|
||||
cp = (dx1-dx2) * (dx1-dx2) + (dy1-dy2) * (dy1-dy2);
|
||||
if(cp < len1 * len1 && cp < len2 * len2)
|
||||
{
|
||||
calc_miter(vc,
|
||||
v0, v1, v2, dx1, dy1, dx2, dy2,
|
||||
miter_join_revert,
|
||||
limit, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_inner_join == inner_jag)
|
||||
{
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
add_vertex(vc, v1.x, v1.y );
|
||||
add_vertex(vc, v1.x + dx2, v1.y - dy2);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
add_vertex(vc, v1.x, v1.y );
|
||||
calc_arc(vc, v1.x, v1.y, dx2, -dy2, dx1, -dy1);
|
||||
add_vertex(vc, v1.x, v1.y );
|
||||
add_vertex(vc, v1.x + dx2, v1.y - dy2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Outer join
|
||||
//---------------
|
||||
|
||||
// Calculate the distance between v1 and
|
||||
// the central point of the bevel line segment
|
||||
//---------------
|
||||
double dx = (dx1 + dx2) / 2;
|
||||
double dy = (dy1 + dy2) / 2;
|
||||
double dbevel = sqrt(dx * dx + dy * dy);
|
||||
|
||||
if(m_line_join == round_join || m_line_join == bevel_join)
|
||||
{
|
||||
// This is an optimization that reduces the number of points
|
||||
// in cases of almost collinear segments. If there's no
|
||||
// visible difference between bevel and miter joins we'd rather
|
||||
// use miter join because it adds only one point instead of two.
|
||||
//
|
||||
// Here we calculate the middle point between the bevel points
|
||||
// and then, the distance between v1 and this middle point.
|
||||
// At outer joins this distance always less than stroke width,
|
||||
// because it's actually the height of an isosceles triangle of
|
||||
// v1 and its two bevel points. If the difference between this
|
||||
// width and this value is small (no visible bevel) we can
|
||||
// add just one point.
|
||||
//
|
||||
// The constant in the expression makes the result approximately
|
||||
// the same as in round joins and caps. You can safely comment
|
||||
// out this entire "if".
|
||||
//-------------------
|
||||
if(m_approx_scale * (m_width_abs - dbevel) < m_width_eps)
|
||||
{
|
||||
if(calc_intersection(v0.x + dx1, v0.y - dy1,
|
||||
v1.x + dx1, v1.y - dy1,
|
||||
v1.x + dx2, v1.y - dy2,
|
||||
v2.x + dx2, v2.y - dy2,
|
||||
&dx, &dy))
|
||||
{
|
||||
add_vertex(vc, dx, dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch(m_line_join)
|
||||
{
|
||||
case miter_join:
|
||||
case miter_join_revert:
|
||||
case miter_join_round:
|
||||
calc_miter(vc,
|
||||
v0, v1, v2, dx1, dy1, dx2, dy2,
|
||||
m_line_join,
|
||||
m_miter_limit,
|
||||
dbevel);
|
||||
break;
|
||||
|
||||
case round_join:
|
||||
calc_arc(vc, v1.x, v1.y, dx1, -dy1, dx2, -dy2);
|
||||
break;
|
||||
|
||||
default: // Bevel join
|
||||
add_vertex(vc, v1.x + dx1, v1.y - dy1);
|
||||
add_vertex(vc, v1.x + dx2, v1.y - dy2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,75 +0,0 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_PATH_LENGTH_INCLUDED
|
||||
#define AGG_PATH_LENGTH_INCLUDED
|
||||
|
||||
#include "agg_math.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class VertexSource>
|
||||
double path_length(VertexSource& vs, unsigned path_id = 0)
|
||||
{
|
||||
double len = 0.0;
|
||||
double start_x = 0.0;
|
||||
double start_y = 0.0;
|
||||
double x1 = 0.0;
|
||||
double y1 = 0.0;
|
||||
double x2 = 0.0;
|
||||
double y2 = 0.0;
|
||||
bool first = true;
|
||||
|
||||
unsigned cmd;
|
||||
vs.rewind(path_id);
|
||||
while(!is_stop(cmd = vs.vertex(&x2, &y2)))
|
||||
{
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(first || is_move_to(cmd))
|
||||
{
|
||||
start_x = x2;
|
||||
start_y = y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
len += calc_distance(x1, y1, x2, y2);
|
||||
}
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_close(cmd) && !first)
|
||||
{
|
||||
len += calc_distance(x1, y1, start_x, start_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue